author | zautrix <zautrix> | 2005-06-11 18:34:05 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-11 18:34:05 (UTC) |
commit | b56d3be87557510285d3381250faf9b7af300680 (patch) (unidiff) | |
tree | 887e24db261f56f78dda8397196a6125cc346fc5 | |
parent | 81370a5f955c2710b6e9336b6c412c8d630ef72a (diff) | |
download | kdepimpi-b56d3be87557510285d3381250faf9b7af300680.zip kdepimpi-b56d3be87557510285d3381250faf9b7af300680.tar.gz kdepimpi-b56d3be87557510285d3381250faf9b7af300680.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/calendarview.cpp | 39 | ||||
-rw-r--r-- | microkde/kfiledialog.cpp | 2 |
2 files changed, 31 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8f5de4d..753d81f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -261,775 +261,778 @@ void MissedAlarmTextBrowser::setSource(const QString & n) | |||
261 | #ifdef DESKTOP_VERSION | 261 | #ifdef DESKTOP_VERSION |
262 | emit showIncidence(n.mid(7)); | 262 | emit showIncidence(n.mid(7)); |
263 | #else | 263 | #else |
264 | emit showIncidence(n.mid(5)); | 264 | emit showIncidence(n.mid(5)); |
265 | #endif | 265 | #endif |
266 | return; | 266 | return; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | class KOBeamPrefs : public QDialog | 271 | class KOBeamPrefs : public QDialog |
272 | { | 272 | { |
273 | public: | 273 | public: |
274 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : | 274 | KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : |
275 | QDialog( parent, name, true ) | 275 | QDialog( parent, name, true ) |
276 | { | 276 | { |
277 | setCaption( i18n("Beam Options") ); | 277 | setCaption( i18n("Beam Options") ); |
278 | QVBoxLayout* lay = new QVBoxLayout( this ); | 278 | QVBoxLayout* lay = new QVBoxLayout( this ); |
279 | lay->setSpacing( 3 ); | 279 | lay->setSpacing( 3 ); |
280 | lay->setMargin( 3 ); | 280 | lay->setMargin( 3 ); |
281 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); | 281 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); |
282 | lay->addWidget( format ); | 282 | lay->addWidget( format ); |
283 | format->setExclusive ( true ) ; | 283 | format->setExclusive ( true ) ; |
284 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); | 284 | QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); |
285 | lay->addWidget( time ); time->setExclusive ( true ) ; | 285 | lay->addWidget( time ); time->setExclusive ( true ) ; |
286 | vcal = new QRadioButton(" vCalendar ", format ); | 286 | vcal = new QRadioButton(" vCalendar ", format ); |
287 | ical = new QRadioButton(" iCalendar ", format ); | 287 | ical = new QRadioButton(" iCalendar ", format ); |
288 | vcal->setChecked( true ); | 288 | vcal->setChecked( true ); |
289 | tz = new QRadioButton(i18n(" With timezone "), time ); | 289 | tz = new QRadioButton(i18n(" With timezone "), time ); |
290 | local = new QRadioButton(i18n(" Local time "), time ); | 290 | local = new QRadioButton(i18n(" Local time "), time ); |
291 | tz->setChecked( true ); | 291 | tz->setChecked( true ); |
292 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); | 292 | QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); |
293 | lay->addWidget( ok ); | 293 | lay->addWidget( ok ); |
294 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 294 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
295 | lay->addWidget( cancel ); | 295 | lay->addWidget( cancel ); |
296 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 296 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
297 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 297 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
298 | resize( 200, 200 ); | 298 | resize( 200, 200 ); |
299 | } | 299 | } |
300 | 300 | ||
301 | bool beamVcal() { return vcal->isChecked(); } | 301 | bool beamVcal() { return vcal->isChecked(); } |
302 | bool beamLocal() { return local->isChecked(); } | 302 | bool beamLocal() { return local->isChecked(); } |
303 | private: | 303 | private: |
304 | QRadioButton* vcal, *ical, *local, *tz; | 304 | QRadioButton* vcal, *ical, *local, *tz; |
305 | }; | 305 | }; |
306 | class KOCatPrefs : public QDialog | 306 | class KOCatPrefs : public QDialog |
307 | { | 307 | { |
308 | public: | 308 | public: |
309 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : | 309 | KOCatPrefs( QWidget *parent=0, const char *name=0 ) : |
310 | QDialog( parent, name, true ) | 310 | QDialog( parent, name, true ) |
311 | { | 311 | { |
312 | setCaption( i18n("Manage new Categories") ); | 312 | setCaption( i18n("Manage new Categories") ); |
313 | QVBoxLayout* lay = new QVBoxLayout( this ); | 313 | QVBoxLayout* lay = new QVBoxLayout( this ); |
314 | lay->setSpacing( 3 ); | 314 | lay->setSpacing( 3 ); |
315 | lay->setMargin( 3 ); | 315 | lay->setMargin( 3 ); |
316 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 316 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
317 | lay->addWidget( lab ); | 317 | lay->addWidget( lab ); |
318 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 318 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
319 | lay->addWidget( format ); | 319 | lay->addWidget( format ); |
320 | format->setExclusive ( true ) ; | 320 | format->setExclusive ( true ) ; |
321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 321 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 322 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
323 | addCatBut->setChecked( true ); | 323 | addCatBut->setChecked( true ); |
324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 324 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
325 | lay->addWidget( ok ); | 325 | lay->addWidget( ok ); |
326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 326 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
327 | lay->addWidget( cancel ); | 327 | lay->addWidget( cancel ); |
328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 328 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 329 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
330 | resize( 200, 200 ); | 330 | resize( 200, 200 ); |
331 | } | 331 | } |
332 | 332 | ||
333 | bool addCat() { return addCatBut->isChecked(); } | 333 | bool addCat() { return addCatBut->isChecked(); } |
334 | private: | 334 | private: |
335 | QRadioButton* addCatBut; | 335 | QRadioButton* addCatBut; |
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
339 | 339 | ||
340 | CalendarView::CalendarView( CalendarResources *calendar, | 340 | CalendarView::CalendarView( CalendarResources *calendar, |
341 | QWidget *parent, const char *name ) | 341 | QWidget *parent, const char *name ) |
342 | : CalendarViewBase( parent, name ), | 342 | : CalendarViewBase( parent, name ), |
343 | mCalendar( calendar ), | 343 | mCalendar( calendar ), |
344 | mResourceManager( calendar->resourceManager() ) | 344 | mResourceManager( calendar->resourceManager() ) |
345 | { | 345 | { |
346 | 346 | ||
347 | mEventEditor = 0; | 347 | mEventEditor = 0; |
348 | mTodoEditor = 0; | 348 | mTodoEditor = 0; |
349 | 349 | ||
350 | init(); | 350 | init(); |
351 | } | 351 | } |
352 | 352 | ||
353 | CalendarView::CalendarView( Calendar *calendar, | 353 | CalendarView::CalendarView( Calendar *calendar, |
354 | QWidget *parent, const char *name ) | 354 | QWidget *parent, const char *name ) |
355 | : CalendarViewBase( parent, name ), | 355 | : CalendarViewBase( parent, name ), |
356 | mCalendar( calendar ), | 356 | mCalendar( calendar ), |
357 | mResourceManager( 0 ) | 357 | mResourceManager( 0 ) |
358 | { | 358 | { |
359 | 359 | ||
360 | mEventEditor = 0; | 360 | mEventEditor = 0; |
361 | mTodoEditor = 0; | 361 | mTodoEditor = 0; |
362 | init(); | 362 | init(); |
363 | } | 363 | } |
364 | 364 | ||
365 | void CalendarView::init() | 365 | void CalendarView::init() |
366 | { | 366 | { |
367 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 367 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
368 | setFocusPolicy ( NoFocus ); | 368 | setFocusPolicy ( NoFocus ); |
369 | mViewerCallerIsSearchDialog = false; | 369 | mViewerCallerIsSearchDialog = false; |
370 | mBlockShowDates = false; | 370 | mBlockShowDates = false; |
371 | beamDialog = new KOBeamPrefs(); | 371 | beamDialog = new KOBeamPrefs(); |
372 | mDatePickerMode = 0; | 372 | mDatePickerMode = 0; |
373 | mCurrentSyncDevice = ""; | 373 | mCurrentSyncDevice = ""; |
374 | writeLocale(); | 374 | writeLocale(); |
375 | mViewManager = new KOViewManager( this ); | 375 | mViewManager = new KOViewManager( this ); |
376 | mDialogManager = new KODialogManager( this ); | 376 | mDialogManager = new KODialogManager( this ); |
377 | mEventViewerDialog = 0; | 377 | mEventViewerDialog = 0; |
378 | mModified = false; | 378 | mModified = false; |
379 | mReadOnly = false; | 379 | mReadOnly = false; |
380 | mSelectedIncidence = 0; | 380 | mSelectedIncidence = 0; |
381 | mCalPrinter = 0; | 381 | mCalPrinter = 0; |
382 | mFilters.setAutoDelete(true); | 382 | mFilters.setAutoDelete(true); |
383 | 383 | ||
384 | mCalendar->registerObserver( this ); | 384 | mCalendar->registerObserver( this ); |
385 | // TODO: Make sure that view is updated, when calendar is changed. | 385 | // TODO: Make sure that view is updated, when calendar is changed. |
386 | 386 | ||
387 | mStorage = new FileStorage( mCalendar ); | 387 | mStorage = new FileStorage( mCalendar ); |
388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 388 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
389 | 389 | ||
390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 390 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
391 | #ifndef KORG_NOSPLITTER | 391 | #ifndef KORG_NOSPLITTER |
392 | // create the main layout frames. | 392 | // create the main layout frames. |
393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 393 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
394 | topLayout->addWidget(mPanner); | 394 | topLayout->addWidget(mPanner); |
395 | 395 | ||
396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 396 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
397 | "CalendarView::LeftFrame"); | 397 | "CalendarView::LeftFrame"); |
398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 398 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
399 | 399 | ||
400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 400 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
401 | "CalendarView::DateNavigator" ); | 401 | "CalendarView::DateNavigator" ); |
402 | 402 | ||
403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 403 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 404 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
405 | mTodoList->setNavigator( mNavigator ); | 405 | mTodoList->setNavigator( mNavigator ); |
406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 406 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
407 | 407 | ||
408 | #ifdef KORG_NORESOURCEVIEW | 408 | #ifdef KORG_NORESOURCEVIEW |
409 | mResourceView = 0; | 409 | mResourceView = 0; |
410 | #else | 410 | #else |
411 | if ( mResourceManager ) { | 411 | if ( mResourceManager ) { |
412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
413 | mResourceView->updateView(); | 413 | mResourceView->updateView(); |
414 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 414 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
415 | SLOT( updateView() ) ); | 415 | SLOT( updateView() ) ); |
416 | } else { | 416 | } else { |
417 | mResourceView = 0; | 417 | mResourceView = 0; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | QWidget *rightBox = new QWidget( mPanner ); | 420 | QWidget *rightBox = new QWidget( mPanner ); |
421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
422 | 422 | ||
423 | mRightFrame = new QWidgetStack( rightBox ); | 423 | mRightFrame = new QWidgetStack( rightBox ); |
424 | rightLayout->addWidget( mRightFrame, 1 ); | 424 | rightLayout->addWidget( mRightFrame, 1 ); |
425 | 425 | ||
426 | mLeftFrame = mLeftSplitter; | 426 | mLeftFrame = mLeftSplitter; |
427 | #else | 427 | #else |
428 | //QWidget *mainBox = new QWidget( this ); | 428 | //QWidget *mainBox = new QWidget( this ); |
429 | //QWidget *leftFrame = new QWidget( mainBox ); | 429 | //QWidget *leftFrame = new QWidget( mainBox ); |
430 | //QBoxLayout * mainBoxLayout; | 430 | //QBoxLayout * mainBoxLayout; |
431 | if ( KOPrefs::instance()->mVerticalScreen ) { | 431 | if ( KOPrefs::instance()->mVerticalScreen ) { |
432 | //mainBoxLayout = new QVBoxLayout(mainBox); | 432 | //mainBoxLayout = new QVBoxLayout(mainBox); |
433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
438 | } else { | 438 | } else { |
439 | //mainBoxLayout = new QHBoxLayout(mainBox); | 439 | //mainBoxLayout = new QHBoxLayout(mainBox); |
440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
445 | } | 445 | } |
446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
447 | //QBoxLayout * leftFrameLayout; | 447 | //QBoxLayout * leftFrameLayout; |
448 | topLayout->addWidget( mMainFrame ); | 448 | topLayout->addWidget( mMainFrame ); |
449 | //mainBoxLayout->addWidget (mLeftFrame); | 449 | //mainBoxLayout->addWidget (mLeftFrame); |
450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 450 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
451 | "CalendarView::DateNavigator" ); | 451 | "CalendarView::DateNavigator" ); |
452 | #if 0 | 452 | #if 0 |
453 | // FIXME | 453 | // FIXME |
454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 454 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
455 | "CalendarView::DateNavigator", QDate::currentDate()); | 455 | "CalendarView::DateNavigator", QDate::currentDate()); |
456 | #endif | 456 | #endif |
457 | // mDateNavigator->blockSignals( true ); | 457 | // mDateNavigator->blockSignals( true ); |
458 | //leftFrameLayout->addWidget( mDateNavigator ); | 458 | //leftFrameLayout->addWidget( mDateNavigator ); |
459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 459 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 460 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 461 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
462 | mTodoList->setNavigator( mNavigator ); | 462 | mTodoList->setNavigator( mNavigator ); |
463 | #if 0 | 463 | #if 0 |
464 | if ( QApplication::desktop()->width() < 480 ) { | 464 | if ( QApplication::desktop()->width() < 480 ) { |
465 | leftFrameLayout->addWidget(mFilterView); | 465 | leftFrameLayout->addWidget(mFilterView); |
466 | leftFrameLayout->addWidget(mTodoList, 2 ); | 466 | leftFrameLayout->addWidget(mTodoList, 2 ); |
467 | 467 | ||
468 | } else { | 468 | } else { |
469 | leftFrameLayout->addWidget(mTodoList,2 ); | 469 | leftFrameLayout->addWidget(mTodoList,2 ); |
470 | leftFrameLayout->addWidget(mFilterView ); | 470 | leftFrameLayout->addWidget(mFilterView ); |
471 | } | 471 | } |
472 | #endif | 472 | #endif |
473 | mFilterView->hide(); | 473 | mFilterView->hide(); |
474 | mCalEditView->hide(); | 474 | mCalEditView->hide(); |
475 | QWidget *rightBox = new QWidget( mMainFrame ); | 475 | QWidget *rightBox = new QWidget( mMainFrame ); |
476 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 476 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
477 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 477 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
478 | mRightFrame = new QWidgetStack( rightBox ); | 478 | mRightFrame = new QWidgetStack( rightBox ); |
479 | rightLayout->addWidget( mRightFrame, 10 ); | 479 | rightLayout->addWidget( mRightFrame, 10 ); |
480 | 480 | ||
481 | //mLeftFrame = (QWidget *)leftFrame; | 481 | //mLeftFrame = (QWidget *)leftFrame; |
482 | if ( KOPrefs::instance()->mVerticalScreen ) { | 482 | if ( KOPrefs::instance()->mVerticalScreen ) { |
483 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 483 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
484 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 484 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
485 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 485 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
486 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 486 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
487 | } else { | 487 | } else { |
488 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 488 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
489 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 489 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
490 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 490 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
491 | } | 491 | } |
492 | if ( !KOPrefs::instance()->mShowDateNavigator) | 492 | if ( !KOPrefs::instance()->mShowDateNavigator) |
493 | mDateNavigator->hide(); | 493 | mDateNavigator->hide(); |
494 | //qDebug("Calendarview Size %d %d ", width(), height()); | 494 | //qDebug("Calendarview Size %d %d ", width(), height()); |
495 | #endif | 495 | #endif |
496 | 496 | ||
497 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 497 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
498 | SLOT( showDates( const KCal::DateList & ) ) ); | 498 | SLOT( showDates( const KCal::DateList & ) ) ); |
499 | 499 | ||
500 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 500 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
501 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 501 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
502 | 502 | ||
503 | 503 | ||
504 | 504 | ||
505 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 505 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
506 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 506 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
507 | 507 | ||
508 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 508 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
509 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 509 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
510 | 510 | ||
511 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 511 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
512 | mNavigator, SLOT( selectPreviousYear() ) ); | 512 | mNavigator, SLOT( selectPreviousYear() ) ); |
513 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 513 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
514 | mNavigator, SLOT( selectNextYear() ) ); | 514 | mNavigator, SLOT( selectNextYear() ) ); |
515 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 515 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
516 | mNavigator, SLOT( selectPreviousMonth() ) ); | 516 | mNavigator, SLOT( selectPreviousMonth() ) ); |
517 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 517 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
518 | mNavigator, SLOT( selectNextMonth() ) ); | 518 | mNavigator, SLOT( selectNextMonth() ) ); |
519 | 519 | ||
520 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 520 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
521 | mNavigator, SLOT( selectPrevious() ) ); | 521 | mNavigator, SLOT( selectPrevious() ) ); |
522 | connect( mDateNavigator, SIGNAL( goNext() ), | 522 | connect( mDateNavigator, SIGNAL( goNext() ), |
523 | mNavigator, SLOT( selectNext() ) ); | 523 | mNavigator, SLOT( selectNext() ) ); |
524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 524 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 525 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
526 | 526 | ||
527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 527 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 528 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
529 | #if 0 | 529 | #if 0 |
530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 530 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
531 | SLOT( incidenceAdded( Incidence *) ) ); | 531 | SLOT( incidenceAdded( Incidence *) ) ); |
532 | #endif | 532 | #endif |
533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 533 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
534 | 534 | ||
535 | connect( this, SIGNAL( configChanged() ), | 535 | connect( this, SIGNAL( configChanged() ), |
536 | mDateNavigator, SLOT( updateConfig() ) ); | 536 | mDateNavigator, SLOT( updateConfig() ) ); |
537 | 537 | ||
538 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 538 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
539 | SLOT( newTodo() ) ); | 539 | SLOT( newTodo() ) ); |
540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 540 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
541 | SLOT( newSubTodo( Todo * ) ) ); | 541 | SLOT( newSubTodo( Todo * ) ) ); |
542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 542 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
543 | SLOT( editTodo( Todo * ) ) ); | 543 | SLOT( editTodo( Todo * ) ) ); |
544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 544 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
545 | SLOT( showTodo( Todo *) ) ); | 545 | SLOT( showTodo( Todo *) ) ); |
546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 546 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
547 | SLOT( deleteTodo( Todo *) ) ); | 547 | SLOT( deleteTodo( Todo *) ) ); |
548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 548 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 549 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
550 | SLOT( purgeCompleted() ) ); | 550 | SLOT( purgeCompleted() ) ); |
551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 551 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
552 | SIGNAL( todoModified( Todo *, int ) ) ); | 552 | SIGNAL( todoModified( Todo *, int ) ) ); |
553 | 553 | ||
554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 554 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 555 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 556 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
557 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 557 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
558 | 558 | ||
559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 559 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
560 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 560 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 561 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
562 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 562 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
563 | 563 | ||
564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 564 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
565 | this, SLOT ( todo_unsub( Todo * ) ) ); | 565 | this, SLOT ( todo_unsub( Todo * ) ) ); |
566 | 566 | ||
567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 567 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 568 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 569 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
570 | SLOT( updateTodo( Todo *, int ) ) ); | 570 | SLOT( updateTodo( Todo *, int ) ) ); |
571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 571 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 572 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
573 | 573 | ||
574 | 574 | ||
575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 575 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 576 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 577 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 578 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
579 | 579 | ||
580 | 580 | ||
581 | 581 | ||
582 | 582 | ||
583 | 583 | ||
584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 584 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
585 | SLOT(checkClipboard())); | 585 | SLOT(checkClipboard())); |
586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 586 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
587 | SLOT( processTodoListSelection( Incidence * ) ) ); | 587 | SLOT( processTodoListSelection( Incidence * ) ) ); |
588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 588 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
589 | 589 | ||
590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 590 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
591 | 591 | ||
592 | mDateFrame = new QVBox(0,0,WType_Popup); | 592 | mDateFrame = new QVBox(0,0,WType_Popup); |
593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 593 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 594 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
595 | mDateFrame->setLineWidth(3); | 595 | mDateFrame->setLineWidth(3); |
596 | mDateFrame->hide(); | 596 | mDateFrame->hide(); |
597 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 597 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 598 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
599 | 599 | ||
600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 600 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
601 | 601 | ||
602 | mEventEditor = mDialogManager->getEventEditor(); | 602 | mEventEditor = mDialogManager->getEventEditor(); |
603 | mTodoEditor = mDialogManager->getTodoEditor(); | 603 | mTodoEditor = mDialogManager->getTodoEditor(); |
604 | 604 | ||
605 | mFlagEditDescription = false; | 605 | mFlagEditDescription = false; |
606 | 606 | ||
607 | mSuspendTimer = new QTimer( this ); | 607 | mSuspendTimer = new QTimer( this ); |
608 | mAlarmTimer = new QTimer( this ); | 608 | mAlarmTimer = new QTimer( this ); |
609 | mRecheckAlarmTimer = new QTimer( this ); | 609 | mRecheckAlarmTimer = new QTimer( this ); |
610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 610 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 611 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 612 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
613 | mAlarmDialog = new AlarmDialog( this ); | 613 | mAlarmDialog = new AlarmDialog( this ); |
614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
615 | mAlarmDialog->setServerNotification( false ); | 615 | mAlarmDialog->setServerNotification( false ); |
616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
617 | 617 | ||
618 | 618 | ||
619 | #ifndef DESKTOP_VERSION | 619 | #ifndef DESKTOP_VERSION |
620 | //US listen for arriving address resultsets | 620 | //US listen for arriving address resultsets |
621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
623 | #endif | 623 | #endif |
624 | mDateNavigator->setCalendar( mCalendar ); | 624 | mDateNavigator->setCalendar( mCalendar ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | CalendarView::~CalendarView() | 628 | CalendarView::~CalendarView() |
629 | { | 629 | { |
630 | // kdDebug() << "~CalendarView()" << endl; | 630 | // kdDebug() << "~CalendarView()" << endl; |
631 | //qDebug("CalendarView::~CalendarView() "); | 631 | //qDebug("CalendarView::~CalendarView() "); |
632 | delete mDialogManager; | 632 | delete mDialogManager; |
633 | delete mViewManager; | 633 | delete mViewManager; |
634 | delete mStorage; | 634 | delete mStorage; |
635 | delete mDateFrame ; | 635 | delete mDateFrame ; |
636 | delete beamDialog; | 636 | delete beamDialog; |
637 | delete mEventViewerDialog; | 637 | delete mEventViewerDialog; |
638 | //kdDebug() << "~CalendarView() done" << endl; | 638 | //kdDebug() << "~CalendarView() done" << endl; |
639 | } | 639 | } |
640 | void CalendarView::checkAlarms() | 640 | void CalendarView::checkAlarms() |
641 | { | 641 | { |
642 | KConfig *config = KOGlobals::config(); | 642 | KConfig *config = KOGlobals::config(); |
643 | config->setGroup( "AppRun" ); | 643 | config->setGroup( "AppRun" ); |
644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
645 | int daysto = dt.daysTo( QDate::currentDate() ); | ||
646 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | ||
647 | dt = dt.addDays( days ); | ||
645 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 648 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
646 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; | 649 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
647 | qDebug("KO: Reading program stop %d ", secs); | 650 | //qDebug("KO: Reading program stop %d ", secs); |
648 | //secs -= ( 3600 * 24*3 ); // debug only | 651 | //secs -= ( 3600 * 24*3 ); // debug only |
649 | QDateTime latest = dt.addSecs ( secs ); | 652 | QDateTime latest = dt.addSecs ( secs ); |
650 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 653 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
651 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 654 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
652 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 655 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
653 | QPtrList<Incidence> al; | 656 | QPtrList<Incidence> al; |
654 | Incidence* inL = el.first(); | 657 | Incidence* inL = el.first(); |
655 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 658 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
656 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 659 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
657 | while ( inL ) { | 660 | while ( inL ) { |
658 | bool ok = false; | 661 | bool ok = false; |
659 | int offset = 0; | 662 | int offset = 0; |
660 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 663 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
661 | if ( ok ) { | 664 | if ( ok ) { |
662 | //qDebug("OK %s",next.toString().latin1()); | 665 | //qDebug("OK %s",next.toString().latin1()); |
663 | if ( next < cur ) { | 666 | if ( next < cur ) { |
664 | al.append( inL ); | 667 | al.append( inL ); |
665 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 668 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
666 | } | 669 | } |
667 | } | 670 | } |
668 | inL = el.next(); | 671 | inL = el.next(); |
669 | } | 672 | } |
670 | if ( al.count() ) { | 673 | if ( al.count() ) { |
671 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 674 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
672 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 675 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
673 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 676 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
674 | lay->setSpacing( 0 ); | 677 | lay->setSpacing( 0 ); |
675 | lay->setMargin( 0 ); | 678 | lay->setMargin( 0 ); |
676 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 679 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
677 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 680 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
678 | lay->addWidget( matb ); | 681 | lay->addWidget( matb ); |
679 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 682 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
680 | int wid = 210; | 683 | int wid = 210; |
681 | int x = QApplication::desktop()->width() - wid - 7; | 684 | int x = QApplication::desktop()->width() - wid - 7; |
682 | int y = QApplication::desktop()->height() - wid - 70; | 685 | int y = QApplication::desktop()->height() - wid - 70; |
683 | dia->setGeometry ( x,y,wid,wid); | 686 | dia->setGeometry ( x,y,wid,wid); |
684 | } else { | 687 | } else { |
685 | int si = 220; | 688 | int si = 220; |
686 | if ( QApplication::desktop()->width() > 470 ) | 689 | if ( QApplication::desktop()->width() > 470 ) |
687 | si = 400; | 690 | si = 400; |
688 | dia->resize(si,si/2); | 691 | dia->resize(si,si/2); |
689 | } | 692 | } |
690 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 693 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
691 | dia->show(); | 694 | dia->show(); |
692 | 695 | ||
693 | } | 696 | } |
694 | } | 697 | } |
695 | void CalendarView::showDay( QDate d ) | 698 | void CalendarView::showDay( QDate d ) |
696 | { | 699 | { |
697 | dateNavigator()->blockSignals( true ); | 700 | dateNavigator()->blockSignals( true ); |
698 | dateNavigator()->selectDate( d ); | 701 | dateNavigator()->selectDate( d ); |
699 | dateNavigator()->blockSignals( false ); | 702 | dateNavigator()->blockSignals( false ); |
700 | mViewManager->showDayView(); | 703 | mViewManager->showDayView(); |
701 | //dateNavigator()->selectDate( d ); | 704 | //dateNavigator()->selectDate( d ); |
702 | } | 705 | } |
703 | void CalendarView::timerAlarm() | 706 | void CalendarView::timerAlarm() |
704 | { | 707 | { |
705 | //qDebug("CalendarView::timerAlarm() "); | 708 | //qDebug("CalendarView::timerAlarm() "); |
706 | computeAlarm(mAlarmNotification ); | 709 | computeAlarm(mAlarmNotification ); |
707 | } | 710 | } |
708 | 711 | ||
709 | void CalendarView::suspendAlarm() | 712 | void CalendarView::suspendAlarm() |
710 | { | 713 | { |
711 | //qDebug(" CalendarView::suspendAlarm() "); | 714 | //qDebug(" CalendarView::suspendAlarm() "); |
712 | computeAlarm(mSuspendAlarmNotification ); | 715 | computeAlarm(mSuspendAlarmNotification ); |
713 | 716 | ||
714 | } | 717 | } |
715 | 718 | ||
716 | void CalendarView::startAlarm( QString mess , QString filename) | 719 | void CalendarView::startAlarm( QString mess , QString filename) |
717 | { | 720 | { |
718 | 721 | ||
719 | topLevelWidget()->showNormal(); | 722 | topLevelWidget()->showNormal(); |
720 | topLevelWidget()->setActiveWindow(); | 723 | topLevelWidget()->setActiveWindow(); |
721 | topLevelWidget()->raise(); | 724 | topLevelWidget()->raise(); |
722 | 725 | ||
723 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 726 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
724 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | 727 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); |
725 | 728 | ||
726 | } | 729 | } |
727 | 730 | ||
728 | void CalendarView::checkNextTimerAlarm() | 731 | void CalendarView::checkNextTimerAlarm() |
729 | { | 732 | { |
730 | mCalendar->checkAlarmForIncidence( 0, true ); | 733 | mCalendar->checkAlarmForIncidence( 0, true ); |
731 | } | 734 | } |
732 | 735 | ||
733 | void CalendarView::computeAlarm( QString msg ) | 736 | void CalendarView::computeAlarm( QString msg ) |
734 | { | 737 | { |
735 | 738 | ||
736 | QString mess = msg; | 739 | QString mess = msg; |
737 | QString mAlarmMessage = mess.mid( 9 ); | 740 | QString mAlarmMessage = mess.mid( 9 ); |
738 | QString filename = MainWindow::resourcePath(); | 741 | QString filename = MainWindow::resourcePath(); |
739 | filename += "koalarm.wav"; | 742 | filename += "koalarm.wav"; |
740 | QString tempfilename; | 743 | QString tempfilename; |
741 | if ( mess.left( 13 ) == "suspend_alarm") { | 744 | if ( mess.left( 13 ) == "suspend_alarm") { |
742 | bool error = false; | 745 | bool error = false; |
743 | int len = mess.mid( 13 ).find("+++"); | 746 | int len = mess.mid( 13 ).find("+++"); |
744 | if ( len < 2 ) | 747 | if ( len < 2 ) |
745 | error = true; | 748 | error = true; |
746 | else { | 749 | else { |
747 | tempfilename = mess.mid( 13, len ); | 750 | tempfilename = mess.mid( 13, len ); |
748 | if ( !QFile::exists( tempfilename ) ) | 751 | if ( !QFile::exists( tempfilename ) ) |
749 | error = true; | 752 | error = true; |
750 | } | 753 | } |
751 | if ( ! error ) { | 754 | if ( ! error ) { |
752 | filename = tempfilename; | 755 | filename = tempfilename; |
753 | } | 756 | } |
754 | mAlarmMessage = mess.mid( 13+len+3 ); | 757 | mAlarmMessage = mess.mid( 13+len+3 ); |
755 | //qDebug("suspend file %s ",tempfilename.latin1() ); | 758 | //qDebug("suspend file %s ",tempfilename.latin1() ); |
756 | startAlarm( mAlarmMessage, filename); | 759 | startAlarm( mAlarmMessage, filename); |
757 | return; | 760 | return; |
758 | } | 761 | } |
759 | if ( mess.left( 11 ) == "timer_alarm") { | 762 | if ( mess.left( 11 ) == "timer_alarm") { |
760 | //mTimerTime = 0; | 763 | //mTimerTime = 0; |
761 | startAlarm( mess.mid( 11 ), filename ); | 764 | startAlarm( mess.mid( 11 ), filename ); |
762 | return; | 765 | return; |
763 | } | 766 | } |
764 | if ( mess.left( 10 ) == "proc_alarm") { | 767 | if ( mess.left( 10 ) == "proc_alarm") { |
765 | bool error = false; | 768 | bool error = false; |
766 | int len = mess.mid( 10 ).find("+++"); | 769 | int len = mess.mid( 10 ).find("+++"); |
767 | if ( len < 2 ) | 770 | if ( len < 2 ) |
768 | error = true; | 771 | error = true; |
769 | else { | 772 | else { |
770 | tempfilename = mess.mid( 10, len ); | 773 | tempfilename = mess.mid( 10, len ); |
771 | if ( !QFile::exists( tempfilename ) ) | 774 | if ( !QFile::exists( tempfilename ) ) |
772 | error = true; | 775 | error = true; |
773 | } | 776 | } |
774 | if ( error ) { | 777 | if ( error ) { |
775 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; | 778 | mAlarmMessage = "Procedure Alarm\nError - File not found\n"; |
776 | mAlarmMessage += mess.mid( 10+len+3+9 ); | 779 | mAlarmMessage += mess.mid( 10+len+3+9 ); |
777 | } else { | 780 | } else { |
778 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); | 781 | //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); |
779 | //qDebug("-----system command %s ",tempfilename.latin1() ); | 782 | //qDebug("-----system command %s ",tempfilename.latin1() ); |
780 | #ifndef _WIN32_ | 783 | #ifndef _WIN32_ |
781 | if ( vfork () == 0 ) { | 784 | if ( vfork () == 0 ) { |
782 | execl ( tempfilename.latin1(), 0 ); | 785 | execl ( tempfilename.latin1(), 0 ); |
783 | return; | 786 | return; |
784 | } | 787 | } |
785 | #else | 788 | #else |
786 | QProcess* p = new QProcess(); | 789 | QProcess* p = new QProcess(); |
787 | p->addArgument( tempfilename.latin1() ); | 790 | p->addArgument( tempfilename.latin1() ); |
788 | p->start(); | 791 | p->start(); |
789 | return; | 792 | return; |
790 | #endif | 793 | #endif |
791 | 794 | ||
792 | return; | 795 | return; |
793 | } | 796 | } |
794 | 797 | ||
795 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); | 798 | //qDebug("+++++++system command %s ",tempfilename.latin1() ); |
796 | } | 799 | } |
797 | if ( mess.left( 11 ) == "audio_alarm") { | 800 | if ( mess.left( 11 ) == "audio_alarm") { |
798 | bool error = false; | 801 | bool error = false; |
799 | int len = mess.mid( 11 ).find("+++"); | 802 | int len = mess.mid( 11 ).find("+++"); |
800 | if ( len < 2 ) | 803 | if ( len < 2 ) |
801 | error = true; | 804 | error = true; |
802 | else { | 805 | else { |
803 | tempfilename = mess.mid( 11, len ); | 806 | tempfilename = mess.mid( 11, len ); |
804 | if ( !QFile::exists( tempfilename ) ) | 807 | if ( !QFile::exists( tempfilename ) ) |
805 | error = true; | 808 | error = true; |
806 | } | 809 | } |
807 | if ( ! error ) { | 810 | if ( ! error ) { |
808 | filename = tempfilename; | 811 | filename = tempfilename; |
809 | } | 812 | } |
810 | mAlarmMessage = mess.mid( 11+len+3+9 ); | 813 | mAlarmMessage = mess.mid( 11+len+3+9 ); |
811 | //qDebug("audio file command %s ",tempfilename.latin1() ); | 814 | //qDebug("audio file command %s ",tempfilename.latin1() ); |
812 | } | 815 | } |
813 | if ( mess.left( 9 ) == "cal_alarm") { | 816 | if ( mess.left( 9 ) == "cal_alarm") { |
814 | mAlarmMessage = mess.mid( 9 ) ; | 817 | mAlarmMessage = mess.mid( 9 ) ; |
815 | } | 818 | } |
816 | 819 | ||
817 | startAlarm( mAlarmMessage, filename ); | 820 | startAlarm( mAlarmMessage, filename ); |
818 | 821 | ||
819 | 822 | ||
820 | } | 823 | } |
821 | 824 | ||
822 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) | 825 | void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) |
823 | { | 826 | { |
824 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 827 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
825 | 828 | ||
826 | mSuspendAlarmNotification = noti; | 829 | mSuspendAlarmNotification = noti; |
827 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 830 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
828 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 831 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
829 | mSuspendTimer->start( ms , true ); | 832 | mSuspendTimer->start( ms , true ); |
830 | 833 | ||
831 | } | 834 | } |
832 | 835 | ||
833 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 836 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
834 | { | 837 | { |
835 | mNextAlarmDateTime = qdt; | 838 | mNextAlarmDateTime = qdt; |
836 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 839 | //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
837 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 840 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
838 | #ifndef DESKTOP_VERSION | 841 | #ifndef DESKTOP_VERSION |
839 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 842 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
840 | #endif | 843 | #endif |
841 | return; | 844 | return; |
842 | } | 845 | } |
843 | int maxSec; | 846 | int maxSec; |
844 | //maxSec = 5; //testing only | 847 | //maxSec = 5; //testing only |
845 | maxSec = 86400+3600; // one day+1hour | 848 | maxSec = 86400+3600; // one day+1hour |
846 | mAlarmNotification = noti; | 849 | mAlarmNotification = noti; |
847 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 850 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
848 | if ( sec > maxSec ) { | 851 | if ( sec > maxSec ) { |
849 | mRecheckAlarmTimer->start( maxSec * 1000 ); | 852 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
850 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | 853 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); |
851 | return; | 854 | return; |
852 | } else { | 855 | } else { |
853 | mRecheckAlarmTimer->stop(); | 856 | mRecheckAlarmTimer->stop(); |
854 | } | 857 | } |
855 | //qDebug("Alarm timer started with secs: %d ", sec); | 858 | //qDebug("Alarm timer started with secs: %d ", sec); |
856 | mAlarmTimer->start( sec *1000 , true ); | 859 | mAlarmTimer->start( sec *1000 , true ); |
857 | 860 | ||
858 | } | 861 | } |
859 | // called by mRecheckAlarmTimer to get next alarm | 862 | // called by mRecheckAlarmTimer to get next alarm |
860 | // we need this, because a QTimer has only a max range of 25 days | 863 | // we need this, because a QTimer has only a max range of 25 days |
861 | void CalendarView::recheckTimerAlarm() | 864 | void CalendarView::recheckTimerAlarm() |
862 | { | 865 | { |
863 | mAlarmTimer->stop(); | 866 | mAlarmTimer->stop(); |
864 | mRecheckAlarmTimer->stop(); | 867 | mRecheckAlarmTimer->stop(); |
865 | mCalendar->checkAlarmForIncidence( 0, true ); | 868 | mCalendar->checkAlarmForIncidence( 0, true ); |
866 | } | 869 | } |
867 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 870 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) |
868 | { | 871 | { |
869 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 872 | //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
870 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 873 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
871 | #ifndef DESKTOP_VERSION | 874 | #ifndef DESKTOP_VERSION |
872 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); | 875 | AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); |
873 | #endif | 876 | #endif |
874 | return; | 877 | return; |
875 | } | 878 | } |
876 | mAlarmTimer->stop(); | 879 | mAlarmTimer->stop(); |
877 | } | 880 | } |
878 | void CalendarView::selectWeekNum ( int num ) | 881 | void CalendarView::selectWeekNum ( int num ) |
879 | { | 882 | { |
880 | dateNavigator()->blockSignals( true ); | 883 | dateNavigator()->blockSignals( true ); |
881 | dateNavigator()->selectWeek( num ); | 884 | dateNavigator()->selectWeek( num ); |
882 | dateNavigator()->blockSignals( false ); | 885 | dateNavigator()->blockSignals( false ); |
883 | mViewManager->showWeekView(); | 886 | mViewManager->showWeekView(); |
884 | } | 887 | } |
885 | KOViewManager *CalendarView::viewManager() | 888 | KOViewManager *CalendarView::viewManager() |
886 | { | 889 | { |
887 | return mViewManager; | 890 | return mViewManager; |
888 | } | 891 | } |
889 | 892 | ||
890 | KODialogManager *CalendarView::dialogManager() | 893 | KODialogManager *CalendarView::dialogManager() |
891 | { | 894 | { |
892 | return mDialogManager; | 895 | return mDialogManager; |
893 | } | 896 | } |
894 | 897 | ||
895 | QDate CalendarView::startDate() | 898 | QDate CalendarView::startDate() |
896 | { | 899 | { |
897 | DateList dates = mNavigator->selectedDates(); | 900 | DateList dates = mNavigator->selectedDates(); |
898 | 901 | ||
899 | return dates.first(); | 902 | return dates.first(); |
900 | } | 903 | } |
901 | 904 | ||
902 | QDate CalendarView::endDate() | 905 | QDate CalendarView::endDate() |
903 | { | 906 | { |
904 | DateList dates = mNavigator->selectedDates(); | 907 | DateList dates = mNavigator->selectedDates(); |
905 | 908 | ||
906 | return dates.last(); | 909 | return dates.last(); |
907 | } | 910 | } |
908 | 911 | ||
909 | 912 | ||
910 | void CalendarView::createPrinter() | 913 | void CalendarView::createPrinter() |
911 | { | 914 | { |
912 | #ifndef KORG_NOPRINTER | 915 | #ifndef KORG_NOPRINTER |
913 | if (!mCalPrinter) { | 916 | if (!mCalPrinter) { |
914 | mCalPrinter = new CalPrinter(this, mCalendar); | 917 | mCalPrinter = new CalPrinter(this, mCalendar); |
915 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); | 918 | connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); |
916 | } | 919 | } |
917 | #endif | 920 | #endif |
918 | } | 921 | } |
919 | 922 | ||
920 | 923 | ||
921 | //KOPrefs::instance()->mWriteBackFile | 924 | //KOPrefs::instance()->mWriteBackFile |
922 | //KOPrefs::instance()->mWriteBackExistingOnly | 925 | //KOPrefs::instance()->mWriteBackExistingOnly |
923 | 926 | ||
924 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | 927 | // 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); |
925 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | 928 | // 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); |
926 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | 929 | // 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); |
927 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | 930 | // 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); |
928 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); | 931 | // 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); |
929 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | 932 | // 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); |
930 | 933 | ||
931 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) | 934 | int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) |
932 | { | 935 | { |
933 | 936 | ||
934 | // 0 equal | 937 | // 0 equal |
935 | // 1 take local | 938 | // 1 take local |
936 | // 2 take remote | 939 | // 2 take remote |
937 | // 3 cancel | 940 | // 3 cancel |
938 | QDateTime lastSync = mLastCalendarSync; | 941 | QDateTime lastSync = mLastCalendarSync; |
939 | QDateTime localMod = local->lastModified(); | 942 | QDateTime localMod = local->lastModified(); |
940 | QDateTime remoteMod = remote->lastModified(); | 943 | QDateTime remoteMod = remote->lastModified(); |
941 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 944 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
942 | bool remCh, locCh; | 945 | bool remCh, locCh; |
943 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 946 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
944 | //if ( remCh ) | 947 | //if ( remCh ) |
945 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 948 | //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
946 | locCh = ( localMod > mLastCalendarSync ); | 949 | locCh = ( localMod > mLastCalendarSync ); |
947 | if ( !remCh && ! locCh ) { | 950 | if ( !remCh && ! locCh ) { |
948 | //qDebug("both not changed "); | 951 | //qDebug("both not changed "); |
949 | lastSync = localMod.addDays(1); | 952 | lastSync = localMod.addDays(1); |
950 | if ( mode <= SYNC_PREF_ASK ) | 953 | if ( mode <= SYNC_PREF_ASK ) |
951 | return 0; | 954 | return 0; |
952 | } else { | 955 | } else { |
953 | if ( locCh ) { | 956 | if ( locCh ) { |
954 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); | 957 | //qDebug("loc changed %d %s %s", local->revision() , localMod.toString().latin1(), mLastCalendarSync.toString().latin1()); |
955 | lastSync = localMod.addDays( -1 ); | 958 | lastSync = localMod.addDays( -1 ); |
956 | if ( !remCh ) | 959 | if ( !remCh ) |
957 | remoteMod = ( lastSync.addDays( -1 ) ); | 960 | remoteMod = ( lastSync.addDays( -1 ) ); |
958 | } else { | 961 | } else { |
959 | //qDebug(" not loc changed "); | 962 | //qDebug(" not loc changed "); |
960 | lastSync = localMod.addDays( 1 ); | 963 | lastSync = localMod.addDays( 1 ); |
961 | if ( remCh ) | 964 | if ( remCh ) |
962 | remoteMod =( lastSync.addDays( 1 ) ); | 965 | remoteMod =( lastSync.addDays( 1 ) ); |
963 | 966 | ||
964 | } | 967 | } |
965 | } | 968 | } |
966 | full = true; | 969 | full = true; |
967 | if ( mode < SYNC_PREF_ASK ) | 970 | if ( mode < SYNC_PREF_ASK ) |
968 | mode = SYNC_PREF_ASK; | 971 | mode = SYNC_PREF_ASK; |
969 | } else { | 972 | } else { |
970 | if ( localMod == remoteMod ) | 973 | if ( localMod == remoteMod ) |
971 | // if ( local->revision() == remote->revision() ) | 974 | // if ( local->revision() == remote->revision() ) |
972 | return 0; | 975 | return 0; |
973 | 976 | ||
974 | } | 977 | } |
975 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); | 978 | // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); |
976 | 979 | ||
977 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); | 980 | //qDebug("%s %d %s %d", localMod.toString().latin1() , local->revision(), remoteMod.toString().latin1(), remote->revision()); |
978 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); | 981 | //qDebug("%d %d %d %d ", localMod.time().second(), localMod.time().msec(), remoteMod.time().second(), remoteMod.time().msec() ); |
979 | //full = true; //debug only | 982 | //full = true; //debug only |
980 | if ( full ) { | 983 | if ( full ) { |
981 | bool equ = false; | 984 | bool equ = false; |
982 | if ( local->typeID() == eventID ) { | 985 | if ( local->typeID() == eventID ) { |
983 | equ = (*((Event*) local) == *((Event*) remote)); | 986 | equ = (*((Event*) local) == *((Event*) remote)); |
984 | } | 987 | } |
985 | else if ( local->typeID() == todoID ) | 988 | else if ( local->typeID() == todoID ) |
986 | equ = (*((Todo*) local) == (*(Todo*) remote)); | 989 | equ = (*((Todo*) local) == (*(Todo*) remote)); |
987 | else if ( local->typeID() == journalID ) | 990 | else if ( local->typeID() == journalID ) |
988 | equ = (*((Journal*) local) == *((Journal*) remote)); | 991 | equ = (*((Journal*) local) == *((Journal*) remote)); |
989 | if ( equ ) { | 992 | if ( equ ) { |
990 | //qDebug("equal "); | 993 | //qDebug("equal "); |
991 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 994 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
992 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 995 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
993 | } | 996 | } |
994 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 997 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
995 | return 0; | 998 | return 0; |
996 | 999 | ||
997 | }//else //debug only | 1000 | }//else //debug only |
998 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 1001 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
999 | } | 1002 | } |
1000 | int result; | 1003 | int result; |
1001 | bool localIsNew; | 1004 | bool localIsNew; |
1002 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); | 1005 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , localMod.toString().latin1() , remoteMod.toString().latin1() ); |
1003 | 1006 | ||
1004 | 1007 | ||
1005 | // ************************************************ | 1008 | // ************************************************ |
1006 | // ************************************************ | 1009 | // ************************************************ |
1007 | // ************************************************ | 1010 | // ************************************************ |
1008 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1011 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1009 | // BUT remoteMod != localMod | 1012 | // BUT remoteMod != localMod |
1010 | 1013 | ||
1011 | 1014 | ||
1012 | if ( full && mode < SYNC_PREF_NEWEST ) | 1015 | if ( full && mode < SYNC_PREF_NEWEST ) |
1013 | mode = SYNC_PREF_ASK; | 1016 | mode = SYNC_PREF_ASK; |
1014 | 1017 | ||
1015 | switch( mode ) { | 1018 | switch( mode ) { |
1016 | case SYNC_PREF_LOCAL: | 1019 | case SYNC_PREF_LOCAL: |
1017 | if ( lastSync > remoteMod ) | 1020 | if ( lastSync > remoteMod ) |
1018 | return 1; | 1021 | return 1; |
1019 | if ( lastSync > localMod ) | 1022 | if ( lastSync > localMod ) |
1020 | return 2; | 1023 | return 2; |
1021 | return 1; | 1024 | return 1; |
1022 | break; | 1025 | break; |
1023 | case SYNC_PREF_REMOTE: | 1026 | case SYNC_PREF_REMOTE: |
1024 | if ( lastSync > localMod ) | 1027 | if ( lastSync > localMod ) |
1025 | return 2; | 1028 | return 2; |
1026 | if ( lastSync > remoteMod ) | 1029 | if ( lastSync > remoteMod ) |
1027 | return 1; | 1030 | return 1; |
1028 | return 2; | 1031 | return 2; |
1029 | break; | 1032 | break; |
1030 | case SYNC_PREF_NEWEST: | 1033 | case SYNC_PREF_NEWEST: |
1031 | if ( localMod >= remoteMod ) | 1034 | if ( localMod >= remoteMod ) |
1032 | return 1; | 1035 | return 1; |
1033 | else | 1036 | else |
1034 | return 2; | 1037 | return 2; |
1035 | break; | 1038 | break; |
@@ -1777,778 +1780,796 @@ bool CalendarView::importQtopia( const QString &categories, | |||
1777 | #if 0 | 1780 | #if 0 |
1778 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1781 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1779 | mCurrentSyncDevice = "qtopia-XML"; | 1782 | mCurrentSyncDevice = "qtopia-XML"; |
1780 | if ( mSyncManager->mAskForPreferences ) | 1783 | if ( mSyncManager->mAskForPreferences ) |
1781 | edit_sync_options(); | 1784 | edit_sync_options(); |
1782 | qApp->processEvents(); | 1785 | qApp->processEvents(); |
1783 | CalendarLocal* calendar = new CalendarLocal(); | 1786 | CalendarLocal* calendar = new CalendarLocal(); |
1784 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1787 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1785 | bool syncOK = false; | 1788 | bool syncOK = false; |
1786 | QtopiaFormat qtopiaFormat; | 1789 | QtopiaFormat qtopiaFormat; |
1787 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1790 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1788 | bool loadOk = true; | 1791 | bool loadOk = true; |
1789 | if ( !categories.isEmpty() ) | 1792 | if ( !categories.isEmpty() ) |
1790 | loadOk = qtopiaFormat.load( calendar, categories ); | 1793 | loadOk = qtopiaFormat.load( calendar, categories ); |
1791 | if ( loadOk && !datebook.isEmpty() ) | 1794 | if ( loadOk && !datebook.isEmpty() ) |
1792 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1795 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1793 | if ( loadOk && !todolist.isEmpty() ) | 1796 | if ( loadOk && !todolist.isEmpty() ) |
1794 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1797 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1795 | 1798 | ||
1796 | if ( loadOk ) { | 1799 | if ( loadOk ) { |
1797 | getEventViewerDialog()->setSyncMode( true ); | 1800 | getEventViewerDialog()->setSyncMode( true ); |
1798 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1801 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1799 | getEventViewerDialog()->setSyncMode( false ); | 1802 | getEventViewerDialog()->setSyncMode( false ); |
1800 | qApp->processEvents(); | 1803 | qApp->processEvents(); |
1801 | if ( syncOK ) { | 1804 | if ( syncOK ) { |
1802 | if ( mSyncManager->mWriteBackFile ) | 1805 | if ( mSyncManager->mWriteBackFile ) |
1803 | { | 1806 | { |
1804 | // write back XML file | 1807 | // write back XML file |
1805 | 1808 | ||
1806 | } | 1809 | } |
1807 | setModified( true ); | 1810 | setModified( true ); |
1808 | } | 1811 | } |
1809 | } else { | 1812 | } else { |
1810 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1813 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1811 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1814 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1812 | question, i18n("Ok")) ; | 1815 | question, i18n("Ok")) ; |
1813 | } | 1816 | } |
1814 | delete calendar; | 1817 | delete calendar; |
1815 | updateView(); | 1818 | updateView(); |
1816 | return syncOK; | 1819 | return syncOK; |
1817 | 1820 | ||
1818 | 1821 | ||
1819 | #endif | 1822 | #endif |
1820 | 1823 | ||
1821 | } | 1824 | } |
1822 | 1825 | ||
1823 | void CalendarView::setSyncEventsReadOnly() | 1826 | void CalendarView::setSyncEventsReadOnly() |
1824 | { | 1827 | { |
1825 | Event * ev; | 1828 | Event * ev; |
1826 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1829 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1827 | ev = eL.first(); | 1830 | ev = eL.first(); |
1828 | while ( ev ) { | 1831 | while ( ev ) { |
1829 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1832 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1830 | ev->setReadOnly( true ); | 1833 | ev->setReadOnly( true ); |
1831 | ev = eL.next(); | 1834 | ev = eL.next(); |
1832 | } | 1835 | } |
1833 | } | 1836 | } |
1834 | bool CalendarView::openCalendar(QString filename, bool merge) | 1837 | bool CalendarView::openCalendar(QString filename, bool merge) |
1835 | { | 1838 | { |
1836 | 1839 | ||
1837 | if (filename.isEmpty()) { | 1840 | if (filename.isEmpty()) { |
1838 | return false; | 1841 | return false; |
1839 | } | 1842 | } |
1840 | 1843 | ||
1841 | if (!QFile::exists(filename)) { | 1844 | if (!QFile::exists(filename)) { |
1842 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1845 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1843 | return false; | 1846 | return false; |
1844 | } | 1847 | } |
1845 | 1848 | ||
1846 | globalFlagBlockAgenda = 1; | 1849 | globalFlagBlockAgenda = 1; |
1847 | clearAllViews(); | 1850 | clearAllViews(); |
1848 | if (!merge) { | 1851 | if (!merge) { |
1849 | mViewManager->setDocumentId( filename ); | 1852 | mViewManager->setDocumentId( filename ); |
1850 | mCalendar->close(); | 1853 | mCalendar->close(); |
1851 | } | 1854 | } |
1852 | mStorage->setFileName( filename ); | 1855 | mStorage->setFileName( filename ); |
1853 | 1856 | ||
1854 | if ( mStorage->load() ) { | 1857 | if ( mStorage->load() ) { |
1855 | if ( merge ) ;//setModified( true ); | 1858 | if ( merge ) ;//setModified( true ); |
1856 | else { | 1859 | else { |
1857 | //setModified( true ); | 1860 | //setModified( true ); |
1858 | mViewManager->setDocumentId( filename ); | 1861 | mViewManager->setDocumentId( filename ); |
1859 | mDialogManager->setDocumentId( filename ); | 1862 | mDialogManager->setDocumentId( filename ); |
1860 | mTodoList->setDocumentId( filename ); | 1863 | mTodoList->setDocumentId( filename ); |
1861 | } | 1864 | } |
1862 | globalFlagBlockAgenda = 2; | 1865 | globalFlagBlockAgenda = 2; |
1863 | // if ( getLastSyncEvent() ) | 1866 | // if ( getLastSyncEvent() ) |
1864 | // getLastSyncEvent()->setReadOnly( true ); | 1867 | // getLastSyncEvent()->setReadOnly( true ); |
1865 | mCalendar->reInitAlarmSettings(); | 1868 | mCalendar->reInitAlarmSettings(); |
1866 | setSyncEventsReadOnly(); | 1869 | setSyncEventsReadOnly(); |
1867 | updateUnmanagedViews(); | 1870 | updateUnmanagedViews(); |
1868 | updateView(); | 1871 | updateView(); |
1869 | if ( filename != MainWindow::defaultFileName() ) { | 1872 | if ( filename != MainWindow::defaultFileName() ) { |
1870 | saveCalendar( MainWindow::defaultFileName() ); | 1873 | saveCalendar( MainWindow::defaultFileName() ); |
1871 | } else { | 1874 | } else { |
1872 | QFileInfo finf ( MainWindow::defaultFileName()); | 1875 | QFileInfo finf ( MainWindow::defaultFileName()); |
1873 | if ( finf.exists() ) { | 1876 | if ( finf.exists() ) { |
1874 | setLoadedFileVersion( finf.lastModified () ); | 1877 | setLoadedFileVersion( finf.lastModified () ); |
1875 | } | 1878 | } |
1876 | } | 1879 | } |
1877 | return true; | 1880 | return true; |
1878 | } else { | 1881 | } else { |
1879 | // while failing to load, the calendar object could | 1882 | // while failing to load, the calendar object could |
1880 | // have become partially populated. Clear it out. | 1883 | // have become partially populated. Clear it out. |
1881 | if ( !merge ) { | 1884 | if ( !merge ) { |
1882 | mCalendar->close(); | 1885 | mCalendar->close(); |
1883 | mViewManager->setDocumentId( filename ); | 1886 | mViewManager->setDocumentId( filename ); |
1884 | mDialogManager->setDocumentId( filename ); | 1887 | mDialogManager->setDocumentId( filename ); |
1885 | mTodoList->setDocumentId( filename ); | 1888 | mTodoList->setDocumentId( filename ); |
1886 | } | 1889 | } |
1887 | 1890 | ||
1888 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1891 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1889 | 1892 | ||
1890 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1893 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1891 | globalFlagBlockAgenda = 2; | 1894 | globalFlagBlockAgenda = 2; |
1892 | mCalendar->reInitAlarmSettings(); | 1895 | mCalendar->reInitAlarmSettings(); |
1893 | setSyncEventsReadOnly(); | 1896 | setSyncEventsReadOnly(); |
1894 | updateUnmanagedViews(); | 1897 | updateUnmanagedViews(); |
1895 | updateView(); | 1898 | updateView(); |
1896 | } | 1899 | } |
1897 | return false; | 1900 | return false; |
1898 | } | 1901 | } |
1899 | void CalendarView::showOpenError() | 1902 | void CalendarView::showOpenError() |
1900 | { | 1903 | { |
1901 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1904 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1902 | } | 1905 | } |
1903 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1906 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1904 | { | 1907 | { |
1905 | loadedFileVersion = dt; | 1908 | loadedFileVersion = dt; |
1906 | } | 1909 | } |
1907 | bool CalendarView::checkFileChanged(QString fn) | 1910 | bool CalendarView::checkFileChanged(QString fn) |
1908 | { | 1911 | { |
1909 | QFileInfo finf ( fn ); | 1912 | QFileInfo finf ( fn ); |
1910 | if ( !finf.exists() ) | 1913 | if ( !finf.exists() ) |
1911 | return true; | 1914 | return true; |
1912 | QDateTime dt = finf.lastModified (); | 1915 | QDateTime dt = finf.lastModified (); |
1913 | if ( dt <= loadedFileVersion ) | 1916 | if ( dt <= loadedFileVersion ) |
1914 | return false; | 1917 | return false; |
1915 | return true; | 1918 | return true; |
1916 | 1919 | ||
1917 | } | 1920 | } |
1918 | void CalendarView::watchSavedFile() | 1921 | void CalendarView::watchSavedFile() |
1919 | { | 1922 | { |
1920 | QFileInfo finf ( MainWindow::defaultFileName()); | 1923 | QFileInfo finf ( MainWindow::defaultFileName()); |
1921 | if ( !finf.exists() ) | 1924 | if ( !finf.exists() ) |
1922 | return; | 1925 | return; |
1923 | QDateTime dt = finf.lastModified (); | 1926 | QDateTime dt = finf.lastModified (); |
1924 | if ( dt < loadedFileVersion ) { | 1927 | if ( dt < loadedFileVersion ) { |
1925 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1928 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1926 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1929 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1927 | return; | 1930 | return; |
1928 | } | 1931 | } |
1929 | loadedFileVersion = dt; | 1932 | loadedFileVersion = dt; |
1930 | } | 1933 | } |
1931 | 1934 | ||
1932 | bool CalendarView::checkFileVersion(QString fn) | 1935 | bool CalendarView::checkFileVersion(QString fn) |
1933 | { | 1936 | { |
1934 | QFileInfo finf ( fn ); | 1937 | QFileInfo finf ( fn ); |
1935 | if ( !finf.exists() ) | 1938 | if ( !finf.exists() ) |
1936 | return true; | 1939 | return true; |
1937 | QDateTime dt = finf.lastModified (); | 1940 | QDateTime dt = finf.lastModified (); |
1938 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1941 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1939 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1942 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1940 | if ( dt <= loadedFileVersion ) | 1943 | if ( dt <= loadedFileVersion ) |
1941 | return true; | 1944 | return true; |
1942 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1945 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1943 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1946 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1944 | i18n("Sync+save")); | 1947 | i18n("Sync+save")); |
1945 | 1948 | ||
1946 | if ( km == KMessageBox::Cancel ) | 1949 | if ( km == KMessageBox::Cancel ) |
1947 | return false; | 1950 | return false; |
1948 | if ( km == KMessageBox::Yes ) | 1951 | if ( km == KMessageBox::Yes ) |
1949 | return true; | 1952 | return true; |
1950 | 1953 | ||
1951 | setSyncDevice("deleteaftersync" ); | 1954 | setSyncDevice("deleteaftersync" ); |
1952 | mSyncManager->mAskForPreferences = true; | 1955 | mSyncManager->mAskForPreferences = true; |
1953 | mSyncManager->mSyncAlgoPrefs = 3; | 1956 | mSyncManager->mSyncAlgoPrefs = 3; |
1954 | mSyncManager->mWriteBackFile = false; | 1957 | mSyncManager->mWriteBackFile = false; |
1955 | mSyncManager->mWriteBackExistingOnly = false; | 1958 | mSyncManager->mWriteBackExistingOnly = false; |
1956 | mSyncManager->mShowSyncSummary = false; | 1959 | mSyncManager->mShowSyncSummary = false; |
1957 | syncCalendar( fn, 3 ); | 1960 | syncCalendar( fn, 3 ); |
1958 | Event * e = getLastSyncEvent(); | 1961 | Event * e = getLastSyncEvent(); |
1959 | if ( e ) | 1962 | if ( e ) |
1960 | deleteEvent ( e ); | 1963 | deleteEvent ( e ); |
1961 | updateView(); | 1964 | updateView(); |
1962 | return true; | 1965 | return true; |
1963 | } | 1966 | } |
1964 | 1967 | ||
1965 | bool CalendarView::saveCalendar( QString filename ) | 1968 | bool CalendarView::saveCalendar( QString filename ) |
1966 | { | 1969 | { |
1967 | 1970 | ||
1968 | // Store back all unsaved data into calendar object | 1971 | // Store back all unsaved data into calendar object |
1969 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1972 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1970 | if ( mViewManager->currentView() ) | 1973 | if ( mViewManager->currentView() ) |
1971 | mViewManager->currentView()->flushView(); | 1974 | mViewManager->currentView()->flushView(); |
1972 | 1975 | ||
1973 | 1976 | ||
1974 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1977 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1975 | mStorage->setSaveFormat( new ICalFormat() ); | 1978 | mStorage->setSaveFormat( new ICalFormat() ); |
1976 | mStorage->setFileName( filename ); | 1979 | mStorage->setFileName( filename ); |
1977 | bool success; | 1980 | bool success; |
1978 | success = mStorage->save(); | 1981 | success = mStorage->save(); |
1979 | if ( !success ) { | 1982 | if ( !success ) { |
1980 | return false; | 1983 | return false; |
1981 | } | 1984 | } |
1982 | if ( filename == MainWindow::defaultFileName() ) { | 1985 | if ( filename == MainWindow::defaultFileName() ) { |
1983 | setLoadedFileVersion( lfv ); | 1986 | setLoadedFileVersion( lfv ); |
1984 | watchSavedFile(); | 1987 | watchSavedFile(); |
1985 | } | 1988 | } |
1986 | return true; | 1989 | return true; |
1987 | } | 1990 | } |
1988 | 1991 | ||
1989 | void CalendarView::closeCalendar() | 1992 | void CalendarView::closeCalendar() |
1990 | { | 1993 | { |
1991 | 1994 | ||
1992 | // child windows no longer valid | 1995 | // child windows no longer valid |
1993 | clearAllViews(); | 1996 | clearAllViews(); |
1994 | emit closingDown(); | 1997 | emit closingDown(); |
1995 | 1998 | ||
1996 | mCalendar->close(); | 1999 | mCalendar->close(); |
1997 | setModified(false); | 2000 | setModified(false); |
1998 | updateView(); | 2001 | updateView(); |
1999 | } | 2002 | } |
2000 | 2003 | ||
2001 | void CalendarView::archiveCalendar() | 2004 | void CalendarView::archiveCalendar() |
2002 | { | 2005 | { |
2003 | mDialogManager->showArchiveDialog(); | 2006 | mDialogManager->showArchiveDialog(); |
2004 | } | 2007 | } |
2005 | 2008 | ||
2006 | 2009 | ||
2007 | void CalendarView::readSettings() | 2010 | void CalendarView::readSettings() |
2008 | { | 2011 | { |
2009 | 2012 | ||
2010 | 2013 | ||
2011 | // mViewManager->showAgendaView(); | 2014 | // mViewManager->showAgendaView(); |
2012 | QString str; | 2015 | QString str; |
2013 | //qDebug("CalendarView::readSettings() "); | 2016 | //qDebug("CalendarView::readSettings() "); |
2014 | // read settings from the KConfig, supplying reasonable | 2017 | // read settings from the KConfig, supplying reasonable |
2015 | // defaults where none are to be found | 2018 | // defaults where none are to be found |
2016 | KConfig *config = KOGlobals::config(); | 2019 | KConfig *config = KOGlobals::config(); |
2017 | #ifndef KORG_NOSPLITTER | 2020 | #ifndef KORG_NOSPLITTER |
2018 | config->setGroup("KOrganizer Geometry"); | 2021 | config->setGroup("KOrganizer Geometry"); |
2019 | 2022 | ||
2020 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2023 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2021 | if (sizes.count() != 2) { | 2024 | if (sizes.count() != 2) { |
2022 | sizes << mDateNavigator->minimumSizeHint().width(); | 2025 | sizes << mDateNavigator->minimumSizeHint().width(); |
2023 | sizes << 300; | 2026 | sizes << 300; |
2024 | } | 2027 | } |
2025 | mPanner->setSizes(sizes); | 2028 | mPanner->setSizes(sizes); |
2026 | 2029 | ||
2027 | sizes = config->readIntListEntry("Separator2"); | 2030 | sizes = config->readIntListEntry("Separator2"); |
2028 | if ( ( mResourceView && sizes.count() == 4 ) || | 2031 | if ( ( mResourceView && sizes.count() == 4 ) || |
2029 | ( !mResourceView && sizes.count() == 3 ) ) { | 2032 | ( !mResourceView && sizes.count() == 3 ) ) { |
2030 | mLeftSplitter->setSizes(sizes); | 2033 | mLeftSplitter->setSizes(sizes); |
2031 | } | 2034 | } |
2032 | #endif | 2035 | #endif |
2033 | globalFlagBlockAgenda = 1; | 2036 | globalFlagBlockAgenda = 1; |
2034 | mViewManager->showAgendaView(); | 2037 | mViewManager->showAgendaView(); |
2035 | //mViewManager->readSettings( config ); | 2038 | //mViewManager->readSettings( config ); |
2036 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2039 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2037 | readFilterSettings(config); | 2040 | readFilterSettings(config); |
2038 | 2041 | ||
2039 | #ifdef DESKTOP_VERSION | 2042 | #ifdef DESKTOP_VERSION |
2040 | config->setGroup("WidgetLayout"); | 2043 | config->setGroup("WidgetLayout"); |
2041 | QStringList list; | 2044 | QStringList list; |
2042 | list = config->readListEntry("MainLayout"); | 2045 | list = config->readListEntry("MainLayout"); |
2043 | int x,y,w,h; | 2046 | int x,y,w,h; |
2044 | if ( ! list.isEmpty() ) { | 2047 | if ( ! list.isEmpty() ) { |
2045 | x = list[0].toInt(); | 2048 | x = list[0].toInt(); |
2046 | y = list[1].toInt(); | 2049 | y = list[1].toInt(); |
2047 | w = list[2].toInt(); | 2050 | w = list[2].toInt(); |
2048 | h = list[3].toInt(); | 2051 | h = list[3].toInt(); |
2049 | KApplication::testCoords( &x,&y,&w,&h ); | 2052 | KApplication::testCoords( &x,&y,&w,&h ); |
2050 | topLevelWidget()->setGeometry(x,y,w,h); | 2053 | topLevelWidget()->setGeometry(x,y,w,h); |
2051 | 2054 | ||
2052 | } else { | 2055 | } else { |
2053 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2056 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2054 | } | 2057 | } |
2055 | list = config->readListEntry("EditEventLayout"); | 2058 | list = config->readListEntry("EditEventLayout"); |
2056 | if ( ! list.isEmpty() ) { | 2059 | if ( ! list.isEmpty() ) { |
2057 | x = list[0].toInt(); | 2060 | x = list[0].toInt(); |
2058 | y = list[1].toInt(); | 2061 | y = list[1].toInt(); |
2059 | w = list[2].toInt(); | 2062 | w = list[2].toInt(); |
2060 | h = list[3].toInt(); | 2063 | h = list[3].toInt(); |
2061 | KApplication::testCoords( &x,&y,&w,&h ); | 2064 | KApplication::testCoords( &x,&y,&w,&h ); |
2062 | mEventEditor->setGeometry(x,y,w,h); | 2065 | mEventEditor->setGeometry(x,y,w,h); |
2063 | 2066 | ||
2064 | } | 2067 | } |
2065 | list = config->readListEntry("EditTodoLayout"); | 2068 | list = config->readListEntry("EditTodoLayout"); |
2066 | if ( ! list.isEmpty() ) { | 2069 | if ( ! list.isEmpty() ) { |
2067 | x = list[0].toInt(); | 2070 | x = list[0].toInt(); |
2068 | y = list[1].toInt(); | 2071 | y = list[1].toInt(); |
2069 | w = list[2].toInt(); | 2072 | w = list[2].toInt(); |
2070 | h = list[3].toInt(); | 2073 | h = list[3].toInt(); |
2071 | KApplication::testCoords( &x,&y,&w,&h ); | 2074 | KApplication::testCoords( &x,&y,&w,&h ); |
2072 | mTodoEditor->setGeometry(x,y,w,h); | 2075 | mTodoEditor->setGeometry(x,y,w,h); |
2073 | 2076 | ||
2074 | } | 2077 | } |
2075 | list = config->readListEntry("ViewerLayout"); | 2078 | list = config->readListEntry("ViewerLayout"); |
2076 | if ( ! list.isEmpty() ) { | 2079 | if ( ! list.isEmpty() ) { |
2077 | x = list[0].toInt(); | 2080 | x = list[0].toInt(); |
2078 | y = list[1].toInt(); | 2081 | y = list[1].toInt(); |
2079 | w = list[2].toInt(); | 2082 | w = list[2].toInt(); |
2080 | h = list[3].toInt(); | 2083 | h = list[3].toInt(); |
2081 | KApplication::testCoords( &x,&y,&w,&h ); | 2084 | KApplication::testCoords( &x,&y,&w,&h ); |
2082 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2085 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2083 | } | 2086 | } |
2084 | #endif | 2087 | #endif |
2085 | config->setGroup( "Views" ); | 2088 | config->setGroup( "Views" ); |
2086 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2089 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2087 | 2090 | ||
2088 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2091 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2089 | 2092 | ||
2090 | int resetval = 0; | 2093 | int resetval = 0; |
2091 | int maxVal = 0; | 2094 | int maxVal = 0; |
2092 | if (sizes.count() != 3) { | 2095 | if (sizes.count() != 3) { |
2093 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2096 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2094 | resetval = mDateNavigator->sizeHint().width()+2; | 2097 | resetval = mDateNavigator->sizeHint().width()+2; |
2095 | } else { | 2098 | } else { |
2096 | resetval = mDateNavigator->sizeHint().height()+2; | 2099 | resetval = mDateNavigator->sizeHint().height()+2; |
2097 | } | 2100 | } |
2098 | } | 2101 | } |
2099 | if ( resetval ) { | 2102 | if ( resetval ) { |
2100 | sizes.clear(); | 2103 | sizes.clear(); |
2101 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2104 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2102 | maxVal = QApplication::desktop()->width() -10; | 2105 | maxVal = QApplication::desktop()->width() -10; |
2103 | } else { | 2106 | } else { |
2104 | maxVal = QApplication::desktop()->height()-10; | 2107 | maxVal = QApplication::desktop()->height()-10; |
2105 | } | 2108 | } |
2106 | sizes << resetval; | 2109 | sizes << resetval; |
2107 | if ( maxVal < resetval + resetval) | 2110 | if ( maxVal < resetval + resetval) |
2108 | resetval = maxVal - resetval; | 2111 | resetval = maxVal - resetval; |
2109 | sizes << resetval; | 2112 | sizes << resetval; |
2110 | sizes << 100; | 2113 | sizes << 100; |
2111 | } | 2114 | } |
2112 | mLeftFrame->setSizes(sizes); | 2115 | mLeftFrame->setSizes(sizes); |
2113 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2116 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2114 | resetval = 0; | 2117 | resetval = 0; |
2115 | maxVal = 0; | 2118 | maxVal = 0; |
2116 | if (sizes.count() != 2) { | 2119 | if (sizes.count() != 2) { |
2117 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2120 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2118 | resetval = mDateNavigator->sizeHint().width()+2; | 2121 | resetval = mDateNavigator->sizeHint().width()+2; |
2119 | } else { | 2122 | } else { |
2120 | resetval = mDateNavigator->sizeHint().height()+2; | 2123 | resetval = mDateNavigator->sizeHint().height()+2; |
2121 | } | 2124 | } |
2122 | } | 2125 | } |
2123 | if ( resetval ) { | 2126 | if ( resetval ) { |
2124 | sizes.clear(); | 2127 | sizes.clear(); |
2125 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2128 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2126 | maxVal = QApplication::desktop()->width() -10; | 2129 | maxVal = QApplication::desktop()->width() -10; |
2127 | } else { | 2130 | } else { |
2128 | maxVal = QApplication::desktop()->height()-10; | 2131 | maxVal = QApplication::desktop()->height()-10; |
2129 | } | 2132 | } |
2130 | sizes << resetval; | 2133 | sizes << resetval; |
2131 | if ( maxVal < resetval + resetval) | 2134 | if ( maxVal < resetval + resetval) |
2132 | resetval = maxVal - resetval; | 2135 | resetval = maxVal - resetval; |
2133 | sizes << resetval; | 2136 | sizes << resetval; |
2134 | } | 2137 | } |
2135 | mMainFrame->setSizes(sizes); | 2138 | mMainFrame->setSizes(sizes); |
2136 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2139 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2137 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2140 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2138 | else mNavigator->selectDates( dateCount ); | 2141 | else mNavigator->selectDates( dateCount ); |
2139 | // mViewManager->readSettings( config ); | 2142 | // mViewManager->readSettings( config ); |
2140 | updateConfig(); | 2143 | updateConfig(); |
2141 | globalFlagBlockAgenda = 2; | 2144 | globalFlagBlockAgenda = 2; |
2142 | mViewManager->readSettings( config ); | 2145 | mViewManager->readSettings( config ); |
2143 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2146 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2144 | } | 2147 | } |
2145 | 2148 | ||
2146 | 2149 | ||
2147 | void CalendarView::writeSettings() | 2150 | void CalendarView::writeSettings() |
2148 | { | 2151 | { |
2149 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2152 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2150 | 2153 | ||
2151 | KConfig *config = KOGlobals::config(); | 2154 | KConfig *config = KOGlobals::config(); |
2152 | 2155 | ||
2153 | mViewManager->writeSettings( config ); | 2156 | mViewManager->writeSettings( config ); |
2154 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2157 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2155 | mDialogManager->writeSettings( config ); | 2158 | mDialogManager->writeSettings( config ); |
2156 | //KOPrefs::instance()->usrWriteConfig(); | 2159 | //KOPrefs::instance()->usrWriteConfig(); |
2157 | KOPrefs::instance()->writeConfig(); | 2160 | KOPrefs::instance()->writeConfig(); |
2158 | 2161 | ||
2159 | writeFilterSettings(config); | 2162 | writeFilterSettings(config); |
2160 | config->setGroup( "AppRun" ); | 2163 | config->setGroup( "AppRun" ); |
2161 | QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) ); | 2164 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2165 | int days = dt.daysTo( QDate::currentDate() ); | ||
2166 | dt = dt.addDays( days ); | ||
2162 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2167 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2163 | config->writeEntry( "LatestProgramStop", secs ); | 2168 | config->writeEntry( "LatestProgramStopDays", days ); |
2164 | qDebug("KO: Writing stop time: %d ", secs); | 2169 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2165 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2170 | //qDebug("KO: Writing stop time: %d ", secs); |
2166 | QDateTime latest = dt.addSecs ( secs ); | 2171 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2167 | qDebug("KO: Test termination on %s ", latest.toString().latin1()); | 2172 | //QDateTime latest = dt.addSecs ( secs ); |
2173 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | ||
2168 | config->setGroup( "Views" ); | 2174 | config->setGroup( "Views" ); |
2169 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2175 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2170 | 2176 | ||
2177 | #if 0 | ||
2178 | qDebug("********************* "); | ||
2179 | qDebug("Testcode secsto "); | ||
2180 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | ||
2181 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | ||
2182 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | ||
2183 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | ||
2184 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | ||
2185 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | ||
2186 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | ||
2187 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | ||
2188 | qDebug("********************* testcode end"); | ||
2189 | |||
2190 | #endif | ||
2191 | |||
2171 | QValueList<int> listINT = mLeftFrame->sizes(); | 2192 | QValueList<int> listINT = mLeftFrame->sizes(); |
2172 | config->writeEntry("Left Splitter Frame",listINT); | 2193 | config->writeEntry("Left Splitter Frame",listINT); |
2173 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2194 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2174 | config->writeEntry("Main Splitter Frame",listINT2); | 2195 | config->writeEntry("Main Splitter Frame",listINT2); |
2175 | #ifdef DESKTOP_VERSION | 2196 | #ifdef DESKTOP_VERSION |
2176 | config->setGroup("WidgetLayout"); | 2197 | config->setGroup("WidgetLayout"); |
2177 | QStringList list ;//= config->readListEntry("MainLayout"); | 2198 | QStringList list ;//= config->readListEntry("MainLayout"); |
2178 | int x,y,w,h; | 2199 | int x,y,w,h; |
2179 | QWidget* wid; | 2200 | QWidget* wid; |
2180 | wid = topLevelWidget(); | 2201 | wid = topLevelWidget(); |
2181 | x = wid->geometry().x(); | 2202 | x = wid->geometry().x(); |
2182 | y = wid->geometry().y(); | 2203 | y = wid->geometry().y(); |
2183 | w = wid->width(); | 2204 | w = wid->width(); |
2184 | h = wid->height(); | 2205 | h = wid->height(); |
2185 | list.clear(); | 2206 | list.clear(); |
2186 | list << QString::number( x ); | 2207 | list << QString::number( x ); |
2187 | list << QString::number( y ); | 2208 | list << QString::number( y ); |
2188 | list << QString::number( w ); | 2209 | list << QString::number( w ); |
2189 | list << QString::number( h ); | 2210 | list << QString::number( h ); |
2190 | config->writeEntry("MainLayout",list ); | 2211 | config->writeEntry("MainLayout",list ); |
2191 | 2212 | ||
2192 | wid = mEventEditor; | 2213 | wid = mEventEditor; |
2193 | x = wid->geometry().x(); | 2214 | x = wid->geometry().x(); |
2194 | y = wid->geometry().y(); | 2215 | y = wid->geometry().y(); |
2195 | w = wid->width(); | 2216 | w = wid->width(); |
2196 | h = wid->height(); | 2217 | h = wid->height(); |
2197 | list.clear(); | 2218 | list.clear(); |
2198 | list << QString::number( x ); | 2219 | list << QString::number( x ); |
2199 | list << QString::number( y ); | 2220 | list << QString::number( y ); |
2200 | list << QString::number( w ); | 2221 | list << QString::number( w ); |
2201 | list << QString::number( h ); | 2222 | list << QString::number( h ); |
2202 | config->writeEntry("EditEventLayout",list ); | 2223 | config->writeEntry("EditEventLayout",list ); |
2203 | 2224 | ||
2204 | wid = mTodoEditor; | 2225 | wid = mTodoEditor; |
2205 | x = wid->geometry().x(); | 2226 | x = wid->geometry().x(); |
2206 | y = wid->geometry().y(); | 2227 | y = wid->geometry().y(); |
2207 | w = wid->width(); | 2228 | w = wid->width(); |
2208 | h = wid->height(); | 2229 | h = wid->height(); |
2209 | list.clear(); | 2230 | list.clear(); |
2210 | list << QString::number( x ); | 2231 | list << QString::number( x ); |
2211 | list << QString::number( y ); | 2232 | list << QString::number( y ); |
2212 | list << QString::number( w ); | 2233 | list << QString::number( w ); |
2213 | list << QString::number( h ); | 2234 | list << QString::number( h ); |
2214 | config->writeEntry("EditTodoLayout",list ); | 2235 | config->writeEntry("EditTodoLayout",list ); |
2215 | wid = getEventViewerDialog(); | 2236 | wid = getEventViewerDialog(); |
2216 | x = wid->geometry().x(); | 2237 | x = wid->geometry().x(); |
2217 | y = wid->geometry().y(); | 2238 | y = wid->geometry().y(); |
2218 | w = wid->width(); | 2239 | w = wid->width(); |
2219 | h = wid->height(); | 2240 | h = wid->height(); |
2220 | list.clear(); | 2241 | list.clear(); |
2221 | list << QString::number( x ); | 2242 | list << QString::number( x ); |
2222 | list << QString::number( y ); | 2243 | list << QString::number( y ); |
2223 | list << QString::number( w ); | 2244 | list << QString::number( w ); |
2224 | list << QString::number( h ); | 2245 | list << QString::number( h ); |
2225 | config->writeEntry("ViewerLayout",list ); | 2246 | config->writeEntry("ViewerLayout",list ); |
2226 | wid = mDialogManager->getSearchDialog(); | 2247 | wid = mDialogManager->getSearchDialog(); |
2227 | if ( wid ) { | 2248 | if ( wid ) { |
2228 | x = wid->geometry().x(); | 2249 | x = wid->geometry().x(); |
2229 | y = wid->geometry().y(); | 2250 | y = wid->geometry().y(); |
2230 | w = wid->width(); | 2251 | w = wid->width(); |
2231 | h = wid->height(); | 2252 | h = wid->height(); |
2232 | list.clear(); | 2253 | list.clear(); |
2233 | list << QString::number( x ); | 2254 | list << QString::number( x ); |
2234 | list << QString::number( y ); | 2255 | list << QString::number( y ); |
2235 | list << QString::number( w ); | 2256 | list << QString::number( w ); |
2236 | list << QString::number( h ); | 2257 | list << QString::number( h ); |
2237 | config->writeEntry("SearchLayout",list ); | 2258 | config->writeEntry("SearchLayout",list ); |
2238 | } | 2259 | } |
2239 | #endif | 2260 | #endif |
2240 | 2261 | ||
2241 | 2262 | ||
2242 | config->sync(); | 2263 | config->sync(); |
2243 | } | 2264 | } |
2244 | 2265 | ||
2245 | void CalendarView::readFilterSettings(KConfig *config) | 2266 | void CalendarView::readFilterSettings(KConfig *config) |
2246 | { | 2267 | { |
2247 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2268 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2248 | 2269 | ||
2249 | mFilters.clear(); | 2270 | mFilters.clear(); |
2250 | 2271 | ||
2251 | config->setGroup("General"); | 2272 | config->setGroup("General"); |
2252 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2273 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2253 | 2274 | ||
2254 | QStringList::ConstIterator it = filterList.begin(); | 2275 | QStringList::ConstIterator it = filterList.begin(); |
2255 | QStringList::ConstIterator end = filterList.end(); | 2276 | QStringList::ConstIterator end = filterList.end(); |
2256 | while(it != end) { | 2277 | while(it != end) { |
2257 | // kdDebug() << " filter: " << (*it) << endl; | 2278 | // kdDebug() << " filter: " << (*it) << endl; |
2258 | 2279 | ||
2259 | CalFilter *filter; | 2280 | CalFilter *filter; |
2260 | filter = new CalFilter(*it); | 2281 | filter = new CalFilter(*it); |
2261 | config->setGroup("Filter_" + (*it).utf8()); | 2282 | config->setGroup("Filter_" + (*it).utf8()); |
2262 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2283 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2263 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2284 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2264 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2285 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2265 | mFilters.append(filter); | 2286 | mFilters.append(filter); |
2266 | 2287 | ||
2267 | ++it; | 2288 | ++it; |
2268 | } | 2289 | } |
2269 | 2290 | ||
2270 | if (mFilters.count() == 0) { | 2291 | if (mFilters.count() == 0) { |
2271 | CalFilter *filter = new CalFilter(i18n("Default")); | 2292 | CalFilter *filter = new CalFilter(i18n("Default")); |
2272 | mFilters.append(filter); | 2293 | mFilters.append(filter); |
2273 | } | 2294 | } |
2274 | mFilterView->updateFilters(); | 2295 | mFilterView->updateFilters(); |
2275 | config->setGroup("FilterView"); | 2296 | config->setGroup("FilterView"); |
2276 | 2297 | ||
2277 | mFilterView->blockSignals(true); | 2298 | mFilterView->blockSignals(true); |
2278 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2299 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2279 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2300 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2280 | mFilterView->blockSignals(false); | 2301 | mFilterView->blockSignals(false); |
2281 | // We do it manually to avoid it being done twice by the above calls | 2302 | // We do it manually to avoid it being done twice by the above calls |
2282 | updateFilter(); | 2303 | updateFilter(); |
2283 | } | 2304 | } |
2284 | 2305 | ||
2285 | void CalendarView::writeFilterSettings(KConfig *config) | 2306 | void CalendarView::writeFilterSettings(KConfig *config) |
2286 | { | 2307 | { |
2287 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2308 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2288 | 2309 | ||
2289 | QStringList filterList; | 2310 | QStringList filterList; |
2290 | 2311 | ||
2291 | CalFilter *filter = mFilters.first(); | 2312 | CalFilter *filter = mFilters.first(); |
2292 | while(filter) { | 2313 | while(filter) { |
2293 | // kdDebug() << " fn: " << filter->name() << endl; | 2314 | // kdDebug() << " fn: " << filter->name() << endl; |
2294 | filterList << filter->name(); | 2315 | filterList << filter->name(); |
2295 | config->setGroup("Filter_" + filter->name().utf8()); | 2316 | config->setGroup("Filter_" + filter->name().utf8()); |
2296 | config->writeEntry("Criteria",filter->criteria()); | 2317 | config->writeEntry("Criteria",filter->criteria()); |
2297 | config->writeEntry("CategoryList",filter->categoryList()); | 2318 | config->writeEntry("CategoryList",filter->categoryList()); |
2298 | filter = mFilters.next(); | 2319 | filter = mFilters.next(); |
2299 | } | 2320 | } |
2300 | config->setGroup("General"); | 2321 | config->setGroup("General"); |
2301 | config->writeEntry("CalendarFilters",filterList); | 2322 | config->writeEntry("CalendarFilters",filterList); |
2302 | 2323 | ||
2303 | config->setGroup("FilterView"); | 2324 | config->setGroup("FilterView"); |
2304 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2325 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2305 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2326 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2306 | } | 2327 | } |
2307 | 2328 | ||
2308 | 2329 | ||
2309 | void CalendarView::goToday() | 2330 | void CalendarView::goToday() |
2310 | { | 2331 | { |
2311 | if ( mViewManager->currentView()->isMonthView() ) | 2332 | if ( mViewManager->currentView()->isMonthView() ) |
2312 | mNavigator->selectTodayMonth(); | 2333 | mNavigator->selectTodayMonth(); |
2313 | else | 2334 | else |
2314 | mNavigator->selectToday(); | 2335 | mNavigator->selectToday(); |
2315 | } | 2336 | } |
2316 | 2337 | ||
2317 | void CalendarView::goNext() | 2338 | void CalendarView::goNext() |
2318 | { | 2339 | { |
2319 | mNavigator->selectNext(); | 2340 | mNavigator->selectNext(); |
2320 | } | 2341 | } |
2321 | 2342 | ||
2322 | void CalendarView::goPrevious() | 2343 | void CalendarView::goPrevious() |
2323 | { | 2344 | { |
2324 | mNavigator->selectPrevious(); | 2345 | mNavigator->selectPrevious(); |
2325 | } | 2346 | } |
2326 | void CalendarView::goNextMonth() | 2347 | void CalendarView::goNextMonth() |
2327 | { | 2348 | { |
2328 | mNavigator->selectNextMonth(); | 2349 | mNavigator->selectNextMonth(); |
2329 | } | 2350 | } |
2330 | 2351 | ||
2331 | void CalendarView::goPreviousMonth() | 2352 | void CalendarView::goPreviousMonth() |
2332 | { | 2353 | { |
2333 | mNavigator->selectPreviousMonth(); | 2354 | mNavigator->selectPreviousMonth(); |
2334 | } | 2355 | } |
2335 | void CalendarView::writeLocale() | 2356 | void CalendarView::writeLocale() |
2336 | { | 2357 | { |
2337 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2358 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2338 | #if 0 | 2359 | #if 0 |
2339 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2360 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2340 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2361 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2341 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2362 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2342 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2363 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2343 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2364 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2344 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2365 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2345 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2366 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2346 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2367 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2347 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2368 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2348 | KOPrefs::instance()->mDaylightsavingStart, | 2369 | KOPrefs::instance()->mDaylightsavingStart, |
2349 | KOPrefs::instance()->mDaylightsavingEnd ); | 2370 | KOPrefs::instance()->mDaylightsavingEnd ); |
2350 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2371 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2351 | #endif | 2372 | #endif |
2352 | } | 2373 | } |
2353 | void CalendarView::updateConfig() | 2374 | void CalendarView::updateConfig() |
2354 | { | 2375 | { |
2355 | writeLocale(); | 2376 | writeLocale(); |
2356 | if ( KOPrefs::instance()->mUseAppColors ) | 2377 | if ( KOPrefs::instance()->mUseAppColors ) |
2357 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2378 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2358 | emit configChanged(); | 2379 | emit configChanged(); |
2359 | mTodoList->updateConfig(); | 2380 | mTodoList->updateConfig(); |
2360 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2381 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2361 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2382 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2362 | // To make the "fill window" configurations work | 2383 | // To make the "fill window" configurations work |
2363 | //mViewManager->raiseCurrentView(); | 2384 | //mViewManager->raiseCurrentView(); |
2364 | } | 2385 | } |
2365 | 2386 | ||
2366 | 2387 | ||
2367 | void CalendarView::eventChanged(Event *event) | 2388 | void CalendarView::eventChanged(Event *event) |
2368 | { | 2389 | { |
2369 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2390 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2370 | //updateUnmanagedViews(); | 2391 | //updateUnmanagedViews(); |
2371 | } | 2392 | } |
2372 | 2393 | ||
2373 | void CalendarView::eventAdded(Event *event) | 2394 | void CalendarView::eventAdded(Event *event) |
2374 | { | 2395 | { |
2375 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2396 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2376 | } | 2397 | } |
2377 | 2398 | ||
2378 | void CalendarView::eventToBeDeleted(Event *) | 2399 | void CalendarView::eventToBeDeleted(Event *) |
2379 | { | 2400 | { |
2380 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2401 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2381 | } | 2402 | } |
2382 | 2403 | ||
2383 | void CalendarView::eventDeleted() | 2404 | void CalendarView::eventDeleted() |
2384 | { | 2405 | { |
2385 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2406 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2386 | } | 2407 | } |
2387 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2408 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2388 | { | 2409 | { |
2389 | changeIncidenceDisplay((Incidence *)which, action); | 2410 | changeIncidenceDisplay((Incidence *)which, action); |
2390 | mDateNavigator->updateView(); //LR | 2411 | mDateNavigator->updateView(); //LR |
2391 | //mDialogManager->updateSearchDialog(); | 2412 | //mDialogManager->updateSearchDialog(); |
2392 | 2413 | ||
2393 | if (which) { | 2414 | if (which) { |
2394 | mViewManager->updateWNview(); | 2415 | mViewManager->updateWNview(); |
2395 | //mTodoList->updateView(); | 2416 | //mTodoList->updateView(); |
2396 | } | 2417 | } |
2397 | 2418 | ||
2398 | } | 2419 | } |
2399 | 2420 | ||
2400 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2421 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2401 | { | 2422 | { |
2402 | updateUnmanagedViews(); | 2423 | updateUnmanagedViews(); |
2403 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2424 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2404 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2425 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2405 | mCalendar->checkAlarmForIncidence( 0, true ); | 2426 | mCalendar->checkAlarmForIncidence( 0, true ); |
2406 | if ( mEventViewerDialog ) | 2427 | if ( mEventViewerDialog ) |
2407 | mEventViewerDialog->hide(); | 2428 | mEventViewerDialog->hide(); |
2408 | } | 2429 | } |
2409 | else | 2430 | else |
2410 | mCalendar->checkAlarmForIncidence( which , false ); | 2431 | mCalendar->checkAlarmForIncidence( which , false ); |
2411 | } | 2432 | } |
2412 | 2433 | ||
2413 | // most of the changeEventDisplays() right now just call the view's | 2434 | // most of the changeEventDisplays() right now just call the view's |
2414 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2435 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2415 | void CalendarView::changeEventDisplay(Event *which, int action) | 2436 | void CalendarView::changeEventDisplay(Event *which, int action) |
2416 | { | 2437 | { |
2417 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2438 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2418 | changeIncidenceDisplay((Incidence *)which, action); | 2439 | changeIncidenceDisplay((Incidence *)which, action); |
2419 | mDateNavigator->updateView(); | 2440 | mDateNavigator->updateView(); |
2420 | //mDialogManager->updateSearchDialog(); | 2441 | //mDialogManager->updateSearchDialog(); |
2421 | 2442 | ||
2422 | if (which) { | 2443 | if (which) { |
2423 | // If there is an event view visible update the display | 2444 | // If there is an event view visible update the display |
2424 | mViewManager->currentView()->changeEventDisplay(which,action); | 2445 | mViewManager->currentView()->changeEventDisplay(which,action); |
2425 | // TODO: check, if update needed | 2446 | // TODO: check, if update needed |
2426 | // if (which->getTodoStatus()) { | 2447 | // if (which->getTodoStatus()) { |
2427 | mTodoList->updateView(); | 2448 | mTodoList->updateView(); |
2428 | // } | 2449 | // } |
2429 | } else { | 2450 | } else { |
2430 | mViewManager->currentView()->updateView(); | 2451 | mViewManager->currentView()->updateView(); |
2431 | } | 2452 | } |
2432 | } | 2453 | } |
2433 | 2454 | ||
2434 | 2455 | ||
2435 | void CalendarView::updateTodoViews() | 2456 | void CalendarView::updateTodoViews() |
2436 | { | 2457 | { |
2437 | mTodoList->updateView(); | 2458 | mTodoList->updateView(); |
2438 | mViewManager->currentView()->updateView(); | 2459 | mViewManager->currentView()->updateView(); |
2439 | 2460 | ||
2440 | } | 2461 | } |
2441 | 2462 | ||
2442 | 2463 | ||
2443 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2464 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2444 | { | 2465 | { |
2445 | mTodoList->updateView(); | 2466 | mTodoList->updateView(); |
2446 | mViewManager->updateView(start, end); | 2467 | mViewManager->updateView(start, end); |
2447 | //mDateNavigator->updateView(); | 2468 | //mDateNavigator->updateView(); |
2448 | } | 2469 | } |
2449 | 2470 | ||
2450 | void CalendarView::clearAllViews() | 2471 | void CalendarView::clearAllViews() |
2451 | { | 2472 | { |
2452 | mTodoList->clearList(); | 2473 | mTodoList->clearList(); |
2453 | mViewManager->clearAllViews(); | 2474 | mViewManager->clearAllViews(); |
2454 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2475 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2455 | if ( sd ) { | 2476 | if ( sd ) { |
2456 | KOListView* kol = sd->listview(); | 2477 | KOListView* kol = sd->listview(); |
2457 | if ( kol ) | 2478 | if ( kol ) |
2458 | kol->clearList(); | 2479 | kol->clearList(); |
2459 | } | 2480 | } |
2460 | } | 2481 | } |
2461 | void CalendarView::updateView() | 2482 | void CalendarView::updateView() |
2462 | { | 2483 | { |
2463 | DateList tmpList = mNavigator->selectedDates(); | 2484 | DateList tmpList = mNavigator->selectedDates(); |
2464 | 2485 | ||
2465 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2486 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2466 | mTodoList->updateView(); | 2487 | mTodoList->updateView(); |
2467 | // We assume that the navigator only selects consecutive days. | 2488 | // We assume that the navigator only selects consecutive days. |
2468 | updateView( tmpList.first(), tmpList.last() ); | 2489 | updateView( tmpList.first(), tmpList.last() ); |
2469 | } | 2490 | } |
2470 | 2491 | ||
2471 | void CalendarView::updateUnmanagedViews() | 2492 | void CalendarView::updateUnmanagedViews() |
2472 | { | 2493 | { |
2473 | mDateNavigator->updateDayMatrix(); | 2494 | mDateNavigator->updateDayMatrix(); |
2474 | } | 2495 | } |
2475 | 2496 | ||
2476 | int CalendarView::msgItemDelete(const QString name) | 2497 | int CalendarView::msgItemDelete(const QString name) |
2477 | { | 2498 | { |
2478 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2499 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2479 | i18n("This item will be\npermanently deleted."), | 2500 | i18n("This item will be\npermanently deleted."), |
2480 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2501 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2481 | } | 2502 | } |
2482 | 2503 | ||
2483 | 2504 | ||
2484 | void CalendarView::edit_cut() | 2505 | void CalendarView::edit_cut() |
2485 | { | 2506 | { |
2486 | Event *anEvent=0; | 2507 | Event *anEvent=0; |
2487 | 2508 | ||
2488 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2509 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2489 | 2510 | ||
2490 | if (mViewManager->currentView()->isEventView()) { | 2511 | if (mViewManager->currentView()->isEventView()) { |
2491 | if ( incidence && incidence->typeID() == eventID ) { | 2512 | if ( incidence && incidence->typeID() == eventID ) { |
2492 | anEvent = static_cast<Event *>(incidence); | 2513 | anEvent = static_cast<Event *>(incidence); |
2493 | } | 2514 | } |
2494 | } | 2515 | } |
2495 | 2516 | ||
2496 | if (!anEvent) { | 2517 | if (!anEvent) { |
2497 | KNotifyClient::beep(); | 2518 | KNotifyClient::beep(); |
2498 | return; | 2519 | return; |
2499 | } | 2520 | } |
2500 | DndFactory factory( mCalendar ); | 2521 | DndFactory factory( mCalendar ); |
2501 | factory.cutIncidence(anEvent); | 2522 | factory.cutIncidence(anEvent); |
2502 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2523 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2503 | } | 2524 | } |
2504 | 2525 | ||
2505 | void CalendarView::edit_copy() | 2526 | void CalendarView::edit_copy() |
2506 | { | 2527 | { |
2507 | Event *anEvent=0; | 2528 | Event *anEvent=0; |
2508 | 2529 | ||
2509 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2530 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2510 | 2531 | ||
2511 | if (mViewManager->currentView()->isEventView()) { | 2532 | if (mViewManager->currentView()->isEventView()) { |
2512 | if ( incidence && incidence->typeID() == eventID ) { | 2533 | if ( incidence && incidence->typeID() == eventID ) { |
2513 | anEvent = static_cast<Event *>(incidence); | 2534 | anEvent = static_cast<Event *>(incidence); |
2514 | } | 2535 | } |
2515 | } | 2536 | } |
2516 | 2537 | ||
2517 | if (!anEvent) { | 2538 | if (!anEvent) { |
2518 | KNotifyClient::beep(); | 2539 | KNotifyClient::beep(); |
2519 | return; | 2540 | return; |
2520 | } | 2541 | } |
2521 | DndFactory factory( mCalendar ); | 2542 | DndFactory factory( mCalendar ); |
2522 | factory.copyIncidence(anEvent); | 2543 | factory.copyIncidence(anEvent); |
2523 | } | 2544 | } |
2524 | 2545 | ||
2525 | void CalendarView::edit_paste() | 2546 | void CalendarView::edit_paste() |
2526 | { | 2547 | { |
2527 | QDate date = mNavigator->selectedDates().first(); | 2548 | QDate date = mNavigator->selectedDates().first(); |
2528 | 2549 | ||
2529 | DndFactory factory( mCalendar ); | 2550 | DndFactory factory( mCalendar ); |
2530 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2551 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2531 | 2552 | ||
2532 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2553 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2533 | } | 2554 | } |
2534 | void CalendarView::edit_global_options() | 2555 | void CalendarView::edit_global_options() |
2535 | { | 2556 | { |
2536 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2557 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2537 | emit save(); | 2558 | emit save(); |
2538 | emit saveStopTimer(); | 2559 | emit saveStopTimer(); |
2539 | mDialogManager->showGlobalOptionsDialog(); | 2560 | mDialogManager->showGlobalOptionsDialog(); |
2540 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2561 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2541 | emit saveStopTimer(); | 2562 | emit saveStopTimer(); |
2542 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2563 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2543 | i18n("Timezone settings"),i18n("Reload"))) { | 2564 | i18n("Timezone settings"),i18n("Reload"))) { |
2544 | qDebug("KO: TZ reload cancelled "); | 2565 | qDebug("KO: TZ reload cancelled "); |
2545 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2566 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2546 | return; | 2567 | return; |
2547 | } | 2568 | } |
2548 | qDebug("KO: Timezone change "); | 2569 | qDebug("KO: Timezone change "); |
2549 | openCalendar( MainWindow::defaultFileName() ); | 2570 | openCalendar( MainWindow::defaultFileName() ); |
2550 | setModified(true); | 2571 | setModified(true); |
2551 | } | 2572 | } |
2552 | else | 2573 | else |
2553 | qDebug("KO: No tz change "); | 2574 | qDebug("KO: No tz change "); |
2554 | } | 2575 | } |
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index c64f325..383e711 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | #include <kfiledialog.h> | 1 | #include <kfiledialog.h> |
2 | #include <qdialog.h> | 2 | #include <qdialog.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qdir.h> | 4 | #include <qdir.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | #ifndef DESKTOP_VERSION | 8 | #ifndef DESKTOP_VERSION |
9 | //US orig#include <ofileselector.h> | 9 | //US orig#include <ofileselector.h> |
10 | #include <ofileselector_p.h> | 10 | #include <ofileselector_p.h> |
11 | QString KFileDialog::getSaveFileName( const QString & fn, | 11 | QString KFileDialog::getSaveFileName( const QString & fn, |
12 | const QString & cap , QWidget * par ) | 12 | const QString & cap , QWidget * par ) |
13 | { | 13 | { |
14 | QString retfile = ""; | 14 | QString retfile = ""; |
15 | QDialog dia ( par, "input-dialog", true ); | 15 | QDialog dia ( par, "input-dialog", true ); |
16 | QVBoxLayout lay( &dia ); | 16 | QVBoxLayout lay( &dia ); |
17 | lay.setMargin(7); | 17 | lay.setMargin(7); |
18 | lay.setSpacing(7); | 18 | lay.setSpacing(7); |
19 | QString file = fn; | 19 | QString file = fn; |
20 | if ( file.isEmpty() ) | 20 | if ( file.isEmpty() ) |
21 | file = QDir::homeDirPath()+"/*"; | 21 | file = QDir::homeDirPath()+"/*"; |
22 | QFileInfo fi ( file ); | 22 | QFileInfo fi ( file ); |
23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); | 23 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); |
24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 24 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
25 | lay.addWidget( &o); | 25 | lay.addWidget( &o); |
26 | // o.setNewVisible( true ); | 26 | // o.setNewVisible( true ); |
27 | // o.setNameVisible( true ); | 27 | // o.setNameVisible( true ); |
28 | dia.showMaximized(); | 28 | dia.showMaximized(); |
29 | if ( cap.isEmpty() ) | 29 | if ( cap.isEmpty() ) |
30 | dia.setCaption( file ); | 30 | dia.setCaption( file ); |
31 | else | 31 | else |
32 | dia.setCaption( cap ); | 32 | dia.setCaption( cap ); |
33 | int res = dia.exec(); | 33 | int res = dia.exec(); |
34 | if ( res ) | 34 | if ( res ) |
35 | retfile = o.selectedName(); | 35 | retfile = o.selectedName(); |
36 | return retfile; | 36 | return retfile; |
37 | } | 37 | } |
38 | 38 | ||
39 | QString KFileDialog::getOpenFileName( const QString & fn, | 39 | QString KFileDialog::getOpenFileName( const QString & fn, |
40 | const QString & cap, QWidget * par ) | 40 | const QString & cap, QWidget * par ) |
41 | { | 41 | { |
42 | QString retfile = ""; | 42 | QString retfile = ""; |
43 | QDialog dia ( par, "input-dialog", true ); | 43 | QDialog dia ( par, "input-dialog", true ); |
44 | // QLineEdit lab ( &dia ); | 44 | // QLineEdit lab ( &dia ); |
45 | QVBoxLayout lay( &dia ); | 45 | QVBoxLayout lay( &dia ); |
46 | lay.setMargin(7); | 46 | lay.setMargin(7); |
47 | lay.setSpacing(7); | 47 | lay.setSpacing(7); |
48 | QString file = fn; | 48 | QString file = fn; |
49 | if ( file.isEmpty() ) | 49 | if ( file.isEmpty() ) |
50 | file = QDir::homeDirPath()+"/*";; | 50 | file = QDir::homeDirPath()+"/*";; |
51 | QFileInfo fi ( file ); | 51 | QFileInfo fi ( file ); |
52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
54 | lay.addWidget( &o); | 54 | lay.addWidget( &o); |
55 | dia.showMaximized(); | 55 | dia.showMaximized(); |
56 | dia.setCaption( cap ); | 56 | dia.setCaption( cap ); |
57 | int res = dia.exec(); | 57 | int res = dia.exec(); |
58 | if ( res ) | 58 | if ( res ) |
59 | retfile = o.selectedName(); | 59 | retfile = o.selectedName(); |
60 | return retfile; | 60 | return retfile; |
61 | } | 61 | } |
62 | QString KFileDialog::getExistingDirectory( const QString & fn, | 62 | QString KFileDialog::getExistingDirectory( const QString & fn, |
63 | const QString & cap, QWidget * par ) | 63 | const QString & cap, QWidget * par ) |
64 | { | 64 | { |
65 | return KFileDialog::getSaveFileName( fn, cap, pr ); | 65 | return KFileDialog::getSaveFileName( fn, cap, par ); |
66 | } | 66 | } |
67 | #else | 67 | #else |
68 | 68 | ||
69 | #include <qfiledialog.h> | 69 | #include <qfiledialog.h> |
70 | 70 | ||
71 | QString KFileDialog::getSaveFileName( const QString & fn, | 71 | QString KFileDialog::getSaveFileName( const QString & fn, |
72 | const QString & cap , QWidget * par ) | 72 | const QString & cap , QWidget * par ) |
73 | { | 73 | { |
74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
75 | } | 75 | } |
76 | QString KFileDialog::getOpenFileName( const QString & fn, | 76 | QString KFileDialog::getOpenFileName( const QString & fn, |
77 | const QString & cap, QWidget * par ) | 77 | const QString & cap, QWidget * par ) |
78 | { | 78 | { |
79 | 79 | ||
80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
81 | } | 81 | } |
82 | QString KFileDialog::getExistingDirectory( const QString & fn, | 82 | QString KFileDialog::getExistingDirectory( const QString & fn, |
83 | const QString & cap, QWidget * par ) | 83 | const QString & cap, QWidget * par ) |
84 | { | 84 | { |
85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); | 85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||