[kmymoney/5.0] kmymoney: Allow to select keys during File/Save As
Thomas Baumgart
null at kde.org
Fri Feb 16 19:19:29 UTC 2018
Git commit 03831143604ffb5f49267fc5dfdde97bb7059866 by Thomas Baumgart.
Committed on 16/02/2018 at 19:19.
Pushed by tbaumgart into branch '5.0'.
Allow to select keys during File/Save As
Due to the change in the KDE file save dialog the additional widgets
could not be inserted dynamically into the dialog as we did in KDE4.
This has been solved by an additional dialog when GPG encryption has
been enabled in the settings and is available.
BUG: 390467
FIXED-IN: 5.0.1
GUI:
M +1 -0 kmymoney/dialogs/CMakeLists.txt
M +77 -88 kmymoney/dialogs/kgpgkeyselectiondlg.cpp
M +15 -3 kmymoney/dialogs/kgpgkeyselectiondlg.h
A +139 -0 kmymoney/dialogs/kgpgkeyselectiondlg.ui
M +19 -89 kmymoney/kmymoney.cpp
M +1 -6 kmymoney/kmymoney.h
https://commits.kde.org/kmymoney/03831143604ffb5f49267fc5dfdde97bb7059866
diff --git a/kmymoney/dialogs/CMakeLists.txt b/kmymoney/dialogs/CMakeLists.txt
index 043f00c9..9726a1a5 100644
--- a/kmymoney/dialogs/CMakeLists.txt
+++ b/kmymoney/dialogs/CMakeLists.txt
@@ -64,6 +64,7 @@ set(dialogs_UI
kenterscheduledlg.ui
kequitypriceupdatedlg.ui kequitypriceupdateconfdlg.ui
kfindtransactiondlg.ui kgeneratesqldlg.ui
+ kgpgkeyselectiondlg.ui
kloadtemplatedlg.ui
kmymoneyfileinfodlg.ui kmymoneypricedlg.ui
knewaccountdlg.ui knewbankdlg.ui knewbudgetdlg.ui
diff --git a/kmymoney/dialogs/kgpgkeyselectiondlg.cpp b/kmymoney/dialogs/kgpgkeyselectiondlg.cpp
index ca15228e..34e820bb 100644
--- a/kmymoney/dialogs/kgpgkeyselectiondlg.cpp
+++ b/kmymoney/dialogs/kgpgkeyselectiondlg.cpp
@@ -19,25 +19,17 @@
// ----------------------------------------------------------------------------
// QT Includes
-
-#include <QLabel>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QGroupBox>
+#include <QPushButton>
+#include <QDialogButtonBox>
// ----------------------------------------------------------------------------
// KDE Includes
-#include <KEditListWidget>
-#include <KLed>
-#include <KLocalizedString>
-
// ----------------------------------------------------------------------------
// Project Includes
#include <kgpgfile.h>
-#include <QDialogButtonBox>
-#include <QPushButton>
+#include <ui_kgpgkeyselectiondlg.h>
class KGpgKeySelectionDlgPrivate
{
@@ -45,6 +37,10 @@ class KGpgKeySelectionDlgPrivate
public:
KGpgKeySelectionDlgPrivate()
+ : ui(new Ui::KGpgKeySelectionDlg)
+ , needCheckList(true)
+ , listOk(false)
+ , checkCount(0)
{
}
@@ -52,11 +48,10 @@ public:
{
}
- KEditListWidget* m_listWidget;
- KLed* m_keyLed;
- bool m_needCheckList;
- bool m_listOk;
- int m_checkCount;
+ Ui::KGpgKeySelectionDlg* ui;
+ bool needCheckList;
+ bool listOk;
+ int checkCount;
};
@@ -65,57 +60,11 @@ KGpgKeySelectionDlg::KGpgKeySelectionDlg(QWidget *parent) :
d_ptr(new KGpgKeySelectionDlgPrivate)
{
Q_D(KGpgKeySelectionDlg);
- d->m_needCheckList = true;
- d->m_listOk = false;
- d->m_checkCount = 0;
- // TODO: check port to kf5
- setWindowTitle(i18n("Select additional keys"));
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
- QWidget *mainWidget = new QWidget(this);
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
- mainLayout->addWidget(mainWidget);
- QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
- okButton->setDefault(true);
- okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
- buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
- setModal(true);
- QWidget* page = new QWidget(this);
- mainLayout->addWidget(page);
- mainLayout->addWidget(buttonBox);
-
- QGroupBox *listBox = new QGroupBox(i18n("User identification"), page);
- QVBoxLayout *verticalLayout = new QVBoxLayout(listBox);
- verticalLayout->setSpacing(6);
- verticalLayout->setContentsMargins(0, 0, 0, 0);
- d->m_listWidget = new KEditListWidget(listBox);
- d->m_listWidget->connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
- d->m_listWidget->connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
- d->m_listWidget->setWhatsThis(i18n("Enter the id of the key you want to use for data encryption. This can either be an e-mail address or the hexadecimal key id. In case of the key id, do not forget the leading 0x."));
- verticalLayout->addWidget(d->m_listWidget);
-
- // add a LED for the availability of all keys
- QHBoxLayout* ledBox = new QHBoxLayout();
- ledBox->setContentsMargins(0, 0, 0, 0);
- ledBox->setSpacing(6);
- ledBox->setObjectName("ledBoxLayout");
-
- d->m_keyLed = new KLed(page);
- mainLayout->addWidget(d->m_keyLed);
- d->m_keyLed->setShape(KLed::Circular);
- d->m_keyLed->setLook(KLed::Sunken);
-
- ledBox->addWidget(d->m_keyLed);
- ledBox->addWidget(new QLabel(i18n("Keys for all of the above user ids found"), page));
- ledBox->addItem(new QSpacerItem(50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
-
- verticalLayout->addLayout(ledBox);
-
- connect(d->m_listWidget, &KEditListWidget::changed, this, &KGpgKeySelectionDlg::slotIdChanged);
- connect(d->m_listWidget, &KEditListWidget::added, this, &KGpgKeySelectionDlg::slotKeyListChanged);
- connect(d->m_listWidget, &KEditListWidget::removed, this, &KGpgKeySelectionDlg::slotKeyListChanged);
+ d->ui->setupUi(this);
+ connect(d->ui->m_secretKey, SIGNAL(currentIndexChanged(int)), this, SLOT(slotIdChanged()));
+ connect(d->ui->m_listWidget, &KEditListWidget::changed, this, &KGpgKeySelectionDlg::slotIdChanged);
+ connect(d->ui->m_listWidget, &KEditListWidget::added, this, &KGpgKeySelectionDlg::slotKeyListChanged);
+ connect(d->ui->m_listWidget, &KEditListWidget::removed, this, &KGpgKeySelectionDlg::slotKeyListChanged);
}
KGpgKeySelectionDlg::~KGpgKeySelectionDlg()
@@ -124,18 +73,52 @@ KGpgKeySelectionDlg::~KGpgKeySelectionDlg()
delete d;
}
-void KGpgKeySelectionDlg::setKeys(const QStringList& list)
+void KGpgKeySelectionDlg::setSecretKeys(const QStringList& keyList, const QString& defaultKey)
+{
+ static constexpr char recoveryKeyId[] = "59B0F826D2B08440";
+
+ Q_D(KGpgKeySelectionDlg);
+ d->ui->m_secretKey->addItem(i18n("No encryption"));
+
+ foreach(auto key, keyList) {
+ QStringList fields = key.split(':', QString::SkipEmptyParts);
+ if (fields[0] != recoveryKeyId) {
+ // replace parenthesis in name field with brackets
+ auto name = fields[1];
+ name.replace('(', "[");
+ name.replace(')', "]");
+ name = QString("%1 (0x%2)").arg(name).arg(fields[0]);
+ d->ui->m_secretKey->addItem(name);
+ if (name.contains(defaultKey)) {
+ d->ui->m_secretKey->setCurrentText(name);
+ }
+ }
+ }
+}
+
+QString KGpgKeySelectionDlg::secretKey() const
+{
+ Q_D(const KGpgKeySelectionDlg);
+ const bool enabled = (d->ui->m_secretKey->currentIndex() != 0);
+ QString key;
+ if (enabled) {
+ key = d->ui->m_secretKey->currentText();
+ }
+ return key;
+}
+
+void KGpgKeySelectionDlg::setAdditionalKeys(const QStringList& list)
{
Q_D(KGpgKeySelectionDlg);
- d->m_listWidget->clear();
- d->m_listWidget->insertStringList(list);
+ d->ui->m_listWidget->clear();
+ d->ui->m_listWidget->insertStringList(list);
slotKeyListChanged();
}
-QStringList KGpgKeySelectionDlg::keys() const
+QStringList KGpgKeySelectionDlg::additionalKeys() const
{
Q_D(const KGpgKeySelectionDlg);
- return d->m_listWidget->items();
+ return d->ui->m_listWidget->items();
}
#if 0
@@ -152,7 +135,7 @@ void KGpgKeySelectionDlg::slotShowHelp()
void KGpgKeySelectionDlg::slotKeyListChanged()
{
Q_D(KGpgKeySelectionDlg);
- d->m_needCheckList = true;
+ d->needCheckList = true;
slotIdChanged();
}
@@ -168,43 +151,49 @@ void KGpgKeySelectionDlg::slotIdChanged()
// The second invocation is counted, but the check is not started until the
// first one finishes. Once the external process finishes, we check if we
// were called in the meantime and restart the check.
- if (++d->m_checkCount == 1) {
- while (1) {
+ if (++d->checkCount == 1) {
+ const bool enabled = (d->ui->m_secretKey->currentIndex() != 0);
+ d->ui->m_listWidget->setEnabled(enabled);
+ d->ui->m_keyLed->setState(enabled ? KLed::On : KLed::Off);
+ while (enabled) {
// first we check the current edit field if filled
bool keysOk = true;
- if (!d->m_listWidget->currentText().isEmpty()) {
- keysOk = KGPGFile::keyAvailable(d->m_listWidget->currentText());
+ if (!d->ui->m_listWidget->currentText().isEmpty()) {
+ keysOk = KGPGFile::keyAvailable(d->ui->m_listWidget->currentText());
}
// if it is available, then scan the current list if we need to
if (keysOk) {
- if (d->m_needCheckList) {
- QStringList keys = d->m_listWidget->items();
+ if (d->needCheckList) {
+ QStringList keys = d->ui->m_listWidget->items();
QStringList::const_iterator it_s;
for (it_s = keys.constBegin(); keysOk && it_s != keys.constEnd(); ++it_s) {
if (!KGPGFile::keyAvailable(*it_s))
keysOk = false;
}
- d->m_listOk = keysOk;
- d->m_needCheckList = false;
+ d->listOk = keysOk;
+ d->needCheckList = false;
} else {
- keysOk = d->m_listOk;
+ keysOk = d->listOk;
}
}
// did we receive some more requests to check?
- if (d->m_checkCount > 1) {
- d->m_checkCount = 1;
+ if (d->checkCount > 1) {
+ d->checkCount = 1;
continue;
}
- d->m_keyLed->setState(static_cast<KLed::State>(keysOk && (d->m_listWidget->items().count() != 0) ? KLed::On : KLed::Off));
- // TODO: port to kf5
- // okButton->setEnabled((m_listWidget->items().count() == 0) || (m_keyLed->state() == KLed::On));
+ if (!d->ui->m_listWidget->items().isEmpty()) {
+ d->ui->m_keyLed->setState(static_cast<KLed::State>(keysOk ? KLed::On : KLed::Off));
+ } else {
+ d->ui->m_keyLed->setState(KLed::On);
+ }
break;
}
- --d->m_checkCount;
+ --d->checkCount;
+ d->ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!enabled || (d->ui->m_keyLed->state() == KLed::On));
}
}
diff --git a/kmymoney/dialogs/kgpgkeyselectiondlg.h b/kmymoney/dialogs/kgpgkeyselectiondlg.h
index 7a37e8b3..165b4a9f 100644
--- a/kmymoney/dialogs/kgpgkeyselectiondlg.h
+++ b/kmymoney/dialogs/kgpgkeyselectiondlg.h
@@ -44,14 +44,26 @@ public:
~KGpgKeySelectionDlg();
/**
- * preset the key list with the given key ids in @a list
+ * preset the key selector with the keys contained in @a keyList.
+ * The key contained in @a defaultKey is made the current selection.
*/
- void setKeys(const QStringList& list);
+ void setSecretKeys(const QStringList& keyList, const QString& defaultKey);
+
+ /**
+ * preset the additional key list with the given key ids in @a list
+ */
+ void setAdditionalKeys(const QStringList& list);
+
+ /**
+ * Returns the selected secret key. In case "No encryption" is selected,
+ * the string is empty.
+ */
+ QString secretKey() const;
/**
* Returns the list of keys currently listed in the KEditListWidget
*/
- QStringList keys() const;
+ QStringList additionalKeys() const;
protected Q_SLOTS:
void slotIdChanged();
diff --git a/kmymoney/dialogs/kgpgkeyselectiondlg.ui b/kmymoney/dialogs/kgpgkeyselectiondlg.ui
new file mode 100644
index 00000000..bae6fe64
--- /dev/null
+++ b/kmymoney/dialogs/kgpgkeyselectiondlg.ui
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KGpgKeySelectionDlg</class>
+ <widget class="QDialog" name="KGpgKeySelectionDlg">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>575</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Select additional keys</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>true</bool>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>You have configured KMyMoney to save your data secured with GPG. Please choose the key you want to use for encryption of your data.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="m_secretKey"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Add additional keys here</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KEditListWidget" name="m_listWidget">
+ <property name="whatsThis">
+ <string>Enter the id of the key you want to use for data encryption. This can either be an e-mail address or the hexadecimal key id. In case of the key id, do not forget the leading 0x.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="KLed" name="m_keyLed"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="ledLabel">
+ <property name="text">
+ <string>Keys for all of the above user ids found</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="hs1">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KEditListWidget</class>
+ <extends>QWidget</extends>
+ <header>keditlistwidget.h</header>
+ </customwidget>
+ <customwidget>
+ <class>KLed</class>
+ <extends>QWidget</extends>
+ <header>kled.h</header>
+ </customwidget>
+ </customwidgets>
+ <tabstops>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>KGpgKeySelectionDlg</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>244</x>
+ <y>415</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>KGpgKeySelectionDlg</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>312</x>
+ <y>415</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/kmymoney/kmymoney.cpp b/kmymoney/kmymoney.cpp
index 36ccfe45..a0300649 100644
--- a/kmymoney/kmymoney.cpp
+++ b/kmymoney/kmymoney.cpp
@@ -1416,40 +1416,6 @@ bool KMyMoneyApp::slotFileSave()
return rc;
}
-void KMyMoneyApp::slotFileSaveAsFilterChanged(const QString& filter)
-{
- if (!d->m_saveEncrypted)
- return;
- if (filter.compare(QLatin1String("*.kmy"), Qt::CaseInsensitive) != 0) {
- d->m_saveEncrypted->setCurrentItem(0);
- d->m_saveEncrypted->setEnabled(false);
- } else {
- d->m_saveEncrypted->setEnabled(true);
- }
-}
-
-void KMyMoneyApp::slotManageGpgKeys()
-{
- QPointer<KGpgKeySelectionDlg> dlg = new KGpgKeySelectionDlg(this);
- dlg->setKeys(d->m_additionalGpgKeys);
- if (dlg->exec() == QDialog::Accepted && dlg != 0) {
- d->m_additionalGpgKeys = dlg->keys();
- d->m_additionalKeyLabel->setText(i18n("Additional encryption keys to be used: %1", d->m_additionalGpgKeys.count()));
- }
- delete dlg;
-}
-
-void KMyMoneyApp::slotKeySelected(int idx)
-{
- int cnt = 0;
- if (idx != 0) {
- cnt = d->m_additionalGpgKeys.count();
- }
- d->m_additionalKeyLabel->setEnabled(idx != 0);
- d->m_additionalKeyButton->setEnabled(idx != 0);
- d->m_additionalKeyLabel->setText(i18n("Additional encryption keys to be used: %1", cnt));
-}
-
bool KMyMoneyApp::slotFileSaveAs()
{
bool rc = false;
@@ -1458,51 +1424,23 @@ bool KMyMoneyApp::slotFileSaveAs()
dynamic_cast<IMyMoneySerialize*>(MyMoneyFile::instance()->storage())->fillStorage();
KMSTATUS(i18n("Saving file with a new filename..."));
- // fill the additional key list with the default
- d->m_additionalGpgKeys = KMyMoneyGlobalSettings::gpgRecipientList();
-
- QWidget* vbox = new QWidget();
- QVBoxLayout *vboxVBoxLayout = new QVBoxLayout(vbox);
- vboxVBoxLayout->setMargin(0);
- if (KGPGFile::GPGAvailable()) {
- QWidget* keyBox = new QWidget(vbox);
- QHBoxLayout *keyBoxHBoxLayout = new QHBoxLayout(keyBox);
- keyBoxHBoxLayout->setMargin(0);
- vboxVBoxLayout->addWidget(keyBox);
- QLabel *keyLabel = new QLabel(i18n("Encryption key to be used"), keyBox);
- keyBoxHBoxLayout->addWidget(keyLabel);
- d->m_saveEncrypted = new KComboBox(keyBox);
- keyBoxHBoxLayout->addWidget(d->m_saveEncrypted);
-
- QWidget* labelBox = new QWidget(vbox);
- QHBoxLayout *labelBoxHBoxLayout = new QHBoxLayout(labelBox);
- labelBoxHBoxLayout->setMargin(0);
- vboxVBoxLayout->addWidget(labelBox);
- d->m_additionalKeyLabel = new QLabel(i18n("Additional encryption keys to be used: %1", d->m_additionalGpgKeys.count()), labelBox);
- labelBoxHBoxLayout->addWidget(d->m_additionalKeyLabel);
- d->m_additionalKeyButton = new QPushButton(i18n("Manage additional keys"), labelBox);
- labelBoxHBoxLayout->addWidget(d->m_additionalKeyButton);
- connect(d->m_additionalKeyButton, SIGNAL(clicked()), this, SLOT(slotManageGpgKeys()));
- connect(d->m_saveEncrypted, SIGNAL(activated(int)), this, SLOT(slotKeySelected(int)));
-
+ QString selectedKeyName;
+ if (KGPGFile::GPGAvailable() && KMyMoneySettings::writeDataEncrypted()) {
// fill the secret key list and combo box
QStringList keyList;
KGPGFile::secretKeyList(keyList);
- d->m_saveEncrypted->addItem(i18n("No encryption"));
-
- for (QStringList::iterator it = keyList.begin(); it != keyList.end(); ++it) {
- QStringList fields = (*it).split(':', QString::SkipEmptyParts);
- if (fields[0] != recoveryKeyId) {
- // replace parenthesis in name field with brackets
- auto name = fields[1];
- name.replace('(', "[");
- name.replace(')', "]");
- name = QString("%1 (0x%2)").arg(name).arg(fields[0]);
- d->m_saveEncrypted->addItem(name);
- if (name.contains(KMyMoneyGlobalSettings::gpgRecipient())) {
- d->m_saveEncrypted->setCurrentItem(name);
- }
- }
+
+ QPointer<KGpgKeySelectionDlg> dlg = new KGpgKeySelectionDlg(this);
+ dlg->setSecretKeys(keyList, KMyMoneyGlobalSettings::gpgRecipient());
+ dlg->setAdditionalKeys(KMyMoneyGlobalSettings::gpgRecipientList());
+ const int rc = dlg->exec();
+ if ((rc == QDialog::Accepted) && (dlg != 0)) {
+ d->m_additionalGpgKeys = dlg->additionalKeys();
+ selectedKeyName = dlg->secretKey();
+ }
+ delete dlg;
+ if ((rc != QDialog::Accepted) || (dlg == 0)) {
+ return false;
}
}
@@ -1517,19 +1455,11 @@ bool KMyMoneyApp::slotFileSaveAs()
QString(QLatin1String("%2 (%1);;")).arg(QStringLiteral("*.anon.xml")).arg(i18nc("Anonymous (Filefilter)", "Anonymous files")) +
QString(QLatin1String("%2 (%1);;")).arg(QStringLiteral("*")).arg(i18nc("All files (Filefilter)", "All files")));
dlg->setAcceptMode(QFileDialog::AcceptSave);
- connect(dlg, SIGNAL(filterSelected(QString)), this, SLOT(slotFileSaveAsFilterChanged(QString)));
if (dlg->exec() == QDialog::Accepted && dlg != 0) {
QUrl newURL = dlg->selectedUrls().first();
if (!newURL.fileName().isEmpty()) {
d->consistencyCheck(false);
- // deleting the dialog will delete the combobox pointed to by d->m_saveEncrypted so get the key name here
- QString selectedKeyName;
- if (d->m_saveEncrypted && d->m_saveEncrypted->currentIndex() != 0)
- selectedKeyName = d->m_saveEncrypted->currentText();
-
- d->m_saveEncrypted = 0;
-
QString newName = newURL.toDisplayString(QUrl::PreferLocalFile);
// append extension if not present
@@ -1550,11 +1480,11 @@ bool KMyMoneyApp::slotFileSaveAs()
QRegExp keyExp(".* \\((.*)\\)");
if (keyExp.indexIn(selectedKeyName) != -1) {
encryptionKeys = keyExp.cap(1);
- }
- if (!d->m_additionalGpgKeys.isEmpty()) {
- if (!encryptionKeys.isEmpty())
- encryptionKeys.append(QLatin1Char(','));
- encryptionKeys.append(d->m_additionalGpgKeys.join(QLatin1Char(',')));
+ if (!d->m_additionalGpgKeys.isEmpty()) {
+ if (!encryptionKeys.isEmpty())
+ encryptionKeys.append(QLatin1Char(','));
+ encryptionKeys.append(d->m_additionalGpgKeys.join(QLatin1Char(',')));
+ }
}
rc = d->m_myMoneyView->saveFile(d->m_fileName, encryptionKeys);
//write the directory used for this file as the default one for next time.
diff --git a/kmymoney/kmymoney.h b/kmymoney/kmymoney.h
index 70509c91..d4f94315 100644
--- a/kmymoney/kmymoney.h
+++ b/kmymoney/kmymoney.h
@@ -109,8 +109,6 @@ private Q_SLOTS:
void slotShowContextMenuForConsistencyCheck(const QPoint &);
protected Q_SLOTS:
- void slotFileSaveAsFilterChanged(const QString& filter);
-
/**
* This slot is intended to be used as part of auto saving. This is used when the
* QTimer emits the timeout signal and simply checks that the file is dirty (has
@@ -260,9 +258,6 @@ protected Q_SLOTS:
void slotAccountUpdateOnline();
void slotAccountUpdateOnlineAll();
- void slotManageGpgKeys();
- void slotKeySelected(int idx);
-
void slotStatusProgressDone();
public:
@@ -529,7 +524,7 @@ public Q_SLOTS:
*/
void slotEquityPriceUpdate();
- void slotOnlineAccountRequested(const MyMoneyAccount& acc, eMenu::Action action);
+ void slotOnlineAccountRequested(const MyMoneyAccount& acc, eMenu::Action action);
/**
* This slot reparents account @p src to be a child of account @p dest
More information about the kde-doc-english
mailing list