From dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 22:38:03 +0000 Subject: Added kmymoney git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239792 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kmymoney2/dialogs/kbackupdlg.cpp | 101 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 kmymoney2/dialogs/kbackupdlg.cpp (limited to 'kmymoney2/dialogs/kbackupdlg.cpp') diff --git a/kmymoney2/dialogs/kbackupdlg.cpp b/kmymoney2/dialogs/kbackupdlg.cpp new file mode 100644 index 0000000..d98aeaf --- /dev/null +++ b/kmymoney2/dialogs/kbackupdlg.cpp @@ -0,0 +1,101 @@ +/*************************************************************************** + 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. * + * * + ***************************************************************************/ + +// ---------------------------------------------------------------------------- +// QT Includes + +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// KDE Includes + +#include +#include +#if QT_VERSION > 300 +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include + +// ---------------------------------------------------------------------------- +// Project Includes + +#include "kbackupdlg.h" + +KBackupDlg::KBackupDlg( QWidget* parent, const char* name/*, bool modal*/) + : kbackupdlgdecl( parent, name , true) +{ + readConfig(); + + // add icons to buttons + KIconLoader *il = KGlobal::iconLoader(); + btnOK->setGuiItem(KStdGuiItem::ok()); + btnCancel->setGuiItem(KStdGuiItem::cancel()); + + KGuiItem chooseButtenItem( i18n("C&hoose..."), + QIconSet(il->loadIcon("folder", KIcon::Small, KIcon::SizeSmall)), + i18n("Select mount point"), + i18n("Use this to browse to the mount point.")); + chooseButton->setGuiItem(chooseButtenItem); + + connect(chooseButton, SIGNAL(clicked()), this, SLOT(chooseButtonClicked())); + connect(btnOK,SIGNAL(clicked()),this,SLOT(accept())); + connect(btnCancel,SIGNAL(clicked()),this,SLOT(reject())); +} + +KBackupDlg::~KBackupDlg() +{ + writeConfig(); +} + +void KBackupDlg::chooseButtonClicked() +{ + KURL newDir = KDirSelectDialog::selectDirectory(KGlobalSettings::documentPath()); + if (newDir.hasPath()) + txtMountPoint->setText(newDir.path()); +} + +void KBackupDlg::readConfig(void) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Last Use Settings"); + mountCheckBox->setChecked(config->readBoolEntry("KBackupDlg_mountDevice", false)); + txtMountPoint->setText(config->readEntry("KBackupDlg_BackupMountPoint", "/mnt/floppy")); +} + +void KBackupDlg::writeConfig(void) +{ + KConfig *config = KGlobal::config(); + config->setGroup("Last Use Settings"); + config->writeEntry("KBackupDlg_mountDevice", mountCheckBox->isChecked()); + config->writeEntry("KBackupDlg_BackupMountPoint", txtMountPoint->text()); + config->sync(); +} + +#include "kbackupdlg.moc" -- cgit v1.2.1