summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-21 19:38:24 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-21 19:38:24 (GMT)
commit67ffca9066e2af8aeee791dd84f0d1737da48b9a (patch)
tree8207d4bd402ebf03f6583fb438cf1e8e2d3bc5d7
parent86780c2e7f0f0b9dad7d5834718048dcd4b6d6df (diff)
main dialog: connect Help, About, Settings and Close button. Close still crashes the application.
-rw-r--r--src/TODO8
-rw-r--r--src/skanlite.cpp36
-rw-r--r--src/skanlite.h2
3 files changed, 29 insertions, 17 deletions
diff --git a/src/TODO b/src/TODO
index 4a6fcfe..208a744 100644
--- a/src/TODO
+++ b/src/TODO
@@ -1,3 +1,11 @@
+2014-01-21 Porting from KDE4 to 5
+=================================
+Issues:
+* Main dialog: Help and Close button do not have icons but they had before (is this a KF5 theme issue?)
+* Main dialog: Help button does not show help (is this a KF5 issue?)
+
+before 2014
+===========
-Make the final image dialog image zoomable
-Add scan profiles (settings/options)
-Start the file number scanning from a specified number or previously saved.
diff --git a/src/skanlite.cpp b/src/skanlite.cpp
index d5bdfc4..f4a81ff 100644
--- a/src/skanlite.cpp
+++ b/src/skanlite.cpp
@@ -49,6 +49,7 @@
#include <kio/global.h>
#include <KSharedConfig>
#include <KConfigGroup>
+#include <KHelpClient>
#include <errno.h>
@@ -57,24 +58,18 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
, m_aboutData(nullptr)
{
setAttribute(Qt::WA_DeleteOnClose);
-
- // FIXME KF5
- //setButtons(KDialog::Help | KDialog::User2 | KDialog::User1 | KDialog::Close);
-
- // FIXME KF5
- //setButtonText(KDialog::User1, i18n("Settings"));
- //setButtonIcon(KDialog::User1, QIcon::fromTheme("configure"));
- //setButtonText(KDialog::User2, i18n("About"));
- //setHelp("index", "skanlite");
- //new
+ //new for KF5
QVBoxLayout *topLayout = new QVBoxLayout(this);
QDialogButtonBox* dlgButtonBoxBottom = new QDialogButtonBox(this);
dlgButtonBoxBottom->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
- QPushButton* btnAbout = dlgButtonBoxBottom->addButton(i18n("About"), QDialogButtonBox::ButtonRole::ActionRole);
- QPushButton* btnSettings = dlgButtonBoxBottom->addButton(i18n("Settings"), QDialogButtonBox::ButtonRole::ActionRole);
- //new end
+ // was "User2:
+ QPushButton* btnAbout = dlgButtonBoxBottom->addButton(i18n("About"), QDialogButtonBox::ButtonRole::ActionRole);
+ // was "User1":
+ QPushButton* btnSettings = dlgButtonBoxBottom->addButton(i18n("Settings"), QDialogButtonBox::ButtonRole::ActionRole);
+ btnSettings->setIcon(QIcon::fromTheme("configure"));
+ //new end KF5
m_firstImage = true;
@@ -99,10 +94,12 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
QSize rect = window.readEntry("Geometry", QSize(740,400));
resize(rect);
- connect (this, SIGNAL(closeClicked()), this, SLOT(saveWindowSize()));
- connect (this, SIGNAL(closeClicked()), this, SLOT(saveScannerOptions()));
- connect (this, SIGNAL(user1Clicked()), this, SLOT(showSettingsDialog()));
- connect (this, SIGNAL(user2Clicked()), this, SLOT(showAboutDialog()));
+ connect(dlgButtonBoxBottom, &QDialogButtonBox::rejected, this, &QDialog::close);
+ connect(this, &QDialog::finished, this, &Skanlite::saveWindowSize);
+ connect(this, &QDialog::finished, this, &Skanlite::saveScannerOptions);
+ connect(btnSettings, &QPushButton::clicked, this, &Skanlite::showSettingsDialog);
+ connect(btnAbout, &QPushButton::clicked, this, &Skanlite::showAboutDialog);
+ connect(dlgButtonBoxBottom, &QDialogButtonBox::helpRequested, this, &Skanlite::showHelp);
//
// Create the settings dialog
@@ -201,6 +198,11 @@ Skanlite::Skanlite(const QString& device, QWidget* parent)
m_firstImage = true;
}
+void Skanlite::showHelp()
+{
+ KHelpClient::invokeHelp("index", "skanlite");
+}
+
void Skanlite::setAboutData(KAboutData* aboutData)
{
m_aboutData = aboutData;
diff --git a/src/skanlite.h b/src/skanlite.h
index 230b38a..4940fa5 100644
--- a/src/skanlite.h
+++ b/src/skanlite.h
@@ -71,6 +71,8 @@ class Skanlite : public QDialog
void alertUser(int type, const QString &strStatus);
void buttonPressed(const QString &optionName, const QString &optionLabel, bool pressed);
+
+ void showHelp();
protected:
void closeEvent(QCloseEvent *event);