[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmymoney/5.0] kmymoney/plugins: Fix appending of file extension on export
From:       Thomas Baumgart <null () kde ! org>
Date:       2018-09-08 10:07:30
Message-ID: E1fya9K-0003qd-4k () code ! kde ! org
[Download RAW message or body]

Git commit 93a87bc816bba1a5c09642981d4a0b3cab6b873b by Thomas Baumgart.
Committed on 08/09/2018 at 10:08.
Pushed by tbaumgart into branch '5.0'.

Fix appending of file extension on export

Only append the necessary file extension when the focus leaves the field
and not on every key pressure. Harmonize behavior of CSV and QIF
exporter.

BUG: 395985
FIXED-IN: 5.0.2

M  +3    -6    kmymoney/plugins/csv/export/csvexportdlg.cpp
M  +1    -1    kmymoney/plugins/qif/export/kexportdlg.cpp

https://commits.kde.org/kmymoney/93a87bc816bba1a5c09642981d4a0b3cab6b873b

diff --git a/kmymoney/plugins/csv/export/csvexportdlg.cpp b/kmymoney/plugins/csv/export/csvexportdlg.cpp
index 4e087b256..660f36ca1 100644
--- a/kmymoney/plugins/csv/export/csvexportdlg.cpp
+++ b/kmymoney/plugins/csv/export/csvexportdlg.cpp
@@ -145,12 +145,9 @@ void CsvExportDlg::checkData(const QString& accountName)
   bool  okEnabled = false;
 
   if (!ui->m_qlineeditFile->text().isEmpty()) {
-    QString strFile(ui->m_qlineeditFile->text());
-    int dot = strFile.indexOf('.');
-    if (dot != -1) {
-      strFile.chop(strFile.length() - dot);
-    }
-    strFile += QLatin1String(".csv");
+    auto strFile(ui->m_qlineeditFile->text());
+    if (!strFile.endsWith(QLatin1String(".csv"), Qt::CaseInsensitive))
+      strFile.append(QLatin1String(".csv"));
     ui->m_qlineeditFile->setText(strFile);
   }
   QDate earliestDate(QDate(2500, 01, 01));
diff --git a/kmymoney/plugins/qif/export/kexportdlg.cpp b/kmymoney/plugins/qif/export/kexportdlg.cpp
index 1a4ac0048..3e177fe7e 100644
--- a/kmymoney/plugins/qif/export/kexportdlg.cpp
+++ b/kmymoney/plugins/qif/export/kexportdlg.cpp
@@ -88,7 +88,7 @@ KExportDlg::KExportDlg(QWidget *parent)
   connect(m_qbuttonCancel, &QAbstractButton::clicked, this, &QDialog::reject);
 
   // connect the change signals to the check slot and perform initial check
-  connect(m_qlineeditFile, SIGNAL(textChanged(QString)), this, SLOT(checkData()));
+  connect(m_qlineeditFile, SIGNAL(editingFinished()), this, SLOT(checkData()));
   connect(m_qcheckboxAccount, SIGNAL(toggled(bool)), this, SLOT(checkData()));
   connect(m_qcheckboxCategories, SIGNAL(toggled(bool)), this, SLOT(checkData()));
   connect(m_accountComboBox, SIGNAL(accountSelected(QString)), this, SLOT(checkData(QString)));
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic