kalarm
messagewin.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef MESSAGEWIN_H
00022 #define MESSAGEWIN_H
00023
00026 #include <QList>
00027 #include <QMap>
00028
00029 #include "mainwindowbase.h"
00030 #include "alarmevent.h"
00031
00032 class QShowEvent;
00033 class QMoveEvent;
00034 class QResizeEvent;
00035 class QCloseEvent;
00036 class QPushButton;
00037 class KPushButton;
00038 class MessageText;
00039 class QCheckBox;
00040 class QLabel;
00041 class DeferAlarmDlg;
00042 class ShellProcess;
00043 namespace Phonon { class MediaObject; }
00044
00048 class MessageWin : public MainWindowBase
00049 {
00050 Q_OBJECT
00051 public:
00052 enum {
00053 NO_RESCHEDULE = 0x01,
00054 NO_DEFER = 0x02,
00055 NO_INIT_VIEW = 0x04
00056 };
00057
00058 MessageWin();
00059 MessageWin(const KAEvent*, const KAAlarm&, int flags);
00060 ~MessageWin();
00061 void repeat(const KAAlarm&);
00062 void setRecreating() { mRecreating = true; }
00063 const DateTime& dateTime() { return mDateTime; }
00064 KAAlarm::Type alarmType() const { return mAlarmType; }
00065 bool hasDefer() const { return !!mDeferButton; }
00066 bool isValid() const { return !mInvalid; }
00067 virtual void show();
00068 virtual QSize sizeHint() const;
00069 static int instanceCount() { return mWindowList.count(); }
00070 static MessageWin* findEvent(const QString& eventID);
00071 static void redisplayAlarms();
00072 static void showError(const KAEvent&, const DateTime& alarmDateTime, const QStringList& errmsgs,
00073 const QString& dontShowAgain = QString());
00074
00075 protected:
00076 virtual void showEvent(QShowEvent*);
00077 virtual void moveEvent(QMoveEvent*);
00078 virtual void resizeEvent(QResizeEvent*);
00079 virtual void closeEvent(QCloseEvent*);
00080 virtual void saveProperties(KConfigGroup&);
00081 virtual void readProperties(const KConfigGroup&);
00082
00083 private slots:
00084 void slotOk();
00085 void slotEdit();
00086 void slotDefer();
00087 void checkDeferralLimit();
00088 void displayMainWindow();
00089 #ifdef KMAIL_SUPPORTED
00090 void slotShowKMailMessage();
00091 #endif
00092 void slotSpeak();
00093 void slotPlayAudio();
00094 void checkAudioPlay();
00095 void stopPlay();
00096 void enableButtons();
00097 void setRemainingTextDay();
00098 void setRemainingTextMinute();
00099 void setMaxSize();
00100 void readProcessOutput(ShellProcess*);
00101
00102 private:
00103 MessageWin(const KAEvent*, const DateTime& alarmDateTime, const QStringList& errmsgs,
00104 const QString& dontShowAgain);
00105 void initView();
00106 void displayComplete();
00107 void playAudio();
00108 void setDeferralLimit(const KAEvent&);
00109 void alarmShowing(KAEvent&, const KCal::Event* = 0);
00110 bool retrieveEvent(KAEvent&, AlarmResource*&, bool& showEdit, bool& showDefer);
00111 bool haveErrorMessage(unsigned msg) const;
00112 void clearErrorMessage(unsigned msg) const;
00113 static bool reinstateFromDisplaying(const KCal::Event*, KAEvent&, AlarmResource*&, bool& showEdit, bool& showDefer);
00114
00115 static QList<MessageWin*> mWindowList;
00116 static QMap<QString, unsigned> mErrorMessages;
00117
00118 QString mMessage;
00119 QFont mFont;
00120 QColor mBgColour, mFgColour;
00121 DateTime mDateTime;
00122 QDateTime mCloseTime;
00123 QString mEventID;
00124 QString mAudioFile;
00125 float mVolume;
00126 float mFadeVolume;
00127 int mFadeSeconds;
00128 int mDefaultDeferMinutes;
00129 KAAlarm::Type mAlarmType;
00130 KAEvent::Action mAction;
00131 unsigned long mKMailSerialNumber;
00132 QStringList mErrorMsgs;
00133 QString mDontShowAgain;
00134 int mRestoreHeight;
00135 bool mAudioRepeat;
00136 bool mConfirmAck;
00137 bool mShowEdit;
00138 bool mNoDefer;
00139 bool mInvalid;
00140
00141 Phonon::MediaObject* mAudioObject;
00142 bool mPlayedOnce;
00143
00144 KAEvent mEvent;
00145 AlarmResource* mResource;
00146 QLabel* mRemainingText;
00147 KPushButton* mOkButton;
00148 QPushButton* mEditButton;
00149 QPushButton* mDeferButton;
00150 QPushButton* mSilenceButton;
00151 QPushButton* mKAlarmButton;
00152 QPushButton* mKMailButton;
00153 MessageText* mCommandText;
00154 QCheckBox* mDontShowAgainCheck;
00155 DeferAlarmDlg* mDeferDlg;
00156 QDateTime mDeferLimit;
00157 int mFlags;
00158 int mLateCancel;
00159 int mButtonDelay;
00160 bool mErrorWindow;
00161 bool mNoPostAction;
00162 bool mRecreating;
00163 bool mBeep;
00164 bool mSpeak;
00165 bool mRescheduleEvent;
00166 bool mShown;
00167 bool mPositioning;
00168 bool mNoCloseConfirm;
00169 bool mDisableDeferral;
00170 };
00171
00172 #endif // MESSAGEWIN_H