blob: d444d3f4ae6ed44f8404e13d365058229e937572 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
/*
This class handles the system tray icon
begin: Sun Nov 9 2003
copyright: (C) 2003 by Peter Simonsson
email: psn@linux.se
*/
#include "trayicon.h"
#include "konversationapplication.h"
#include "channel.h"
#include "server.h"
#include "chatwindow.h"
#include "config/preferences.h"
#include <tqtimer.h>
#include <tqtooltip.h>
#include <tdeglobal.h>
#include <kiconloader.h>
#include <tdelocale.h>
namespace Konversation
{
TrayIcon::TrayIcon(TQWidget* parent) : KSystemTray(parent)
{
m_notificationEnabled = false;
m_blinkTimer = new TQTimer(this);
connect(m_blinkTimer, TQT_SIGNAL(timeout()), TQT_SLOT(blinkTimeout()));
updateAppearance();
TQToolTip::add(this,i18n("Konversation - IRC Client"));
}
TrayIcon::~TrayIcon()
{
}
void TrayIcon::startNotification()
{
if(!m_notificationEnabled)
{
return;
}
if(Preferences::trayNotifyBlink())
{
if(!m_blinkTimer->isActive())
{
setPixmap(m_messagePix);
m_blinkOn = true;
m_blinkTimer->start(500);
}
}
else
{
setPixmap(m_messagePix);
m_blinkTimer->stop();
}
}
void TrayIcon::endNotification()
{
m_blinkTimer->stop();
setPixmap(m_nomessagePix);
}
void TrayIcon::blinkTimeout()
{
m_blinkOn = !m_blinkOn;
if(m_blinkOn)
{
setPixmap(m_messagePix);
}
else
{
setPixmap(m_nomessagePix);
}
}
void TrayIcon::updateAppearance()
{
m_nomessagePix = loadIcon("konversation");
m_messagePix = loadIcon("konv_message");
setPixmap(m_nomessagePix);
}
}
#include "trayicon.moc"
|