summaryrefslogtreecommitdiffstats
path: root/src/libs/installer
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@digia.com>2013-04-22 17:12:13 +0200
committerTim Jenssen <tim.jenssen@digia.com>2013-04-23 09:23:11 +0200
commitd7f58f9f589c7de1a34e73ab4fda48a06a6b4ee4 (patch)
treee2cfe5f4c5d768cbd19f0173ef55bbb6701bfd25 /src/libs/installer
parentf4da469896bcde4f2d6b3c2c23e7f4bbf0062055 (diff)
added orderedButtons method
- this is needed to write an unittest Change-Id: I2987c56360ac82f27e0bbfc0563feae297bb856b Reviewed-by: Niels Weber <niels.weber@digia.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r--src/libs/installer/messageboxhandler.cpp19
-rw-r--r--src/libs/installer/messageboxhandler.h2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/libs/installer/messageboxhandler.cpp b/src/libs/installer/messageboxhandler.cpp
index 219bc8057..832a96e85 100644
--- a/src/libs/installer/messageboxhandler.cpp
+++ b/src/libs/installer/messageboxhandler.cpp
@@ -151,6 +151,19 @@ QWidget *MessageBoxHandler::currentBestSuitParent()
return qApp->activeWindow();
}
+QList<QMessageBox::Button> MessageBoxHandler::orderedButtons()
+{
+ static QList<QMessageBox::Button> buttons;
+ if (!buttons.isEmpty())
+ return buttons;
+ buttons << QMessageBox::YesToAll << QMessageBox::Yes << QMessageBox::Ok << QMessageBox::Apply
+ << QMessageBox::SaveAll << QMessageBox::Save <<QMessageBox::Retry << QMessageBox::Ignore
+ << QMessageBox::Help << QMessageBox::RestoreDefaults << QMessageBox::Reset << QMessageBox::Open
+ << QMessageBox::Cancel << QMessageBox::Close << QMessageBox::Abort << QMessageBox::Discard
+ << QMessageBox::No << QMessageBox::NoToAll;
+ return buttons;
+}
+
void MessageBoxHandler::setDefaultAction(DefaultAction defaultAction)
{
if (m_defaultAction == defaultAction)
@@ -159,11 +172,7 @@ void MessageBoxHandler::setDefaultAction(DefaultAction defaultAction)
m_buttonOrder.clear();
if (m_defaultAction != AskUser) {
- m_buttonOrder << QMessageBox::YesToAll << QMessageBox::Yes << QMessageBox::Ok << QMessageBox::Apply
- << QMessageBox::SaveAll << QMessageBox::Save <<QMessageBox::Retry << QMessageBox::Ignore
- << QMessageBox::Help << QMessageBox::RestoreDefaults << QMessageBox::Reset << QMessageBox::Open
- << QMessageBox::Cancel << QMessageBox::Close << QMessageBox::Abort << QMessageBox::Discard
- << QMessageBox::No << QMessageBox::NoToAll;
+ m_buttonOrder = orderedButtons();
}
if (m_defaultAction == Reject) {
diff --git a/src/libs/installer/messageboxhandler.h b/src/libs/installer/messageboxhandler.h
index b0b0fb6f2..197a51d85 100644
--- a/src/libs/installer/messageboxhandler.h
+++ b/src/libs/installer/messageboxhandler.h
@@ -110,6 +110,8 @@ public:
QMessageBox::StandardButtons buttons = QMessageBox::Ok,
QMessageBox::StandardButton button = QMessageBox::NoButton) const;
+ static QList<QMessageBox::Button> orderedButtons();
+
private Q_SLOTS:
//this removes the slot from the script area
virtual void deleteLater() {