aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Mi <codeminister@publicstatic.de>2014-01-21 11:48:14 (GMT)
committerGregor Mi <codeminister@publicstatic.de>2014-01-21 11:48:14 (GMT)
commitb60a536fafba1b77a1fcd2ad105d68287de12d5b (patch)
treee4ed762d6cb8cff469432971bf1b104b621f95ec
parent346b0dd2d3b8ee98ecd474b3595a29bf7cc79c87 (diff)
Introduce QDialogButtonBox because the setButtons(KDialog::User1...) etc. is not available anymore
-rw-r--r--.gitignore1
-rw-r--r--src/ksane_device_dialog.cpp26
-rw-r--r--src/ksane_device_dialog.h3
3 files changed, 18 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore
index 7e52a79..133ec2a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ tests/databases/*/*.db
.kdev4/
build/
libksane.kdev4
+src/.kdev_include_paths
diff --git a/src/ksane_device_dialog.cpp b/src/ksane_device_dialog.cpp
index 4c0bfd6..88f22ca 100644
--- a/src/ksane_device_dialog.cpp
+++ b/src/ksane_device_dialog.cpp
@@ -27,10 +27,7 @@
*
* ============================================================ */
-// Local includes
#include "ksane_device_dialog.h"
-#include "ksane_device_dialog.moc"
-
// Sane includes
extern "C"
@@ -43,7 +40,6 @@ extern "C"
#include <QLabel>
#include <QDialogButtonBox>
-
#include <KLocalizedString>
namespace KSaneIface
@@ -54,9 +50,8 @@ KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent)
{
//setButtons(KDialog::User1 | KDialog::Ok | KDialog::Cancel); // FIXME KF5
//setButtonText(User1, i18n("Reload devices list")); // FIXME KF5
-
- QDialogButtonBox* buttonbox = new QDialogButtonBox();
- buttonbox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+ QVBoxLayout * top = new QVBoxLayout(this);
m_btnGroup = new QButtonGroup(this);
@@ -87,13 +82,24 @@ KSaneDeviceDialog::KSaneDeviceDialog(QWidget *parent)
area->setWidgetResizable(true);
area->setFrameShape(QFrame::NoFrame);
area->setWidget(m_btnContainer);
-
- //setMainWidget(m_btnBox); // FIXME KF5
+
+ QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
+ buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QPushButton* reloadDevicesButton = buttonBox->addButton(i18n("Reload devices list"), QDialogButtonBox::ButtonRole::ActionRole);
+ layout->addWidget(buttonBox);
+ //connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ //connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
+ connect(reloadDevicesButton, &QPushButton::clicked, this, &KSaneDeviceDialog::reloadDevicesList);
+
+ top->addWidget(m_btnBox);
+ top->addWidget(buttonBox);
+
setMinimumHeight(200);
m_findDevThread = FindSaneDevicesThread::getInstance();
connect(m_findDevThread, SIGNAL(finished()), this, SLOT(updateDevicesList()));
- connect(this, SIGNAL(user1Clicked()), this, SLOT(reloadDevicesList()));
reloadDevicesList();
}
diff --git a/src/ksane_device_dialog.h b/src/ksane_device_dialog.h
index d7f86fb..cb95744 100644
--- a/src/ksane_device_dialog.h
+++ b/src/ksane_device_dialog.h
@@ -32,7 +32,6 @@
#include "ksane_find_devices_thread.h"
-// Qt includes
#include <QGroupBox>
#include <QStringList>
#include <QButtonGroup>
@@ -75,6 +74,6 @@ private:
FindSaneDevicesThread *m_findDevThread;
};
-} // NameSpace KSaneIface
+}
#endif