-rw-r--r-- | korganizer/kofilterview.cpp | 28 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 32 |
2 files changed, 49 insertions, 11 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index ce2880a..9709324 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -136,26 +136,26 @@ void KOCalEditView::selectStdCal( int id, bool b ) | |||
136 | { | 136 | { |
137 | 137 | ||
138 | if ( !b ) { | 138 | if ( !b ) { |
139 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 139 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
140 | if ( it ) { | 140 | if ( it ) { |
141 | it->blockSignals( true ); | 141 | it->blockSignals( true ); |
142 | it->setChecked( true ); | 142 | it->setChecked( true ); |
143 | it->blockSignals( false ); | 143 | it->blockSignals( false ); |
144 | return; | 144 | return; |
145 | } | 145 | } |
146 | return; | 146 | return; |
147 | } | 147 | } |
148 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 148 | KOCalRadioButton* sen = (KOCalRadioButton*) sender(); |
149 | KOCalCheckButton* it = mStdandardB.first(); | 149 | KOCalRadioButton* it = mStdandardB.first(); |
150 | while ( it ) { | 150 | while ( it ) { |
151 | if ( it->isChecked() ) { | 151 | if ( it->isChecked() ) { |
152 | if ( it != sen ) { | 152 | if ( it != sen ) { |
153 | it->blockSignals( true ); | 153 | it->blockSignals( true ); |
154 | it->setChecked( false ); | 154 | it->setChecked( false ); |
155 | it->blockSignals( false ); | 155 | it->blockSignals( false ); |
156 | break; | 156 | break; |
157 | } | 157 | } |
158 | } | 158 | } |
159 | it = mStdandardB.next(); | 159 | it = mStdandardB.next(); |
160 | } | 160 | } |
161 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 161 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
@@ -227,25 +227,27 @@ void KOCalEditView::readConfig() | |||
227 | mROB.clear(); | 227 | mROB.clear(); |
228 | 228 | ||
229 | if ( mw ) delete mw; | 229 | if ( mw ) delete mw; |
230 | mw = new QWidget ( viewport() ); | 230 | mw = new QWidget ( viewport() ); |
231 | addChild(mw); | 231 | addChild(mw); |
232 | int ii = 0; | 232 | int ii = 0; |
233 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 233 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
234 | mainLayout->setMargin( 2 ); | 234 | mainLayout->setMargin( 2 ); |
235 | mainLayout->setSpacing( 2 ); | 235 | mainLayout->setSpacing( 2 ); |
236 | QPushButton * addBut = new QPushButton ( mw ); | 236 | QPushButton * addBut = new QPushButton ( mw ); |
237 | addBut->setFocusPolicy(NoFocus); | 237 | addBut->setFocusPolicy(NoFocus); |
238 | mainLayout->addWidget( addBut,0,0 ); | 238 | mainLayout->addWidget( addBut,0,0 ); |
239 | addBut->setPixmap ( SmallIcon("greenhook16")); | 239 | addBut->setText( "D"); |
240 | connect(addBut,SIGNAL(clicked()),SLOT(defaultInfo())); | ||
241 | //addBut->setPixmap ( SmallIcon("greenhook16")); | ||
240 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 242 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
241 | int max = addBut->sizeHint().height(); | 243 | int max = addBut->sizeHint().height(); |
242 | addBut = new QPushButton ( mw ); | 244 | addBut = new QPushButton ( mw ); |
243 | addBut->setFocusPolicy(NoFocus); | 245 | addBut->setFocusPolicy(NoFocus); |
244 | mainLayout->addWidget( addBut,0,++ii ); | 246 | mainLayout->addWidget( addBut,0,++ii ); |
245 | addBut->setPixmap ( SmallIcon("eye")); | 247 | addBut->setPixmap ( SmallIcon("eye")); |
246 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 248 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
247 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 249 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
248 | 250 | ||
249 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); | 251 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); |
250 | mainLayout->addWidget( lab,0,++ii ); | 252 | mainLayout->addWidget( lab,0,++ii ); |
251 | //lab = new QLabel ( i18n(" "), mw ); | 253 | //lab = new QLabel ( i18n(" "), mw ); |
@@ -281,32 +283,32 @@ void KOCalEditView::readConfig() | |||
281 | addBut = new QPushButton ( mw ); | 283 | addBut = new QPushButton ( mw ); |
282 | mainLayout->addWidget( addBut,0,6 ); | 284 | mainLayout->addWidget( addBut,0,6 ); |
283 | addBut->setPixmap ( SmallIcon("minus")); | 285 | addBut->setPixmap ( SmallIcon("minus")); |
284 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 286 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
285 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 287 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
286 | #endif | 288 | #endif |
287 | 289 | ||
288 | 290 | ||
289 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 291 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
290 | int row = 1; | 292 | int row = 1; |
291 | while ( kkf ) { | 293 | while ( kkf ) { |
292 | int iii = 0; | 294 | int iii = 0; |
293 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 295 | KOCalRadioButton* rb = new KOCalRadioButton( mw ); |
294 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 296 | mainLayout->addWidget( rb,row,0 );mStdandardB.append( rb ); |
295 | cb->setChecked( kkf->isStandard ); | 297 | rb->setChecked( kkf->isStandard ); |
296 | cb->setNum( kkf->mCalNumber ); | 298 | rb->setNum( kkf->mCalNumber ); |
297 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 299 | connect (rb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
298 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 300 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
299 | cb->setEnabled( false ); | 301 | rb->setEnabled( false ); |
300 | cb = new KOCalCheckButton( mw ); | 302 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
301 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); | 303 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); |
302 | cb->setChecked( kkf->isEnabled ); | 304 | cb->setChecked( kkf->isEnabled ); |
303 | cb->setNum( kkf->mCalNumber ); | 305 | cb->setNum( kkf->mCalNumber ); |
304 | if ( kkf->mErrorOnLoad ) | 306 | if ( kkf->mErrorOnLoad ) |
305 | cb->setEnabled( false ); | 307 | cb->setEnabled( false ); |
306 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 308 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
307 | KOCalButton* name = new KOCalButton( mw ); | 309 | KOCalButton* name = new KOCalButton( mw ); |
308 | name->setNum( kkf->mCalNumber ); | 310 | name->setNum( kkf->mCalNumber ); |
309 | name->setText( kkf->mName ); | 311 | name->setText( kkf->mName ); |
310 | mainLayout->addWidget( name,row,++iii ); | 312 | mainLayout->addWidget( name,row,++iii ); |
311 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 313 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
312 | //lab = new QLabel (" ", mw ); | 314 | //lab = new QLabel (" ", mw ); |
@@ -338,24 +340,30 @@ void KOCalEditView::readConfig() | |||
338 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 340 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
339 | int hei = calb->sizeHint().height(); | 341 | int hei = calb->sizeHint().height(); |
340 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 342 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
341 | } | 343 | } |
342 | ++row; | 344 | ++row; |
343 | kkf = KOPrefs::instance()->mCalendars.next(); | 345 | kkf = KOPrefs::instance()->mCalendars.next(); |
344 | } | 346 | } |
345 | lab = new QLabel ( "", mw ); | 347 | lab = new QLabel ( "", mw ); |
346 | mainLayout->addWidget( lab,row,0 ); | 348 | mainLayout->addWidget( lab,row,0 ); |
347 | mw->show(); | 349 | mw->show(); |
348 | 350 | ||
349 | } | 351 | } |
352 | |||
353 | |||
354 | void KOCalEditView::defaultInfo() | ||
355 | { | ||
356 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); | ||
357 | } | ||
350 | void KOCalEditView::addCal() | 358 | void KOCalEditView::addCal() |
351 | { | 359 | { |
352 | bool tryagain = true; | 360 | bool tryagain = true; |
353 | QString name, file; | 361 | QString name, file; |
354 | while ( tryagain ) { | 362 | while ( tryagain ) { |
355 | KONewCalPrefs prefs ( this ); | 363 | KONewCalPrefs prefs ( this ); |
356 | prefs.nameE->setText( name ); | 364 | prefs.nameE->setText( name ); |
357 | prefs.url->setURL( file ); | 365 | prefs.url->setURL( file ); |
358 | if ( ! prefs.exec() ) | 366 | if ( ! prefs.exec() ) |
359 | return; | 367 | return; |
360 | name = prefs.calName(); | 368 | name = prefs.calName(); |
361 | file = prefs.calFileName(); | 369 | file = prefs.calFileName(); |
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 5495d60..b57a6e9 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -16,24 +16,25 @@ | |||
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 <qradiobutton.h> | ||
28 | #include <qlayout.h> | 29 | #include <qlayout.h> |
29 | #include <qlabel.h> | 30 | #include <qlabel.h> |
30 | #include <qdialog.h> | 31 | #include <qdialog.h> |
31 | #include <qscrollview.h> | 32 | #include <qscrollview.h> |
32 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
33 | #include <kconfig.h> | 34 | #include <kconfig.h> |
34 | #include "kofilterview_base.h" | 35 | #include "kofilterview_base.h" |
35 | 36 | ||
36 | #include <libkcal/calfilter.h> | 37 | #include <libkcal/calfilter.h> |
37 | 38 | ||
38 | #include <kurlrequester.h> | 39 | #include <kurlrequester.h> |
39 | #include <klineedit.h> | 40 | #include <klineedit.h> |
@@ -139,24 +140,52 @@ class KOCalCheckButton : public QCheckBox | |||
139 | void selectNum ( int, bool ); | 140 | void selectNum ( int, bool ); |
140 | private: | 141 | private: |
141 | int mNumber; | 142 | int mNumber; |
142 | void keyPressEvent ( QKeyEvent * e ) | 143 | void keyPressEvent ( QKeyEvent * e ) |
143 | { | 144 | { |
144 | e->ignore(); | 145 | e->ignore(); |
145 | } | 146 | } |
146 | 147 | ||
147 | private slots : | 148 | private slots : |
148 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 149 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } |
149 | }; | 150 | }; |
150 | 151 | ||
152 | class KOCalRadioButton : public QRadioButton | ||
153 | { | ||
154 | Q_OBJECT | ||
155 | public: | ||
156 | KOCalRadioButton( QWidget *parent=0, const char *name=0 ) : | ||
157 | QRadioButton( parent, name) | ||
158 | { | ||
159 | connect( this, SIGNAL( toggled ( bool ) ), | ||
160 | SLOT( bottonClicked( bool ) )); | ||
161 | mNumber = -1; | ||
162 | setFocusPolicy(NoFocus); | ||
163 | //setMaximumWidth( 10 ); | ||
164 | |||
165 | } | ||
166 | void setNum ( int num ) {mNumber = num; } | ||
167 | signals: | ||
168 | void selectNum ( int, bool ); | ||
169 | private: | ||
170 | int mNumber; | ||
171 | void keyPressEvent ( QKeyEvent * e ) | ||
172 | { | ||
173 | e->ignore(); | ||
174 | } | ||
175 | |||
176 | private slots : | ||
177 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | ||
178 | }; | ||
179 | |||
151 | 180 | ||
152 | 181 | ||
153 | class KOFilterView : public KOFilterView_base | 182 | class KOFilterView : public KOFilterView_base |
154 | { | 183 | { |
155 | Q_OBJECT | 184 | Q_OBJECT |
156 | public: | 185 | public: |
157 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 186 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); |
158 | ~KOFilterView(); | 187 | ~KOFilterView(); |
159 | 188 | ||
160 | void updateFilters(); | 189 | void updateFilters(); |
161 | 190 | ||
162 | bool filtersEnabled(); | 191 | bool filtersEnabled(); |
@@ -185,34 +214,35 @@ class KOCalEditView : public QScrollView | |||
185 | void enableAll(); | 214 | void enableAll(); |
186 | void enableAlarm(); | 215 | void enableAlarm(); |
187 | void disableRO(); | 216 | void disableRO(); |
188 | void deleteAll(); | 217 | void deleteAll(); |
189 | void selectStdCal(int,bool ); | 218 | void selectStdCal(int,bool ); |
190 | void selectCal(int,bool ); | 219 | void selectCal(int,bool ); |
191 | void selectCalAlarm(int,bool ); | 220 | void selectCalAlarm(int,bool ); |
192 | void selectReadOnly(int,bool ); | 221 | void selectReadOnly(int,bool ); |
193 | void setColor(const QColor &,int) ; | 222 | void setColor(const QColor &,int) ; |
194 | void deleteCal(int) ; | 223 | void deleteCal(int) ; |
195 | void infoCal(int) ; | 224 | void infoCal(int) ; |
196 | void readConfig(); | 225 | void readConfig(); |
226 | void defaultInfo(); | ||
197 | signals: | 227 | signals: |
198 | void alarmEnabled ( int cal, bool enable ); | 228 | void alarmEnabled ( int cal, bool enable ); |
199 | void calendarEnabled ( int cal, bool enable ); | 229 | void calendarEnabled ( int cal, bool enable ); |
200 | void calendarReadonly ( int cal, bool readonly ); | 230 | void calendarReadonly ( int cal, bool readonly ); |
201 | void setCalendarDefault ( int cal ); | 231 | void setCalendarDefault ( int cal ); |
202 | void removeCalendar ( int cal ); | 232 | void removeCalendar ( int cal ); |
203 | void calendarAdded( int ); | 233 | void calendarAdded( int ); |
204 | void needsUpdate(); | 234 | void needsUpdate(); |
205 | 235 | ||
206 | private: | 236 | private: |
207 | QWidget *mw; | 237 | QWidget *mw; |
208 | void toggleList ( QPtrList<KOCalCheckButton> ); | 238 | void toggleList ( QPtrList<KOCalCheckButton> ); |
209 | QPtrList<KOCalCheckButton> mStdandardB; | 239 | QPtrList<KOCalRadioButton> mStdandardB; |
210 | QPtrList<KOCalCheckButton> mEnabledB; | 240 | QPtrList<KOCalCheckButton> mEnabledB; |
211 | QPtrList<KOCalCheckButton> mAlarmB; | 241 | QPtrList<KOCalCheckButton> mAlarmB; |
212 | QPtrList<KOCalCheckButton> mROB; | 242 | QPtrList<KOCalCheckButton> mROB; |
213 | QGridLayout* mainLayout; | 243 | QGridLayout* mainLayout; |
214 | }; | 244 | }; |
215 | 245 | ||
216 | 246 | ||
217 | 247 | ||
218 | #endif // KOFILTERVIEW_H | 248 | #endif // KOFILTERVIEW_H |