• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

task.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   task.cpp                                                              *
00003  *                                                                         *
00004  *   Copyright (C) 2008 Jason Stubbs <jasonbstubbs@gmail.com>              *
00005  *                                                                         *
00006  *   This program is free software; you can redistribute it and/or modify  *
00007  *   it under the terms of the GNU General Public License as published by  *
00008  *   the Free Software Foundation; either version 2 of the License, or     *
00009  *   (at your option) any later version.                                   *
00010  *                                                                         *
00011  *   This program is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU General Public License for more details.                          *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this program; if not, write to the                         *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
00020  ***************************************************************************/
00021 
00022 #include "task.h"
00023 
00024 #include <QtGui/QGraphicsWidget>
00025 
00026 
00027 namespace SystemTray
00028 {
00029 
00030 
00031 class Task::Private
00032 {
00033 public:
00034     QList<QGraphicsWidget*> associatedWidgets;
00035     Task::Order order;
00036 };
00037 
00038 
00039 Task::Task()
00040     : d(new Private)
00041 {
00042     d->order = Normal;
00043 }
00044 
00045 Task::~Task()
00046 {
00047     emit destroyed(this);
00048     delete d;
00049 }
00050 
00051 
00052 QGraphicsWidget* Task::widget(Plasma::Applet *host)
00053 {
00054     Q_ASSERT(host);
00055 
00056     QGraphicsWidget *widget;
00057     widget = createWidget(host);
00058     d->associatedWidgets.append(widget);
00059     connect(widget, SIGNAL(destroyed()), this, SLOT(widgetDeleted()));
00060     connect(this, SIGNAL(destroyed()), widget, SLOT(deleteLater()));
00061 
00062     return widget;
00063 }
00064 
00065 
00066 void Task::widgetDeleted()
00067 {
00068     bool wasEmbeddable = isEmbeddable();
00069     d->associatedWidgets.removeAll(static_cast<QGraphicsWidget*>(sender()));
00070     if (!wasEmbeddable && isEmbeddable()) {
00071         emit changed(this);
00072     }
00073 }
00074 
00075 
00076 QList<QGraphicsWidget*> Task::associatedWidgets() const
00077 {
00078     return d->associatedWidgets;
00079 }
00080 
00081 bool Task::isHideable() const
00082 {
00083     return true;
00084 }
00085 
00086 Task::Order Task::order() const
00087 {
00088     return d->order;
00089 }
00090 
00091 void Task::setOrder(Order order)
00092 {
00093     d->order = order;
00094 }
00095 
00096 }
00097 
00098 
00099 #include "task.moc"

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal