From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- korn/hvitem.cpp | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 korn/hvitem.cpp (limited to 'korn/hvitem.cpp') diff --git a/korn/hvitem.cpp b/korn/hvitem.cpp new file mode 100644 index 000000000..e8cc2483d --- /dev/null +++ b/korn/hvitem.cpp @@ -0,0 +1,82 @@ +/* + * 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 "hvitem.h" + +#include "label.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +HVItem::HVItem( QWidget *parent, const char *name ) + : BoxContainerItem( 0, name ), + _label( new Label( parent, "label" ) ), + _popup( new KPopupMenu( _label, "popupmenu" ) ), + _actions( new KActionCollection( _popup, "actions" ) ) +{ + _popup->insertTitle( kapp->miniIcon(), kapp->caption() ); + this->fillKPopupMenu( _popup, _actions ); + _popup->insertSeparator(); + KStdAction::quit( kapp, SLOT( quit() ), _actions )->plug( _popup ); + + connect( _label, SIGNAL( mouseButtonPressed( Qt::ButtonState ) ), this, SLOT( mouseButtonPressed( Qt::ButtonState ) ) ); +} + +HVItem::~HVItem() +{ + //Let everything be deleted by his parents. +} + +void HVItem::showBox() +{ + _label->show(); +} + +void HVItem::setCount( const int count, const bool newMessages ) +{ + drawLabel( _label, count, newMessages ); +} + +void HVItem::setTooltip( const QString& string ) +{ + QToolTip::add( _label, string ); +} + +void HVItem::slotShowPassivePopup( QPtrList< KornMailSubject >* list, int total, bool date, const QString& name ) +{ + showPassivePopup( _label, list, total, name, date ); +} + +void HVItem::slotShowPassivePopup( const QString& errorMessage, const QString& name ) +{ + KPassivePopup::message( QString( "korn-%1-%2" ).arg( objId() ).arg( name ), errorMessage, _label, "Passive error message" ); +} + +void HVItem::doPopup() +{ + _popup->popup( QCursor::pos() ); +} + +#include "hvitem.moc" -- cgit v1.2.1