summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-22 23:23:21 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-22 23:23:21 (GMT)
commit06ba636dd6b220a5e0f5e49c5e706fbe1e2a81e4 (patch)
treed3acc924c1c8e037898dd8b1e76341679fd3f9f8
parent1a71f4fc5777ea92a25381e8cf97a14b565888e7 (diff)
Found bug in QFileDialog KDE integration
-rw-r--r--src/TODO6
-rw-r--r--src/skanlite.cpp26
2 files changed, 16 insertions, 16 deletions
diff --git a/src/TODO b/src/TODO
index 5d944dc..03d493a 100644
--- a/src/TODO
+++ b/src/TODO
@@ -1,16 +1,16 @@
2014-01-21 Porting from KDE4 to 5
=================================
-Changes in 1.1.0 (from 1.0.0)
+Changes in 1.2.0 (from 1.1.0)
-----------------------------
* Save Image Dialog: "Close" button is now called "Discard" because it discards the currently scanned image
Major issues
------------
-* Scan button: crash after scan
+* Save Image Dialog: KDE Save Dialog is borken (see https://git.reviewboard.kde.org/r/115238/)
Questions
---------
-* Difference between "skanlite -d test" and one of the SANE test scanners test:0 or test:1
+* Difference between "skanlite -d test" and one of the SANE test scanners test:0 or test:1?
Minor issues
------------
diff --git a/src/skanlite.cpp b/src/skanlite.cpp
index 872a7d1..ad19ee0 100644
--- a/src/skanlite.cpp
+++ b/src/skanlite.cpp
@@ -35,16 +35,11 @@
#include <QUrl>
#include <QDialogButtonBox>
#include <QComboBox>
+#include <QMessageBox>
#include <KAboutApplicationDialog>
-#include <KAction>
-#include <KComponentData>
-#include <KDebug>
-#include <KGlobal>
#include <KMessageBox>
-#include <KStandardAction>
#include <KImageIO>
-#include <kdeversion.h>
#include <kio/netaccess.h>
#include <KTemporaryFile>
#include <kio/global.h>
@@ -366,15 +361,15 @@ void Skanlite::saveImage()
QString dir = m_saveLocation->u_saveDirLEdit->text();
QString prefix = m_saveLocation->u_imgPrefix->text();
- QString type = m_saveLocation->u_imgFormat->currentText().toLower();
+ QString imgFormat = m_saveLocation->u_imgFormat->currentText().toLower();
int fileNumber = m_saveLocation->u_numStartFrom->value();
QStringList filterList = m_filterList;
if ((m_format==KSaneIface::KSaneWidget::FormatRGB_16_C) ||
(m_format==KSaneIface::KSaneWidget::FormatGrayScale16))
{
filterList = m_filter16BitList;
- if (type != "png") {
- type = "png";
+ if (imgFormat != "png") {
+ imgFormat = "png";
KMessageBox::information(this, i18n("The image will be saved in the PNG format, as Skanlite only supports saving 16 bit color images in the PNG format."));
}
}
@@ -387,7 +382,7 @@ void Skanlite::saveImage()
fname = QString("%1%2.%3")
.arg(prefix)
.arg(i, 4, 10, QChar('0'))
- .arg(type);
+ .arg(imgFormat);
fileUrl = QUrl(QString("%1/%2").arg(dir).arg(fname));
if (fileUrl.isLocalFile()) {
@@ -409,8 +404,13 @@ void Skanlite::saveImage()
saveDialog.setFileMode(QFileDialog::AnyFile);
// ask for a filename if requested.
+ qDebug() << fileUrl.url();
saveDialog.selectFile(fileUrl.url());
- //saveDialog.setMimeTypeFilters(filterList, "image/"+type); // FIXME KF5 API changed
+
+ //saveDialog.setMimeTypeFilters(filterList, "image/"+type); // FIXME KF5: review if works when QFileDialog is fixed by KDE frameworks team
+ QStringList actualFilterList = filterList;
+ actualFilterList << ("image/" + imgFormat);
+ saveDialog.setMimeTypeFilters(actualFilterList);
do {
if (saveDialog.exec() != QFileDialog::Accepted) return;
@@ -569,7 +569,7 @@ void Skanlite::loadScannerOptions()
void Skanlite::availableDevices(const QList<KSaneWidget::DeviceInfo> &deviceList)
{
for (int i=0; i<deviceList.size(); i++) {
- kDebug() << deviceList[i].name;
+ qDebug() << deviceList[i].name;
}
}
@@ -588,5 +588,5 @@ void Skanlite::alertUser(int type, const QString &strStatus)
//************************************************************
void Skanlite::buttonPressed(const QString &optionName, const QString &optionLabel, bool pressed)
{
- kDebug() << "Button" << optionName << optionLabel << ((pressed) ? "pressed" : "released");
+ qDebug() << "Button" << optionName << optionLabel << ((pressed) ? "pressed" : "released");
}