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 <tqlineedit.h>
00028 
00029 class TQWidget;
00030 class TQBoxLayout;
00031 class TQHBox;
00032 class TQLineEdit;
00033 class TQLabel;
00034 class TQCheckBox;
00035 class TQSpinBox;
00036 class TQPushButton;
00037 class TQComboBox;
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( TQWidget *parent );
00054 
00055   signals:
00056     void focusReceivedSignal();
00057 
00058   protected:
00059     void focusInEvent ( TQFocusEvent *e );
00060 
00061   private:
00062     bool mSkipFirst;
00063 };
00064 
00065 class KOEditorGeneral : public QObject
00066 {
00067     Q_OBJECT
00068   public:
00069     KOEditorGeneral (TQObject* parent=0,const char* name=0);
00070     virtual ~KOEditorGeneral();
00071 
00072     void initHeader( TQWidget *parent,TQBoxLayout *topLayout );
00073     void initDescription(TQWidget *,TQBoxLayout *);
00074     void initSecrecy(TQWidget *,TQBoxLayout *);
00075     void initAlarm(TQWidget *,TQBoxLayout *);
00076     void initAttachments(TQWidget *,TQBoxLayout *);
00077 
00079     void setDefaults(bool allDay);
00081     void readIncidence( Incidence *incidence, Calendar *calendar );
00083     void writeIncidence( Incidence *incidence );
00084 
00086     bool validateInput() { return true; }
00087 
00088     void enableAlarm( bool enable );
00089     void toggleAlarm( bool on );
00090 
00091     void setSummary( const TQString & );
00092     void setDescription( const TQString & );
00093 
00094     TQObject *typeAheadReceiver() const;
00095 
00096   public slots:
00097     void setCategories(const TQStringList &categories);
00098     void selectCategories();
00099     void setType( const TQCString &type );
00100     void addAttachments( const TQStringList &attachments,
00101                          const TQStringList& mimeTypes = TQStringList(),
00102                          bool inlineAttachment = false );
00103 
00104   protected slots:
00105     void editAlarms();
00106     void updateAlarmWidgets( Incidence *incidence );
00107     void updateDefaultAlarmTime();
00108     void updateAttendeeSummary( int count );
00109 
00110   signals:
00111     void openCategoryDialog();
00112     void updateCategoryConfig();
00113     void focusReceivedSignal();
00114     void openURL( const KURL & );
00115 
00116   protected:
00117     TQLineEdit               *mSummaryEdit;
00118     TQLineEdit               *mLocationEdit;
00119     TQLabel                  *mAttendeeSummaryLabel;
00120     TQLabel                  *mRecEditLabel;
00121     TQPushButton             *mRecEditButton;
00122     TQLabel                  *mAlarmBell;
00123     TQLabel                  *mAlarmInfoLabel;
00124     TQCheckBox               *mAlarmButton;
00125     TQSpinBox                *mAlarmTimeEdit;
00126     TQComboBox               *mAlarmIncrCombo;
00127     TQPushButton             *mAlarmAdvancedButton;
00128     KTextEdit               *mDescriptionEdit;
00129     TQLabel                  *mOwnerLabel;
00130     TQComboBox               *mSecrecyCombo;
00131     TQPushButton             *mCategoriesButton;
00132     KSqueezedTextLabel      *mCategoriesLabel;
00133     KOEditorAttachments     *mAttachments;
00134     TQLabel                  *mResourceLabel;
00135 
00136   private:
00137     Alarm *alarmFromSimplePage( Incidence *incidence ) const;
00138     bool isSimpleAlarm( Alarm *alarm ) const;
00139 
00140     bool mAlarmIsSimple;
00141     TQHBox *mSimpleAlarmBox;
00142     TQStringList mCategories;
00143     TQCString mType; // as in Incidence::type()
00144     KCal::Alarm::List mAlarmList;
00145 };
00146 
00147 #endif