00001 /*************************************************************************** 00002 configlist.h - description 00003 ------------------- 00004 begin : Tue May 9 2000 00005 copyright : (C) 2000-2001 by Eggert Ehmke 00006 (C) 2007 by Ulrich Weigelt 00007 email : eggert.ehmke@berlin.de 00008 ulrich.weigelt@gmx.de 00009 00010 26 Sep 2002 - Allow for columns to be hidden. Allistar Melville 00011 ***************************************************************************/ 00012 00013 /*************************************************************************** 00014 * * 00015 * This program is free software; you can redistribute it and/or modify * 00016 * it under the terms of the GNU General Public License as published by * 00017 * the Free Software Foundation; either version 2 of the License, or * 00018 * (at your option) any later version. * 00019 * * 00020 ***************************************************************************/ 00021 00022 #ifndef CONFIGLIST_H 00023 #define CONFIGLIST_H 00024 00025 //Qt header 00026 #include <qptrlist.h> 00027 #include <qlistview.h> 00028 #include <qobject.h> 00029 00030 //KDE headers 00031 #include <kcombobox.h> 00032 #include <kprocess.h> 00033 #include <kdebug.h> 00034 00035 //KShowmail headers 00036 #include "configelem.h" 00037 #include "constants.h" 00038 #include "kshowmailview.h" 00039 #include "types.h" 00040 #include "encryption.h" 00041 #include "kwalletaccess.h" 00042 00043 00044 using namespace Constants; 00045 using namespace Types; 00046 using namespace Encryption; 00047 00048 class ConfigElem; 00049 class KshowmailView; 00050 00057 class ConfigList : public QObject, public QPtrList<ConfigElem> 00058 { 00059 00060 Q_OBJECT 00061 00062 public: 00063 00067 ConfigList (); 00068 00072 virtual ~ConfigList () {}; 00073 00079 void refreshSetup( KListView* view ); 00080 00085 int getRefreshTimeInterval() const; 00086 00091 void setRefreshTimeInterval( unsigned int interval ); 00092 00097 bool AutoRefreshOn() const; 00098 00103 void setConfirmDeletion( bool confirm ); 00104 00110 bool confirmDeletion(); 00111 00117 bool confirmClose() const; 00118 00124 bool startMinimized() const; 00125 00131 bool closeToTray() const; 00132 00138 bool minimizesToTray() const; 00139 00145 bool showConnectionErrors() const; 00146 00152 void setAllowHTML( bool allowHTML ); 00153 00160 bool allowHTML() const; 00161 00162 00168 bool hasActiveAccounts(); 00169 00174 uint getTimeoutTime() const; 00175 00182 void setTimeoutTime( uint time ); 00183 00190 ConfigElem* getSelectedAccount(); 00191 00197 void deleteSelectedMails(); 00198 00208 void connectAccounts(); 00209 00214 QStringList getSelectedSubjects() const; 00215 00222 bool hasSelectedMails(); 00223 00230 void showSelectedMails(); 00231 00238 void refreshMailLists(); 00239 00244 int getNumberNewMails(); 00245 00250 int getNumberMails(); 00251 00256 long getTotalSize(); 00257 00263 void fillMailListView( KshowmailView* view ); 00264 00271 bool showMainWindowForNewMails(); 00272 00279 bool showAlertMessageForNewMails(); 00280 00287 bool quitNoNewMails(); 00288 00295 bool minimizeMainWindowNoNewMails(); 00296 00301 int getInitTime(); 00302 00307 void setInitTime( int time ); 00308 00314 bool hasInitTime(); 00315 00319 void refreshAccountList(); 00320 00324 void killPOP3Jobs(); 00325 00329 void showSelectedHeaders(); 00330 00335 void executeNewMailCommand(); 00336 00342 bool keepNew(); 00343 00347 void printSetup(); 00348 00354 void saveOptions(); 00355 00361 void readStoredMails(); 00362 00363 00364 bool setItem (const char* item); 00365 void setList (QListView* list); 00366 void beep (); 00367 void playSound (); 00368 void playSound (const char* file); 00369 void applyFilters(); 00370 00371 00372 private: 00373 00377 KConfig* config; 00378 00382 int m_nIntervalTimer; 00383 00387 uint m_nPop3Timer; 00388 00400 AccountTaskMap_Type AccountDeletionMap; 00401 00413 AccountTaskMap_Type AccountShowBodiesMap; 00414 00426 AccountTaskMap_Type AccountRefreshMap; 00427 00432 bool m_bConfirmDelete; 00433 00440 bool m_bAllowHTML; 00441 00448 int ctrOpenMessageWindows; 00449 00455 int m_nInitTimer; 00456 00460 bool m_bShowMessage; 00461 00465 bool m_bShowMainWindow; 00466 00470 bool m_bBeep; 00471 00475 bool m_bSound; 00476 00480 QString m_strSoundFile; 00481 00485 bool m_bCommand; 00486 00490 QString m_strCommandPath; 00491 00495 bool m_bTerminate; 00496 00500 bool m_bMinimize; 00501 00505 bool m_bShowConnectionErrors; 00506 00510 bool m_bConfirmClose; 00511 00515 bool m_bStartMinimized; 00516 00520 bool m_bCloseMinimizes; 00521 00525 bool m_bMinimizeToTray; 00526 00530 bool m_bKeepNew; 00531 00532 00533 protected: 00534 00542 virtual QCollection::Item newItem( QCollection::Item item ); 00543 00552 virtual int compareItems( QCollection::Item item1, QCollection::Item item2 ); 00553 00560 bool hasAccount( const QString& name ) const; 00561 00567 ConfigElem* getAccount( const QString& name ) const; 00568 00569 protected slots: 00570 00575 void slotAccountConfigChanged(); 00576 00586 void slotCheckDeletionState( QString account ); 00587 00597 void slotCheckShowBodiesState( QString account ); 00598 00608 void slotMessageWindowOpened(); 00609 00619 void slotMessageWindowClosed(); 00620 00630 void slotCheckRefreshState( QString account ); 00631 00632 signals: 00633 00638 void sigConfigChanged(); 00639 00643 void sigDeleteReady(); 00644 00648 void sigShowBodiesReady(); 00649 00655 void sigMessageWindowOpened(); 00656 00662 void sigAllMessageWindowsClosed(); 00663 00667 void sigRefreshReady(); 00668 }; 00669 00670 #endif