korganizer
koeditorgeneral.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
00022
00023
00024 #ifndef KOEDITORGENERAL_H
00025 #define KOEDITORGENERAL_H
00026
00027 #include <kcal/alarm.h>
00028
00029 #include <KLineEdit>
00030
00031 #include <QLabel>
00032 #include <QFocusEvent>
00033 #include <QBoxLayout>
00034 #include <QTextList>
00035
00036 class QWidget;
00037 class QBoxLayout;
00038 class QLabel;
00039 class QCheckBox;
00040 class QStackedWidget;
00041 class QSpinBox;
00042 class QPushButton;
00043 class QToolButton;
00044 class KComboBox;
00045 class KLineEdit;
00046 class KToolBar;
00047 class KRichTextWidget;
00048 class KSqueezedTextLabel;
00049 class KUrl;
00050 class KOEditorAttachments;
00051
00052 namespace KCal {
00053 class Incidence;
00054 class Calendar;
00055 }
00056 using namespace KCal;
00057
00058 class FocusLineEdit : public KLineEdit
00059 {
00060 Q_OBJECT
00061 public:
00062 explicit FocusLineEdit( QWidget *parent );
00063
00064 signals:
00065 void focusReceivedSignal();
00066
00067 protected:
00068 void focusInEvent ( QFocusEvent *e );
00069
00070 private:
00071 bool mFirst;
00072 };
00073
00074 class KOEditorGeneral : public QObject
00075 {
00076 Q_OBJECT
00077 public:
00078 explicit KOEditorGeneral( QObject *parent=0 );
00079 virtual ~KOEditorGeneral();
00080
00081 void initHeader( QWidget *parent, QBoxLayout *topLayout );
00082 void initDescription( QWidget *, QBoxLayout * );
00083 void initSecrecy( QWidget *, QBoxLayout * );
00084 void initAlarm( QWidget *, QBoxLayout * );
00085 void initAttachments( QWidget *, QBoxLayout * );
00086
00088 void setDefaults( bool allDay );
00089
00091 void readIncidence( Incidence *event, Calendar *calendar );
00093 void writeIncidence( Incidence * );
00094
00096 bool validateInput() { return true; }
00097
00098 void enableAlarm( bool enable );
00099 void toggleAlarm( bool on );
00100
00101 void setSummary( const QString & );
00102 void setDescription( const QString &, bool isRich );
00103
00104 QObject *typeAheadReceiver() const;
00105
00106 public slots:
00107 void setCategories( const QStringList &categories );
00108 void selectCategories();
00109 void addAttachments( const QStringList &attachments,
00110 const QStringList &mimeTypes = QStringList(),
00111 bool inlineAttachment = false );
00112
00113 protected slots:
00114 void editAlarms();
00115 void updateAlarmWidgets();
00116 void updateDefaultAlarmTime();
00117 void updateAttendeeSummary( int count );
00118 void setDescriptionRich( bool rich );
00119
00120 signals:
00121 void openCategoryDialog();
00122 void updateCategoryConfig();
00123 void focusReceivedSignal();
00124 void openURL( const KUrl & );
00125
00126 protected:
00127 Alarm *alarmFromSimplePage() const;
00128
00129 KLineEdit *mSummaryEdit;
00130 KLineEdit *mLocationEdit;
00131 QLabel *mAttendeeSummaryLabel;
00132 QLabel *mAlarmBell;
00133 QStackedWidget *mAlarmStack;
00134 QLabel *mAlarmInfoLabel;
00135 QCheckBox *mAlarmButton;
00136 QSpinBox *mAlarmTimeEdit;
00137 KComboBox *mAlarmIncrCombo;
00138 QPushButton *mAlarmEditButton;
00139 KRichTextWidget *mDescriptionEdit;
00140 QLabel *mOwnerLabel;
00141 KComboBox *mSecrecyCombo;
00142 QPushButton *mCategoriesButton;
00143 KSqueezedTextLabel *mCategoriesLabel;
00144 KToolBar *mEditToolBar;
00145 KToolBar *mFormatToolBar;
00146 QCheckBox *mRichDescription;
00147 KOEditorAttachments *mAttachments;
00148
00149 enum AlarmStackPages {
00150 SimpleAlarmPage,
00151 AdvancedAlarmLabel
00152 };
00153
00154 private:
00155 void toggleDescriptionRichButtons( bool rich );
00156 QStringList mCategories;
00157 KCal::Alarm::List mAlarmList;
00158 };
00159
00160 #endif