korganizer

koeditorgeneral.h
1 /*
2  This file is part of KOrganizer.
3  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 
19  As a special exception, permission is given to link this program
20  with any edition of TQt, and distribute the resulting executable,
21  without including the source code for TQt in the source distribution.
22 */
23 #ifndef KOEDITORGENERAL_H
24 #define KOEDITORGENERAL_H
25 
26 #include <libkcal/alarm.h>
27 #include <tqlineedit.h>
28 
29 class TQWidget;
30 class TQBoxLayout;
31 class TQHBox;
32 class TQLineEdit;
33 class TQLabel;
34 class TQCheckBox;
35 class TQSpinBox;
36 class TQPushButton;
37 class TQComboBox;
38 class KTextEdit;
39 class KSqueezedTextLabel;
40 class KURL;
41 class KOEditorAttachments;
42 
43 namespace KCal {
44  class Incidence;
45  class Calendar;
46 }
47 using namespace KCal;
48 
49 class FocusLineEdit : public TQLineEdit
50 {
51  TQ_OBJECT
52 
53  public:
54  FocusLineEdit( TQWidget *parent );
55 
56  signals:
57  void focusReceivedSignal();
58 
59  protected:
60  void focusInEvent ( TQFocusEvent *e );
61 
62  private:
63  bool mSkipFirst;
64 };
65 
66 class KOEditorGeneral : public TQObject
67 {
68  TQ_OBJECT
69 
70  public:
71  KOEditorGeneral (TQObject* parent=0,const char* name=0);
72  virtual ~KOEditorGeneral();
73 
74  void initHeader( TQWidget *parent,TQBoxLayout *topLayout );
75  void initDescription(TQWidget *,TQBoxLayout *);
76  void initSecrecy(TQWidget *,TQBoxLayout *);
77  void initAlarm(TQWidget *,TQBoxLayout *);
78  void initAttachments(TQWidget *,TQBoxLayout *);
79 
81  void setDefaults(bool allDay);
83  void readIncidence( Incidence *incidence, Calendar *calendar );
85  void writeIncidence( Incidence *incidence );
86 
88  bool validateInput() { return true; }
89 
90  void enableAlarm( bool enable );
91  void toggleAlarm( bool on );
92 
93  void setSummary( const TQString & );
94  void setDescription( const TQString & );
95 
96  TQObject *typeAheadReceiver() const;
97 
98  public slots:
99  void setCategories(const TQStringList &categories);
100  void selectCategories();
101  void setType( const TQCString &type );
102  void addAttachments( const TQStringList &attachments,
103  const TQStringList& mimeTypes = TQStringList(),
104  bool inlineAttachment = false );
105 
106  protected slots:
107  void editAlarms();
108  void updateAlarmWidgets( Incidence *incidence );
109  void updateDefaultAlarmTime();
110  void updateAttendeeSummary( int count );
111 
112  signals:
113  void openCategoryDialog();
114  void updateCategoryConfig();
115  void focusReceivedSignal();
116  void openURL( const KURL & );
117 
118  protected:
119  TQLineEdit *mSummaryEdit;
120  TQLineEdit *mLocationEdit;
121  TQLabel *mAttendeeSummaryLabel;
122  TQLabel *mRecEditLabel;
123  TQPushButton *mRecEditButton;
124  TQLabel *mAlarmBell;
125  TQLabel *mAlarmInfoLabel;
126  TQCheckBox *mAlarmButton;
127  TQSpinBox *mAlarmTimeEdit;
128  TQComboBox *mAlarmIncrCombo;
129  TQPushButton *mAlarmAdvancedButton;
130  KTextEdit *mDescriptionEdit;
131  TQLabel *mOwnerLabel;
132  TQComboBox *mSecrecyCombo;
133  TQPushButton *mCategoriesButton;
134  KSqueezedTextLabel *mCategoriesLabel;
135  KOEditorAttachments *mAttachments;
136  TQLabel *mResourceLabel;
137 
138  private:
139  Alarm *alarmFromSimplePage( Incidence *incidence ) const;
140  bool isSimpleAlarm( Alarm *alarm ) const;
141 
142  bool mAlarmIsSimple;
143  TQHBox *mSimpleAlarmBox;
144  TQStringList mCategories;
145  TQCString mType; // as in Incidence::type()
146  KCal::Alarm::List mAlarmList;
147 };
148 
149 #endif