-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 @@ -698,97 +698,97 @@ void CalendarView::nextConflict( bool all, bool allday ) Event * test2 = testlist2.first(); while ( test2 ) { skip = test2->isTagged(); if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); if ( !skip ) { if ( found ) skip = !test2->matchTime( &startDT, &conflict ); else skip = !test2->matchTime( &startDT, 0 ); } if ( !skip ) { if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { //qDebug("overlap "); if ( ! found ) { if ( retVal >= startDT ) { conflict = retVal; cE = test; cE2 = test2; found = true; } } else { if ( retVal >= startDT && retVal < conflict ) { conflict = retVal; cE = test; cE2 = test2; } } } } test2 = testlist2.next(); } } test->setTagged( true ); test = testlist.next(); } //qDebug("Search time : %d", tm.elapsed()); if ( found ) { if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) mViewManager->showDayView(); mNavigator->slotDaySelect( conflict.date() ); int hour = conflict.time().hour(); mViewManager->agendaView()->setStartHour( hour ); topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); block = false; return; } topLevelWidget()->setCaption( i18n("No conflict found") ); - qDebug("No conflict found "); + //qDebug("No conflict found "); block = false; return; } void CalendarView::conflictAll() { nextConflict ( true, true ); } void CalendarView::conflictAllday() { nextConflict ( false, true ); } void CalendarView::conflictNotAll() { nextConflict ( false, false ); } void CalendarView::setCalReadOnly( int id, bool readO ) { if ( readO ) { emit save(); } mCalendar->setReadOnly( id, readO ); } void CalendarView::setScrollBarStep(int val ) { #ifdef DESKTOP_VERSION mDateScrollBar->setLineStep ( val ); #endif } void CalendarView::scrollBarValue(int val ) { #ifdef DESKTOP_VERSION if ( QApplication::desktop()->width() < 800 ) return; static bool block = false; if ( block ) return; block = true; int count = mNavigator->selectedDates().count(); int day = mNavigator->selectedDates().first().dayOfYear(); int stepdays = val; if ( mDateScrollBar->lineStep () <= count ) { //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); //qDebug("VAL %d ",val ); stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); stepdays = day+stepdays; if ( stepdays < 0 ) stepdays = 0; } if ( stepdays == day ) { @@ -2783,104 +2783,105 @@ void CalendarView::changeEventDisplay(Event *which, int action) QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); } // } } else { mViewManager->currentView()->updateView(); } } void CalendarView::checkConflictForEvent() { if (!KOPrefs::instance()->mConfirm) return; if ( ! mConflictingEvent ) return; QDateTime current = QDateTime::currentDateTime(); if ( ! mConflictingEvent->matchTime( ¤t, 0 ) ) { mConflictingEvent = 0; return; } QPtrList<Event> testlist = mCalendar->events(); Event * test = testlist.first(); QDateTime conflict; QDateTime retVal; bool found = false; Event * cE = 0; topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); while ( test ) { qApp->processEvents(); bool skip = false; if ( found ) skip = !test->matchTime( ¤t, &conflict ); else skip = !test->matchTime( ¤t, 0 ); if ( !skip && !test->doesFloat() ) { if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { if ( ! found ) { conflict = retVal; cE = test; } else { if ( retVal < conflict ) { conflict = retVal; cE = test; } } found = true; } } test = testlist.next(); } + topLevelWidget()->setCaption( i18n("KO/Pi") ); if ( found ) { 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()) ) ; qApp->processEvents(); int km = KMessageBox::warningContinueCancel(this,mess, i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); - if ( km != KMessageBox::Continue ) + if ( km != KMessageBox::Continue ) { return; - + } if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) mViewManager->showDayView(); mNavigator->slotDaySelect( conflict.date() ); int hour = conflict.time().hour(); mViewManager->agendaView()->setStartHour( hour ); topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); } else topLevelWidget()->setCaption( i18n("No conflict found") ); mConflictingEvent = 0; return; } void CalendarView::updateTodoViews() { mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::clearAllViews() { mTodoList->clearList(); mViewManager->clearAllViews(); SearchDialog * sd = mDialogManager->getSearchDialog(); if ( sd ) { KOListView* kol = sd->listview(); if ( kol ) kol->clearList(); } } void CalendarView::updateView() { static bool clearallviews = false; if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { if ( clearallviews ) { clearAllViews(); clearallviews = false; } return; } clearallviews = true; DateList tmpList = mNavigator->selectedDates(); if ( KOPrefs::instance()->mHideNonStartedTodos ) mTodoList->updateView(); diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 7ce3f1f..6a6fff9 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -320,125 +320,129 @@ void KOCalEditView::readConfig() //lab = new QLabel (" ", mw ); //mainLayout->addWidget( lab,row,++iii ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); cb->setChecked( kkf->isAlarmEnabled && !kkf->mErrorOnLoad); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); cb->setChecked( kkf->isReadOnly ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); if ( row > 1) { KColorButton *colb = new KColorButton( mw ); mainLayout->addWidget( colb,row,++iii ); colb->setID( kkf->mCalNumber ); colb->setColor( kkf->mDefaultColor ); connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); KOCalButton* calb = new KOCalButton( mw ); mainLayout->addWidget( calb,row,++iii ); calb->setNum( kkf->mCalNumber ); calb->setPixmap ( SmallIcon("minus")); connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); int hei = calb->sizeHint().height(); //calb->setMaximumSize( hei*9/10, hei*9/10 ); } ++row; kkf = KOPrefs::instance()->mCalendars.next(); } if ( errorLoadStandard ) findNewStandard(); lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,row,0 ); mw->show(); } void KOCalEditView::defaultInfo() { 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.") ); } void KOCalEditView::addCal() { bool tryagain = true; - QString name, file; + QString name, file = KGlobalSettings::calendarDir()+"newCal.ics"; while ( tryagain ) { KONewCalPrefs prefs ( this ); prefs.nameE->setText( name ); prefs.url->setURL( file ); if ( ! prefs.exec() ) return; name = prefs.calName(); file = prefs.calFileName(); tryagain = false; KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { if ( kkf->mName == name ) { KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); name = ""; tryagain = true; break; } if ( kkf->mFileName == file ) { KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) ); tryagain = true; - file = ""; + file = KGlobalSettings::calendarDir()+"newCal.ics"; break; } kkf = KOPrefs::instance()->mCalendars.next(); + } + QFileInfo fi ( file ); + if ( fi.isDir() ) { + tryagain = true; } } addCalendar ( name, file ); - QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); + QTimer::singleShot( 100, this, SIGNAL ( checkCalendar() ) ); } int KOCalEditView::addCalendar( QString name, QString file, bool ask ) { QFileInfo fi ( file ); QString absFile = file; bool isRelative = false; if ( fi.isRelative() ) { isRelative = true; absFile = KGlobalSettings::calendarDir()+file; fi.setFile( absFile ); } else { QString cd = KGlobalSettings::calendarDir(); if ( file.left( cd.length() ) == cd ) { isRelative = true; file = fi.fileName (); fi.setFile( absFile ); } } if (!fi.exists() ) { if ( ask ) 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 ) return 0; QFile fileIn( absFile ); if (!fileIn.open( IO_WriteOnly ) ) { KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); return 0; } QTextStream tsIn( &fileIn ); tsIn.setCodec( QTextCodec::codecForName("utf8") ); tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; fileIn.close(); } KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); kkf->mName = name; kkf->mFileName = absFile; kkf->mSavedFileName = file; kkf->isRelative = isRelative; emit calendarAdded( kkf->mCalNumber ); if ( ask ) emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); return kkf->mCalNumber; } int KOCalEditView::getBirtdayID() { KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); while ( kkf ) { |