author | zautrix <zautrix> | 2004-10-05 08:32:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 08:32:25 (UTC) |
commit | 701cd3c2b2b713c12797f5bda24c35d3a7889539 (patch) (unidiff) | |
tree | 56d07b2f4a050fbc839ab6435b2266e8a52a08ba /korganizer | |
parent | ad859d26b813101adab963f50e694961702561d9 (diff) | |
download | kdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.zip kdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.tar.gz kdepimpi-701cd3c2b2b713c12797f5bda24c35d3a7889539.tar.bz2 |
warning dialog fixes
-rw-r--r-- | korganizer/calendarview.cpp | 17 | ||||
-rw-r--r-- | korganizer/calendarview.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index fecc7e2..687943e 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1502,57 +1502,70 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1502 | if ( mStorage->load() ) { | 1502 | if ( mStorage->load() ) { |
1503 | if ( merge ) ;//setModified( true ); | 1503 | if ( merge ) ;//setModified( true ); |
1504 | else { | 1504 | else { |
1505 | //setModified( true ); | 1505 | //setModified( true ); |
1506 | mViewManager->setDocumentId( filename ); | 1506 | mViewManager->setDocumentId( filename ); |
1507 | mDialogManager->setDocumentId( filename ); | 1507 | mDialogManager->setDocumentId( filename ); |
1508 | mTodoList->setDocumentId( filename ); | 1508 | mTodoList->setDocumentId( filename ); |
1509 | } | 1509 | } |
1510 | globalFlagBlockAgenda = 2; | 1510 | globalFlagBlockAgenda = 2; |
1511 | // if ( getLastSyncEvent() ) | 1511 | // if ( getLastSyncEvent() ) |
1512 | // getLastSyncEvent()->setReadOnly( true ); | 1512 | // getLastSyncEvent()->setReadOnly( true ); |
1513 | mCalendar->reInitAlarmSettings(); | 1513 | mCalendar->reInitAlarmSettings(); |
1514 | setSyncEventsReadOnly(); | 1514 | setSyncEventsReadOnly(); |
1515 | updateUnmanagedViews(); | 1515 | updateUnmanagedViews(); |
1516 | updateView(); | 1516 | updateView(); |
1517 | loadedFileVersion = QDateTime::currentDateTime(); | 1517 | loadedFileVersion = QDateTime::currentDateTime(); |
1518 | if ( filename != MainWindow::defaultFileName() ) { | 1518 | if ( filename != MainWindow::defaultFileName() ) { |
1519 | saveCalendar( MainWindow::defaultFileName() ); | 1519 | saveCalendar( MainWindow::defaultFileName() ); |
1520 | watchSavedFile(); | 1520 | watchSavedFile(); |
1521 | } | 1521 | } |
1522 | return true; | 1522 | return true; |
1523 | } else { | 1523 | } else { |
1524 | // while failing to load, the calendar object could | 1524 | // while failing to load, the calendar object could |
1525 | // have become partially populated. Clear it out. | 1525 | // have become partially populated. Clear it out. |
1526 | if ( !merge ) mCalendar->close(); | 1526 | if ( !merge ) { |
1527 | mCalendar->close(); | ||
1528 | mViewManager->setDocumentId( filename ); | ||
1529 | mDialogManager->setDocumentId( filename ); | ||
1530 | mTodoList->setDocumentId( filename ); | ||
1531 | } | ||
1527 | 1532 | ||
1528 | KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1533 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1529 | 1534 | ||
1535 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | ||
1530 | globalFlagBlockAgenda = 2; | 1536 | globalFlagBlockAgenda = 2; |
1537 | mCalendar->reInitAlarmSettings(); | ||
1538 | setSyncEventsReadOnly(); | ||
1539 | updateUnmanagedViews(); | ||
1531 | updateView(); | 1540 | updateView(); |
1532 | } | 1541 | } |
1533 | return false; | 1542 | return false; |
1534 | } | 1543 | } |
1544 | void CalendarView::showOpenError() | ||
1545 | { | ||
1546 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | ||
1547 | } | ||
1535 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1548 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1536 | { | 1549 | { |
1537 | loadedFileVersion = dt; | 1550 | loadedFileVersion = dt; |
1538 | } | 1551 | } |
1539 | bool CalendarView::checkFileChanged(QString fn) | 1552 | bool CalendarView::checkFileChanged(QString fn) |
1540 | { | 1553 | { |
1541 | QFileInfo finf ( fn ); | 1554 | QFileInfo finf ( fn ); |
1542 | if ( !finf.exists() ) | 1555 | if ( !finf.exists() ) |
1543 | return true; | 1556 | return true; |
1544 | QDateTime dt = finf.lastModified (); | 1557 | QDateTime dt = finf.lastModified (); |
1545 | if ( dt <= loadedFileVersion ) | 1558 | if ( dt <= loadedFileVersion ) |
1546 | return false; | 1559 | return false; |
1547 | return true; | 1560 | return true; |
1548 | 1561 | ||
1549 | } | 1562 | } |
1550 | void CalendarView::watchSavedFile() | 1563 | void CalendarView::watchSavedFile() |
1551 | { | 1564 | { |
1552 | QFileInfo finf ( MainWindow::defaultFileName()); | 1565 | QFileInfo finf ( MainWindow::defaultFileName()); |
1553 | if ( !finf.exists() ) | 1566 | if ( !finf.exists() ) |
1554 | return; | 1567 | return; |
1555 | QDateTime dt = finf.lastModified (); | 1568 | QDateTime dt = finf.lastModified (); |
1556 | if ( dt < loadedFileVersion ) { | 1569 | if ( dt < loadedFileVersion ) { |
1557 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1570 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1558 | return; | 1571 | return; |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 355bb84..cd54685 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -151,48 +151,49 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
151 | void incidenceSelected( Incidence * ); | 151 | void incidenceSelected( Incidence * ); |
152 | /** Emitted, when a todoitem is selected or deselected. */ | 152 | /** Emitted, when a todoitem is selected or deselected. */ |
153 | void todoSelected( bool ); | 153 | void todoSelected( bool ); |
154 | 154 | ||
155 | /** | 155 | /** |
156 | Emitted, when clipboard content changes. Parameter indicates if paste | 156 | Emitted, when clipboard content changes. Parameter indicates if paste |
157 | is possible or not. | 157 | is possible or not. |
158 | */ | 158 | */ |
159 | void pasteEnabled(bool); | 159 | void pasteEnabled(bool); |
160 | 160 | ||
161 | /** Emitted, when the number of incoming messages has changed. */ | 161 | /** Emitted, when the number of incoming messages has changed. */ |
162 | void numIncomingChanged(int); | 162 | void numIncomingChanged(int); |
163 | 163 | ||
164 | /** Emitted, when the number of outgoing messages has changed. */ | 164 | /** Emitted, when the number of outgoing messages has changed. */ |
165 | void numOutgoingChanged(int); | 165 | void numOutgoingChanged(int); |
166 | 166 | ||
167 | /** Send status message, which can e.g. be displayed in the status bar. */ | 167 | /** Send status message, which can e.g. be displayed in the status bar. */ |
168 | void statusMessage(const QString &); | 168 | void statusMessage(const QString &); |
169 | 169 | ||
170 | void calendarViewExpanded( bool ); | 170 | void calendarViewExpanded( bool ); |
171 | void updateSearchDialog(); | 171 | void updateSearchDialog(); |
172 | 172 | ||
173 | 173 | ||
174 | public slots: | 174 | public slots: |
175 | void showOpenError(); | ||
175 | void watchSavedFile(); | 176 | void watchSavedFile(); |
176 | void recheckTimerAlarm(); | 177 | void recheckTimerAlarm(); |
177 | void checkNextTimerAlarm(); | 178 | void checkNextTimerAlarm(); |
178 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 179 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
179 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); | 180 | void addSuspendAlarm(const QDateTime &qdt, const QString ¬i ); |
180 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); | 181 | void removeAlarm(const QDateTime &qdt, const QString ¬i ); |
181 | 182 | ||
182 | /** options dialog made a changed to the configuration. we catch this | 183 | /** options dialog made a changed to the configuration. we catch this |
183 | * and notify all widgets which need to update their configuration. */ | 184 | * and notify all widgets which need to update their configuration. */ |
184 | void updateConfig(); | 185 | void updateConfig(); |
185 | 186 | ||
186 | /** | 187 | /** |
187 | Load calendar from file \a filename. If \a merge is true, load | 188 | Load calendar from file \a filename. If \a merge is true, load |
188 | calendar into existing one, if it is false, clear calendar, before | 189 | calendar into existing one, if it is false, clear calendar, before |
189 | loading. Return true, if calendar could be successfully loaded. | 190 | loading. Return true, if calendar could be successfully loaded. |
190 | */ | 191 | */ |
191 | bool openCalendar(QString filename, bool merge=false); | 192 | bool openCalendar(QString filename, bool merge=false); |
192 | bool syncCalendar(QString filename,int mode = 0 ); | 193 | bool syncCalendar(QString filename,int mode = 0 ); |
193 | 194 | ||
194 | /** | 195 | /** |
195 | Save calendar data to file. Return true if calendar could be | 196 | Save calendar data to file. Return true if calendar could be |
196 | successfully saved. | 197 | successfully saved. |
197 | */ | 198 | */ |
198 | bool saveCalendar(QString filename); | 199 | bool saveCalendar(QString filename); |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 43ee2d7..7b666d1 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -123,76 +123,74 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
123 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 123 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
124 | setDefaultPreferences(); | 124 | setDefaultPreferences(); |
125 | mCalendar = new CalendarLocal(); | 125 | mCalendar = new CalendarLocal(); |
126 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 126 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
127 | mView->hide(); | 127 | mView->hide(); |
128 | //mView->resize(splash->size() ); | 128 | //mView->resize(splash->size() ); |
129 | initActions(); | 129 | initActions(); |
130 | #ifndef DESKTOP_VERSION | 130 | #ifndef DESKTOP_VERSION |
131 | iconToolBar->show(); | 131 | iconToolBar->show(); |
132 | qApp->processEvents(); | 132 | qApp->processEvents(); |
133 | #endif | 133 | #endif |
134 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 134 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
135 | int vh = height() ; | 135 | int vh = height() ; |
136 | int vw = width(); | 136 | int vw = width(); |
137 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 137 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
138 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 138 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
139 | vh -= iconToolBar->height(); | 139 | vh -= iconToolBar->height(); |
140 | } else { | 140 | } else { |
141 | vw -= iconToolBar->height(); | 141 | vw -= iconToolBar->height(); |
142 | } | 142 | } |
143 | //mView->setMaximumSize( splash->size() ); | 143 | //mView->setMaximumSize( splash->size() ); |
144 | //mView->resize( splash->size() ); | 144 | //mView->resize( splash->size() ); |
145 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 145 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
146 | mView->readSettings(); | 146 | mView->readSettings(); |
147 | bool oldOpened = false; | ||
148 | bool newFile = false; | 147 | bool newFile = false; |
149 | if( !QFile::exists( defaultFileName() ) ) { | 148 | if( !QFile::exists( defaultFileName() ) ) { |
150 | QFileInfo finfo ( defaultFileName() ); | 149 | QFileInfo finfo ( defaultFileName() ); |
151 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 150 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
152 | qDebug("oldfile %s ", oldFile.latin1()); | 151 | qDebug("oldfile %s ", oldFile.latin1()); |
153 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 152 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
154 | finfo.setFile( oldFile ); | 153 | finfo.setFile( oldFile ); |
155 | if (finfo.exists() ) { | 154 | if (finfo.exists() ) { |
156 | KMessageBox::information( this, message); | 155 | KMessageBox::information( this, message); |
157 | mView->openCalendar( oldFile ); | 156 | mView->openCalendar( oldFile ); |
158 | qApp->processEvents(); | 157 | qApp->processEvents(); |
159 | } else { | 158 | } else { |
160 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 159 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
161 | finfo.setFile( oldFile ); | 160 | finfo.setFile( oldFile ); |
162 | if (finfo.exists() ) { | 161 | if (finfo.exists() ) { |
163 | KMessageBox::information( this, message); | 162 | KMessageBox::information( this, message); |
164 | mView->openCalendar( oldFile ); | 163 | mView->openCalendar( oldFile ); |
165 | qApp->processEvents(); | 164 | qApp->processEvents(); |
166 | } | 165 | } |
167 | } | 166 | } |
168 | mView->saveCalendar( defaultFileName() ); | 167 | mView->saveCalendar( defaultFileName() ); |
169 | newFile = true; | 168 | newFile = true; |
170 | } | 169 | } |
171 | 170 | ||
172 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 171 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
173 | if ( ! oldOpened ) | 172 | mView->openCalendar( defaultFileName() ); |
174 | mView->openCalendar( defaultFileName() ); | ||
175 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 173 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
176 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 174 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
177 | 175 | ||
178 | if ( KOPrefs::instance()->mLanguageChanged ) { | 176 | if ( KOPrefs::instance()->mLanguageChanged ) { |
179 | KOPrefs::instance()->setCategoryDefaults(); | 177 | KOPrefs::instance()->setCategoryDefaults(); |
180 | int count = mView->addCategories(); | 178 | int count = mView->addCategories(); |
181 | KOPrefs::instance()->mLanguageChanged = false; | 179 | KOPrefs::instance()->mLanguageChanged = false; |
182 | } | 180 | } |
183 | processIncidenceSelection( 0 ); | 181 | processIncidenceSelection( 0 ); |
184 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 182 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
185 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 183 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
186 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 184 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
187 | SLOT( slotModifiedChanged( bool ) ) ); | 185 | SLOT( slotModifiedChanged( bool ) ) ); |
188 | 186 | ||
189 | 187 | ||
190 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 188 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
191 | mView->setModified( false ); | 189 | mView->setModified( false ); |
192 | mBlockAtStartup = false; | 190 | mBlockAtStartup = false; |
193 | mView->setModified( false ); | 191 | mView->setModified( false ); |
194 | setCentralWidget( mView ); | 192 | setCentralWidget( mView ); |
195 | globalFlagBlockStartup = 0; | 193 | globalFlagBlockStartup = 0; |
196 | mView->show(); | 194 | mView->show(); |
197 | delete splash; | 195 | delete splash; |
198 | if ( newFile ) | 196 | if ( newFile ) |