00001 /* 00002 Copyright 2010 Ulrich Weigelt <ulrich.weigelt@gmx.de> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License as 00006 published by the Free Software Foundation; either version 2 of 00007 the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef KSHOWMAIL_H 00019 #define KSHOWMAIL_H 00020 00021 class KShowmailView; 00022 class MailViewModel; 00023 00024 //Qt headers 00025 #include <QListIterator> 00026 #include <QSortFilterProxyModel> 00027 #include <QList> 00028 #include <QStringList> 00029 #include <QPointer> 00030 00031 //KDE headers 00032 #include <kstatusbar.h> 00033 #include <KDE/KLocale> 00034 #include <kxmlguiwindow.h> 00035 #include <kaction.h> 00036 #include <KStandardAction> 00037 #include <KActionCollection> 00038 #include <KDebug> 00039 #include <KApplication> 00040 #include <KCMultiDialog> 00041 #include <KMessageBox> 00042 #include <KSystemTrayIcon> 00043 #include <Phonon/AudioOutput> 00044 #include <Phonon/MediaObject> 00045 #include <KProcess> 00046 #include <kconfigdialog.h> 00047 #include <kconfigskeleton.h> 00048 00049 //KShowmail headers 00050 #include "kshowmailview.h" 00051 #include "accountlist.h" 00052 #include "accountviewmodel.h" 00053 #include "mailviewmodel.h" 00054 #include "mail.h" 00055 #include "types.h" 00056 #include "filterlogview.h" 00057 #include "showheaderdialog.h" 00058 #include "showmaildialog.h" 00059 #include "systemtrayicon.h" 00060 #include "accountsetupdialogcontext.h" 00061 #include "newmaildialog.h" 00062 00063 using namespace Types; 00064 00072 class KShowmail : public KXmlGuiWindow 00073 { 00074 Q_OBJECT 00075 00076 public: 00077 00081 KShowmail(); 00082 00086 virtual ~KShowmail(); 00087 00088 protected: 00089 00093 void initActions(); 00094 00099 void showStatusMessage( const QString& text ); 00100 00105 virtual bool queryClose(); 00106 00110 void initStatusBar(); 00111 00115 void refreshFilterStatusBar(); 00116 00120 FilterLog fLog; 00121 00126 void startAutomaticRefresh( bool initiate = false ); 00127 00131 void stopAutomaticRefresh(); 00132 00136 void handleNewMails(); 00137 00141 void handleNoNewMails(); 00142 00147 bool askCloseConfirmation(); 00148 00149 00150 protected slots: 00151 00156 void slotRefresh(); 00157 00161 void slotShowHeader(); 00162 00167 void slotShowMessage(); 00168 00173 void slotDelete(); 00174 00179 void slotStop(); 00180 00184 void slotShowFilterLog(); 00185 00189 void slotAddToWhitelist(); 00190 00194 void slotAddToBlacklist(); 00195 00200 void slotSetup(); 00201 00205 void slotSendFeedbackMail(); 00206 00210 void slotFileQuit(); 00211 00216 void slotConfChanged(); 00217 00223 void slotRefreshReady(); 00224 00231 void slotNormalCursor(); 00232 00239 void slotWaitingCursor(); 00240 00248 void slotDeletionReady(); 00249 00256 void slotShowMessageReady(); 00257 00262 void slotRefreshTimer(); 00263 00269 void slotSetupAccount(); 00270 00275 void slotShowMainWindow(); 00276 00281 void slotMailDoubleClicked(); 00282 00283 private: 00284 00288 KShowmailView* view; 00289 00293 KAction* actionRefresh; 00294 00299 KAction* actionShowHeader; 00300 00305 KAction* actionShowMessage; 00306 00311 KAction* actionDelete; 00312 00317 KAction* actionStop; 00318 00323 KAction* actionShowFilterLog; 00324 00329 KAction* actionAddWhitelist; 00330 00335 KAction* actionAddBlacklist; 00336 00341 KAction* actionSetupAccount; 00342 00346 AccountList* accounts; 00347 00351 KCMultiDialog* setupDialog; 00352 00356 KSharedConfigPtr config; 00357 00361 KConfigGroup* configGeneral; 00362 00366 State_Type state; 00367 00371 QItemSelectionModel* mailSelectModel; 00372 00376 QItemSelectionModel* accountSelectModel; 00377 00381 MailViewModel* mailModel; 00382 00386 AccountViewModel* accountModel; 00387 00391 SystemTrayIcon* trayIcon; 00392 00396 QTimer* refreshTimer; 00397 00401 unsigned int timeToRefresh; 00402 00407 Phonon::MediaObject *mediaObject; 00408 00413 Phonon::AudioOutput *audioOutput; 00414 00419 NewMailDialog* newMailDlg; 00420 00424 bool forceExit; 00425 00426 }; 00427 00428 #endif // _KSHOWMAIL_H_