/* * Icon Task Manager * * Copyright 2011 Craig Drummond * * ---- * * 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; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef __DOCKMANAGER_H__ #define __DOCKMANAGER_H__ #include #include #include #include class DockItem; class DockHelper; class DockConfig; class AbstractTaskItem; class KConfigDialog; class KConfigGroup; class QTimer; class QDBusServiceWatcher; class DockManager : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "net.launchpad.DockManager") public: static DockManager * self(); DockManager(); void setEnabled(bool en); bool isEnabled() const { return m_enabled; } void reloadItems(); void registerTask(AbstractTaskItem *item); void unregisterTask(AbstractTaskItem *item); void remove(DockItem *item); void itemService(DockItem *item, const QString &serviceName); QStringList dirs() const; const QSet enabledHelpers() const { return m_enabledHelpers; } void addConfigWidget(KConfigDialog *parent); void readConfig(KConfigGroup &cg); void writeConfig(KConfigGroup &cg); private: bool stopDaemon(); public Q_SLOTS: void removeConfigWidget(); Q_SCRIPTABLE QStringList GetCapabilities(); Q_SCRIPTABLE QDBusObjectPath GetItemByXid(qlonglong xid); Q_SCRIPTABLE QList GetItems(); Q_SCRIPTABLE QList GetItemsByDesktopFile(const QString &desktopFile); Q_SCRIPTABLE QList GetItemsByName(QString name); Q_SCRIPTABLE QList GetItemsByPid(int pid); Q_SIGNALS: void ItemAdded(const QDBusObjectPath &path); void ItemRemoved(const QDBusObjectPath &path); private Q_SLOTS: void updateHelpers(); void updateHelpersDelayed(); void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); private: bool m_enabled; bool m_connected; QMap m_items; QMap m_itemService; QMap m_tasks; QList m_helpers; QSet m_enabledHelpers; QTimer *m_timer; DockConfig *m_config; QDBusServiceWatcher *m_watcher; }; #endif