• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kalarm

messagewin.h

Go to the documentation of this file.
00001 /*
00002  *  messagewin.h  -  displays an alarm message
00003  *  Program:  kalarm
00004  *  Copyright © 2001-2008 by David Jarvie <djarvie@kde.org>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 {                // flags for constructor
00053             NO_RESCHEDULE = 0x01,    // don't reschedule the event once it has displayed
00054             NO_DEFER      = 0x02,    // don't display the Defer button
00055             NO_INIT_VIEW  = 0x04     // for internal MessageWin use only
00056         };
00057 
00058         MessageWin();     // for session management restoration only
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;  // list of existing message windows
00116         static QMap<QString, unsigned> mErrorMessages;  // error messages currently displayed, by event ID
00117         // Properties needed by readProperties()
00118         QString             mMessage;
00119         QFont               mFont;
00120         QColor              mBgColour, mFgColour;
00121         DateTime            mDateTime;        // date/time displayed in the message window
00122         QDateTime           mCloseTime;       // local time at which window should be auto-closed
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; // if email text, message's KMail serial number, else 0
00132         QStringList         mErrorMsgs;
00133         QString             mDontShowAgain;   // non-null for don't-show-again option with error message
00134         int                 mRestoreHeight;
00135         bool                mAudioRepeat;
00136         bool                mConfirmAck;
00137         bool                mShowEdit;        // display the Edit button
00138         bool                mNoDefer;         // don't display a Defer option
00139         bool                mInvalid;         // restored window is invalid
00140         // Sound file playing
00141         Phonon::MediaObject* mAudioObject;
00142         bool                mPlayedOnce;      // the sound file has started playing at least once
00143         // Miscellaneous
00144         KAEvent             mEvent;           // the whole event, for updating the calendar file
00145         AlarmResource*      mResource;        // resource which the event comes/came from
00146         QLabel*             mRemainingText;   // the remaining time (for a reminder window)
00147         KPushButton*        mOkButton;
00148         QPushButton*        mEditButton;
00149         QPushButton*        mDeferButton;
00150         QPushButton*        mSilenceButton;
00151         QPushButton*        mKAlarmButton;
00152         QPushButton*        mKMailButton;
00153         MessageText*        mCommandText;     // shows output from command
00154         QCheckBox*          mDontShowAgainCheck;
00155         DeferAlarmDlg*      mDeferDlg;
00156         QDateTime           mDeferLimit;      // last time to which the message can currently be deferred
00157         int                 mFlags;
00158         int                 mLateCancel;
00159         int                 mButtonDelay;     // delay (ms) after window is shown before buttons are enabled
00160         bool                mErrorWindow;     // the window is simply an error message
00161         bool                mNoPostAction;    // don't execute any post-alarm action
00162         bool                mRecreating;      // window is about to be deleted and immediately recreated
00163         bool                mBeep;
00164         bool                mSpeak;           // the message should be spoken via kttsd
00165         bool                mRescheduleEvent; // true to delete event after message has been displayed
00166         bool                mShown;           // true once the window has been displayed
00167         bool                mPositioning;     // true when the window is being positioned initially
00168         bool                mNoCloseConfirm;  // the Defer or Edit button is closing the dialog
00169         bool                mDisableDeferral; // true if past deferral limit, so don't enable Defer button
00170 };
00171 
00172 #endif // MESSAGEWIN_H

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal