[PATCH 1 of 2] (issue99) Make OK button in message box notification configurable and change it for list updates
Wald Commits
scm-commit at wald.intevation.org
Thu Sep 18 11:13:10 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1411031337 -7200
# Node ID a4282bc67a8bc6e352bd8cfd2a1add7c5e9a31df
# Parent 05d4e882fe185a2c744322a919eaa6704a4ee3bd
(issue99) Make OK button in message box notification configurable and change it for list updates
diff -r 05d4e882fe18 -r a4282bc67a8b ui/mainwindow.cpp
--- a/ui/mainwindow.cpp Wed Sep 17 18:56:29 2014 +0200
+++ b/ui/mainwindow.cpp Thu Sep 18 11:08:57 2014 +0200
@@ -174,8 +174,17 @@
* the trayicon. So we delay here.*/
QTimer::singleShot(2000, this, SLOT(showMessage()));
} else if (mCurState == NewSoftwareAvailable || !isVisible()) {
- mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
- QSystemTrayIcon::Information, 10000);
+ if (mCurState == NewListAvailable) {
+ mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
+ QSystemTrayIcon::Information, 10000,
+ tr("Show recommendations"));
+ } else if (mCurState == NewSoftwareAvailable || !mTrayIcon->isAlternative()) {
+ /* Only show new list or new software in alternative as
+ * the current tray icon alternative is too invasive for pure
+ * informational messages. */
+ mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
+ QSystemTrayIcon::Information, 10000);
+ }
mMessageTimer->start(); // Restart the timer so that we don't spam
}
}
diff -r 05d4e882fe18 -r a4282bc67a8b ui/trayicon.cpp
--- a/ui/trayicon.cpp Wed Sep 17 18:56:29 2014 +0200
+++ b/ui/trayicon.cpp Thu Sep 18 11:08:57 2014 +0200
@@ -37,7 +37,8 @@
}
void TrayIcon::showMessage(const QString &title, const QString &msg,
- QSystemTrayIcon::MessageIcon msg_icon, int msecs) {
+ QSystemTrayIcon::MessageIcon msg_icon, int msecs,
+ const QString &okBtnText) {
if (!useAlt) {
QSystemTrayIcon::showMessage(title, msg, msg_icon, msecs);
return;
@@ -51,7 +52,11 @@
}
mMessageBox->setIconPixmap(icon().pixmap(mMessageBox->iconPixmap().size()));
mMessageBox->setWindowIcon(icon());
- mMessageBox->button(QMessageBox::Ok)->setText (tr("Install update"));
+ if (!okBtnText.isEmpty()) {
+ mMessageBox->button(QMessageBox::Ok)->setText (okBtnText);
+ } else {
+ mMessageBox->button(QMessageBox::Ok)->setText (tr("Install update"));
+ }
mMessageBox->button(QMessageBox::No)->setText (tr("Remind me later"));
mMessageBox->show();
}
diff -r 05d4e882fe18 -r a4282bc67a8b ui/trayicon.h
--- a/ui/trayicon.h Wed Sep 17 18:56:29 2014 +0200
+++ b/ui/trayicon.h Thu Sep 18 11:08:57 2014 +0200
@@ -34,7 +34,8 @@
public Q_SLOTS:
void showMessage(const QString &title, const QString &msg,
- QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 10000);
+ QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information, int msecs = 10000,
+ const QString &okBtnText = QString());
private Q_SLOTS:
void messageDestroyed();
More information about the Trustbridge-commits
mailing list