Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/dialogs/kbackupdlg.cpp
Context not available. | |||||
6 | email : mte@users.sourceforge.net | 6 | email : mte@users.sourceforge.net | ||
---|---|---|---|---|---|
7 | Javier Campos Morales <javi_c@ctv.es> | 7 | Javier Campos Morales <javi_c@ctv.es> | ||
8 | Felix Rodriguez <frodriguez@mail.wesleyan.edu> | 8 | Felix Rodriguez <frodriguez@mail.wesleyan.edu> | ||
9 | (C) 2017 by Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> | ||||
9 | ***************************************************************************/ | 10 | ***************************************************************************/ | ||
10 | 11 | | |||
11 | /*************************************************************************** | 12 | /*************************************************************************** | ||
Context not available. | |||||
33 | 34 | | |||
34 | #include <KConfig> | 35 | #include <KConfig> | ||
35 | #include <KConfigGroup> | 36 | #include <KConfigGroup> | ||
36 | #include <KGuiItem> | | |||
37 | #include <KLocalizedString> | 37 | #include <KLocalizedString> | ||
38 | #include <KSharedConfig> | 38 | #include <KSharedConfig> | ||
39 | 39 | | |||
40 | // ---------------------------------------------------------------------------- | 40 | // ---------------------------------------------------------------------------- | ||
41 | // Project Includes | 41 | // Project Includes | ||
42 | | ||||
43 | #include "ui_kbackupdlg.h" | ||||
44 | | ||||
42 | #include "icons/icons.h" | 45 | #include "icons/icons.h" | ||
43 | 46 | | |||
44 | using namespace Icons; | 47 | using namespace Icons; | ||
45 | 48 | | |||
46 | KBackupDlg::KBackupDlg(QWidget* parent) | 49 | KBackupDlg::KBackupDlg(QWidget* parent) : | ||
47 | : kbackupdlgdecl(parent) | 50 | QDialog(parent), | ||
51 | ui(new Ui::KBackupDlg) | ||||
48 | { | 52 | { | ||
53 | ui->setupUi(this); | ||||
49 | readConfig(); | 54 | readConfig(); | ||
50 | 55 | | |||
51 | KGuiItem chooseButtenItem(i18n("C&hoose..."), | 56 | ui->chooseButton->setIcon(QIcon::fromTheme(g_Icons[Icon::Folder])); | ||
52 | QIcon::fromTheme(g_Icons[Icon::Folder]), | | |||
53 | i18n("Select mount point"), | | |||
54 | i18n("Use this to browse to the mount point.")); | | |||
55 | KGuiItem::assign(chooseButton, chooseButtenItem); | | |||
56 | 57 | | |||
57 | connect(chooseButton, SIGNAL(clicked()), this, SLOT(chooseButtonClicked())); | 58 | connect(ui->chooseButton, &QAbstractButton::clicked, this, &KBackupDlg::chooseButtonClicked); | ||
58 | connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); | | |||
59 | connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); | | |||
60 | } | 59 | } | ||
61 | 60 | | |||
62 | KBackupDlg::~KBackupDlg() | 61 | KBackupDlg::~KBackupDlg() | ||
63 | { | 62 | { | ||
64 | writeConfig(); | 63 | writeConfig(); | ||
64 | delete ui; | ||||
65 | } | ||||
66 | | ||||
67 | QString KBackupDlg::mountPoint() const | ||||
68 | { | ||||
69 | return ui->txtMountPoint->text(); | ||||
70 | } | ||||
71 | | ||||
72 | bool KBackupDlg::mountCheckBox() const | ||||
73 | { | ||||
74 | return ui->mountCheckBox; | ||||
65 | } | 75 | } | ||
66 | 76 | | |||
67 | void KBackupDlg::chooseButtonClicked() | 77 | void KBackupDlg::chooseButtonClicked() | ||
68 | { | 78 | { | ||
69 | QUrl newDir = QFileDialog::getExistingDirectoryUrl(this, QString(), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); | 79 | auto newDir = QFileDialog::getExistingDirectoryUrl(this, QString(), QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation))); | ||
70 | if (!newDir.path().isEmpty()) | 80 | if (!newDir.path().isEmpty()) | ||
71 | txtMountPoint->setText(newDir.path()); | 81 | ui->txtMountPoint->setText(newDir.path()); | ||
72 | } | 82 | } | ||
73 | 83 | | |||
74 | void KBackupDlg::readConfig() | 84 | void KBackupDlg::readConfig() | ||
Context not available. | |||||
81 | #endif | 91 | #endif | ||
82 | KSharedConfigPtr config = KSharedConfig::openConfig(); | 92 | KSharedConfigPtr config = KSharedConfig::openConfig(); | ||
83 | KConfigGroup grp = config->group("Last Use Settings"); | 93 | KConfigGroup grp = config->group("Last Use Settings"); | ||
84 | mountCheckBox->setChecked(grp.readEntry("KBackupDlg_mountDevice", false)); | 94 | ui->mountCheckBox->setChecked(grp.readEntry("KBackupDlg_mountDevice", false)); | ||
85 | txtMountPoint->setText(grp.readEntry("KBackupDlg_BackupMountPoint", backupDefaultLocation)); | 95 | ui->txtMountPoint->setText(grp.readEntry("KBackupDlg_BackupMountPoint", backupDefaultLocation)); | ||
86 | } | 96 | } | ||
87 | 97 | | |||
88 | void KBackupDlg::writeConfig() | 98 | void KBackupDlg::writeConfig() | ||
89 | { | 99 | { | ||
90 | KSharedConfigPtr config = KSharedConfig::openConfig(); | 100 | KSharedConfigPtr config = KSharedConfig::openConfig(); | ||
91 | KConfigGroup grp = config->group("Last Use Settings"); | 101 | KConfigGroup grp = config->group("Last Use Settings"); | ||
92 | grp.writeEntry("KBackupDlg_mountDevice", mountCheckBox->isChecked()); | 102 | grp.writeEntry("KBackupDlg_mountDevice", ui->mountCheckBox->isChecked()); | ||
93 | grp.writeEntry("KBackupDlg_BackupMountPoint", txtMountPoint->text()); | 103 | grp.writeEntry("KBackupDlg_BackupMountPoint", ui->txtMountPoint->text()); | ||
94 | config->sync(); | 104 | config->sync(); | ||
95 | } | 105 | } | ||
Context not available. |