Now the systrayicon change it's color when a download is in progress. I simply change...
[kdenetwork.git] / kget / dockindividual.cpp
blob1ecf61faee5e9ddb313857599073f9aae05c8073
1 /***************************************************************************
2 * dockindividual.cpp
3 * -------------------
5 * Revision : $Id$
6 * begin : Tue Jan 29 2002
7 * copyright : (C) 2002 by Patrick Charbonnier
8 * :
9 * email : pch@freeshell.org
11 ****************************************************************************/
13 /***************************************************************************
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 ***************************************************************************/
27 #include <qtooltip.h>
29 #include <kpopupmenu.h>
31 #include "dockindividual.h"
32 DockIndividual::DockIndividual(QWidget *parent, const char *name ) : KSystemTray(parent,name)
34 nPic=0;
35 setPixmap( loadIcon("bar0") );
38 DockIndividual::~DockIndividual()
40 QToolTip::remove(this);
44 void DockIndividual::setValue(int value){
45 #ifdef _DEBUG
46 //sDebugIn<<" value ="<<value<<endl;
47 #endif
48 int tmpPic=0;
49 if (value<20)
50 tmpPic=1;
51 else if(value<40)
52 tmpPic=2;
54 else if(value<60)
55 tmpPic=3;
57 else if(value<80)
58 tmpPic=4;
60 else if(value<=95)
61 tmpPic=5;
63 else if(value>=96)
64 tmpPic=6;
66 if (tmpPic!=nPic)
68 nPic=tmpPic;
69 QString str = "bar" + QString::number( nPic );
70 setPixmap( loadIcon( str ) );
73 #ifdef _DEBUG
74 //sDebugOut<<endl;
75 #endif
80 void DockIndividual::setTip(const QString & _tip)
82 #ifdef _DEBUG
83 //sDebugIn<<"_tip="<<_tip<<endl;
84 #endif
87 QToolTip::add( this, _tip );
89 #ifdef _DEBUG
90 //sDebugOut<<endl;
91 #endif
94 #include "dockindividual.moc"
95 /** No descriptions */
96 void DockIndividual::contextMenuAboutToShow ( KPopupMenu* menu )
98 menu->removeItemAt (3);