-rw-r--r-- | korganizer/calendarview.cpp | 7 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 10 |
2 files changed, 11 insertions, 6 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 9674921..3ab4bb4 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -714,65 +714,65 @@ void CalendarView::nextConflict( bool all, bool allday ) | |||
714 | cE = test; | 714 | cE = test; |
715 | cE2 = test2; | 715 | cE2 = test2; |
716 | found = true; | 716 | found = true; |
717 | } | 717 | } |
718 | } else { | 718 | } else { |
719 | if ( retVal >= startDT && retVal < conflict ) { | 719 | if ( retVal >= startDT && retVal < conflict ) { |
720 | conflict = retVal; | 720 | conflict = retVal; |
721 | cE = test; | 721 | cE = test; |
722 | cE2 = test2; | 722 | cE2 = test2; |
723 | } | 723 | } |
724 | } | 724 | } |
725 | } | 725 | } |
726 | } | 726 | } |
727 | test2 = testlist2.next(); | 727 | test2 = testlist2.next(); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | test->setTagged( true ); | 730 | test->setTagged( true ); |
731 | test = testlist.next(); | 731 | test = testlist.next(); |
732 | } | 732 | } |
733 | //qDebug("Search time : %d", tm.elapsed()); | 733 | //qDebug("Search time : %d", tm.elapsed()); |
734 | if ( found ) { | 734 | if ( found ) { |
735 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 735 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
736 | mViewManager->showDayView(); | 736 | mViewManager->showDayView(); |
737 | mNavigator->slotDaySelect( conflict.date() ); | 737 | mNavigator->slotDaySelect( conflict.date() ); |
738 | int hour = conflict.time().hour(); | 738 | int hour = conflict.time().hour(); |
739 | mViewManager->agendaView()->setStartHour( hour ); | 739 | mViewManager->agendaView()->setStartHour( hour ); |
740 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 740 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
741 | block = false; | 741 | block = false; |
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | 744 | ||
745 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 745 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
746 | qDebug("No conflict found "); | 746 | //qDebug("No conflict found "); |
747 | block = false; | 747 | block = false; |
748 | return; | 748 | return; |
749 | } | 749 | } |
750 | 750 | ||
751 | void CalendarView::conflictAll() | 751 | void CalendarView::conflictAll() |
752 | { | 752 | { |
753 | nextConflict ( true, true ); | 753 | nextConflict ( true, true ); |
754 | } | 754 | } |
755 | void CalendarView::conflictAllday() | 755 | void CalendarView::conflictAllday() |
756 | { | 756 | { |
757 | nextConflict ( false, true ); | 757 | nextConflict ( false, true ); |
758 | } | 758 | } |
759 | void CalendarView::conflictNotAll() | 759 | void CalendarView::conflictNotAll() |
760 | { | 760 | { |
761 | nextConflict ( false, false ); | 761 | nextConflict ( false, false ); |
762 | } | 762 | } |
763 | 763 | ||
764 | void CalendarView::setCalReadOnly( int id, bool readO ) | 764 | void CalendarView::setCalReadOnly( int id, bool readO ) |
765 | { | 765 | { |
766 | if ( readO ) { | 766 | if ( readO ) { |
767 | emit save(); | 767 | emit save(); |
768 | } | 768 | } |
769 | mCalendar->setReadOnly( id, readO ); | 769 | mCalendar->setReadOnly( id, readO ); |
770 | } | 770 | } |
771 | void CalendarView::setScrollBarStep(int val ) | 771 | void CalendarView::setScrollBarStep(int val ) |
772 | { | 772 | { |
773 | #ifdef DESKTOP_VERSION | 773 | #ifdef DESKTOP_VERSION |
774 | mDateScrollBar->setLineStep ( val ); | 774 | mDateScrollBar->setLineStep ( val ); |
775 | #endif | 775 | #endif |
776 | } | 776 | } |
777 | void CalendarView::scrollBarValue(int val ) | 777 | void CalendarView::scrollBarValue(int val ) |
778 | { | 778 | { |
@@ -2799,72 +2799,73 @@ void CalendarView::checkConflictForEvent() | |||
2799 | return; | 2799 | return; |
2800 | } | 2800 | } |
2801 | QPtrList<Event> testlist = mCalendar->events(); | 2801 | QPtrList<Event> testlist = mCalendar->events(); |
2802 | Event * test = testlist.first(); | 2802 | Event * test = testlist.first(); |
2803 | QDateTime conflict; | 2803 | QDateTime conflict; |
2804 | QDateTime retVal; | 2804 | QDateTime retVal; |
2805 | bool found = false; | 2805 | bool found = false; |
2806 | Event * cE = 0; | 2806 | Event * cE = 0; |
2807 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 2807 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
2808 | while ( test ) { | 2808 | while ( test ) { |
2809 | qApp->processEvents(); | 2809 | qApp->processEvents(); |
2810 | bool skip = false; | 2810 | bool skip = false; |
2811 | if ( found ) | 2811 | if ( found ) |
2812 | skip = !test->matchTime( ¤t, &conflict ); | 2812 | skip = !test->matchTime( ¤t, &conflict ); |
2813 | else | 2813 | else |
2814 | skip = !test->matchTime( ¤t, 0 ); | 2814 | skip = !test->matchTime( ¤t, 0 ); |
2815 | if ( !skip && !test->doesFloat() ) { | 2815 | if ( !skip && !test->doesFloat() ) { |
2816 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { | 2816 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2817 | if ( ! found ) { | 2817 | if ( ! found ) { |
2818 | conflict = retVal; | 2818 | conflict = retVal; |
2819 | cE = test; | 2819 | cE = test; |
2820 | } else { | 2820 | } else { |
2821 | if ( retVal < conflict ) { | 2821 | if ( retVal < conflict ) { |
2822 | conflict = retVal; | 2822 | conflict = retVal; |
2823 | cE = test; | 2823 | cE = test; |
2824 | } | 2824 | } |
2825 | } | 2825 | } |
2826 | found = true; | 2826 | found = true; |
2827 | } | 2827 | } |
2828 | } | 2828 | } |
2829 | test = testlist.next(); | 2829 | test = testlist.next(); |
2830 | } | 2830 | } |
2831 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | ||
2831 | if ( found ) { | 2832 | if ( found ) { |
2832 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2833 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2833 | qApp->processEvents(); | 2834 | qApp->processEvents(); |
2834 | int km = KMessageBox::warningContinueCancel(this,mess, | 2835 | int km = KMessageBox::warningContinueCancel(this,mess, |
2835 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2836 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2836 | if ( km != KMessageBox::Continue ) | 2837 | if ( km != KMessageBox::Continue ) { |
2837 | return; | 2838 | return; |
2838 | 2839 | } | |
2839 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2840 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2840 | mViewManager->showDayView(); | 2841 | mViewManager->showDayView(); |
2841 | mNavigator->slotDaySelect( conflict.date() ); | 2842 | mNavigator->slotDaySelect( conflict.date() ); |
2842 | int hour = conflict.time().hour(); | 2843 | int hour = conflict.time().hour(); |
2843 | mViewManager->agendaView()->setStartHour( hour ); | 2844 | mViewManager->agendaView()->setStartHour( hour ); |
2844 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2845 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2845 | } else | 2846 | } else |
2846 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 2847 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
2847 | mConflictingEvent = 0; | 2848 | mConflictingEvent = 0; |
2848 | return; | 2849 | return; |
2849 | 2850 | ||
2850 | } | 2851 | } |
2851 | 2852 | ||
2852 | void CalendarView::updateTodoViews() | 2853 | void CalendarView::updateTodoViews() |
2853 | { | 2854 | { |
2854 | mTodoList->updateView(); | 2855 | mTodoList->updateView(); |
2855 | mViewManager->currentView()->updateView(); | 2856 | mViewManager->currentView()->updateView(); |
2856 | 2857 | ||
2857 | } | 2858 | } |
2858 | 2859 | ||
2859 | 2860 | ||
2860 | 2861 | ||
2861 | void CalendarView::clearAllViews() | 2862 | void CalendarView::clearAllViews() |
2862 | { | 2863 | { |
2863 | mTodoList->clearList(); | 2864 | mTodoList->clearList(); |
2864 | mViewManager->clearAllViews(); | 2865 | mViewManager->clearAllViews(); |
2865 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2866 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2866 | if ( sd ) { | 2867 | if ( sd ) { |
2867 | KOListView* kol = sd->listview(); | 2868 | KOListView* kol = sd->listview(); |
2868 | if ( kol ) | 2869 | if ( kol ) |
2869 | kol->clearList(); | 2870 | kol->clearList(); |
2870 | } | 2871 | } |
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 7ce3f1f..6a6fff9 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -336,93 +336,97 @@ void KOCalEditView::readConfig() | |||
336 | if ( row > 1) { | 336 | if ( row > 1) { |
337 | KColorButton *colb = new KColorButton( mw ); | 337 | KColorButton *colb = new KColorButton( mw ); |
338 | mainLayout->addWidget( colb,row,++iii ); | 338 | mainLayout->addWidget( colb,row,++iii ); |
339 | colb->setID( kkf->mCalNumber ); | 339 | colb->setID( kkf->mCalNumber ); |
340 | colb->setColor( kkf->mDefaultColor ); | 340 | colb->setColor( kkf->mDefaultColor ); |
341 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 341 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
342 | KOCalButton* calb = new KOCalButton( mw ); | 342 | KOCalButton* calb = new KOCalButton( mw ); |
343 | mainLayout->addWidget( calb,row,++iii ); | 343 | mainLayout->addWidget( calb,row,++iii ); |
344 | calb->setNum( kkf->mCalNumber ); | 344 | calb->setNum( kkf->mCalNumber ); |
345 | calb->setPixmap ( SmallIcon("minus")); | 345 | calb->setPixmap ( SmallIcon("minus")); |
346 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 346 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
347 | int hei = calb->sizeHint().height(); | 347 | int hei = calb->sizeHint().height(); |
348 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 348 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
349 | } | 349 | } |
350 | ++row; | 350 | ++row; |
351 | kkf = KOPrefs::instance()->mCalendars.next(); | 351 | kkf = KOPrefs::instance()->mCalendars.next(); |
352 | } | 352 | } |
353 | if ( errorLoadStandard ) | 353 | if ( errorLoadStandard ) |
354 | findNewStandard(); | 354 | findNewStandard(); |
355 | lab = new QLabel ( "", mw ); | 355 | lab = new QLabel ( "", mw ); |
356 | mainLayout->addWidget( lab,row,0 ); | 356 | mainLayout->addWidget( lab,row,0 ); |
357 | mw->show(); | 357 | mw->show(); |
358 | 358 | ||
359 | } | 359 | } |
360 | 360 | ||
361 | void KOCalEditView::defaultInfo() | 361 | void KOCalEditView::defaultInfo() |
362 | { | 362 | { |
363 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); | 363 | KMessageBox::information( this, i18n("Please choose the <b>default calendar</b> in this column. Newly created or imported items are added to the default calendar.") ); |
364 | } | 364 | } |
365 | void KOCalEditView::addCal() | 365 | void KOCalEditView::addCal() |
366 | { | 366 | { |
367 | bool tryagain = true; | 367 | bool tryagain = true; |
368 | QString name, file; | 368 | QString name, file = KGlobalSettings::calendarDir()+"newCal.ics"; |
369 | while ( tryagain ) { | 369 | while ( tryagain ) { |
370 | KONewCalPrefs prefs ( this ); | 370 | KONewCalPrefs prefs ( this ); |
371 | prefs.nameE->setText( name ); | 371 | prefs.nameE->setText( name ); |
372 | prefs.url->setURL( file ); | 372 | prefs.url->setURL( file ); |
373 | if ( ! prefs.exec() ) | 373 | if ( ! prefs.exec() ) |
374 | return; | 374 | return; |
375 | name = prefs.calName(); | 375 | name = prefs.calName(); |
376 | file = prefs.calFileName(); | 376 | file = prefs.calFileName(); |
377 | tryagain = false; | 377 | tryagain = false; |
378 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 378 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
379 | while ( kkf ) { | 379 | while ( kkf ) { |
380 | if ( kkf->mName == name ) { | 380 | if ( kkf->mName == name ) { |
381 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); | 381 | KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); |
382 | name = ""; | 382 | name = ""; |
383 | tryagain = true; | 383 | tryagain = true; |
384 | break; | 384 | break; |
385 | } | 385 | } |
386 | if ( kkf->mFileName == file ) { | 386 | if ( kkf->mFileName == file ) { |
387 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); | 387 | KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); |
388 | tryagain = true; | 388 | tryagain = true; |
389 | file = ""; | 389 | file = KGlobalSettings::calendarDir()+"newCal.ics"; |
390 | break; | 390 | break; |
391 | } | 391 | } |
392 | kkf = KOPrefs::instance()->mCalendars.next(); | 392 | kkf = KOPrefs::instance()->mCalendars.next(); |
393 | } | ||
394 | QFileInfo fi ( file ); | ||
395 | if ( fi.isDir() ) { | ||
396 | tryagain = true; | ||
393 | } | 397 | } |
394 | } | 398 | } |
395 | addCalendar ( name, file ); | 399 | addCalendar ( name, file ); |
396 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); | 400 | QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); |
397 | } | 401 | } |
398 | int KOCalEditView::addCalendar( QString name, QString file, bool ask ) | 402 | int KOCalEditView::addCalendar( QString name, QString file, bool ask ) |
399 | { | 403 | { |
400 | 404 | ||
401 | QFileInfo fi ( file ); | 405 | QFileInfo fi ( file ); |
402 | QString absFile = file; | 406 | QString absFile = file; |
403 | bool isRelative = false; | 407 | bool isRelative = false; |
404 | if ( fi.isRelative() ) { | 408 | if ( fi.isRelative() ) { |
405 | isRelative = true; | 409 | isRelative = true; |
406 | absFile = KGlobalSettings::calendarDir()+file; | 410 | absFile = KGlobalSettings::calendarDir()+file; |
407 | fi.setFile( absFile ); | 411 | fi.setFile( absFile ); |
408 | } else { | 412 | } else { |
409 | QString cd = KGlobalSettings::calendarDir(); | 413 | QString cd = KGlobalSettings::calendarDir(); |
410 | if ( file.left( cd.length() ) == cd ) { | 414 | if ( file.left( cd.length() ) == cd ) { |
411 | isRelative = true; | 415 | isRelative = true; |
412 | file = fi.fileName (); | 416 | file = fi.fileName (); |
413 | fi.setFile( absFile ); | 417 | fi.setFile( absFile ); |
414 | } | 418 | } |
415 | } | 419 | } |
416 | if (!fi.exists() ) { | 420 | if (!fi.exists() ) { |
417 | if ( ask ) | 421 | if ( ask ) |
418 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) | 422 | if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( KGlobal::formatMessage (absFile,0) ) )== KMessageBox::No ) |
419 | return 0; | 423 | return 0; |
420 | QFile fileIn( absFile ); | 424 | QFile fileIn( absFile ); |
421 | if (!fileIn.open( IO_WriteOnly ) ) { | 425 | if (!fileIn.open( IO_WriteOnly ) ) { |
422 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); | 426 | KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); |
423 | return 0; | 427 | return 0; |
424 | } | 428 | } |
425 | QTextStream tsIn( &fileIn ); | 429 | QTextStream tsIn( &fileIn ); |
426 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 430 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
427 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; | 431 | tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; |
428 | fileIn.close(); | 432 | fileIn.close(); |