-rw-r--r-- | korganizer/kofilterview.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 2b16347..361eec8 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -175,98 +175,101 @@ void KOCalEditView::selectStdCal( int id, bool b ) | |||
175 | return; | 175 | return; |
176 | } | 176 | } |
177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
178 | KOCalCheckButton* it = mStdandardB.first(); | 178 | KOCalCheckButton* it = mStdandardB.first(); |
179 | while ( it ) { | 179 | while ( it ) { |
180 | if ( it->isChecked() ) { | 180 | if ( it->isChecked() ) { |
181 | if ( it != sen ) { | 181 | if ( it != sen ) { |
182 | it->blockSignals( true ); | 182 | it->blockSignals( true ); |
183 | it->setChecked( false ); | 183 | it->setChecked( false ); |
184 | it->blockSignals( false ); | 184 | it->blockSignals( false ); |
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | it = mStdandardB.next(); | 188 | it = mStdandardB.next(); |
189 | } | 189 | } |
190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
191 | while ( kkf ) { | 191 | while ( kkf ) { |
192 | kkf->isStandard = false; | 192 | kkf->isStandard = false; |
193 | kkf = KOPrefs::instance()->mCalendars.next(); | 193 | kkf = KOPrefs::instance()->mCalendars.next(); |
194 | } | 194 | } |
195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
196 | emit setCalendarDefault ( id ); | 196 | emit setCalendarDefault ( id ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
200 | { | 200 | { |
201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
202 | emit alarmEnabled ( id , b ); | 202 | emit alarmEnabled ( id , b ); |
203 | emit needsUpdate(); | 203 | emit needsUpdate(); |
204 | } | 204 | } |
205 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 205 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
206 | { | 206 | { |
207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
208 | emit calendarReadonly ( id , b ); | 208 | emit calendarReadonly ( id , b ); |
209 | emit needsUpdate(); | 209 | emit needsUpdate(); |
210 | 210 | ||
211 | } | 211 | } |
212 | void KOCalEditView::setColor( const QColor& c, int id ) | 212 | void KOCalEditView::setColor( const QColor& c, int id ) |
213 | { | 213 | { |
214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 214 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
215 | emit needsUpdate(); | 215 | emit needsUpdate(); |
216 | } | 216 | } |
217 | void KOCalEditView::deleteCal( int id ) | 217 | void KOCalEditView::deleteCal( int id ) |
218 | { | 218 | { |
219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 219 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
220 | QString name = kkf->mName; | 220 | QString name = kkf->mName; |
221 | QString file = kkf->mFileName; | 221 | QString file = kkf->mFileName; |
222 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; | 222 | if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; |
223 | if ( kkf->isStandard ) | ||
224 | selectStdCal( 1, true ); | ||
223 | emit removeCalendar ( id ); | 225 | emit removeCalendar ( id ); |
224 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 226 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
227 | emit needsUpdate(); | ||
225 | readConfig(); | 228 | readConfig(); |
226 | } | 229 | } |
227 | void KOCalEditView::infoCal( int id ) | 230 | void KOCalEditView::infoCal( int id ) |
228 | { | 231 | { |
229 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 232 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
230 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 233 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
231 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 234 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
232 | } | 235 | } |
233 | void KOCalEditView::readConfig() | 236 | void KOCalEditView::readConfig() |
234 | { | 237 | { |
235 | 238 | ||
236 | mStdandardB.clear(); | 239 | mStdandardB.clear(); |
237 | mEnabledB.clear(); | 240 | mEnabledB.clear(); |
238 | mAlarmB.clear(); | 241 | mAlarmB.clear(); |
239 | mROB.clear(); | 242 | mROB.clear(); |
240 | 243 | ||
241 | if ( mw ) delete mw; | 244 | if ( mw ) delete mw; |
242 | mw = new QWidget ( this ); | 245 | mw = new QWidget ( this ); |
243 | ml->addWidget ( mw ); | 246 | ml->addWidget ( mw ); |
244 | 247 | ||
245 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 248 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
246 | //mainLayout->setSpacing( 3 ); | 249 | //mainLayout->setSpacing( 3 ); |
247 | QPushButton * addBut = new QPushButton ( mw ); | 250 | QPushButton * addBut = new QPushButton ( mw ); |
248 | mainLayout->addWidget( addBut,0,0 ); | 251 | mainLayout->addWidget( addBut,0,0 ); |
249 | addBut->setPixmap ( SmallIcon("plus")); | 252 | addBut->setPixmap ( SmallIcon("plus")); |
250 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 253 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
251 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 254 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
252 | 255 | ||
253 | addBut = new QPushButton ( mw ); | 256 | addBut = new QPushButton ( mw ); |
254 | mainLayout->addWidget( addBut,0,1 ); | 257 | mainLayout->addWidget( addBut,0,1 ); |
255 | addBut->setPixmap ( SmallIcon("eye")); | 258 | addBut->setPixmap ( SmallIcon("eye")); |
256 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 259 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
257 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 260 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
258 | 261 | ||
259 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 262 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); |
260 | mainLayout->addWidget( lab,0,2 ); | 263 | mainLayout->addWidget( lab,0,2 ); |
261 | 264 | ||
262 | addBut = new QPushButton ( mw ); | 265 | addBut = new QPushButton ( mw ); |
263 | mainLayout->addWidget( addBut,0,3 ); | 266 | mainLayout->addWidget( addBut,0,3 ); |
264 | addBut->setPixmap ( SmallIcon("bell")); | 267 | addBut->setPixmap ( SmallIcon("bell")); |
265 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 268 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
266 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 269 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
267 | 270 | ||
268 | addBut = new QPushButton ( mw ); | 271 | addBut = new QPushButton ( mw ); |
269 | mainLayout->addWidget( addBut,0,4 ); | 272 | mainLayout->addWidget( addBut,0,4 ); |
270 | addBut->setPixmap ( SmallIcon("pencil")); | 273 | addBut->setPixmap ( SmallIcon("pencil")); |
271 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 274 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
272 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 275 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
@@ -306,82 +309,83 @@ void KOCalEditView::readConfig() | |||
306 | cb->setChecked( kkf->isAlarmEnabled ); | 309 | cb->setChecked( kkf->isAlarmEnabled ); |
307 | cb->setNum( kkf->mCalNumber ); | 310 | cb->setNum( kkf->mCalNumber ); |
308 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 311 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
309 | cb = new KOCalCheckButton( mw ); | 312 | cb = new KOCalCheckButton( mw ); |
310 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 313 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); |
311 | cb->setChecked( kkf->isReadOnly ); | 314 | cb->setChecked( kkf->isReadOnly ); |
312 | cb->setNum( kkf->mCalNumber ); | 315 | cb->setNum( kkf->mCalNumber ); |
313 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
314 | KColorButton *colb = new KColorButton( mw ); | 317 | KColorButton *colb = new KColorButton( mw ); |
315 | mainLayout->addWidget( colb,row,5 ); | 318 | mainLayout->addWidget( colb,row,5 ); |
316 | colb->setID( kkf->mCalNumber ); | 319 | colb->setID( kkf->mCalNumber ); |
317 | colb->setColor( kkf->mDefaultColor ); | 320 | colb->setColor( kkf->mDefaultColor ); |
318 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 321 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
319 | if ( row > 1) { | 322 | if ( row > 1) { |
320 | KOCalButton* calb = new KOCalButton( mw ); | 323 | KOCalButton* calb = new KOCalButton( mw ); |
321 | mainLayout->addWidget( calb,row,6 ); | 324 | mainLayout->addWidget( calb,row,6 ); |
322 | calb->setNum( kkf->mCalNumber ); | 325 | calb->setNum( kkf->mCalNumber ); |
323 | calb->setPixmap ( SmallIcon("minus")); | 326 | calb->setPixmap ( SmallIcon("minus")); |
324 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 327 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
325 | int hei = calb->sizeHint().height(); | 328 | int hei = calb->sizeHint().height(); |
326 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 329 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
327 | } | 330 | } |
328 | ++row; | 331 | ++row; |
329 | kkf = KOPrefs::instance()->mCalendars.next(); | 332 | kkf = KOPrefs::instance()->mCalendars.next(); |
330 | } | 333 | } |
331 | lab = new QLabel ( "", mw ); | 334 | lab = new QLabel ( "", mw ); |
332 | mainLayout->addWidget( lab,row,0 ); | 335 | mainLayout->addWidget( lab,row,0 ); |
333 | mw->show(); | 336 | mw->show(); |
334 | 337 | ||
335 | } | 338 | } |
336 | void KOCalEditView::addCal() | 339 | void KOCalEditView::addCal() |
337 | { | 340 | { |
338 | qDebug("addcal "); | 341 | qDebug("addcal "); |
339 | KONewCalPrefs prefs ( this ); | 342 | KONewCalPrefs prefs ( this ); |
340 | if ( ! prefs.exec() ) | 343 | if ( ! prefs.exec() ) |
341 | return; | 344 | return; |
342 | QString name = prefs.calName(); | 345 | QString name = prefs.calName(); |
343 | QString file = prefs.calFileName(); | 346 | QString file = prefs.calFileName(); |
344 | QFileInfo fi ( file ); | 347 | QFileInfo fi ( file ); |
345 | if (!fi.exists() ) { | 348 | if (!fi.exists() ) { |
346 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 349 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
347 | return; | 350 | return; |
348 | } | 351 | } |
349 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 352 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
350 | kkf->mName = name; | 353 | kkf->mName = name; |
351 | kkf->mFileName = file; | 354 | kkf->mFileName = file; |
352 | emit calendarAdded( kkf->mCalNumber ); | 355 | emit calendarAdded( kkf->mCalNumber ); |
353 | readConfig(); | 356 | readConfig(); |
357 | emit needsUpdate(); | ||
354 | } | 358 | } |
355 | void KOCalEditView::enableAll() | 359 | void KOCalEditView::enableAll() |
356 | { | 360 | { |
357 | toggleList( mEnabledB ); | 361 | toggleList( mEnabledB ); |
358 | } | 362 | } |
359 | void KOCalEditView::enableAlarm() | 363 | void KOCalEditView::enableAlarm() |
360 | { | 364 | { |
361 | toggleList( mAlarmB ); | 365 | toggleList( mAlarmB ); |
362 | } | 366 | } |
363 | void KOCalEditView::disableRO() | 367 | void KOCalEditView::disableRO() |
364 | { | 368 | { |
365 | toggleList( mROB ); | 369 | toggleList( mROB ); |
366 | } | 370 | } |
367 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 371 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
368 | { | 372 | { |
369 | bool dis = false; | 373 | bool dis = false; |
370 | KOCalCheckButton* it = list.first(); | 374 | KOCalCheckButton* it = list.first(); |
371 | while ( it ) { | 375 | while ( it ) { |
372 | if ( !it->isChecked() ) { | 376 | if ( !it->isChecked() ) { |
373 | dis = true; | 377 | dis = true; |
374 | break; | 378 | break; |
375 | } | 379 | } |
376 | it = list.next(); | 380 | it = list.next(); |
377 | } | 381 | } |
378 | it = list.first(); | 382 | it = list.first(); |
379 | while ( it ) { | 383 | while ( it ) { |
380 | it->setChecked(dis); | 384 | it->setChecked(dis); |
381 | it = list.next(); | 385 | it = list.next(); |
382 | } | 386 | } |
383 | } | 387 | } |
384 | void KOCalEditView::deleteAll() | 388 | void KOCalEditView::deleteAll() |
385 | { | 389 | { |
386 | qDebug("delteAll"); | 390 | qDebug("delteAll"); |
387 | } | 391 | } |