author | zautrix <zautrix> | 2004-10-05 13:34:33 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 13:34:33 (UTC) |
commit | 191ced43b27c047b0a39f0acdc8ba1f8a58817df (patch) (unidiff) | |
tree | d164ae32c16259d9a8d5c9fdfa74f975d1f10075 /korganizer | |
parent | a946c09db6f71f595d8bdcb6b34ba3160c5497dc (diff) | |
download | kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.zip kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.tar.gz kdepimpi-191ced43b27c047b0a39f0acdc8ba1f8a58817df.tar.bz2 |
fix for filewatch and vcal timezone
-rw-r--r-- | korganizer/calendarview.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 687943e..b1da144 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1493,49 +1493,49 @@ bool CalendarView::openCalendar(QString filename, bool merge) | |||
1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1493 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1494 | return false; | 1494 | return false; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | globalFlagBlockAgenda = 1; | 1497 | globalFlagBlockAgenda = 1; |
1498 | if (!merge) mCalendar->close(); | 1498 | if (!merge) mCalendar->close(); |
1499 | 1499 | ||
1500 | mStorage->setFileName( filename ); | 1500 | mStorage->setFileName( filename ); |
1501 | 1501 | ||
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 | setLoadedFileVersion( QDateTime::currentDateTime().addSecs( -1 )); |
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 ) { | 1526 | if ( !merge ) { |
1527 | mCalendar->close(); | 1527 | mCalendar->close(); |
1528 | mViewManager->setDocumentId( filename ); | 1528 | mViewManager->setDocumentId( filename ); |
1529 | mDialogManager->setDocumentId( filename ); | 1529 | mDialogManager->setDocumentId( filename ); |
1530 | mTodoList->setDocumentId( filename ); | 1530 | mTodoList->setDocumentId( filename ); |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | //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)); |
1534 | 1534 | ||
1535 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1535 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1536 | globalFlagBlockAgenda = 2; | 1536 | globalFlagBlockAgenda = 2; |
1537 | mCalendar->reInitAlarmSettings(); | 1537 | mCalendar->reInitAlarmSettings(); |
1538 | setSyncEventsReadOnly(); | 1538 | setSyncEventsReadOnly(); |
1539 | updateUnmanagedViews(); | 1539 | updateUnmanagedViews(); |
1540 | updateView(); | 1540 | updateView(); |
1541 | } | 1541 | } |
@@ -1546,48 +1546,49 @@ void CalendarView::showOpenError() | |||
1546 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1546 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1547 | } | 1547 | } |
1548 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1548 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1549 | { | 1549 | { |
1550 | loadedFileVersion = dt; | 1550 | loadedFileVersion = dt; |
1551 | } | 1551 | } |
1552 | bool CalendarView::checkFileChanged(QString fn) | 1552 | bool CalendarView::checkFileChanged(QString fn) |
1553 | { | 1553 | { |
1554 | QFileInfo finf ( fn ); | 1554 | QFileInfo finf ( fn ); |
1555 | if ( !finf.exists() ) | 1555 | if ( !finf.exists() ) |
1556 | return true; | 1556 | return true; |
1557 | QDateTime dt = finf.lastModified (); | 1557 | QDateTime dt = finf.lastModified (); |
1558 | if ( dt <= loadedFileVersion ) | 1558 | if ( dt <= loadedFileVersion ) |
1559 | return false; | 1559 | return false; |
1560 | return true; | 1560 | return true; |
1561 | 1561 | ||
1562 | } | 1562 | } |
1563 | void CalendarView::watchSavedFile() | 1563 | void CalendarView::watchSavedFile() |
1564 | { | 1564 | { |
1565 | QFileInfo finf ( MainWindow::defaultFileName()); | 1565 | QFileInfo finf ( MainWindow::defaultFileName()); |
1566 | if ( !finf.exists() ) | 1566 | if ( !finf.exists() ) |
1567 | return; | 1567 | return; |
1568 | QDateTime dt = finf.lastModified (); | 1568 | QDateTime dt = finf.lastModified (); |
1569 | if ( dt < loadedFileVersion ) { | 1569 | if ( dt < loadedFileVersion ) { |
1570 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | ||
1570 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1571 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1571 | return; | 1572 | return; |
1572 | } | 1573 | } |
1573 | loadedFileVersion = dt; | 1574 | loadedFileVersion = dt; |
1574 | } | 1575 | } |
1575 | 1576 | ||
1576 | bool CalendarView::checkFileVersion(QString fn) | 1577 | bool CalendarView::checkFileVersion(QString fn) |
1577 | { | 1578 | { |
1578 | QFileInfo finf ( fn ); | 1579 | QFileInfo finf ( fn ); |
1579 | if ( !finf.exists() ) | 1580 | if ( !finf.exists() ) |
1580 | return true; | 1581 | return true; |
1581 | QDateTime dt = finf.lastModified (); | 1582 | QDateTime dt = finf.lastModified (); |
1582 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1583 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1583 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1584 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1584 | if ( dt <= loadedFileVersion ) | 1585 | if ( dt <= loadedFileVersion ) |
1585 | return true; | 1586 | return true; |
1586 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1587 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1587 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1588 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1588 | i18n("Sync+save")); | 1589 | i18n("Sync+save")); |
1589 | 1590 | ||
1590 | if ( km == KMessageBox::Cancel ) | 1591 | if ( km == KMessageBox::Cancel ) |
1591 | return false; | 1592 | return false; |
1592 | if ( km == KMessageBox::Yes ) | 1593 | if ( km == KMessageBox::Yes ) |
1593 | return true; | 1594 | return true; |