summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cord-Landwehr <cordlandwehr@kde.org>2016-10-23 09:00:46 (GMT)
committerAndreas Cord-Landwehr <cordlandwehr@kde.org>2016-10-23 09:00:46 (GMT)
commit2d5de6b0fbecf677cb35db742d02d5aeb3438c40 (patch)
treeb50851f2e53537e5c383340ba02043decc6699e1
parent18fae5c3d61aaffbca45539030e39f6881c513c8 (diff)
Revisit broken element info dialog port
-rw-r--r--src/detailinfodlg.cpp34
-rw-r--r--src/detailinfodlg.h4
-rw-r--r--src/kalzium.cpp2
3 files changed, 26 insertions, 14 deletions
diff --git a/src/detailinfodlg.cpp b/src/detailinfodlg.cpp
index 22b149f..486f56a 100644
--- a/src/detailinfodlg.cpp
+++ b/src/detailinfodlg.cpp
@@ -33,6 +33,7 @@
#include <KPageDialog>
#include <QUrl>
#include "psetables.h"
+#include <QDialogButtonBox>
#include <QFile>
#include <QFileInfo>
@@ -52,13 +53,23 @@ DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent),
{
setFaceType(List);
+ buttonBox()->clear();
+ buttonBox()->addButton(QDialogButtonBox::Close);
+ buttonBox()->addButton(QDialogButtonBox::Help);
+
+ const QString nextButtonIconSource = (layoutDirection() == Qt::LeftToRight) ? "arrow-right" : "arrow-left";
+ QPushButton *nextButton = new QPushButton(QIcon::fromTheme(nextButtonIconSource), i18nc("Next element", "Next"), this);
+ nextButton->setToolTip(i18n("Goes to the next element"));
+
+ const QString prevButtonIconSource = (layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right";
+ QPushButton *prevButton = new QPushButton(QIcon::fromTheme(prevButtonIconSource), i18nc("Previous element", "Previous"), this);
+ prevButton->setToolTip(i18n("Goes to the previous element"));
+
+ buttonBox()->addButton(prevButton, QDialogButtonBox::ActionRole);
+ buttonBox()->addButton(nextButton, QDialogButtonBox::ActionRole);
- /*setButtons(Help | User1 | User2 | Close);
- setDefaultButton(Close);
- setButtonGuiItem(User1, KGuiItem(i18nc("Next element", "Next"),(layoutDirection() == Qt::LeftToRight) ? "arrow-right" : "arrow-left", i18n("Goes to the next element")));
- setButtonGuiItem(User2, KGuiItem(i18nc("Previous element", "Previous"),(layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right", i18n("Goes to the previous element")));
resize(820, 580);
-*/
+
m_baseHtml = QStandardPaths::locate(QStandardPaths::DataLocation, "data/htmlview/", QStandardPaths::LocateDirectory);
m_baseHtml2 = QStandardPaths::locate(QStandardPaths::DataLocation, "data/hazardsymbols/", QStandardPaths::LocateDirectory);
@@ -71,9 +82,12 @@ DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent),
m_actionCollection = new KActionCollection(this);
KStandardAction::quit(this, SLOT(close()), m_actionCollection);
- connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()));
- connect(this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()));
- connect(this, SIGNAL(helpClicked()), this, SLOT(slotHelp()));
+ connect(prevButton, &QPushButton::clicked,
+ this, &DetailedInfoDlg::showPreviousElement);
+ connect(nextButton, &QPushButton::clicked,
+ this, &DetailedInfoDlg::showNextElement);
+ connect(buttonBox(), &QDialogButtonBox::helpRequested,
+ this, &DetailedInfoDlg::slotHelp);
// setting the element and updating the whole dialog
setElement(el);
@@ -612,12 +626,12 @@ void DetailedInfoDlg::slotHelp()
KHelpClient::invokeHelp("infodialog_spectrum", QLatin1String("kalzium"));
}
-void DetailedInfoDlg::slotUser1()
+void DetailedInfoDlg::showNextElement()
{
setElement(pseTables::instance()->getTabletype(m_tableTyp)->nextOf(m_elementNumber));
}
-void DetailedInfoDlg::slotUser2()
+void DetailedInfoDlg::showPreviousElement()
{
setElement(pseTables::instance()->getTabletype(m_tableTyp)->previousOf(m_elementNumber));
}
diff --git a/src/detailinfodlg.h b/src/detailinfodlg.h
index 9132ed9..c005493 100644
--- a/src/detailinfodlg.h
+++ b/src/detailinfodlg.h
@@ -128,8 +128,8 @@ private:
private slots:
void slotLinkClicked(const QUrl &url);
- virtual void slotUser1();
- virtual void slotUser2();
+ void showNextElement();
+ void showPreviousElement();
/**
* invoke the help of the correct chapter
*/
diff --git a/src/kalzium.cpp b/src/kalzium.cpp
index de99915..852e608 100644
--- a/src/kalzium.cpp
+++ b/src/kalzium.cpp
@@ -612,8 +612,6 @@ void Kalzium::openInformationDialog(int number)
m_infoDialog = new DetailedInfoDlg(number, this);
// Remove the selection when this dialog finishes or hides.
- connect(m_infoDialog, SIGNAL(hidden()),
- m_periodicTable, SLOT(slotUnSelectElements()));
connect(m_infoDialog, SIGNAL(elementChanged(int)),
m_periodicTable, SLOT(slotSelectOneElement(int)));
connect(m_infoDialog, SIGNAL(elementChanged(int)),