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

kalarm

editdlg.h

Go to the documentation of this file.
00001 /*
00002  *  editdlg.h  -  dialog to create or modify an alarm or alarm template
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 EDITDLG_H
00022 #define EDITDLG_H
00023 
00024 #include <kdialog.h>
00025 
00026 #include "alarmevent.h"
00027 #include "alarmtext.h"
00028 #include "datetime.h"
00029 
00030 class QLabel;
00031 class QShowEvent;
00032 class QResizeEvent;
00033 class QAbstractButton;
00034 class QGroupBox;
00035 class QVBoxLayout;
00036 class KTabWidget;
00037 class KLineEdit;
00038 class AlarmResource;
00039 class ButtonGroup;
00040 class TimeEdit;
00041 class RadioButton;
00042 class CheckBox;
00043 class LateCancelSelector;
00044 class AlarmTimeWidget;
00045 class RecurrenceEdit;
00046 class Reminder;
00047 class ShellProcess;
00048 class TimeSpinBox;
00049 
00050 
00051 class EditAlarmDlg : public KDialog
00052 {
00053         Q_OBJECT
00054     public:
00055         enum Type { DISPLAY, COMMAND, EMAIL };
00056         enum GetResourceType {
00057             RES_PROMPT,        // prompt for resource
00058             RES_USE_EVENT_ID,  // use resource containing event, or prompt if not found
00059             RES_IGNORE         // don't get resource
00060         };
00061 
00062         static EditAlarmDlg* create(bool Template, Type, bool newAlarm, QWidget* parent = 0,
00063                                     GetResourceType = RES_PROMPT);
00064         static EditAlarmDlg* create(bool Template, const KAEvent*, bool newAlarm, QWidget* parent = 0,
00065                                     GetResourceType = RES_PROMPT, bool readOnly = false);
00066         virtual ~EditAlarmDlg();
00067         bool            getEvent(KAEvent&, AlarmResource*&);
00068         virtual void    setAction(KAEvent::Action, const AlarmText& = AlarmText()) = 0;
00069         virtual QSize   minimumSizeHint() const;
00070 
00071         static QString  i18n_chk_ShowInKOrganizer();   // text of 'Show in KOrganizer' checkbox
00072 
00073     protected:
00074         EditAlarmDlg(bool Template, KAEvent::Action, QWidget* parent = 0,
00075                      GetResourceType = RES_PROMPT);
00076         EditAlarmDlg(bool Template, const KAEvent*, QWidget* parent = 0,
00077                      GetResourceType = RES_PROMPT, bool readOnly = false);
00078         void            init(const KAEvent* event, bool newAlarm);
00079         virtual void    resizeEvent(QResizeEvent*);
00080         virtual void    showEvent(QShowEvent*);
00081         virtual QString type_caption(bool newAlarm) const = 0;
00082         virtual void    type_init(QWidget* parent, QVBoxLayout* frameLayout) = 0;
00083         virtual void    type_initValues(const KAEvent*) = 0;
00084         virtual void    setReadOnly(bool readOnly) = 0;
00085         virtual void    saveState(const KAEvent*) = 0;
00086         virtual bool    type_stateChanged() const = 0;
00087         virtual void    type_setEvent(KAEvent&, const KDateTime&, const QString& text, int lateCancel, bool trial) = 0;
00088         virtual int     getAlarmFlags() const;
00089         virtual bool    type_validate(bool trial) = 0;
00090         virtual void    type_trySuccessMessage(ShellProcess*, const QString& text) = 0;
00091         virtual Reminder* createReminder(QWidget* parent)  { Q_UNUSED(parent); return 0; }
00092         virtual CheckBox* type_createConfirmAckCheckbox(QWidget* parent)  { Q_UNUSED(parent); return 0; }
00093         virtual bool    checkText(QString& result, bool showErrorMessage = true) const = 0;
00094 
00095         void            showMainPage();
00096         bool            isTemplate() const         { return mTemplate; }
00097         bool            dateOnly() const;
00098         bool            isTimedRecurrence() const;
00099         Reminder*       reminder() const           { return mReminder; }
00100         LateCancelSelector* lateCancel() const     { return mLateCancel; }
00101 
00102     protected slots:
00103         virtual void    slotTry();
00104         virtual void    slotDefault();   // Load Template
00105         virtual void    slotButtonClicked(int button);
00106     private slots:
00107         void            slotRecurTypeChange(int repeatType);
00108         void            slotRecurFrequencyChange();
00109         void            slotEditDeferral();
00110         void            slotShowMainPage();
00111         void            slotShowRecurrenceEdit();
00112         void            slotAnyTimeToggled(bool anyTime);
00113         void            slotTemplateTimeType(QAbstractButton*);
00114         void            slotSetSubRepetition();
00115         void            slotTrySuccess();
00116 
00117     private:
00118         void            init(const KAEvent* event, GetResourceType getResource);
00119         void            initValues(const KAEvent*);
00120         void            setEvent(KAEvent&, const QString& text, bool trial);
00121         bool            validate();
00122         void            setRecurTabTitle(const KAEvent* = 0);
00123         virtual bool    stateChanged() const;
00124 
00125     protected:
00126         KAEvent::Action     mAlarmType;           // actual alarm type
00127     private:
00128         KTabWidget*         mTabs;                // the tabs in the dialog
00129         int                 mMainPageIndex;
00130         int                 mRecurPageIndex;
00131         bool                mMainPageShown;            // true once the main tab has been displayed
00132         bool                mRecurPageShown;           // true once the recurrence tab has been displayed
00133         bool                mRecurSetDefaultEndDate;   // adjust default end date/time when recurrence tab is displayed
00134 
00135         // Templates
00136         KLineEdit*          mTemplateName;
00137         ButtonGroup*        mTemplateTimeGroup;
00138         RadioButton*        mTemplateDefaultTime; // no alarm time is specified
00139         RadioButton*        mTemplateUseTimeAfter;// alarm time is specified as an offset from current
00140         RadioButton*        mTemplateAnyTime;     // alarms have date only, no time
00141         RadioButton*        mTemplateUseTime;     // an alarm time is specified
00142         TimeSpinBox*        mTemplateTimeAfter;   // the specified offset from the current time
00143         TimeEdit*           mTemplateTime;        // the alarm time which is specified 
00144         QGroupBox*          mDeferGroup;
00145         QLabel*             mDeferTimeLabel;
00146         QPushButton*        mDeferChangeButton;
00147 
00148         AlarmTimeWidget*    mTimeWidget;
00149         LateCancelSelector* mLateCancel;
00150         Reminder*           mReminder;           // null except for display alarms
00151         CheckBox*           mShowInKorganizer;
00152 
00153         RecurrenceEdit*     mRecurrenceEdit;
00154 
00155         QString             mAlarmMessage;       // message text/file name/command/email message
00156         DateTime            mAlarmDateTime;
00157         DateTime            mDeferDateTime;
00158         QString             mResourceEventId;    // if non-empty, save alarm in resource containing this event ID
00159         AlarmResource*      mResource;           // resource to save event into, or null
00160         int                 mDeferGroupHeight;   // height added by deferred time widget
00161         int                 mDesktop;            // desktop to display the dialog in
00162         bool                mTemplate;           // editing an alarm template
00163         bool                mExpiredRecurrence;  // initially a recurrence which has expired
00164         mutable bool        mChanged;            // controls other than deferral have changed since dialog was displayed
00165         mutable bool        mOnlyDeferred;       // the only change made in the dialog was to the existing deferral
00166         bool                mDesiredReadOnly;    // the specified read-only status of the dialog
00167         bool                mReadOnly;           // the actual read-only status of the dialog
00168 
00169         // Initial state of all controls
00170         KAEvent*            mSavedEvent;
00171         QString             mSavedTemplateName;     // mTemplateName value
00172         QAbstractButton*    mSavedTemplateTimeType; // selected button in mTemplateTimeGroup
00173         QTime               mSavedTemplateTime;     // mTemplateTime value
00174         int                 mSavedTemplateAfterTime;// mTemplateAfterTime value
00175         QString             mSavedTextFileCommandMessage;  // mTextMessageEdit/mFileMessageEdit/mCmdCommandEdit/mEmailMessageEdit value
00176         KDateTime           mSavedDateTime;         // mTimeWidget value
00177         int                 mSavedRecurrenceType;   // RecurrenceEdit::RepeatType value
00178         int                 mSavedLateCancel;       // mLateCancel value
00179         bool                mSavedShowInKorganizer; // mShowInKorganizer status
00180 };
00181 
00182 #endif // EDITDLG_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