summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp21
-rw-r--r--korganizer/mainwindow.cpp12
2 files changed, 21 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3ab4bb4..a76f2ed 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -367,13 +367,13 @@ CalendarView::CalendarView( Calendar *calendar,
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 369 mNextAlarmDateTime = QDateTime::currentDateTime();
370 setFocusPolicy (NoFocus ); 370 setFocusPolicy (NoFocus );
371 mViewerCallerIsSearchDialog = false; 371 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 372 mBlockShowDates = false;
373 373 mConflictingEvent = 0;
374 mDatePickerMode = 0; 374 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 375 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 376 mViewManager = new KOViewManager( this );
377 mDialogManager = new KODialogManager( this ); 377 mDialogManager = new KODialogManager( this );
378 mEventViewerDialog = 0; 378 mEventViewerDialog = 0;
379 mModified = false; 379 mModified = false;
@@ -2790,15 +2790,16 @@ void CalendarView::changeEventDisplay(Event *which, int action)
2790void CalendarView::checkConflictForEvent() 2790void CalendarView::checkConflictForEvent()
2791{ 2791{
2792 2792
2793 if (!KOPrefs::instance()->mConfirm) 2793 if (!KOPrefs::instance()->mConfirm)
2794 return; 2794 return;
2795 if ( ! mConflictingEvent ) return; 2795 if ( ! mConflictingEvent ) return;
2796 Event * conflictingEvent = mConflictingEvent;
2797 mConflictingEvent = 0;
2796 QDateTime current = QDateTime::currentDateTime(); 2798 QDateTime current = QDateTime::currentDateTime();
2797 if ( ! mConflictingEvent->matchTime( &current, 0 ) ) { 2799 if ( ! conflictingEvent->matchTime( &current, 0 ) ) {
2798 mConflictingEvent = 0;
2799 return; 2800 return;
2800 } 2801 }
2801 QPtrList<Event> testlist = mCalendar->events(); 2802 QPtrList<Event> testlist = mCalendar->events();
2802 Event * test = testlist.first(); 2803 Event * test = testlist.first();
2803 QDateTime conflict; 2804 QDateTime conflict;
2804 QDateTime retVal; 2805 QDateTime retVal;
@@ -2810,13 +2811,13 @@ void CalendarView::checkConflictForEvent()
2810 bool skip = false; 2811 bool skip = false;
2811 if ( found ) 2812 if ( found )
2812 skip = !test->matchTime( &current, &conflict ); 2813 skip = !test->matchTime( &current, &conflict );
2813 else 2814 else
2814 skip = !test->matchTime( &current, 0 ); 2815 skip = !test->matchTime( &current, 0 );
2815 if ( !skip && !test->doesFloat() ) { 2816 if ( !skip && !test->doesFloat() ) {
2816 if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) { 2817 if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
2817 if ( ! found ) { 2818 if ( ! found ) {
2818 conflict = retVal; 2819 conflict = retVal;
2819 cE = test; 2820 cE = test;
2820 } else { 2821 } else {
2821 if ( retVal < conflict ) { 2822 if ( retVal < conflict ) {
2822 conflict = retVal; 2823 conflict = retVal;
@@ -2827,28 +2828,27 @@ void CalendarView::checkConflictForEvent()
2827 } 2828 }
2828 } 2829 }
2829 test = testlist.next(); 2830 test = testlist.next();
2830 } 2831 }
2831 topLevelWidget()->setCaption( i18n("KO/Pi") ); 2832 topLevelWidget()->setCaption( i18n("KO/Pi") );
2832 if ( found ) { 2833 if ( found ) {
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()) ) ; 2834 QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ;
2834 qApp->processEvents(); 2835 qApp->processEvents();
2835 int km = KMessageBox::warningContinueCancel(this,mess, 2836 int km = KMessageBox::warningContinueCancel(this,mess,
2836 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); 2837 i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
2837 if ( km != KMessageBox::Continue ) { 2838 if ( km != KMessageBox::Continue ) {
2838 return; 2839 return;
2839 } 2840 }
2840 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) 2841 if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 )
2841 mViewManager->showDayView(); 2842 mViewManager->showDayView();
2842 mNavigator->slotDaySelect( conflict.date() ); 2843 mNavigator->slotDaySelect( conflict.date() );
2843 int hour = conflict.time().hour(); 2844 int hour = conflict.time().hour();
2844 mViewManager->agendaView()->setStartHour( hour ); 2845 mViewManager->agendaView()->setStartHour( hour );
2845 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); 2846 topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
2846 } else 2847 } else
2847 topLevelWidget()->setCaption( i18n("No conflict found") ); 2848 topLevelWidget()->setCaption( i18n("No conflict found") );
2848 mConflictingEvent = 0;
2849 return; 2849 return;
2850 2850
2851} 2851}
2852 2852
2853void CalendarView::updateTodoViews() 2853void CalendarView::updateTodoViews()
2854{ 2854{
@@ -4089,18 +4089,19 @@ void CalendarView::openAddressbook()
4089{ 4089{
4090 KRun::runCommand("kaddressbook"); 4090 KRun::runCommand("kaddressbook");
4091} 4091}
4092 4092
4093void CalendarView::setModified(bool modified) 4093void CalendarView::setModified(bool modified)
4094{ 4094{
4095 //qDebug("CalendarView::setModified %d ", modified);
4095 if ( modified ) 4096 if ( modified )
4096 emit signalmodified(); 4097 emit signalmodified();
4097 if (mModified != modified) { 4098 mModified = modified;
4098 mModified = modified; 4099 if ( mModified )
4099 emit modifiedChanged(mModified); 4100 emit modifiedChanged(mModified);
4100 } 4101
4101} 4102}
4102 4103
4103bool CalendarView::isReadOnly() 4104bool CalendarView::isReadOnly()
4104{ 4105{
4105 return mReadOnly; 4106 return mReadOnly;
4106} 4107}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 279955f..77d0ac8 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1911,12 +1911,16 @@ void MainWindow::saveOnClose()
1911void MainWindow::slotModifiedChanged( bool ) 1911void MainWindow::slotModifiedChanged( bool )
1912{ 1912{
1913 if ( mBlockAtStartup ) 1913 if ( mBlockAtStartup )
1914 return; 1914 return;
1915 1915
1916 int msec; 1916 int msec;
1917 if ( mCalendarModifiedFlag ) {
1918 //qDebug(" MainWindow timer is running ");
1919 return;
1920 }
1917 // we store the changes after 1 minute, 1921 // we store the changes after 1 minute,
1918 // and for safety reasons after 10 minutes again 1922 // and for safety reasons after 10 minutes again
1919 if ( !mSyncManager->blockSave() ) 1923 if ( !mSyncManager->blockSave() )
1920 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1924 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1921 else 1925 else
1922 msec = 1000 * 600; 1926 msec = 1000 * 600;
@@ -1972,14 +1976,15 @@ void MainWindow::save()
1972 if ( mView->viewManager()->journalView() ) 1976 if ( mView->viewManager()->journalView() )
1973 mView->viewManager()->journalView()->checkModified(); 1977 mView->viewManager()->journalView()->checkModified();
1974 if ( !mCalendarModifiedFlag ) { 1978 if ( !mCalendarModifiedFlag ) {
1975 qDebug("KO: Calendar not modified. Nothing saved."); 1979 qDebug("KO: Calendar not modified. Nothing saved.");
1976 return; 1980 return;
1977 } 1981 }
1978 if ( mSyncManager->blockSave() ) 1982 if ( mSyncManager->blockSave() ) {
1979 return; 1983 return;
1984 }
1980 mSyncManager->setBlockSave(true); 1985 mSyncManager->setBlockSave(true);
1981 if ( mView->checkAllFileVersions() ) { 1986 if ( mView->checkAllFileVersions() ) {
1982 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ 1987 if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
1983 QDate reference ( 2000,1,1); 1988 QDate reference ( 2000,1,1);
1984 int daysTo = reference.daysTo ( QDate::currentDate() ); 1989 int daysTo = reference.daysTo ( QDate::currentDate() );
1985 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { 1990 if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
@@ -1998,14 +2003,17 @@ void MainWindow::save()
1998 QString savemes; 2003 QString savemes;
1999 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 2004 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
2000 if ( !isMinimized () ) 2005 if ( !isMinimized () )
2001 setCaption(savemes); 2006 setCaption(savemes);
2002 else 2007 else
2003 qDebug(savemes); 2008 qDebug(savemes);
2004 } else 2009 } else {
2005 setCaption(i18n("Saving cancelled!")); 2010 setCaption(i18n("Saving cancelled!"));
2011 mCalendarModifiedFlag = false;
2012 slotModifiedChanged( true );
2013 }
2006 mSyncManager->setBlockSave( false ); 2014 mSyncManager->setBlockSave( false );
2007} 2015}
2008 2016
2009void MainWindow::keyReleaseEvent ( QKeyEvent * e) 2017void MainWindow::keyReleaseEvent ( QKeyEvent * e)
2010{ 2018{
2011 if ( !e->isAutoRepeat() ) { 2019 if ( !e->isAutoRepeat() ) {