korganizer

koeditorgeneral.h

00001 /*
00002     This file is part of KOrganizer.
00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 #ifndef KOEDITORGENERAL_H
00024 #define KOEDITORGENERAL_H
00025 
00026 #include <libkcal/alarm.h>
00027 #include <qlineedit.h>
00028 
00029 class QWidget;
00030 class QBoxLayout;
00031 class QLineEdit;
00032 class QLabel;
00033 class QCheckBox;
00034 class QWidgetStack;
00035 class QSpinBox;
00036 class QPushButton;
00037 class QComboBox;
00038 class KTextEdit;
00039 class KSqueezedTextLabel;
00040 class KURL;
00041 class KOEditorAttachments;
00042 
00043 namespace KCal {
00044 class Incidence;
00045 class Calendar;
00046 }
00047 using namespace KCal;
00048 
00049 class FocusLineEdit : public QLineEdit
00050 {
00051     Q_OBJECT
00052   public:
00053     FocusLineEdit( QWidget *parent );
00054 
00055   signals:
00056     void focusReceivedSignal();
00057 
00058   protected:
00059     void focusInEvent ( QFocusEvent *e );
00060 
00061   private:
00062     bool mSkipFirst;
00063 };
00064 
00065 class KOEditorGeneral : public QObject
00066 {
00067     Q_OBJECT
00068   public:
00069     KOEditorGeneral (QObject* parent=0,const char* name=0);
00070     virtual ~KOEditorGeneral();
00071 
00072     void initHeader( QWidget *parent,QBoxLayout *topLayout );
00073     void initDescription(QWidget *,QBoxLayout *);
00074     void initSecrecy(QWidget *,QBoxLayout *);
00075     void initAlarm(QWidget *,QBoxLayout *);
00076     void initAttachments(QWidget *,QBoxLayout *);
00077 
00079     void setDefaults(bool allDay);
00081     void readIncidence(Incidence *event, Calendar *calendar);
00083     void writeIncidence(Incidence *);
00084 
00086     bool validateInput() { return true; }
00087 
00088     void enableAlarm( bool enable );
00089     void toggleAlarm( bool on );
00090 
00091     void setSummary( const QString & );
00092     void setDescription( const QString & );
00093 
00094     QObject *typeAheadReceiver() const;
00095 
00096   public slots:
00097     void setCategories(const QStringList &categories);
00098     void selectCategories();
00099     void setType( const QCString &type );
00100     void addAttachments( const QStringList &attachments,
00101                          const QStringList& mimeTypes = QStringList(),
00102                          bool inlineAttachment = false );
00103 
00104 
00105   protected slots:
00106     void editAlarms();
00107     void updateAlarmWidgets();
00108     void updateDefaultAlarmTime();
00109     void updateAttendeeSummary( int count );
00110 
00111   signals:
00112     void openCategoryDialog();
00113     void updateCategoryConfig();
00114     void focusReceivedSignal();
00115     void openURL( const KURL & );
00116   protected:
00117     Alarm *alarmFromSimplePage() const;
00118 
00119     QLineEdit               *mSummaryEdit;
00120     QLineEdit               *mLocationEdit;
00121     QLabel                  *mAttendeeSummaryLabel;
00122     QLabel                  *mAlarmBell;
00123     QWidgetStack            *mAlarmStack;
00124     QLabel                  *mAlarmInfoLabel;
00125     QCheckBox               *mAlarmButton;
00126     QSpinBox                *mAlarmTimeEdit;
00127     QComboBox               *mAlarmIncrCombo;
00128     QPushButton             *mAlarmEditButton;
00129     KTextEdit               *mDescriptionEdit;
00130     QLabel                  *mOwnerLabel;
00131     QComboBox               *mSecrecyCombo;
00132     QPushButton             *mCategoriesButton;
00133     KSqueezedTextLabel      *mCategoriesLabel;
00134     KOEditorAttachments     *mAttachments;
00135     QLabel                  *mResourceLabel;
00136 
00137     enum AlarmStackPages { SimpleAlarmPage, AdvancedAlarmLabel };
00138 
00139   private:
00140     QStringList mCategories;
00141     QCString mType; // as in Incidence::type()
00142     KCal::Alarm::List mAlarmList;
00143 };
00144 
00145 #endif