-rw-r--r-- | korganizer/kofilterview.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 02107cf..874fc6a 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -25,226 +25,230 @@ | |||
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qcheckbox.h> | 27 | #include <qcheckbox.h> |
28 | #include <qradiobutton.h> | 28 | #include <qradiobutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qdialog.h> | 31 | #include <qdialog.h> |
32 | #include <qscrollview.h> | 32 | #include <qscrollview.h> |
33 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include "kofilterview_base.h" | 35 | #include "kofilterview_base.h" |
36 | 36 | ||
37 | #include <libkcal/calfilter.h> | 37 | #include <libkcal/calfilter.h> |
38 | 38 | ||
39 | #include <kurlrequester.h> | 39 | #include <kurlrequester.h> |
40 | #include <klineedit.h> | 40 | #include <klineedit.h> |
41 | #include <kglobal.h> | 41 | #include <kglobal.h> |
42 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
43 | 43 | ||
44 | class QGridLayout; | 44 | class QGridLayout; |
45 | 45 | ||
46 | using namespace KCal; | 46 | using namespace KCal; |
47 | 47 | ||
48 | class KONewCalPrefs : public QDialog | 48 | class KONewCalPrefs : public QDialog |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | public: | 51 | public: |
52 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : | 52 | KONewCalPrefs( QWidget *parent=0, const char *name=0 ) : |
53 | QDialog( parent, name, true ) | 53 | QDialog( parent, name, true ) |
54 | { | 54 | { |
55 | setCaption( i18n("Add new Calendar") ); | 55 | setCaption( i18n("Add new Calendar") ); |
56 | QVBoxLayout* lay = new QVBoxLayout( this ); | 56 | QVBoxLayout* lay = new QVBoxLayout( this ); |
57 | lay->setSpacing( 3 ); | 57 | lay->setSpacing( 3 ); |
58 | lay->setMargin( 3 ); | 58 | lay->setMargin( 3 ); |
59 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 59 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
60 | lay->addWidget( lab ); | 60 | lay->addWidget( lab ); |
61 | nameE = new KLineEdit( this ); | 61 | nameE = new KLineEdit( this ); |
62 | lay->addWidget( nameE ); | 62 | lay->addWidget( nameE ); |
63 | lab = new QLabel( i18n("<b>Local ical (*.ics) file:</b>"), this ); | 63 | lab = new QLabel( i18n("<b>Local ical (*.ics) file:</b>"), this ); |
64 | lay->addWidget( lab ); | 64 | lay->addWidget( lab ); |
65 | url = new KURLRequester ( this ); | 65 | url = new KURLRequester ( this ); |
66 | lay->addWidget( url ); | 66 | lay->addWidget( url ); |
67 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 67 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
68 | lay->addWidget( ok ); | 68 | lay->addWidget( ok ); |
69 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 69 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
70 | lay->addWidget( cancel ); | 70 | lay->addWidget( cancel ); |
71 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); | 71 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( checkValid() ) ); |
72 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 72 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
73 | setMinimumWidth( 220 ); | 73 | int minwid = 220; |
74 | if ( QApplication::desktop()->width() >= 320 ) minwid = 300; | ||
75 | setMinimumWidth( minwid ); | ||
74 | resize(sizeHint() ); | 76 | resize(sizeHint() ); |
75 | } | 77 | } |
76 | 78 | ||
77 | QString calName() { return nameE->text(); } | 79 | QString calName() { return nameE->text(); } |
78 | QString calFileName() { return url->url(); } | 80 | QString calFileName() { return url->url(); } |
79 | 81 | ||
80 | public slots: | 82 | public slots: |
81 | void checkValid() { | 83 | void checkValid() { |
82 | if ( nameE->text().isEmpty() ) { | 84 | if ( nameE->text().isEmpty() ) { |
83 | KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); | 85 | KMessageBox::information( this, i18n("Sorry, the calendar name is empty!") ); |
84 | nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); | 86 | nameE->setText( "LPQJ_"+ QString::number( QTime::currentTime().msec () )); |
85 | return; | 87 | return; |
86 | } | 88 | } |
87 | if ( url->url().isEmpty() ) { | 89 | if ( url->url().isEmpty() ) { |
88 | KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); | 90 | KMessageBox::information( this, i18n("Sorry, the file name is empty!") ); |
89 | return; | 91 | return; |
90 | } | 92 | } |
91 | accept(); | 93 | accept(); |
92 | } | 94 | } |
93 | 95 | ||
94 | public: | 96 | public: |
95 | KLineEdit* nameE; | 97 | KLineEdit* nameE; |
96 | KURLRequester *url; | 98 | KURLRequester *url; |
97 | }; | 99 | }; |
98 | 100 | ||
99 | class KOCalButton : public QPushButton | 101 | class KOCalButton : public QPushButton |
100 | { | 102 | { |
101 | Q_OBJECT | 103 | Q_OBJECT |
102 | public: | 104 | public: |
103 | KOCalButton( QWidget *parent=0, const char *name=0 ) : | 105 | KOCalButton( QWidget *parent=0, const char *name=0 ) : |
104 | QPushButton( parent, name) | 106 | QPushButton( parent, name) |
105 | { | 107 | { |
106 | connect( this, SIGNAL( clicked() ), | 108 | connect( this, SIGNAL( clicked() ), |
107 | SLOT( bottonClicked() )); | 109 | SLOT( bottonClicked() )); |
108 | mNumber = -1; | 110 | mNumber = -1; |
109 | setFocusPolicy(NoFocus); | 111 | setFocusPolicy(NoFocus); |
110 | } | 112 | } |
111 | void setNum ( int num ) {mNumber = num; } | 113 | void setNum ( int num ) {mNumber = num; } |
112 | signals: | 114 | signals: |
113 | void selectNum ( int ); | 115 | void selectNum ( int ); |
114 | private: | 116 | private: |
115 | int mNumber; | 117 | int mNumber; |
116 | void keyPressEvent ( QKeyEvent * e ) | 118 | void keyPressEvent ( QKeyEvent * e ) |
117 | { | 119 | { |
118 | e->ignore(); | 120 | e->ignore(); |
119 | } | 121 | } |
120 | 122 | ||
121 | private slots : | 123 | private slots : |
122 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } | 124 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } |
123 | }; | 125 | }; |
124 | class KOCalCheckButton : public QCheckBox | 126 | class KOCalCheckButton : public QCheckBox |
125 | { | 127 | { |
126 | Q_OBJECT | 128 | Q_OBJECT |
127 | public: | 129 | public: |
128 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : | 130 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : |
129 | QCheckBox( parent, name) | 131 | QCheckBox( parent, name) |
130 | { | 132 | { |
131 | connect( this, SIGNAL( toggled ( bool ) ), | 133 | connect( this, SIGNAL( toggled ( bool ) ), |
132 | SLOT( bottonClicked( bool ) )); | 134 | SLOT( bottonClicked( bool ) )); |
133 | mNumber = -1; | 135 | mNumber = -1; |
134 | setFocusPolicy(NoFocus); | 136 | setFocusPolicy(NoFocus); |
135 | //setMaximumWidth( 10 ); | 137 | //setMaximumWidth( 10 ); |
136 | 138 | ||
137 | } | 139 | } |
138 | void setNum ( int num ) {mNumber = num; } | 140 | void setNum ( int num ) {mNumber = num; } |
139 | signals: | 141 | signals: |
140 | void selectNum ( int, bool ); | 142 | void selectNum ( int, bool ); |
141 | private: | 143 | private: |
142 | int mNumber; | 144 | int mNumber; |
143 | void keyPressEvent ( QKeyEvent * e ) | 145 | void keyPressEvent ( QKeyEvent * e ) |
144 | { | 146 | { |
145 | e->ignore(); | 147 | e->ignore(); |
146 | } | 148 | } |
147 | 149 | ||
148 | private slots : | 150 | private slots : |
149 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 151 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } |
150 | }; | 152 | }; |
151 | 153 | ||
152 | class KOCalRadioButton : public QRadioButton | 154 | class KOCalRadioButton : public QRadioButton |
153 | { | 155 | { |
154 | Q_OBJECT | 156 | Q_OBJECT |
155 | public: | 157 | public: |
156 | KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : | 158 | KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : |
157 | QRadioButton( parent, name) | 159 | QRadioButton( parent, name) |
158 | { | 160 | { |
159 | connect( this, SIGNAL( toggled ( bool ) ), | 161 | connect( this, SIGNAL( toggled ( bool ) ), |
160 | SLOT( bottonClicked( bool ) )); | 162 | SLOT( bottonClicked( bool ) )); |
161 | mNumber = -1; | 163 | mNumber = -1; |
162 | setFocusPolicy(NoFocus); | 164 | setFocusPolicy(NoFocus); |
163 | //setMaximumWidth( 10 ); | 165 | //setMaximumWidth( 10 ); |
164 | 166 | ||
165 | } | 167 | } |
168 | int num() { return mNumber;} | ||
166 | void setNum ( int num ) {mNumber = num; } | 169 | void setNum ( int num ) {mNumber = num; } |
167 | signals: | 170 | signals: |
168 | void selectNum ( int, bool ); | 171 | void selectNum ( int ); |
169 | private: | 172 | private: |
170 | int mNumber; | 173 | int mNumber; |
171 | void keyPressEvent ( QKeyEvent * e ) | 174 | void keyPressEvent ( QKeyEvent * e ) |
172 | { | 175 | { |
173 | e->ignore(); | 176 | e->ignore(); |
174 | } | 177 | } |
175 | 178 | ||
176 | private slots : | 179 | private slots : |
177 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 180 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber); } |
178 | }; | 181 | }; |
179 | 182 | ||
180 | 183 | ||
181 | 184 | ||
182 | class KOFilterView : public KOFilterView_base | 185 | class KOFilterView : public KOFilterView_base |
183 | { | 186 | { |
184 | Q_OBJECT | 187 | Q_OBJECT |
185 | public: | 188 | public: |
186 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 189 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); |
187 | ~KOFilterView(); | 190 | ~KOFilterView(); |
188 | 191 | ||
189 | void updateFilters(); | 192 | void updateFilters(); |
190 | 193 | ||
191 | bool filtersEnabled(); | 194 | bool filtersEnabled(); |
192 | void setFiltersEnabled(bool); | 195 | void setFiltersEnabled(bool); |
193 | CalFilter *selectedFilter(); | 196 | CalFilter *selectedFilter(); |
194 | void setSelectedFilter(QString); | 197 | void setSelectedFilter(QString); |
195 | void setSelectedFilter( int ); | 198 | void setSelectedFilter( int ); |
196 | 199 | ||
197 | signals: | 200 | signals: |
198 | void filterChanged(); | 201 | void filterChanged(); |
199 | void editFilters(); | 202 | void editFilters(); |
200 | 203 | ||
201 | private: | 204 | private: |
202 | QPtrList<CalFilter> *mFilters; | 205 | QPtrList<CalFilter> *mFilters; |
203 | }; | 206 | }; |
204 | 207 | ||
205 | class KOCalEditView : public QScrollView | 208 | class KOCalEditView : public QScrollView |
206 | { | 209 | { |
207 | Q_OBJECT | 210 | Q_OBJECT |
208 | public: | 211 | public: |
209 | KOCalEditView( QWidget* parent=0,const char* name=0); | 212 | KOCalEditView( QWidget* parent=0,const char* name=0); |
210 | ~KOCalEditView(); | 213 | ~KOCalEditView(); |
211 | int addCalendar( QString calName, QString fileName, bool ask = true ); | 214 | int addCalendar( QString calName, QString fileName, bool ask = true ); |
212 | int getBirtdayID(); | 215 | int getBirtdayID(); |
213 | public slots: | 216 | public slots: |
214 | void addCal(); | 217 | void addCal(); |
215 | void enableAll(); | 218 | void enableAll(); |
216 | void enableAlarm(); | 219 | void enableAlarm(); |
217 | void disableRO(); | 220 | void disableRO(); |
218 | void deleteAll(); | 221 | void deleteAll(); |
219 | void selectStdCal(int,bool ); | 222 | void selectStdCal(int); |
220 | void selectCal(int,bool ); | 223 | void selectCal(int,bool ); |
221 | void selectCalAlarm(int,bool ); | 224 | void selectCalAlarm(int,bool ); |
222 | void selectReadOnly(int,bool ); | 225 | void selectReadOnly(int,bool ); |
223 | void setColor(const QColor &,int) ; | 226 | void setColor(const QColor &,int) ; |
224 | void deleteCal(int) ; | 227 | void deleteCal(int) ; |
225 | void infoCal(int) ; | 228 | void infoCal(int) ; |
226 | void readConfig(); | 229 | void readConfig(); |
227 | void defaultInfo(); | 230 | void defaultInfo(); |
231 | void findNewStandard(); | ||
228 | signals: | 232 | signals: |
229 | void alarmEnabled ( int cal, bool enable ); | 233 | void alarmEnabled ( int cal, bool enable ); |
230 | void calendarEnabled ( int cal, bool enable ); | 234 | void calendarEnabled ( int cal, bool enable ); |
231 | void calendarReadonly ( int cal, bool readonly ); | 235 | void calendarReadonly ( int cal, bool readonly ); |
232 | void setCalendarDefault ( int cal ); | 236 | void setCalendarDefault ( int cal ); |
233 | void removeCalendar ( int cal ); | 237 | void removeCalendar ( int cal ); |
234 | void calendarAdded( int ); | 238 | void calendarAdded( int ); |
235 | void needsUpdate(); | 239 | void needsUpdate(); |
236 | void checkCalendar(); | 240 | void checkCalendar(); |
237 | 241 | ||
238 | private: | 242 | private: |
239 | QWidget *mw; | 243 | QWidget *mw; |
240 | void toggleList ( QPtrList<KOCalCheckButton> ); | 244 | void toggleList ( QPtrList<KOCalCheckButton> , bool b = true ); |
241 | QPtrList<KOCalRadioButton> mStdandardB; | 245 | QPtrList<KOCalRadioButton> mStdandardB; |
242 | QPtrList<KOCalCheckButton> mEnabledB; | 246 | QPtrList<KOCalCheckButton> mEnabledB; |
243 | QPtrList<KOCalCheckButton> mAlarmB; | 247 | QPtrList<KOCalCheckButton> mAlarmB; |
244 | QPtrList<KOCalCheckButton> mROB; | 248 | QPtrList<KOCalCheckButton> mROB; |
245 | QGridLayout* mainLayout; | 249 | QGridLayout* mainLayout; |
246 | }; | 250 | }; |
247 | 251 | ||
248 | 252 | ||
249 | 253 | ||
250 | #endif // KOFILTERVIEW_H | 254 | #endif // KOFILTERVIEW_H |