[kde-doc-english] [trojita] src/Gui: GUI: improve systray tooltips
Jan Kundrát
jkt at kde.org
Thu Mar 3 23:22:16 UTC 2016
Git commit ca5eeb61a9e452c0d2402c3e5751f1e60fc156ba by Jan Kundrát.
Committed on 01/03/2016 at 00:57.
Pushed by gerrit into branch 'master'.
GUI: improve systray tooltips
- do not translate the word "Trojitá"
- add profile name in there
- indicate offline status
Change-Id: I9ce9f26f3b75c86fa6260550fbe193e399ad601e
M +12 -2 src/Gui/Window.cpp
http://commits.kde.org/trojita/ca5eeb61a9e452c0d2402c3e5751f1e60fc156ba
diff --git a/src/Gui/Window.cpp b/src/Gui/Window.cpp
index 5a4cb4c..cc1e1d0 100644
--- a/src/Gui/Window.cpp
+++ b/src/Gui/Window.cpp
@@ -891,7 +891,13 @@ void MainWindow::handleTrayIconChange()
== Imap::Mailbox::NETWORK_OFFLINE;
auto pixmap = UiUtils::loadIcon(QStringLiteral("trojita"))
.pixmap(QSize(32, 32), isOffline ? QIcon::Disabled : QIcon::Normal);
- auto tooltip = trUtf8("Trojitá");
+ QString tooltip;
+ auto profileName = QString::fromUtf8(qgetenv("TROJITA_PROFILE"));
+ if (profileName.isEmpty()) {
+ tooltip = QStringLiteral("Trojitá");
+ } else {
+ tooltip = QStringLiteral("Trojitá [%1]").arg(profileName);
+ }
if (mailbox.isValid() && mailbox.data(Imap::Mailbox::RoleMailboxName).toString() == QLatin1String("INBOX")) {
if (mailbox.data(Imap::Mailbox::RoleUnreadMessageCount).toInt() > 0) {
@@ -925,8 +931,12 @@ void MainWindow::handleTrayIconChange()
painter.setBrush(isOffline ? Qt::red : Qt::black);
painter.drawPath(path);
- tooltip = trUtf8("Trojitá - %n unread message(s)", 0, mailbox.data(Imap::Mailbox::RoleUnreadMessageCount).toInt());
+ //: This is a tooltip for the tray icon. It will be prefixed by something like "Trojita" or "Trojita [work]"
+ tooltip += trUtf8(" - %n unread message(s)", 0, mailbox.data(Imap::Mailbox::RoleUnreadMessageCount).toInt());
}
+ } else if (isOffline) {
+ //: A tooltip suffix when offline. The prefix is something like "Trojita" or "Trojita [work]"
+ tooltip += tr(" - offline");
}
m_trayIcon->setToolTip(tooltip);
m_trayIcon->setIcon(QIcon(pixmap));
More information about the kde-doc-english
mailing list