summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Fischer <[email protected]>2014-12-09 10:58:27 +0100
committerAndi Fischer <[email protected]>2014-12-09 10:58:27 +0100
commit1431ba1fedf17e44cdb5b5a5a5f610d6273d81e7 (patch)
tree3fd1f77e24c44083be278f0414cfd245f01d4935
parent900573ace11b3f01470b21313bd1e10f013dc804 (diff)
Dialog buttons handled and FIXME KF5 comments removed.
-rw-r--r--umbrello/dialogs/umlroledialog.cpp47
-rw-r--r--umbrello/dialogs/umlroledialog.h7
2 files changed, 44 insertions, 10 deletions
diff --git a/umbrello/dialogs/umlroledialog.cpp b/umbrello/dialogs/umlroledialog.cpp
index fe5046f..80085cc 100644
--- a/umbrello/dialogs/umlroledialog.cpp
+++ b/umbrello/dialogs/umlroledialog.cpp
@@ -11,13 +11,17 @@
// own header
#include "umlroledialog.h"
-// kde includes
-#include <KLocalizedString>
-
// app includes
#include "umlrole.h"
#include "umlroleproperties.h"
+// kde includes
+#include <KHelpClient>
+#include <KLocalizedString>
+
+// qt includes
+#include <QDialogButtonBox>
+
/**
* Constructor.
*/
@@ -51,13 +55,11 @@ void UMLRoleDialog::setupDialog()
resize(QSize(425, 620).expandedTo(minimumSizeHint()));
-// topLayout->addWidget(m_pParmsGB);
-
-//FIXME KF5
-// setButtons(Help | Ok | Cancel);
-// setDefaultButton(Ok);
-// showButtonSeparator(true);
- connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ m_dialogButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
+ QDialogButtonBox::Help |
+ QDialogButtonBox::Cancel);
+ connect(m_dialogButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
+ topLayout->addWidget(m_dialogButtonBox);
}
/**
@@ -82,3 +84,28 @@ void UMLRoleDialog::slotOk()
accept();
}
}
+
+/**
+ * Activated when a button is clicked
+ * @param button the button that was clicked
+ */
+void UMLRoleDialog::slotButtonClicked(QAbstractButton* button)
+{
+ uDebug() << "UMLRoleDialog::slotButtonClicked - " << button->text();
+ switch (m_dialogButtonBox->buttonRole(button)) {
+ case QDialogButtonBox::AcceptRole:
+ slotOk();
+ break;
+ case QDialogButtonBox::RejectRole:
+ reject();
+ break;
+// case QDialogButtonBox::ApplyRole:
+// slotApply();
+ case QDialogButtonBox::HelpRole:
+ KHelpClient::invokeHelp(QLatin1String("help:/umbrello/index.html"), QLatin1String("umbrello"));
+ break;
+ default:
+ uDebug() << "UMLRoleDialog::slotButtonClicked - " << button->text() << " unhandled!";
+ break;
+ }
+}
diff --git a/umbrello/dialogs/umlroledialog.h b/umbrello/dialogs/umlroledialog.h
index 679d100..5bc94b0 100644
--- a/umbrello/dialogs/umlroledialog.h
+++ b/umbrello/dialogs/umlroledialog.h
@@ -17,6 +17,8 @@
/**
* @author Paul Hensgen
*/
+class QAbstractButton;
+class QDialogButtonBox;
class UMLRole;
class UMLRoleProperties;
@@ -36,9 +38,14 @@ protected:
private:
UMLRoleProperties *m_pRoleProps;
+ QDialogButtonBox *m_dialogButtonBox;
public slots:
void slotOk();
+
+protected slots:
+ virtual void slotButtonClicked(QAbstractButton *button);
+
};
#endif