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
|
/***************************************************************************
kshowmaildock.cpp - description
-------------------
begin : Wed Jan 3 2001
copyright : (C) 2001 by Eggert Ehmke
email : eggert.ehmke@berlin.de
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include <tqpixmap.h>
#include <tqpainter.h>
#include <tqtooltip.h>
#include <tdepopupmenu.h>
#include <kstandarddirs.h>
#include <tdeglobalsettings.h>
#include <tdelocale.h>
#include <kdebug.h>
#include "kshowmail.h"
#include "kshowmaildock.h"
KShowMailDock::KShowMailDock(TQWidget* parent, TDEAction *actionRefresh )
: KSystemTray (parent, 0),
m_background (TQPixmap(::locate ("data", "kshowmail/pics/kshowmail24.png")))
{
// kdDebug () << "KShowMailDock::KShowMailDock" << endl;
drawText ("?", TQt::red);
TQToolTip::add (this, i18n("KShowmail: a powerful pop3 email checker"));
show();
actionRefresh->plug( contextMenu() );
//((KShowMailApp*)parent)->m_actionRefresh->plug (contextMenu());
connect (contextMenu(),SIGNAL(activated(int)),this, SIGNAL(sigActivated(int)));
connect (contextMenu(),SIGNAL(highlighted(int)),this, SIGNAL(sigHighlighted(int)));
}
void KShowMailDock::drawText (const TQString str, const TQColor& color)
{
setPixmap (m_background);
TQPixmap* pix = pixmap ();
if (pix && !pix->isNull ())
{
TQPainter p (pix);
// p.setFont (TDEGlobalSettings::toolBarFont());
p.setFont (TDEGlobalSettings::windowTitleFont());
p.setPen (color);
p.drawText (0,0,24,24,TQPainter::AlignCenter,str,str.length());
}
else
kdError () << "No pixmap for traybar !" << endl;
}
void KShowMailDock::drawNumber (int n, const TQColor& color)
{
setPixmap (m_background);
TQPixmap* pix = pixmap ();
if (pix && !pix->isNull ())
{
TQString num (TQString::number(n));
TQPainter p (pix);
p.setFont (TDEGlobalSettings::toolBarFont());
p.setPen (color);
p.drawText (0,0,24,24,TQPainter::AlignCenter,num,num.length());
}
else
kdError () << "No pixmap for traybar !" << endl;
}
void KShowMailDock::clear ()
{
setPixmap (m_background);
}
#include "kshowmaildock.moc"
|