kalarm
messagewin.hGo 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 <qmap.h>
00027
00028 #include "mainwindowbase.h"
00029 #include "alarmevent.h"
00030
00031 class QPushButton;
00032 class KPushButton;
00033 class QLabel;
00034 class QTimer;
00035 class KWinModule;
00036 class AlarmTimeWidget;
00037 class DeferAlarmDlg;
00038 class KArtsDispatcher;
00039 namespace KDE { class PlayObject; }
00040
00044 class MessageWin : public MainWindowBase
00045 {
00046 Q_OBJECT
00047 public:
00048 MessageWin();
00049 MessageWin(const KAEvent&, const KAAlarm&, bool reschedule_event = true, bool allowDefer = true);
00050 MessageWin(const KAEvent&, const DateTime& alarmDateTime, const QStringList& errmsgs);
00051 ~MessageWin();
00052 void repeat(const KAAlarm&);
00053 void setRecreating() { mRecreating = true; }
00054 const DateTime& dateTime() { return mDateTime; }
00055 KAAlarm::Type alarmType() const { return mAlarmType; }
00056 bool hasDefer() const { return !!mDeferButton; }
00057 bool isValid() const { return !mInvalid; }
00058 virtual void show();
00059 virtual QSize sizeHint() const;
00060 static int instanceCount() { return mWindowList.count(); }
00061 static MessageWin* findEvent(const QString& eventID);
00062
00063 protected:
00064 virtual void showEvent(QShowEvent*);
00065 virtual void moveEvent(QMoveEvent*);
00066 virtual void resizeEvent(QResizeEvent*);
00067 virtual void closeEvent(QCloseEvent*);
00068 virtual void saveProperties(KConfig*);
00069 virtual void readProperties(KConfig*);
00070
00071 private slots:
00072 void slotEdit();
00073 void slotDefer();
00074 void checkDeferralLimit();
00075 void displayMainWindow();
00076 void slotShowKMailMessage();
00077 void slotSpeak();
00078 void slotPlayAudio();
00079 void checkAudioPlay();
00080 void stopPlay();
00081 void slotFade();
00082 void enableButtons();
00083 void setRemainingTextDay();
00084 void setRemainingTextMinute();
00085 void setMaxSize();
00086
00087 private:
00088 void initView();
00089 #ifndef WITHOUT_ARTS
00090 void initAudio(bool firstTime);
00091 int getKMixVolume();
00092 void setKMixVolume(int percent);
00093 #endif
00094 void displayComplete();
00095 void playAudio();
00096 void setDeferralLimit(const KAEvent&);
00097 bool haveErrorMessage(unsigned msg) const;
00098 void clearErrorMessage(unsigned msg) const;
00099
00100 static QValueList<MessageWin*> mWindowList;
00101 static QMap<QString, unsigned> mErrorMessages;
00102
00103 QString mMessage;
00104 QFont mFont;
00105 QColor mBgColour, mFgColour;
00106 DateTime mDateTime;
00107 QDateTime mCloseTime;
00108 QString mEventID;
00109 QString mAudioFile;
00110 float mVolume;
00111 float mFadeVolume;
00112 int mFadeSeconds;
00113 int mDefaultDeferMinutes;
00114 KAAlarm::Type mAlarmType;
00115 KAEvent::Action mAction;
00116 unsigned long mKMailSerialNumber;
00117 QStringList mErrorMsgs;
00118 int mRestoreHeight;
00119 bool mAudioRepeat;
00120 bool mConfirmAck;
00121 bool mShowEdit;
00122 bool mNoDefer;
00123 bool mInvalid;
00124
00125 KArtsDispatcher* mArtsDispatcher;
00126 KDE::PlayObject* mPlayObject;
00127 QCString mKMixName;
00128 QString mKMixError;
00129 QTimer* mPlayTimer;
00130 QTimer* mFadeTimer;
00131 float mOldVolume;
00132 QString mLocalAudioFile;
00133 QTime mAudioFileStart;
00134 int mAudioFileLoadSecs;
00135 bool mPlayedOnce;
00136 bool mPlayed;
00137
00138 KAEvent mEvent;
00139 QLabel* mRemainingText;
00140 KPushButton* mOkButton;
00141 QPushButton* mEditButton;
00142 QPushButton* mDeferButton;
00143 QPushButton* mSilenceButton;
00144 QPushButton* mKAlarmButton;
00145 QPushButton* mKMailButton;
00146 DeferAlarmDlg* mDeferDlg;
00147 QDateTime mDeferLimit;
00148 mutable KWinModule* mWinModule;
00149 int mFlags;
00150 int mLateCancel;
00151 int mButtonDelay;
00152 bool mErrorWindow;
00153 bool mNoPostAction;
00154 bool mRecreating;
00155 bool mBeep;
00156 bool mSpeak;
00157 bool mRescheduleEvent;
00158 bool mShown;
00159 bool mPositioning;
00160 bool mNoCloseConfirm;
00161 bool mUsingKMix;
00162 bool mDisableDeferral;
00163 };
00164
00165 #endif // MESSAGEWIN_H
|