kshowmail: kshowmail/kshowmaildock.cpp Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# kshowmaildock.cpp

    00001 /***************************************************************************
    00002                           kshowmaildock.cpp  -  description
    00003                              -------------------
    00004     begin                : Wed Jan 3 2001
    00005     copyright            : (C) 2001 by Eggert Ehmke
    00006     email                : eggert.ehmke@berlin.de
    00007  ***************************************************************************/
    00008
    00009 /***************************************************************************
    00010  *                                                                         *
    00011  *   This program is free software; you can redistribute it and/or modify  *
    00012  *   it under the terms of the GNU General Public License as published by  *
    00013  *   the Free Software Foundation; either version 2 of the License, or     *
    00014  *   (at your option) any later version.                                   *
    00015  *                                                                         *
    00016  ***************************************************************************/
    00017
    00018 #include <ntqpixmap.h>
    00019 #include <ntqpainter.h>
    00020 #include <ntqtooltip.h>
    00021
    00022 #include <tdepopupmenu.h>
    00023 #include <kstandarddirs.h>
    00024 #include <tdeglobalsettings.h>
    00025 #include <tdelocale.h>
    00026 #include <kdebug.h>
    00027
    00028 #include "kshowmail.h"
    00029 #include "kshowmaildock.h"
    00030
    00031 KShowMailDock::KShowMailDock(TQWidget* parent, TDEAction *actionRefresh )
    00032 : KSystemTray (parent, 0),
    00033       m_background (TQPixmap(::locate ("data", "kshowmail/pics/kshowmail24.png")))
    00034 {
    00035 //  kdDebug () << "KShowMailDock::KShowMailDock" << endl;
    00036   drawText ("?", TQt::red);
    00037   TQToolTip::add (this, i18n("KShowmail: a powerful pop3 email checker"));
    00038
    00039   show();
    00040
    00041   actionRefresh->plug( contextMenu() );
    00042   //((KShowMailApp*)parent)->m_actionRefresh->plug (contextMenu());
    00043   connect (contextMenu(),TQ_SIGNAL(activated(int)),this, TQ_SIGNAL(sigActivated(int)));
    00044   connect (contextMenu(),TQ_SIGNAL(highlighted(int)),this, TQ_SIGNAL(sigHighlighted(int)));
    00045 }
    00046
    00047 void KShowMailDock::drawText (const TQString str, const TQColor& color)
    00048 {
    00049   setPixmap (m_background);
    00050   TQPixmap* pix = pixmap ();
    00051    if (pix && !pix->isNull ())
    00052   {
    00053     TQPainter p (pix);
    00054 //     p.setFont (TDEGlobalSettings::toolBarFont());
    00055      p.setFont (TDEGlobalSettings::windowTitleFont());
    00056     p.setPen (color);
    00057      p.drawText  (0,0,24,24,TQPainter::AlignCenter,str,str.length());
    00058   }
    00059   else
    00060     kdError () << "No pixmap for traybar !" << endl;
    00061 }
    00062
    00063 void KShowMailDock::drawNumber (int n, const TQColor& color)
    00064 {
    00065   setPixmap (m_background);
    00066   TQPixmap* pix = pixmap ();
    00067    if (pix && !pix->isNull ())
    00068   {
    00069     TQString num (TQString::number(n));
    00070     TQPainter p (pix);
    00071      p.setFont (TDEGlobalSettings::toolBarFont());
    00072     p.setPen (color);
    00073      p.drawText  (0,0,24,24,TQPainter::AlignCenter,num,num.length());
    00074   }
    00075   else
    00076     kdError () << "No pixmap for traybar !" << endl;
    00077 }
    00078
    00079 void KShowMailDock::clear ()
    00080 {
    00081   setPixmap (m_background);
    00082 }
    00083