summaryrefslogtreecommitdiffstats
path: root/korn/dockeditem.cpp
blob: 7d5de18651b7089bc1e729f9fad22ca7747af196 (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
/*
 * Copyright (C) 2004, Mart Kelder (mart.kde@hccnet.nl)
 *
 * 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 program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "dockeditem.h"

#include "systemtray.h"

#include <tdeapplication.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kpassivepopup.h>
#include <tdepopupmenu.h>
#include <klocale.h>

#include <tqbitmap.h>
#include <tqcursor.h>
#include <tqtooltip.h>
#include <tqpainter.h>
#include <tqpixmap.h>
#include <tqmovie.h>

DockedItem::DockedItem( TQWidget * parent, const char * name )
	: BoxContainerItem( TQT_TQOBJECT(parent), name ),
	_systemtray( new SystemTray( parent, "System tray" ) )	
{
	this->fillTDEPopupMenu( _systemtray->contextMenu(), _systemtray->actionCollection() );
	
	connect( _systemtray, TQT_SIGNAL( quitSelected() ), kapp, TQT_SLOT( quit() ) );
	connect( _systemtray, TQT_SIGNAL( mouseButtonPressed( TQt::ButtonState ) ),
		 this, TQT_SLOT( mouseButtonPressed( TQt::ButtonState ) ) );
}

DockedItem::~DockedItem()
{
	delete _systemtray;
}

void DockedItem::showBox()
{
	_systemtray->show();
}
	
void DockedItem::readConfig( TDEConfig* config, const int index )
{
	BoxContainerItem::readConfig( config, index );
	
	//No additional information to be loaded.
}
	
void DockedItem::setCount( const int count, const bool newMessages )
{
	drawLabel( _systemtray, count, newMessages );
}

void DockedItem::setTooltip( const TQString& tooltip )
{
	TQToolTip::add( _systemtray, tooltip );
}

void DockedItem::slotShowPassivePopup( TQPtrList< KornMailSubject >* list, int total, bool date, const TQString& name )
{
	showPassivePopup( _systemtray, list, total, name, date );
}

void DockedItem::slotShowPassivePopup( const TQString& message, const TQString& name )
{
	KPassivePopup::message( i18n( "Korn - %1/%2" ).arg( TQString(objId()) ).arg( name ), message, _systemtray, "Passive error message" );
}

void DockedItem::doPopup()
{
	_systemtray->contextMenu()->popup( TQCursor::pos() );
}

#include "dockeditem.moc"