-rw-r--r-- | korganizer/kofilterview.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 0dd423a..f1bbab4 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -1,257 +1,263 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 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 | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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 | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOFILTERVIEW_H | 23 | #ifndef KOFILTERVIEW_H |
24 | #define KOFILTERVIEW_H | 24 | #define KOFILTERVIEW_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | #include <QDesktopWidget> | ||
29 | #include <qradiobutton.h> | 30 | #include <qradiobutton.h> |
30 | #include <qlayout.h> | 31 | #include <qlayout.h> |
31 | #include <qlabel.h> | 32 | #include <qlabel.h> |
32 | #include <qdialog.h> | 33 | #include <qdialog.h> |
33 | #include <qscrollview.h> | 34 | #include <q3scrollview.h> |
34 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3GridLayout> | ||
38 | #include <Q3PtrList> | ||
39 | #include <QKeyEvent> | ||
40 | #include <Q3VBoxLayout> | ||
35 | #include <kconfig.h> | 41 | #include <kconfig.h> |
36 | #include "kofilterview_base.h" | 42 | #include "kofilterview_base.h" |
37 | 43 | ||
38 | #include <libkcal/calfilter.h> | 44 | #include <libkcal/calfilter.h> |
39 | 45 | ||
40 | #include <kurlrequester.h> | 46 | #include <kurlrequester.h> |
41 | #include <klineedit.h> | 47 | #include <klineedit.h> |
42 | #include <kglobal.h> | 48 | #include <kglobal.h> |
43 | #include <kmessagebox.h> | 49 | #include <kmessagebox.h> |
44 | 50 | ||
45 | class QGridLayout; | 51 | class Q3GridLayout; |
46 | 52 | ||
47 | using namespace KCal; | 53 | using namespace KCal; |
48 | 54 | ||
49 | class KONewCalPrefs : public QDialog | 55 | class KONewCalPrefs : public QDialog |
50 | { | 56 | { |
51 | Q_OBJECT | 57 | Q_OBJECT |
52 | public: | 58 | public: |
53 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : | 59 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : |
54 | QDialog( parent, name, true ) | 60 | QDialog( parent, name, true ) |
55 | { | 61 | { |
56 | setCaption( i18n("Add new Calendar") ); | 62 | setCaption( i18n("Add new Calendar") ); |
57 | QVBoxLayout* lay = new QVBoxLayout( this ); | 63 | Q3VBoxLayout* lay = new Q3VBoxLayout( this ); |
58 | lay->setSpacing( 3 ); | 64 | lay->setSpacing( 3 ); |
59 | lay->setMargin( 3 ); | 65 | lay->setMargin( 3 ); |
60 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 66 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
61 | lay->addWidget( lab ); | 67 | lay->addWidget( lab ); |
62 | nameE = new KLineEdit( this ); | 68 | nameE = new KLineEdit( this ); |
63 | lay->addWidget( nameE ); | 69 | lay->addWidget( nameE ); |
64 | lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this ); | 70 | lab = new QLabel( i18n("<b>iCal (*.ics) file on disk:</b><br>(will be created, if not existing)"), this ); |
65 | lay->addWidget( lab ); | 71 | lay->addWidget( lab ); |
66 | url = new KURLRequester ( this ); | 72 | url = new KURLRequester ( this ); |
67 | lay->addWidget( url ); | 73 | lay->addWidget( url ); |
68 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 74 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
69 | lay->addWidget( ok ); | 75 | lay->addWidget( ok ); |
70 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 76 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
71 | lay->addWidget( cancel ); | 77 | lay->addWidget( cancel ); |
72 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); | 78 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); |
73 | connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) ); | 79 | connect (cancel, SIGNAL( clicked() ), this, SLOT ( reject()) ); |
74 | int minwid = 440; | 80 | int minwid = 440; |
75 | if ( QApplication::desktop()->width() < 480 ) minwid = 220; | 81 | if ( QApplication::desktop()->width() < 480 ) minwid = 220; |
76 | setMinimumWidth( minwid ); | 82 | setMinimumWidth( minwid ); |
77 | resize(sizeHint() ); | 83 | resize(sizeHint() ); |
78 | } | 84 | } |
79 | 85 | ||
80 | QString calName() { return nameE->text(); } | 86 | QString calName() { return nameE->text(); } |
81 | QString calFileName() { return url->url(); } | 87 | QString calFileName() { return url->url(); } |
82 | 88 | ||
83 | public slots: | 89 | public slots: |
84 | void checkValid() { | 90 | void checkValid() { |
85 | if ( nameE->text().isEmpty() ) { | 91 | if ( nameE->text().isEmpty() ) { |
86 | KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); | 92 | KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); |
87 | nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); | 93 | nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); |
88 | return; | 94 | return; |
89 | } | 95 | } |
90 | if ( url->url().isEmpty() ) { | 96 | if ( url->url().isEmpty() ) { |
91 | KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); | 97 | KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); |
92 | url->setURL( nameE->text() + ".ics" ); | 98 | url->setURL( nameE->text() + ".ics" ); |
93 | return; | 99 | return; |
94 | } | 100 | } |
95 | accept(); | 101 | accept(); |
96 | } | 102 | } |
97 | 103 | ||
98 | public: | 104 | public: |
99 | KLineEdit* nameE; | 105 | KLineEdit* nameE; |
100 | KURLRequester *url; | 106 | KURLRequester *url; |
101 | }; | 107 | }; |
102 | 108 | ||
103 | class KOCalButton : public QPushButton | 109 | class KOCalButton : public QPushButton |
104 | { | 110 | { |
105 | Q_OBJECT | 111 | Q_OBJECT |
106 | public: | 112 | public: |
107 | KOCalButton( QWidget *parent=0, const char *name=0 ) : | 113 | KOCalButton( QWidget *parent=0, const char *name=0 ) : |
108 | QPushButton( parent, name) | 114 | QPushButton( parent, name) |
109 | { | 115 | { |
110 | connect( this, SIGNAL( clicked() ), | 116 | connect( this, SIGNAL( clicked() ), |
111 | SLOT( bottonClicked() )); | 117 | SLOT( bottonClicked() )); |
112 | mNumber = -1; | 118 | mNumber = -1; |
113 | setFocusPolicy(NoFocus); | 119 | setFocusPolicy(Qt::NoFocus); |
114 | } | 120 | } |
115 | void setNum ( int num ) {mNumber = num; } | 121 | void setNum ( int num ) {mNumber = num; } |
116 | signals: | 122 | signals: |
117 | void selectNum ( int ); | 123 | void selectNum ( int ); |
118 | private: | 124 | private: |
119 | int mNumber; | 125 | int mNumber; |
120 | void keyPressEvent ( QKeyEvent * e ) | 126 | void keyPressEvent ( QKeyEvent * e ) |
121 | { | 127 | { |
122 | e->ignore(); | 128 | e->ignore(); |
123 | } | 129 | } |
124 | 130 | ||
125 | private slots : | 131 | private slots : |
126 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } | 132 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } |
127 | }; | 133 | }; |
128 | class KOCalCheckButton : public QCheckBox | 134 | class KOCalCheckButton : public QCheckBox |
129 | { | 135 | { |
130 | Q_OBJECT | 136 | Q_OBJECT |
131 | public: | 137 | public: |
132 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : | 138 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : |
133 | QCheckBox( parent, name) | 139 | QCheckBox( parent, name) |
134 | { | 140 | { |
135 | connect( this, SIGNAL( toggled ( bool ) ), | 141 | connect( this, SIGNAL( toggled ( bool ) ), |
136 | SLOT( bottonClicked( bool ) )); | 142 | SLOT( bottonClicked( bool ) )); |
137 | mNumber = -1; | 143 | mNumber = -1; |
138 | setFocusPolicy(NoFocus); | 144 | setFocusPolicy(Qt::NoFocus); |
139 | //setMaximumWidth( 10 ); | 145 | //setMaximumWidth( 10 ); |
140 | 146 | ||
141 | } | 147 | } |
142 | void setNum ( int num ) {mNumber = num; } | 148 | void setNum ( int num ) {mNumber = num; } |
143 | signals: | 149 | signals: |
144 | void selectNum ( int, bool ); | 150 | void selectNum ( int, bool ); |
145 | private: | 151 | private: |
146 | int mNumber; | 152 | int mNumber; |
147 | void keyPressEvent ( QKeyEvent * e ) | 153 | void keyPressEvent ( QKeyEvent * e ) |
148 | { | 154 | { |
149 | e->ignore(); | 155 | e->ignore(); |
150 | } | 156 | } |
151 | 157 | ||
152 | private slots : | 158 | private slots : |
153 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 159 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } |
154 | }; | 160 | }; |
155 | 161 | ||
156 | class KOCalRadioButton : public QRadioButton | 162 | class KOCalRadioButton : public QRadioButton |
157 | { | 163 | { |
158 | Q_OBJECT | 164 | Q_OBJECT |
159 | public: | 165 | public: |
160 | KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : | 166 | KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : |
161 | QRadioButton( parent, name) | 167 | QRadioButton( parent, name) |
162 | { | 168 | { |
163 | connect( this, SIGNAL( toggled ( bool ) ), | 169 | connect( this, SIGNAL( toggled ( bool ) ), |
164 | SLOT( bottonClicked( bool ) )); | 170 | SLOT( bottonClicked( bool ) )); |
165 | mNumber = -1; | 171 | mNumber = -1; |
166 | setFocusPolicy(NoFocus); | 172 | setFocusPolicy(Qt::NoFocus); |
167 | //setMaximumWidth( 10 ); | 173 | //setMaximumWidth( 10 ); |
168 | 174 | ||
169 | } | 175 | } |
170 | int num() { return mNumber;} | 176 | int num() { return mNumber;} |
171 | void setNum ( int num ) {mNumber = num; } | 177 | void setNum ( int num ) {mNumber = num; } |
172 | signals: | 178 | signals: |
173 | void selectNum ( int ); | 179 | void selectNum ( int ); |
174 | private: | 180 | private: |
175 | int mNumber; | 181 | int mNumber; |
176 | void keyPressEvent ( QKeyEvent * e ) | 182 | void keyPressEvent ( QKeyEvent * e ) |
177 | { | 183 | { |
178 | e->ignore(); | 184 | e->ignore(); |
179 | } | 185 | } |
180 | 186 | ||
181 | private slots : | 187 | private slots : |
182 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); } | 188 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); } |
183 | }; | 189 | }; |
184 | 190 | ||
185 | 191 | ||
186 | 192 | ||
187 | class KOFilterView : public KOFilterView_base | 193 | class KOFilterView : public KOFilterView_base |
188 | { | 194 | { |
189 | Q_OBJECT | 195 | Q_OBJECT |
190 | public: | 196 | public: |
191 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 197 | KOFilterView(Q3PtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, Qt::WFlags fl=0); |
192 | ~KOFilterView(); | 198 | ~KOFilterView(); |
193 | 199 | ||
194 | void updateFilters(); | 200 | void updateFilters(); |
195 | 201 | ||
196 | bool filtersEnabled(); | 202 | bool filtersEnabled(); |
197 | void setFiltersEnabled(bool); | 203 | void setFiltersEnabled(bool); |
198 | CalFilter *selectedFilter(); | 204 | CalFilter *selectedFilter(); |
199 | void setSelectedFilter(QString); | 205 | void setSelectedFilter(QString); |
200 | void setSelectedFilter( int ); | 206 | void setSelectedFilter( int ); |
201 | 207 | ||
202 | signals: | 208 | signals: |
203 | void filterChanged(); | 209 | void filterChanged(); |
204 | void editFilters(); | 210 | void editFilters(); |
205 | 211 | ||
206 | private: | 212 | private: |
207 | QPtrList<CalFilter> *mFilters; | 213 | Q3PtrList<CalFilter> *mFilters; |
208 | }; | 214 | }; |
209 | 215 | ||
210 | class KOCalEditView : public QScrollView | 216 | class KOCalEditView : public Q3ScrollView |
211 | { | 217 | { |
212 | Q_OBJECT | 218 | Q_OBJECT |
213 | public: | 219 | public: |
214 | KOCalEditView( QWidget* parent=0,const char* name=0); | 220 | KOCalEditView( QWidget* parent=0,const char* name=0); |
215 | ~KOCalEditView(); | 221 | ~KOCalEditView(); |
216 | int addCalendar( QString calName, QString fileName, bool ask = true ); | 222 | int addCalendar( QString calName, QString fileName, bool ask = true ); |
217 | int getBirtdayID(); | 223 | int getBirtdayID(); |
218 | public slots: | 224 | public slots: |
219 | void addCal(); | 225 | void addCal(); |
220 | void enableAll(); | 226 | void enableAll(); |
221 | void enableAlarm(); | 227 | void enableAlarm(); |
222 | void disableRO(); | 228 | void disableRO(); |
223 | void deleteAll(); | 229 | void deleteAll(); |
224 | void selectStdCal(int); | 230 | void selectStdCal(int); |
225 | void selectCal(int,bool ); | 231 | void selectCal(int,bool ); |
226 | void selectCalAlarm(int,bool ); | 232 | void selectCalAlarm(int,bool ); |
227 | void selectReadOnly(int,bool ); | 233 | void selectReadOnly(int,bool ); |
228 | void setColor(const QColor &,int) ; | 234 | void setColor(const QColor &,int) ; |
229 | void deleteCal(int) ; | 235 | void deleteCal(int) ; |
230 | void infoCal(int) ; | 236 | void infoCal(int) ; |
231 | void readConfig(); | 237 | void readConfig(); |
232 | void defaultInfo(); | 238 | void defaultInfo(); |
233 | void findNewStandard(); | 239 | void findNewStandard(); |
234 | signals: | 240 | signals: |
235 | void alarmEnabled ( int cal, bool enable ); | 241 | void alarmEnabled ( int cal, bool enable ); |
236 | void calendarEnabled ( int cal, bool enable ); | 242 | void calendarEnabled ( int cal, bool enable ); |
237 | void calendarReadonly ( int cal, bool readonly ); | 243 | void calendarReadonly ( int cal, bool readonly ); |
238 | void setCalendarDefault ( int cal ); | 244 | void setCalendarDefault ( int cal ); |
239 | void removeCalendar ( int cal ); | 245 | void removeCalendar ( int cal ); |
240 | void calendarAdded( int ); | 246 | void calendarAdded( int ); |
241 | void needsUpdate(); | 247 | void needsUpdate(); |
242 | void checkCalendar(); | 248 | void checkCalendar(); |
243 | void requestCalendarInfo( int id ); | 249 | void requestCalendarInfo( int id ); |
244 | 250 | ||
245 | private: | 251 | private: |
246 | QWidget *mw; | 252 | QWidget *mw; |
247 | void toggleList ( QPtrList<KOCalCheckButton> , bool b = true ); | 253 | void toggleList ( Q3PtrList<KOCalCheckButton> , bool b = true ); |
248 | QPtrList<KOCalRadioButton> mStdandardB; | 254 | Q3PtrList<KOCalRadioButton> mStdandardB; |
249 | QPtrList<KOCalCheckButton> mEnabledB; | 255 | Q3PtrList<KOCalCheckButton> mEnabledB; |
250 | QPtrList<KOCalCheckButton> mAlarmB; | 256 | Q3PtrList<KOCalCheckButton> mAlarmB; |
251 | QPtrList<KOCalCheckButton> mROB; | 257 | Q3PtrList<KOCalCheckButton> mROB; |
252 | QGridLayout* mainLayout; | 258 | Q3GridLayout* mainLayout; |
253 | }; | 259 | }; |
254 | 260 | ||
255 | 261 | ||
256 | 262 | ||
257 | #endif // KOFILTERVIEW_H | 263 | #endif // KOFILTERVIEW_H |