summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Fischer <[email protected]>2014-12-04 23:09:03 +0100
committerAndi Fischer <[email protected]>2014-12-04 23:09:03 +0100
commitb55f200d97bd52ce6b1ba8200ede92d3b31319ce (patch)
treec2213c04ba80259eb853ca29d96dfde09b1e96af
parent92fcee96ed1be041c8412acba8dc2812b17027e7 (diff)
Fix some code marked with FIXME KF5.
-rw-r--r--umbrello/codegenerators/codegenerator.cpp39
-rw-r--r--umbrello/codegenerators/simplecodegenerator.cpp35
-rw-r--r--umbrello/debug/debug_utils.h2
-rw-r--r--umbrello/dialogs/overwritedialog.cpp29
-rw-r--r--umbrello/dialogs/overwritedialog.h2
5 files changed, 50 insertions, 57 deletions
diff --git a/umbrello/codegenerators/codegenerator.cpp b/umbrello/codegenerators/codegenerator.cpp
index cd282a3..4f0475e 100644
--- a/umbrello/codegenerators/codegenerator.cpp
+++ b/umbrello/codegenerators/codegenerator.cpp
@@ -32,7 +32,7 @@
// kde includes
#include <KLocalizedString>
-#include <kmessagebox.h>
+#include <KMessageBox>
// qt includes
#include <QApplication>
@@ -527,14 +527,14 @@ QString CodeGenerator::overwritableName(const QString& name, const QString &exte
int suffix;
QPointer<OverwriteDialog> overwriteDialog =
new OverwriteDialog(name, outputDirectory.absolutePath(),
- m_applyToAllRemaining, qApp->activeWindow());
+ m_applyToAllRemaining, qApp->activeWindow());
switch (pol->getOverwritePolicy()) { //if it exists, check the OverwritePolicy we should use
case CodeGenerationPolicy::Ok: //ok to overwrite file
filename = name + extension;
break;
case CodeGenerationPolicy::Ask: //ask if we can overwrite
switch(overwriteDialog->exec()) {
- case QDialog::Accepted: //overwrite file
+ case QDialogButtonBox::Yes: //overwrite file
if (overwriteDialog->applyToAllRemaining()) {
pol->setOverwritePolicy(CodeGenerationPolicy::Ok);
filename = name + extension;
@@ -543,23 +543,22 @@ QString CodeGenerator::overwritableName(const QString& name, const QString &exte
m_applyToAllRemaining = false;
}
break;
-//FIXME KF5
-// case QDialog::No: //generate similar name
-// suffix = 1;
-// while (1) {
-// filename = name + QLatin1String("__") + QString::number(suffix) + extension;
-// if (!outputDirectory.exists(filename))
-// break;
-// suffix++;
-// }
-// if (overwriteDialog->applyToAllRemaining()) {
-// pol->setOverwritePolicy(CodeGenerationPolicy::Never);
-// }
-// else {
-// m_applyToAllRemaining = false;
-// }
-// break;
- case QDialog::Rejected: //don't output anything
+ case QDialogButtonBox::No: //generate similar name
+ suffix = 1;
+ while (1) {
+ filename = name + QLatin1String("__") + QString::number(suffix) + extension;
+ if (!outputDirectory.exists(filename))
+ break;
+ suffix++;
+ }
+ if (overwriteDialog->applyToAllRemaining()) {
+ pol->setOverwritePolicy(CodeGenerationPolicy::Never);
+ }
+ else {
+ m_applyToAllRemaining = false;
+ }
+ break;
+ case QDialogButtonBox::Cancel: //don't output anything
if (overwriteDialog->applyToAllRemaining()) {
pol->setOverwritePolicy(CodeGenerationPolicy::Cancel);
}
diff --git a/umbrello/codegenerators/simplecodegenerator.cpp b/umbrello/codegenerators/simplecodegenerator.cpp
index 3cb6863..c5e1ebd 100644
--- a/umbrello/codegenerators/simplecodegenerator.cpp
+++ b/umbrello/codegenerators/simplecodegenerator.cpp
@@ -175,35 +175,34 @@ QString SimpleCodeGenerator::overwritableName(UMLPackage* concept, const QString
int suffix;
QPointer<OverwriteDialog> overwriteDialog =
new OverwriteDialog(filename, outputDir.absolutePath(),
- m_applyToAllRemaining, qApp->activeWindow());
+ m_applyToAllRemaining, qApp->activeWindow());
switch(commonPolicy->getOverwritePolicy()) { //if it exists, check the OverwritePolicy we should use
case CodeGenerationPolicy::Ok: //ok to overwrite file
break;
case CodeGenerationPolicy::Ask: //ask if we can overwrite
switch(overwriteDialog->exec()) {
- case QDialog::Accepted: //overwrite file
+ case QDialogButtonBox::Yes: //overwrite file
if (overwriteDialog->applyToAllRemaining()) {
commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Ok);
} else {
m_applyToAllRemaining = false;
}
break;
-//FIXME KF5
-// case QDialog::No: //generate similar name
-// suffix = 1;
-// while (1) {
-// filename = name + QLatin1String("__") + QString::number(suffix) + ext;
-// if (!outputDir.exists(filename))
-// break;
-// suffix++;
-// }
-// if (overwriteDialog->applyToAllRemaining()) {
-// commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Never);
-// } else {
-// m_applyToAllRemaining = false;
-// }
-// break;
- case QDialog::Rejected: //don't output anything
+ case QDialogButtonBox::No: //generate similar name
+ suffix = 1;
+ while (1) {
+ filename = name + QLatin1String("__") + QString::number(suffix) + ext;
+ if (!outputDir.exists(filename))
+ break;
+ suffix++;
+ }
+ if (overwriteDialog->applyToAllRemaining()) {
+ commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Never);
+ } else {
+ m_applyToAllRemaining = false;
+ }
+ break;
+ case QDialogButtonBox::Cancel: //don't output anything
if (overwriteDialog->applyToAllRemaining()) {
commonPolicy->setOverwritePolicy(CodeGenerationPolicy::Cancel);
} else {
diff --git a/umbrello/debug/debug_utils.h b/umbrello/debug/debug_utils.h
index 6b8b1bc..d9302ed 100644
--- a/umbrello/debug/debug_utils.h
+++ b/umbrello/debug/debug_utils.h
@@ -82,7 +82,7 @@ protected:
void updateParentItemCheckBox(QTreeWidgetItem *parent);
virtual void showEvent(QShowEvent*);
-private slots:
+private Q_SLOTS:
void slotParentItemClicked(QTreeWidgetItem *parent);
void slotItemClicked(QTreeWidgetItem* item, int column);
diff --git a/umbrello/dialogs/overwritedialog.cpp b/umbrello/dialogs/overwritedialog.cpp
index 2337b76..48f6c9c 100644
--- a/umbrello/dialogs/overwritedialog.cpp
+++ b/umbrello/dialogs/overwritedialog.cpp
@@ -25,17 +25,14 @@
/**
* Constructor sets up the dialog, adding checkbox and label.
*/
-OverwriteDialog::OverwriteDialog(
- const QString& fileName,
- const QString& outputDirectory,
- bool applyToAllRemaining, QWidget* parent)
+OverwriteDialog::OverwriteDialog(const QString& fileName, const QString& outputDirectory,
+ bool applyToAllRemaining, QWidget* parent)
: QDialog(parent)
{
setWindowTitle(i18n("Destination File Already Exists"));
setModal(true);
QVBoxLayout* layout = new QVBoxLayout();
-//FIXME KF5 layout->setSpacing(spacingHint());
layout->setMargin(0);
setLayout(layout);
@@ -47,15 +44,13 @@ OverwriteDialog::OverwriteDialog(
layout->addWidget(m_applyToAllRemaining);
QDialogButtonBox *buttonBox = new QDialogButtonBox();
- buttonBox->addButton(i18n("&Overwrite"), QDialogButtonBox::AcceptRole);
-//FIXME KF5 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
-//FIXME KF5 okButton->setDefault(true);
- buttonBox->addButton(i18n("&Generate Similar File Name"), QDialogButtonBox::ApplyRole);
- buttonBox->addButton(i18n("&Do Not Generate File"), QDialogButtonBox::RejectRole);
-
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotOk()));
-//FIXME KF5 connect(buttonBox, SIGNAL(clicked()), this, SLOT(slotApply()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()));
+ QPushButton* okayBtn = buttonBox->addButton(i18n("&Overwrite"), QDialogButtonBox::AcceptRole);
+ QPushButton* applyBtn = buttonBox->addButton(i18n("&Generate Similar File Name"), QDialogButtonBox::ApplyRole);
+ QPushButton* cancelBtn = buttonBox->addButton(i18n("&Do Not Generate File"), QDialogButtonBox::RejectRole);
+ layout->addWidget(buttonBox);
+ connect(okayBtn, SIGNAL(clicked()), this, SLOT(slotOk()));
+ connect(applyBtn, SIGNAL(clicked()), this, SLOT(slotApply()));
+ connect(cancelBtn, SIGNAL(clicked()), this, SLOT(slotCancel()));
}
/**
@@ -71,7 +66,7 @@ OverwriteDialog::~OverwriteDialog()
*/
void OverwriteDialog::slotOk()
{
- accept();
+ done(QDialogButtonBox::Yes);
}
/**
@@ -79,7 +74,7 @@ void OverwriteDialog::slotOk()
*/
void OverwriteDialog::slotApply()
{
-//FIXME KF5 done(No);
+ done(QDialogButtonBox::No);
}
/**
@@ -87,7 +82,7 @@ void OverwriteDialog::slotApply()
*/
void OverwriteDialog::slotCancel()
{
- reject();
+ done(QDialogButtonBox::Cancel);
}
/**
diff --git a/umbrello/dialogs/overwritedialog.h b/umbrello/dialogs/overwritedialog.h
index 4fc2679..540ed6d 100644
--- a/umbrello/dialogs/overwritedialog.h
+++ b/umbrello/dialogs/overwritedialog.h
@@ -31,7 +31,7 @@ class OverwriteDialog: public QDialog
Q_OBJECT
public:
OverwriteDialog(const QString& fileName, const QString& outputDirectory,
- bool applyToAllRemaining, QWidget* parent=0);
+ bool applyToAllRemaining, QWidget* parent = 0);
~OverwriteDialog();
bool applyToAllRemaining();