-rw-r--r-- | korganizer/mainwindow.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9ad0694..eed023c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1746,94 +1746,93 @@ void MainWindow::saveOnClose() | |||
1746 | p->mToolBarUpF = myP.x() > width()/2 ; | 1746 | p->mToolBarUpF = myP.x() > width()/2 ; |
1747 | } | 1747 | } |
1748 | #else | 1748 | #else |
1749 | if ( p->mToolBarHor ) | 1749 | if ( p->mToolBarHor ) |
1750 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1750 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1751 | else | 1751 | else |
1752 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1752 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1753 | if ( p->mToolBarHorV ) | 1753 | if ( p->mToolBarHorV ) |
1754 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1754 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1755 | else | 1755 | else |
1756 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1756 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1757 | 1757 | ||
1758 | if ( p->mToolBarHorN ) | 1758 | if ( p->mToolBarHorN ) |
1759 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1759 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1760 | else | 1760 | else |
1761 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1761 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1762 | if ( filterToolBar ) { | 1762 | if ( filterToolBar ) { |
1763 | if ( p->mToolBarHorF ) | 1763 | if ( p->mToolBarHorF ) |
1764 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1764 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1765 | else | 1765 | else |
1766 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1766 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1767 | } | 1767 | } |
1768 | #endif | 1768 | #endif |
1769 | 1769 | ||
1770 | |||
1771 | mView->writeSettings(); | ||
1772 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1770 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1773 | save(); | 1771 | save(); |
1772 | mView->writeSettings(); | ||
1774 | } | 1773 | } |
1775 | void MainWindow::slotModifiedChanged( bool changed ) | 1774 | void MainWindow::slotModifiedChanged( bool changed ) |
1776 | { | 1775 | { |
1777 | if ( mBlockAtStartup ) | 1776 | if ( mBlockAtStartup ) |
1778 | return; | 1777 | return; |
1779 | 1778 | ||
1780 | int msec; | 1779 | int msec; |
1781 | // we store the changes after 1 minute, | 1780 | // we store the changes after 1 minute, |
1782 | // and for safety reasons after 10 minutes again | 1781 | // and for safety reasons after 10 minutes again |
1783 | if ( !mSyncManager->blockSave() ) | 1782 | if ( !mSyncManager->blockSave() ) |
1784 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1783 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1785 | else | 1784 | else |
1786 | msec = 1000 * 600; | 1785 | msec = 1000 * 600; |
1787 | mSaveTimer.start( msec, true ); // 1 minute | 1786 | mSaveTimer.start( msec, true ); // 1 minute |
1788 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1787 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1789 | mCalendarModifiedFlag = true; | 1788 | mCalendarModifiedFlag = true; |
1790 | } | 1789 | } |
1791 | void MainWindow::saveStopTimer() | 1790 | void MainWindow::saveStopTimer() |
1792 | { | 1791 | { |
1793 | mSaveTimer.stop(); | 1792 | mSaveTimer.stop(); |
1794 | } | 1793 | } |
1795 | void MainWindow::save() | 1794 | void MainWindow::save() |
1796 | { | 1795 | { |
1797 | if ( !mCalendarModifiedFlag ) { | 1796 | if ( !mCalendarModifiedFlag ) { |
1798 | qDebug("KO: Calendar not modified. Nothing saved."); | 1797 | qDebug("KO: Calendar not modified. Nothing saved."); |
1799 | return; | 1798 | return; |
1800 | } | 1799 | } |
1801 | if ( mSyncManager->blockSave() ) | 1800 | if ( mSyncManager->blockSave() ) |
1802 | return; | 1801 | return; |
1803 | mSyncManager->setBlockSave(true); | 1802 | mSyncManager->setBlockSave(true); |
1804 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1803 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1805 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | 1804 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ |
1806 | QDate reference ( 2000,1,1); | 1805 | QDate reference ( 2000,1,1); |
1807 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1806 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1808 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | 1807 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { |
1809 | setCaption(i18n("KO/Pi:Creating backup ... please wait ..." )); | 1808 | setCaption(i18n("KO/Pi:Creating backup ... please wait ..." )); |
1810 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1809 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
1811 | // we need the file path, the backup dir and the number of bups as param | 1810 | // we need the file path, the backup dir and the number of bups as param |
1812 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; | 1811 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
1813 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) | 1812 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
1814 | bupDir = KGlobalSettings::backupDataDir(); | 1813 | bupDir = KGlobalSettings::backupDataDir(); |
1815 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );//55;//call backup | 1814 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1816 | if ( retval == 0 ) { | 1815 | if ( retval == 0 ) { |
1817 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1816 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1818 | // retval == 0 : backup skipped for today, try again tomorrow | 1817 | // retval == 0 : backup skipped for today, try again tomorrow |
1819 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; | 1818 | KOPrefs::instance()->mLastBackupDate = daysTo- KPimGlobalPrefs::instance()->mBackupDayCount+1; |
1820 | } else if ( retval == 1 ){ | 1819 | } else if ( retval == 1 ){ |
1821 | qDebug("KO: Backup created."); | 1820 | qDebug("KO: Backup created."); |
1822 | // backup ok | 1821 | // backup ok |
1823 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1822 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1824 | 1823 | ||
1825 | } else if ( retval == 2 ){ | 1824 | } else if ( retval == 2 ){ |
1826 | qDebug("KO: Backup globally cancelled."); | 1825 | qDebug("KO: Backup globally cancelled."); |
1827 | // backup globally cancelled | 1826 | // backup globally cancelled |
1828 | KPimGlobalPrefs::instance()->mBackupEnabled = false; | 1827 | KPimGlobalPrefs::instance()->mBackupEnabled = false; |
1829 | } | 1828 | } |
1830 | // retval == 3: do nothing, try again later | 1829 | // retval == 3: do nothing, try again later |
1831 | } | 1830 | } |
1832 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1831 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1833 | } | 1832 | } |
1834 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1833 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1835 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1834 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1836 | qDebug("KO: Start saving data to file!"); | 1835 | qDebug("KO: Start saving data to file!"); |
1837 | mView->saveCalendar( defaultFileName() ); | 1836 | mView->saveCalendar( defaultFileName() ); |
1838 | mCalendarModifiedFlag = false; | 1837 | mCalendarModifiedFlag = false; |
1839 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1838 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |