author | zautrix <zautrix> | 2005-06-26 13:45:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-26 13:45:09 (UTC) |
commit | bb565390dd1c31929780df60e2bb06e9259f4d0b (patch) (unidiff) | |
tree | 3f9f8b72ba68958553e8b20f5061ab55ec7b50f1 | |
parent | d9255cd129d42abf08efc11ff9b29e831e05e803 (diff) | |
download | kdepimpi-bb565390dd1c31929780df60e2bb06e9259f4d0b.zip kdepimpi-bb565390dd1c31929780df60e2bb06e9259f4d0b.tar.gz kdepimpi-bb565390dd1c31929780df60e2bb06e9259f4d0b.tar.bz2 |
fixxx
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 8 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 69 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
3 files changed, 42 insertions, 36 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 90521ec..2ade5bd 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1358,5 +1358,5 @@ | |||
1358 | { "Make backup every ","Mache ein Backup alle " }, | 1358 | { "Make backup every ","Mache ein Backup alle " }, |
1359 | { " days"," Tage" }, | 1359 | { " days"," Tage" }, |
1360 | { "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." }, | 1360 | { "Creating backup ... please wait ...","Erstelle Backup ... bitte warten ..." }, |
1361 | { "Backup Failed!","Backup Problem!" }, | 1361 | { "Backup Failed!","Backup Problem!" }, |
1362 | { "Try again now","Versuche jetzt nochmal" }, | 1362 | { "Try again now","Versuche jetzt nochmal" }, |
@@ -1451,4 +1451,10 @@ | |||
1451 | { "Children","Kinder" }, | 1451 | { "Children","Kinder" }, |
1452 | { "Department","Abteilung" }, | 1452 | { "Department","Abteilung" }, |
1453 | { "Backup cancelled","Backup abgebrochen" }, | ||
1454 | { "Backup globally disabled","Backup global abgeschaltet" }, | ||
1455 | { "Backup succesfully finished","Backup erfolgreich beendet" }, | ||
1456 | { "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, | ||
1457 | { "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, | ||
1458 | { "","" }, | ||
1453 | { "","" }, | 1459 | { "","" }, |
1454 | { "","" }, | 1460 | { "","" }, |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 48320a5..b9d8742 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1034,9 +1034,10 @@ void MainWindow::initActions() | |||
1034 | 1034 | ||
1035 | //importMenu->insertSeparator(); | 1035 | //importMenu->insertSeparator(); |
1036 | #if 0 | ||
1036 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 1037 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
1037 | this ); | 1038 | this ); |
1038 | action->addTo( importMenu ); | 1039 | action->addTo( importMenu ); |
1039 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 1040 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
1040 | 1041 | #endif | |
1041 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 1042 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
1042 | this ); | 1043 | this ); |
@@ -1846,18 +1847,8 @@ void MainWindow::saveStopTimer() | |||
1846 | mSaveTimer.stop(); | 1847 | mSaveTimer.stop(); |
1847 | } | 1848 | } |
1848 | void MainWindow::save() | 1849 | void MainWindow::backupAllFiles() |
1849 | { | 1850 | { |
1850 | if ( !mCalendarModifiedFlag ) { | ||
1851 | qDebug("KO: Calendar not modified. Nothing saved."); | ||
1852 | return; | ||
1853 | } | ||
1854 | if ( mSyncManager->blockSave() ) | ||
1855 | return; | ||
1856 | mSyncManager->setBlockSave(true); | ||
1857 | if ( mView->checkAllFileVersions() ) { | ||
1858 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | ||
1859 | QDate reference ( 2000,1,1); | 1851 | QDate reference ( 2000,1,1); |
1860 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 1852 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
1861 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | ||
1862 | setCaption(i18n("Creating backup ... please wait ..." )); | 1853 | setCaption(i18n("Creating backup ... please wait ..." )); |
1863 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); | 1854 | qDebug("KO: Last backup was %d days ago ", daysTo - KOPrefs::instance()->mLastBackupDate); |
@@ -1868,4 +1859,5 @@ void MainWindow::save() | |||
1868 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); | 1859 | int retval = KApplication::createBackup( defaultFileName(), bupDir, KPimGlobalPrefs::instance()->mBackupNumbers ); |
1869 | if ( retval == 0 ) { | 1860 | if ( retval == 0 ) { |
1861 | setCaption(i18n("Backup cancelled" )); | ||
1870 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 1862 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
1871 | // retval == 0 : backup skipped for today, try again tomorrow | 1863 | // retval == 0 : backup skipped for today, try again tomorrow |
@@ -1884,5 +1876,7 @@ void MainWindow::save() | |||
1884 | } | 1876 | } |
1885 | KOPrefs::instance()->mLastBackupDate = daysTo; | 1877 | KOPrefs::instance()->mLastBackupDate = daysTo; |
1878 | setCaption(i18n("Backup succesfully finished" )); | ||
1886 | } else if ( retval == 2 ){ | 1879 | } else if ( retval == 2 ){ |
1880 | setCaption(i18n("Backup globally disabled" )); | ||
1887 | qDebug("KO: Backup globally cancelled."); | 1881 | qDebug("KO: Backup globally cancelled."); |
1888 | // backup globally cancelled | 1882 | // backup globally cancelled |
@@ -1891,4 +1885,20 @@ void MainWindow::save() | |||
1891 | // retval == 3: do nothing, try again later | 1885 | // retval == 3: do nothing, try again later |
1892 | } | 1886 | } |
1887 | void MainWindow::save() | ||
1888 | { | ||
1889 | if ( !mCalendarModifiedFlag ) { | ||
1890 | qDebug("KO: Calendar not modified. Nothing saved."); | ||
1891 | return; | ||
1892 | } | ||
1893 | if ( mSyncManager->blockSave() ) | ||
1894 | return; | ||
1895 | mSyncManager->setBlockSave(true); | ||
1896 | if ( mView->checkAllFileVersions() ) { | ||
1897 | if ( KPimGlobalPrefs::instance()->mBackupEnabled ){ | ||
1898 | QDate reference ( 2000,1,1); | ||
1899 | int daysTo = reference.daysTo ( QDate::currentDate() ); | ||
1900 | if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) { | ||
1901 | backupAllFiles(); | ||
1902 | } | ||
1893 | ; // KPimGlobalPrefs::instance()->mLastBackupDate | 1903 | ; // KPimGlobalPrefs::instance()->mLastBackupDate |
1894 | } | 1904 | } |
@@ -2301,32 +2311,20 @@ void MainWindow::configureAgenda( int item ) | |||
2301 | void MainWindow::saveCalendar() | 2311 | void MainWindow::saveCalendar() |
2302 | { | 2312 | { |
2303 | QString fn = KOPrefs::instance()->mLastSaveFile; | ||
2304 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | ||
2305 | 2313 | ||
2306 | if ( fn == "" ) | 2314 | QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir; |
2307 | return; | 2315 | if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir) |
2308 | QFileInfo info; | 2316 | bupDir = KGlobalSettings::backupDataDir(); |
2309 | info.setFile( fn ); | 2317 | bupDir = KGlobal::formatMessage ( bupDir, 0 ); |
2310 | QString mes; | 2318 | QString bupHint; |
2311 | bool createbup = true; | 2319 | if ( !KPimGlobalPrefs::instance()->mBackupEnabled ) |
2312 | if ( info. exists() ) { | 2320 | bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)"); |
2313 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2321 | if ( KMessageBox::warningContinueCancel( this, i18n("This will <b>backup all calendar files</b> to the directory %1 %2").arg(bupDir).arg(bupHint),i18n("Information") ) != KMessageBox::Continue ) return; |
2314 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2322 | backupAllFiles(); |
2315 | i18n("Overwrite!"), i18n("Cancel"), 0, | ||
2316 | 0, 1 ); | ||
2317 | if ( result != 0 ) { | ||
2318 | createbup = false; | ||
2319 | } | ||
2320 | } | ||
2321 | if ( createbup ) { | ||
2322 | mView->saveCalendar( fn ); | ||
2323 | mes = i18n("KO/Pi:Saved %1").arg(fn); | ||
2324 | KOPrefs::instance()->mLastSaveFile = fn; | ||
2325 | setCaption(mes); | ||
2326 | } | ||
2327 | } | 2323 | } |
2328 | void MainWindow::loadCalendar() | 2324 | void MainWindow::loadCalendar() |
2329 | { | 2325 | { |
2330 | 2326 | ||
2327 | |||
2328 | #if 0 | ||
2331 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2329 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2332 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2330 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
@@ -2360,4 +2358,5 @@ void MainWindow::loadCalendar() | |||
2360 | setCaption(mess); | 2358 | setCaption(mess); |
2361 | } | 2359 | } |
2360 | #endif | ||
2362 | 2361 | ||
2363 | } | 2362 | } |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 9a8bc7f..c9817c3 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -82,4 +82,5 @@ class MainWindow : public QMainWindow | |||
82 | 82 | ||
83 | void save(); | 83 | void save(); |
84 | void backupAllFiles(); | ||
84 | void saveStopTimer(); | 85 | void saveStopTimer(); |
85 | void configureToolBar( int ); | 86 | void configureToolBar( int ); |