summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/mainwindow.cpp12
2 files changed, 20 insertions, 11 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,
void CalendarView::init()
{
mNextAlarmDateTime = QDateTime::currentDateTime();
setFocusPolicy (NoFocus );
mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
-
+ mConflictingEvent = 0;
mDatePickerMode = 0;
mCurrentSyncDevice = "";
mViewManager = new KOViewManager( this );
mDialogManager = new KODialogManager( this );
mEventViewerDialog = 0;
mModified = false;
@@ -2790,15 +2790,16 @@ void CalendarView::changeEventDisplay(Event *which, int action)
void CalendarView::checkConflictForEvent()
{
if (!KOPrefs::instance()->mConfirm)
return;
if ( ! mConflictingEvent ) return;
- QDateTime current = QDateTime::currentDateTime();
- if ( ! mConflictingEvent->matchTime( &current, 0 ) ) {
+ Event * conflictingEvent = mConflictingEvent;
mConflictingEvent = 0;
+ QDateTime current = QDateTime::currentDateTime();
+ if ( ! conflictingEvent->matchTime( &current, 0 ) ) {
return;
}
QPtrList<Event> testlist = mCalendar->events();
Event * test = testlist.first();
QDateTime conflict;
QDateTime retVal;
@@ -2810,13 +2811,13 @@ void CalendarView::checkConflictForEvent()
bool skip = false;
if ( found )
skip = !test->matchTime( &current, &conflict );
else
skip = !test->matchTime( &current, 0 );
if ( !skip && !test->doesFloat() ) {
- if ( mConflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
+ if ( conflictingEvent->isOverlapping ( test, &retVal, &current ) ) {
if ( ! found ) {
conflict = retVal;
cE = test;
} else {
if ( retVal < conflict ) {
conflict = retVal;
@@ -2827,28 +2828,27 @@ void CalendarView::checkConflictForEvent()
}
}
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()) ) ;
+ 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()) ) ;
qApp->processEvents();
int km = KMessageBox::warningContinueCancel(this,mess,
i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!"));
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 ) ) );
+ topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) );
} else
topLevelWidget()->setCaption( i18n("No conflict found") );
- mConflictingEvent = 0;
return;
}
void CalendarView::updateTodoViews()
{
@@ -4089,18 +4089,19 @@ void CalendarView::openAddressbook()
{
KRun::runCommand("kaddressbook");
}
void CalendarView::setModified(bool modified)
{
+ //qDebug("CalendarView::setModified %d ", modified);
if ( modified )
emit signalmodified();
- if (mModified != modified) {
mModified = modified;
+ if ( mModified )
emit modifiedChanged(mModified);
- }
+
}
bool CalendarView::isReadOnly()
{
return mReadOnly;
}
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()
void MainWindow::slotModifiedChanged( bool )
{
if ( mBlockAtStartup )
return;
int msec;
+ if ( mCalendarModifiedFlag ) {
+ //qDebug(" MainWindow timer is running ");
+ return;
+ }
// we store the changes after 1 minute,
// and for safety reasons after 10 minutes again
if ( !mSyncManager->blockSave() )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
else
msec = 1000 * 600;
@@ -1972,14 +1976,15 @@ void MainWindow::save()
if ( mView->viewManager()->journalView() )
mView->viewManager()->journalView()->checkModified();
if ( !mCalendarModifiedFlag ) {
qDebug("KO: Calendar not modified. Nothing saved.");
return;
}
- if ( mSyncManager->blockSave() )
+ if ( mSyncManager->blockSave() ) {
return;
+ }
mSyncManager->setBlockSave(true);
if ( mView->checkAllFileVersions() ) {
if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
QDate reference ( 2000,1,1);
int daysTo = reference.daysTo ( QDate::currentDate() );
if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
@@ -1998,14 +2003,17 @@ void MainWindow::save()
QString savemes;
savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
if ( !isMinimized () )
setCaption(savemes);
else
qDebug(savemes);
- } else
+ } else {
setCaption(i18n("Saving cancelled!"));
+ mCalendarModifiedFlag = false;
+ slotModifiedChanged( true );
+ }
mSyncManager->setBlockSave( false );
}
void MainWindow::keyReleaseEvent ( QKeyEvent * e)
{
if ( !e->isAutoRepeat() ) {