summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Fischer <[email protected]>2014-11-05 00:51:01 +0100
committerAndi Fischer <[email protected]>2014-11-05 00:51:01 +0100
commit01d0d5749497bb7ffa5cdb09a7fed07e5029926b (patch)
tree6b1381cde0e942865dd12315ee593f8266961382
parent0b97cf9951ec00fa6f3f87945fb7a038ebf91eba (diff)
KDialog --> QDialog
-rw-r--r--umbrello/codegenerators/codegenerator.cpp2
-rw-r--r--umbrello/codegenerators/simplecodegenerator.cpp2
-rw-r--r--umbrello/dialogs/dialogbase.cpp74
-rw-r--r--umbrello/dialogs/dialogbase.h3
-rw-r--r--umbrello/dialogs/umlcheckconstraintdialog.cpp4
-rw-r--r--umbrello/dialogs/umlentityattributedialog.cpp4
-rw-r--r--umbrello/dialogs/umltemplatedialog.cpp4
7 files changed, 65 insertions, 28 deletions
diff --git a/umbrello/codegenerators/codegenerator.cpp b/umbrello/codegenerators/codegenerator.cpp
index 16bf072..15230bc 100644
--- a/umbrello/codegenerators/codegenerator.cpp
+++ b/umbrello/codegenerators/codegenerator.cpp
@@ -544,7 +544,7 @@ QString CodeGenerator::overwritableName(const QString& name, const QString &exte
}
break;
//FIXME KF5
-// case KDialog::No: //generate similar name
+// case QDialog::No: //generate similar name
// suffix = 1;
// while (1) {
// filename = name + QLatin1String("__") + QString::number(suffix) + extension;
diff --git a/umbrello/codegenerators/simplecodegenerator.cpp b/umbrello/codegenerators/simplecodegenerator.cpp
index 5e2b626..0baf945 100644
--- a/umbrello/codegenerators/simplecodegenerator.cpp
+++ b/umbrello/codegenerators/simplecodegenerator.cpp
@@ -189,7 +189,7 @@ QString SimpleCodeGenerator::overwritableName(UMLPackage* concept, const QString
}
break;
//FIXME KF5
-// case KDialog::No: //generate similar name
+// case QDialog::No: //generate similar name
// suffix = 1;
// while (1) {
// filename = name + QLatin1String("__") + QString::number(suffix) + ext;
diff --git a/umbrello/dialogs/dialogbase.cpp b/umbrello/dialogs/dialogbase.cpp
index e25ad14..3177ba1 100644
--- a/umbrello/dialogs/dialogbase.cpp
+++ b/umbrello/dialogs/dialogbase.cpp
@@ -12,6 +12,7 @@
#include "dialogbase.h"
// local includes
+#include "debug_utils.h"
#include "icon_utils.h"
#include "uml.h"
#include "umlwidget.h"
@@ -23,11 +24,16 @@
#include <KPageWidget>
// qt includes
+#include <QAbstractButton>
#include <QApplication>
+#include <QDialogButtonBox>
#include <QDockWidget>
#include <QFrame>
#include <QHBoxLayout>
#include <QKeyEvent>
+#include <QPushButton>
+
+DEBUG_REGISTER(DialogBase)
/**
* Constructor
@@ -41,20 +47,24 @@ DialogBase::DialogBase(QWidget *parent, bool withDefaultButton)
{
if (m_useDialog) {
m_pageDialog = new KPageDialog(parent);
-#if 0 //FIXME KF5
- KDialog::ButtonCodes buttons = KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Help;
- if (withDefaultButton)
- buttons |= KDialog::Default;
- m_pageDialog->setButtons(buttons);
- m_pageDialog->setDefaultButton(KDialog::Ok);
- m_pageDialog->showButtonSeparator(true);
- m_pageDialog->setFaceType(KPageDialog::List);
m_pageDialog->setModal(true);
+ m_pageDialog->setFaceType(KPageDialog::List);
+ m_pageDialog->setStandardButtons(QDialogButtonBox::Ok |
+ QDialogButtonBox::Apply |
+ QDialogButtonBox::Cancel |
+ QDialogButtonBox::Help);
+ QDialogButtonBox * dlgButtonBox = m_pageDialog->findChild<QDialogButtonBox*>(QLatin1String("buttonbox"));
+ if (withDefaultButton) {
+ QPushButton *defaultButton = new QPushButton(i18n("Default"));
+ m_pageDialog->addActionButton(defaultButton);
+ connect(defaultButton, SIGNAL(clicked()), this, SLOT(slotDefaultClicked()));
+ }
+#if 0 //FIXME KF5
m_pageDialog->setHelp(QString::fromLatin1("umbrello/index.html"), QString());
#endif
- connect(m_pageDialog, SIGNAL(okClicked()), this, SLOT(slotOkClicked()));
- connect(m_pageDialog, SIGNAL(applyClicked()), this, SLOT(slotApplyClicked()));
- connect(m_pageDialog, SIGNAL(defaultClicked()), this, SLOT(slotDefaultClicked()));
+ connect(m_pageDialog, SIGNAL(accepted()), this, SLOT(slotOkClicked()));
+ connect(dlgButtonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
+ connect(dlgButtonBox, SIGNAL(helpRequested()), this, SLOT(slotHelpClicked()));
} else {
m_pageWidget = new KPageWidget(this);
m_pageWidget->setFaceType(KPageView::Tree);
@@ -136,22 +146,23 @@ void DialogBase::saveStylePageData(UMLWidget *widget)
void DialogBase::setCaption(const QString &caption)
{
-#if 0 //FIXME KF5
- if (m_pageDialog)
- m_pageDialog->setCaption(caption);
-#endif
+ if (m_pageDialog) {
+ m_pageDialog->setWindowTitle(caption);
+ }
}
void DialogBase::accept()
{
- if (m_pageDialog)
- m_pageDialog->accept();
+//FIXME KF%
+// if (m_pageDialog)
+// m_pageDialog->accept();
}
void DialogBase::reject()
{
- if (m_pageDialog)
- m_pageDialog->reject();
+//FIXME KF%
+// if (m_pageDialog)
+// m_pageDialog->reject();
}
KPageWidgetItem *DialogBase::currentPage()
@@ -173,7 +184,7 @@ void DialogBase::addPage(KPageWidgetItem *page)
int DialogBase::spacingHint()
{
#if 0 //FIXME KF5
- return KDialog::spacingHint();
+ return QDialog::spacingHint();
#endif
return 0;
}
@@ -221,6 +232,29 @@ void DialogBase::slotDefaultClicked()
emit defaultClicked();
}
+void DialogBase::slotHelpClicked()
+{
+ DEBUG(DBG_SRC) << "HELP clicked...directly handled";
+}
+
+void DialogBase::slotButtonClicked(QAbstractButton *button)
+{
+ if (button == (QAbstractButton*)m_pageDialog->button(QDialogButtonBox::Apply)) {
+ DEBUG(DBG_SRC) << "APPLY clicked...";
+ slotApplyClicked();
+ }
+// else if (button == (QAbstractButton*)m_pageDialog->button(QDialogButtonBox::Default)) {
+// DEBUG(DBG_SRC) << "DEFAULT clicked...";
+// slotDefaultClicked();
+// }
+ else if (button == (QAbstractButton*)m_pageDialog->button(QDialogButtonBox::Help)) {
+ DEBUG(DBG_SRC) << "HELP clicked...";
+ }
+ else {
+ DEBUG(DBG_SRC) << "Button clicked with unhandled role.";
+ }
+}
+
/**
* Handle key press event.
*
diff --git a/umbrello/dialogs/dialogbase.h b/umbrello/dialogs/dialogbase.h
index 21353e0..325cc5f 100644
--- a/umbrello/dialogs/dialogbase.h
+++ b/umbrello/dialogs/dialogbase.h
@@ -22,6 +22,7 @@
//forward declarations
class KFontChooser;
class KPageDialog;
+class QAbstractButton;
class QFrame;
class UMLWidget;
class UMLWidgetStylePage;
@@ -68,6 +69,8 @@ signals:
private slots:
void slotOkClicked();
+ void slotHelpClicked();
+ void slotButtonClicked(QAbstractButton *button);
void slotApplyClicked();
void slotDefaultClicked();
diff --git a/umbrello/dialogs/umlcheckconstraintdialog.cpp b/umbrello/dialogs/umlcheckconstraintdialog.cpp
index e1279c8..f3c1d4c 100644
--- a/umbrello/dialogs/umlcheckconstraintdialog.cpp
+++ b/umbrello/dialogs/umlcheckconstraintdialog.cpp
@@ -84,8 +84,8 @@ void UMLCheckConstraintDialog::setupDialog()
// set text of label
m_pNameLE->setText(m_pCheckConstraint->name());
- QDialogButtonBox *buttonBox = new QDialogButtonBox();
- buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
+ QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
diff --git a/umbrello/dialogs/umlentityattributedialog.cpp b/umbrello/dialogs/umlentityattributedialog.cpp
index 0ba6440..16e4ccf 100644
--- a/umbrello/dialogs/umlentityattributedialog.cpp
+++ b/umbrello/dialogs/umlentityattributedialog.cpp
@@ -156,8 +156,8 @@ void UMLEntityAttributeDialog::setupDialog()
m_pNameLE->setFocus();
connect(m_pAutoIncrementCB, SIGNAL(clicked(bool)), this, SLOT(slotAutoIncrementStateChanged(bool)));
- QDialogButtonBox *buttonBox = new QDialogButtonBox();
- buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
+ QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
diff --git a/umbrello/dialogs/umltemplatedialog.cpp b/umbrello/dialogs/umltemplatedialog.cpp
index 250cd58..f73ae76 100644
--- a/umbrello/dialogs/umltemplatedialog.cpp
+++ b/umbrello/dialogs/umltemplatedialog.cpp
@@ -85,8 +85,8 @@ void UMLTemplateDialog::setupDialog()
m_pNameLE->setFocus();
- QDialogButtonBox *buttonBox = new QDialogButtonBox();
- buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
+ QDialogButtonBox::Cancel);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);