summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp69
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 35 insertions, 35 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 48320a5..b9d8742 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1035,2 +1035,3 @@ void MainWindow::initActions()
//importMenu->insertSeparator();
+#if 0
action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
@@ -1039,3 +1040,3 @@ void MainWindow::initActions()
connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
-
+#endif
action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
@@ -1847,16 +1848,6 @@ void MainWindow::saveStopTimer()
}
-void MainWindow::save()
+void MainWindow::backupAllFiles()
{
- if ( !mCalendarModifiedFlag ) {
- qDebug("KO: Calendar not modified. Nothing saved.");
- return;
- }
- 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 ) {
setCaption(i18n("Creating backup ... please wait ..." ));
@@ -1869,2 +1860,3 @@ void MainWindow::save()
if ( retval == 0 ) {
+ setCaption(i18n("Backup cancelled" ));
qDebug("KO: Backup cancelled. Will try again tomorrow ");
@@ -1885,3 +1877,5 @@ void MainWindow::save()
KOPrefs::instance()->mLastBackupDate = daysTo;
+ setCaption(i18n("Backup succesfully finished" ));
} else if ( retval == 2 ){
+ setCaption(i18n("Backup globally disabled" ));
qDebug("KO: Backup globally cancelled.");
@@ -1892,2 +1886,18 @@ void MainWindow::save()
}
+void MainWindow::save()
+{
+ if ( !mCalendarModifiedFlag ) {
+ qDebug("KO: Calendar not modified. Nothing saved.");
+ return;
+ }
+ 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 ) {
+ backupAllFiles();
+ }
; // KPimGlobalPrefs::instance()->mLastBackupDate
@@ -2302,26 +2312,12 @@ void MainWindow::saveCalendar()
{
- QString fn = KOPrefs::instance()->mLastSaveFile;
- fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
- if ( fn == "" )
- return;
- QFileInfo info;
- info.setFile( fn );
- QString mes;
- bool createbup = true;
- if ( info. exists() ) {
- mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
- int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
- i18n("Overwrite!"), i18n("Cancel"), 0,
- 0, 1 );
- if ( result != 0 ) {
- createbup = false;
- }
- }
- if ( createbup ) {
- mView->saveCalendar( fn );
- mes = i18n("KO/Pi:Saved %1").arg(fn);
- KOPrefs::instance()->mLastSaveFile = fn;
- setCaption(mes);
- }
+ QString bupDir = KPimGlobalPrefs::instance()->mBackupDatadir;
+ if ( KPimGlobalPrefs::instance()->mBackupUseDefaultDir)
+ bupDir = KGlobalSettings::backupDataDir();
+ bupDir = KGlobal::formatMessage ( bupDir, 0 );
+ QString bupHint;
+ if ( !KPimGlobalPrefs::instance()->mBackupEnabled )
+ bupHint = i18n("(Hint: You can enable automatic backup in the global settings!)");
+ 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;
+ backupAllFiles();
}
@@ -2330,2 +2326,4 @@ void MainWindow::loadCalendar()
+
+#if 0
QString fn = KOPrefs::instance()->mLastLoadFile;
@@ -2361,2 +2359,3 @@ void MainWindow::loadCalendar()
}
+#endif
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 9a8bc7f..c9817c3 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -83,2 +83,3 @@ class MainWindow : public QMainWindow
void save();
+ void backupAllFiles();
void saveStopTimer();