/* 
 * This file is part of DesktopBSD, see the README file.
 *
 * Author: Reinhard Pointner <rpointner@desktopbsd.net>
 *         (C) 2006
 *
 * Copyright: BSD, see the COPYING file included in this distribution
 *
 */
#ifndef PACKAGEMGRTRAY_H
#define PACKAGEMGRTRAY_H

#include <ksystemtray.h>
#include <kpopupmenu.h>

#include <qwidget.h>
#include <qpixmap.h>
#include <qstring.h>


/**
	Basic Trayicon for the Packagemanager that quits the
	application the "Exit" is clicked.
*/
class PackageMgrTray : public KSystemTray {
Q_OBJECT


public:
	PackageMgrTray(QWidget *parent, bool menuEnabled = false);
	~PackageMgrTray() { };

	enum PkgMgrState { Normal, Working, Notify };

public slots:

	/**
		Changes the tooltip that is used for this trayicon
	*/
	void setTooltip(QString tooltip);
	
	/**
	   Remove a tooltip used for the tray icon.
	*/
	void clearTooltip();

	/**
		Changes the icon according to the state.
		\param state New State (Normal, Working or Notify).
	*/
	void setState(PkgMgrState state);

	/**
		Displays a KPassivePopup. The title will be set to KApplication.caption().
		\param message Message that will be displayed.
	*/
	void displayMessage(QString message);

protected:
	void mousePressEvent(QMouseEvent *e);

private:
	bool menuEnabled;
	QPixmap getIcon(PkgMgrState state);
};

#endif
