diff options
author | Timothy Pearson <[email protected]> | 2012-06-13 21:56:45 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-06-13 21:56:45 -0500 |
commit | c57a10113d7abc28a8e05d2cbf9ea9956bb5b58b (patch) | |
tree | a972ddbdb855f3466dc35f644220d2ab013e5294 /src/toplevel.cpp | |
parent | 02d6ef6446dc03f56abde8d71852f69c91403af8 (diff) | |
download | kerberostray-c57a10113d7abc28a8e05d2cbf9ea9956bb5b58b.tar.gz kerberostray-c57a10113d7abc28a8e05d2cbf9ea9956bb5b58b.zip |
Make tray icon easier to see and understand
Diffstat (limited to 'src/toplevel.cpp')
-rw-r--r-- | src/toplevel.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/toplevel.cpp b/src/toplevel.cpp index 3b80d2d..d998691 100644 --- a/src/toplevel.cpp +++ b/src/toplevel.cpp @@ -271,7 +271,8 @@ void TopLevel::resizeEvent (TQResizeEvent *) noTicketsPixmap = loadSizedIcon("kerberos_notickets", width()); expiredTicketsPixmap = loadSizedIcon("kerberos_expiredtickets", width()); partiallyExpiredTicketsPixmap = loadSizedIcon("kerberos_someexpiredtickets", width()); - expiringTicketsPixmap = loadSizedIcon("kerberos_ticketexpiring", width()); + timerOverlayPixmap = loadSizedIcon("kerberos_timeroverlay", width()); + warningOverlayPixmap = loadSizedIcon("kerberos_warningoverlay", width()); repaint(); } @@ -293,8 +294,6 @@ void TopLevel::mousePressEvent(TQMouseEvent *event) { void TopLevel::paintEvent(TQPaintEvent *) { TQString baseToolTip = i18n("%1 Kerberos ticket(s) listed for principal %2").arg(m_ticketList.count()).arg(m_ticketList[0].cachePrincipal); - TQPixmap *pm = &noTicketsPixmap; - bool has_tickets = false; bool tickets_expiring_soon = false; bool some_tickets_expired = false; @@ -318,31 +317,33 @@ void TopLevel::paintEvent(TQPaintEvent *) { if (!notifyExpiry) tickets_expiring_soon = false; + TQPainter p(this); if (has_tickets) { if (all_tickets_expired) { - pm = &expiredTicketsPixmap; + p.drawPixmap(0, 0, expiredTicketsPixmap); + p.drawPixmap(0, 0, warningOverlayPixmap); baseToolTip = baseToolTip + "\n" + i18n("All ticket(s) have expired"); } - else if (tickets_expiring_soon) { - pm = &expiringTicketsPixmap; - baseToolTip = baseToolTip + "\n" + i18n("Ticket(s) will expire soon"); - } else if (some_tickets_expired) { - pm = &partiallyExpiredTicketsPixmap; + p.drawPixmap(0, 0, partiallyExpiredTicketsPixmap); + p.drawPixmap(0, 0, warningOverlayPixmap); baseToolTip = baseToolTip + "\n" + i18n("Some ticket(s) have expired"); } else { - pm = &activeTicketsPixmap; - baseToolTip = baseToolTip + "\n" + i18n("All ticket(s) are active"); + p.drawPixmap(0, 0, activeTicketsPixmap); + if (tickets_expiring_soon) { + p.drawPixmap(0, 0, timerOverlayPixmap); + baseToolTip = baseToolTip + "\n" + i18n("All ticket(s) are active\nSome ticket(s) will expire shortly"); + } + else { + baseToolTip = baseToolTip + "\n" + i18n("All ticket(s) are active"); + } } } else { + p.drawPixmap(0, 0, noTicketsPixmap); baseToolTip = i18n("No Kerberos tickets are available"); } - - TQPixmap base(*pm); // make copy of base pixmap - TQPainter p(this); - p.drawPixmap(0, 0, base); p.end(); setToolTip(baseToolTip); |