diff --git a/kmymoney/dialogs/CMakeLists.txt b/kmymoney/dialogs/CMakeLists.txt --- a/kmymoney/dialogs/CMakeLists.txt +++ b/kmymoney/dialogs/CMakeLists.txt @@ -7,7 +7,6 @@ investactivities.cpp investtransactioneditor.cpp kaccountselectdlg.cpp - kbackupdlg.cpp kbalancechartdlg.cpp kbalancewarning.cpp kcategoryreassigndlg.cpp @@ -57,7 +56,7 @@ set(dialogs_UI splitadjustdialog.ui - kaccountselectdlgdecl.ui kbackupdlgdecl.ui + kaccountselectdlgdecl.ui kcategoryreassigndlgdecl.ui kchooseimportexportdlgdecl.ui kconfirmmanualenterdlgdecl.ui kcurrencycalculatordecl.ui kcurrencyeditdlg.ui kavailablecurrencydlg.ui kcurrencyeditordlg.ui diff --git a/kmymoney/dialogs/kbackupdlg.h b/kmymoney/dialogs/kbackupdlg.h deleted file mode 100644 --- a/kmymoney/dialogs/kbackupdlg.h +++ /dev/null @@ -1,54 +0,0 @@ -/*************************************************************************** - kbackupdialog.h - description - ------------------- - begin : Mon Jun 4 2001 - copyright : (C) 2001 by Michael Edwardes - email : mte@users.sourceforge.net - Javier Campos Morales - Felix Rodriguez - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef KBACKUPDLG_H -#define KBACKUPDLG_H - -#include -#include "ui_kbackupdlgdecl.h" - -/** - *@author Michael Edwardes - */ - - -class kbackupdlgdecl : public QDialog, public Ui::kbackupdlgdecl -{ -public: - kbackupdlgdecl(QWidget *parent) : QDialog(parent) { - setupUi(this); - } -}; - -class KBackupDlg : public kbackupdlgdecl -{ - Q_OBJECT -private: - void readConfig(); - void writeConfig(); - -protected slots: - void chooseButtonClicked(); - -public: - KBackupDlg(QWidget* parent); - ~KBackupDlg(); -}; - -#endif // KBACKUPDLG_H diff --git a/kmymoney/dialogs/kbackupdlg.cpp b/kmymoney/dialogs/kbackupdlg.cpp deleted file mode 100644 --- a/kmymoney/dialogs/kbackupdlg.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************** - kbackupdialog.cpp - description - ------------------- - begin : Mon Jun 4 2001 - copyright : (C) 2001 by Michael Edwardes - email : mte@users.sourceforge.net - Javier Campos Morales - Felix Rodriguez - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include "kbackupdlg.h" - -// ---------------------------------------------------------------------------- -// QT Includes - -#include -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- -// KDE Includes - -#include -#include -#include -#include -#include -#include - -// ---------------------------------------------------------------------------- -// Project Includes - -KBackupDlg::KBackupDlg(QWidget* parent) - : kbackupdlgdecl(parent) -{ - readConfig(); - - KGuiItem chooseButtenItem(i18n("C&hoose..."), - QIcon::fromTheme("folder"), - i18n("Select mount point"), - i18n("Use this to browse to the mount point.")); - KGuiItem::assign(chooseButton, chooseButtenItem); - - connect(chooseButton, SIGNAL(clicked()), this, SLOT(chooseButtonClicked())); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); -} - -KBackupDlg::~KBackupDlg() -{ - writeConfig(); -} - -void KBackupDlg::chooseButtonClicked() -{ - QUrl newDir = QFileDialog::getExistingDirectoryUrl(this, QString(), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); - if (!newDir.path().isEmpty()) - txtMountPoint->setText(newDir.path()); -} - -void KBackupDlg::readConfig() -{ - KSharedConfigPtr config = KSharedConfig::openConfig(); - KConfigGroup grp = config->group("Last Use Settings"); - mountCheckBox->setChecked(grp.readEntry("KBackupDlg_mountDevice", false)); - txtMountPoint->setText(grp.readEntry("KBackupDlg_BackupMountPoint", "/mnt/floppy")); -} - -void KBackupDlg::writeConfig() -{ - KSharedConfigPtr config = KSharedConfig::openConfig(); - KConfigGroup grp = config->group("Last Use Settings"); - grp.writeEntry("KBackupDlg_mountDevice", mountCheckBox->isChecked()); - grp.writeEntry("KBackupDlg_BackupMountPoint", txtMountPoint->text()); - config->sync(); -} diff --git a/kmymoney/dialogs/kbackupdlgdecl.ui b/kmymoney/dialogs/kbackupdlgdecl.ui deleted file mode 100644 --- a/kmymoney/dialogs/kbackupdlgdecl.ui +++ /dev/null @@ -1,183 +0,0 @@ - - - kbackupdlgdecl - - - - 0 - 0 - 641 - 301 - - - - Backup - - - - 6 - - - 11 - - - 11 - - - 11 - - - 11 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Use this dialog to backup your data. - -Please make sure you have a disk inserted and that the drive is ready. Then choose the mount point from either the Choose button or by entering the path in the available box. - -Click OK to perform the backup. If your system does not use an automounter, make sure you mark the checkbox below to "mount this directory before backing up." - - - Qt::AlignTop - - - true - - - - - - - - - QFrame::HLine - - - QFrame::Raised - - - - - - - Device options - - - - 6 - - - 11 - - - 11 - - - 11 - - - 11 - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Mount Point: - - - false - - - - - - - - - - C&hoose... - - - - - - - - - Mount this directory before backing up. - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 0 - 24 - - - - - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
-
- - -
diff --git a/kmymoney/kmymoney.h b/kmymoney/kmymoney.h --- a/kmymoney/kmymoney.h +++ b/kmymoney/kmymoney.h @@ -194,9 +194,6 @@ */ void slotSettings(); - /** No descriptions */ - void slotFileBackup(); - void slotShowTipOfTheDay(); void slotQifProfileEditor(); @@ -889,9 +886,6 @@ */ void slotStatusProgressBar(int current, int total = 0); - /** No descriptions */ - void slotProcessExited(); - /** * Called to update stock and currency prices from the user menu */ diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp --- a/kmymoney/kmymoney.cpp +++ b/kmymoney/kmymoney.cpp @@ -97,7 +97,6 @@ #include "kmymoneyadaptor.h" #include "dialogs/settings/ksettingskmymoney.h" -#include "dialogs/kbackupdlg.h" #include "dialogs/kexportdlg.h" #include "dialogs/kimportdlg.h" #include "dialogs/mymoneyqifprofileeditor.h" @@ -178,13 +177,6 @@ #define RECOVER_KEY_EXPIRATION_WARNING 30 #endif -enum backupStateE { - BACKUP_IDLE = 0, - BACKUP_MOUNTING, - BACKUP_COPYING, - BACKUP_UNMOUNTING -}; - class KMyMoneyApp::Private { public: @@ -270,28 +262,6 @@ */ QMap m_onlinePlugins; - /** - * The following variable represents the state while crafting a backup. - * It can have the following values - * - * - IDLE: the default value if not performing a backup - * - MOUNTING: when a mount command has been issued - * - COPYING: when a copy command has been issued - * - UNMOUNTING: when an unmount command has been issued - */ - backupStateE m_backupState; - - /** - * This variable keeps the result of the backup operation. - */ - int m_backupResult; - - /** - * This variable is set, when the user selected to mount/unmount - * the backup volume. - */ - bool m_backupMount; - QProcess m_proc; /// A pointer to the view holding the tabs. @@ -426,13 +396,9 @@ setCentralWidget(frame); - connect(&d->m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcessExited())); - // force to show the home page if the file is closed connect(action("view_show_transaction_detail"), SIGNAL(toggled(bool)), d->m_myMoneyView, SLOT(slotShowTransactionDetail(bool))); - d->m_backupState = BACKUP_IDLE; - // TODO: port kf5 int weekStart = 1;//KLocale::global()->workingWeekStartDay(); int weekEnd = 7;//KLocale::global()->workingWeekEndDay(); @@ -581,12 +547,6 @@ saveas_database->setIcon(QIcon::fromTheme("svn-update")); connect(saveas_database, SIGNAL(triggered()), this, SLOT(slotSaveAsDatabase())); - QAction *file_backup = actionCollection()->addAction("file_backup"); - file_backup->setText(i18n("Backup...")); - file_backup->setIcon(QIcon::fromTheme(QStringLiteral("utilities-file-archiver"), - QIcon::fromTheme(QStringLiteral("package")))); - connect(file_backup, SIGNAL(triggered()), this, SLOT(slotFileBackup())); - QAction *file_import_qif = actionCollection()->addAction("file_import_qif"); file_import_qif->setText(i18n("QIF...")); connect(file_import_qif, SIGNAL(triggered()), this, SLOT(slotQifImport())); @@ -2607,197 +2567,6 @@ } } -/** No descriptions */ -void KMyMoneyApp::slotFileBackup() -{ - // Save the file first so isLocalFile() works - if (d->m_myMoneyView && d->m_myMoneyView->dirty()) - - { - if (KMessageBox::questionYesNo(this, i18n("The file must be saved first " - "before it can be backed up. Do you want to continue?")) == KMessageBox::No) { - return; - - } - - slotFileSave(); - } - - - - if (d->m_fileName.isEmpty()) - return; - - if (!d->m_fileName.isLocalFile()) { - KMessageBox::sorry(this, - i18n("The current implementation of the backup functionality only supports local files as source files. Your current source file is '%1'.", d->m_fileName.url()), - - i18n("Local files only")); - return; - } - // TODO: port KF5 -#if 0 - QPointer backupDlg = new KBackupDlg(this); - int returncode = backupDlg->exec(); - if (returncode == QDialog::Accepted && backupDlg != 0) { - - d->m_backupMount = backupDlg->mountCheckBox->isChecked(); - d->m_proc.clearProgram(); - d->m_backupState = BACKUP_MOUNTING; - d->m_mountpoint = backupDlg->txtMountPoint->text(); - - if (d->m_backupMount) { - progressCallback(0, 300, i18n("Mounting %1", d->m_mountpoint)); - d->m_proc.setProgram("mount"); - d->m_proc << d->m_mountpoint; - d->m_proc.start(); - - } else { - // If we don't have to mount a device, we just issue - // a dummy command to start the copy operation - progressCallback(0, 300, ""); - d->m_proc.setProgram("true"); - d->m_proc.start(); - } - - } - - delete backupDlg; -#endif -} - - -/** No descriptions */ -void KMyMoneyApp::slotProcessExited() -{ - // TODO: port KF5 -#if 0 - switch (d->m_backupState) { - case BACKUP_MOUNTING: - - if (d->m_proc.exitStatus() == QProcess::NormalExit && d->m_proc.exitCode() == 0) { - d->m_proc.clearProgram(); - QString today; - today.sprintf("-%04d-%02d-%02d.kmy", - QDate::currentDate().year(), - QDate::currentDate().month(), - QDate::currentDate().day()); - QString backupfile = d->m_mountpoint + '/' + d->m_fileName.fileName(); - KMyMoneyUtils::appendCorrectFileExt(backupfile, today); - - // check if file already exists and ask what to do - d->m_backupResult = 0; - QFile f(backupfile); - if (f.exists()) { - int answer = KMessageBox::warningContinueCancel(this, i18n("Backup file for today exists on that device. Replace?"), i18n("Backup"), KGuiItem(i18n("&Replace"))); - if (answer == KMessageBox::Cancel) { - d->m_backupResult = 1; - - if (d->m_backupMount) { - progressCallback(250, 0, i18n("Unmounting %1", d->m_mountpoint)); - d->m_proc.clearProgram(); - d->m_proc.setProgram("umount"); - d->m_proc << d->m_mountpoint; - d->m_backupState = BACKUP_UNMOUNTING; - d->m_proc.start(); - } else { - d->m_backupState = BACKUP_IDLE; - progressCallback(-1, -1, QString()); - ready(); - } - } - } - - if (d->m_backupResult == 0) { - progressCallback(50, 0, i18n("Writing %1", backupfile)); -//FIXME: FIX on windows - d->m_proc << "cp" << "-f" << d->m_fileName.path() << backupfile; - d->m_backupState = BACKUP_COPYING; - d->m_proc.start(); - } - - } else { - KMessageBox::information(this, i18n("Error mounting device"), i18n("Backup")); - d->m_backupResult = 1; - if (d->m_backupMount) { - progressCallback(250, 0, i18n("Unmounting %1", d->m_mountpoint)); - d->m_proc.clearProgram(); - d->m_proc.setProgram("umount"); - d->m_proc << d->m_mountpoint; - d->m_backupState = BACKUP_UNMOUNTING; - d->m_proc.start(); - - } else { - d->m_backupState = BACKUP_IDLE; - progressCallback(-1, -1, QString()); - ready(); - } - } - break; - - case BACKUP_COPYING: - if (d->m_proc.exitStatus() == QProcess::NormalExit && d->m_proc.exitCode() == 0) { - - if (d->m_backupMount) { - progressCallback(250, 0, i18n("Unmounting %1", d->m_mountpoint)); - d->m_proc.clearProgram(); - d->m_proc.setProgram("umount"); - d->m_proc << d->m_mountpoint; - d->m_backupState = BACKUP_UNMOUNTING; - d->m_proc.start(); - } else { - progressCallback(300, 0, i18nc("Backup done", "Done")); - KMessageBox::information(this, i18n("File successfully backed up"), i18n("Backup")); - d->m_backupState = BACKUP_IDLE; - progressCallback(-1, -1, QString()); - ready(); - } - } else { - qDebug("cp exit code is %d", d->m_proc.exitCode()); - d->m_backupResult = 1; - KMessageBox::information(this, i18n("Error copying file to device"), i18n("Backup")); - - if (d->m_backupMount) { - progressCallback(250, 0, i18n("Unmounting %1", d->m_mountpoint)); - d->m_proc.clearProgram(); - d->m_proc.setProgram("umount"); - d->m_proc << d->m_mountpoint; - d->m_backupState = BACKUP_UNMOUNTING; - d->m_proc.start(); - - - } else { - d->m_backupState = BACKUP_IDLE; - progressCallback(-1, -1, QString()); - ready(); - } - } - break; - - - case BACKUP_UNMOUNTING: - if (d->m_proc.exitStatus() == QProcess::NormalExit && d->m_proc.exitCode() == 0) { - - progressCallback(300, 0, i18nc("Backup done", "Done")); - if (d->m_backupResult == 0) - KMessageBox::information(this, i18n("File successfully backed up"), i18n("Backup")); - } else { - KMessageBox::information(this, i18n("Error unmounting device"), i18n("Backup")); - } - d->m_backupState = BACKUP_IDLE; - progressCallback(-1, -1, QString()); - ready(); - break; - - default: - qWarning("Unknown state for backup operation!"); - progressCallback(-1, -1, QString()); - ready(); - break; - } -#endif -} - void KMyMoneyApp::slotShowTipOfTheDay() { KTipDialog::showTip(d->m_myMoneyView, "", true); @@ -6398,7 +6167,6 @@ action("file_save_as")->setEnabled(fileOpen); action("file_close")->setEnabled(fileOpen); action("view_personal_data")->setEnabled(fileOpen); - action("file_backup")->setEnabled(fileOpen && !d->m_myMoneyView->isDatabase()); action("file_print")->setEnabled(fileOpen && d->m_myMoneyView->canPrint()); #ifdef KMM_DEBUG action("view_file_info")->setEnabled(fileOpen); diff --git a/kmymoney/kmymoney.upd b/kmymoney/kmymoney.upd --- a/kmymoney/kmymoney.upd +++ b/kmymoney/kmymoney.upd @@ -2,3 +2,9 @@ File=kmymoneyrc Group=List Options Key=listErronousTransactionColor,listErroneousTransactionColor + +Id=v5.0 +File=kmymoneyrc +Group=Last Use Settings +RemoveKey=KBackupDlg_BackupMountPoint +RemoveKey=KBackupDlg_mountDevice diff --git a/kmymoney/kmymoneyui.rc b/kmymoney/kmymoneyui.rc --- a/kmymoney/kmymoneyui.rc +++ b/kmymoney/kmymoneyui.rc @@ -20,7 +20,6 @@ -