You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kshowmail/kshowmail/kshowmaildock.cpp

84 lines
2.8 KiB

/***************************************************************************
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 <ntqpixmap.h>
#include <ntqpainter.h>
#include <ntqtooltip.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);
}