Index: libs/plasma/appletmanager.h===================================================================--- libs/plasma/appletmanager.h (revision 0)+++ libs/plasma/appletmanager.h (revision 0)@@ -0,0 +1,59 @@+/*+ * Copyright (C) 2007 Mike Evans <mike@asrc.info>+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License version 2 (or,+ * at your option, any later version) as published by the Free Software+ * Foundation+ *+ * 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 Library 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.+ */++#ifndef APPLETMANAGERWINDOW_H_+#define APPLETMANAGERWINDOW_H_++#include <KDE/KDialog>++#include <plasma/plasma_export.h>++namespace Plasma+{++class Corona;+class Containment;++class PLASMA_EXPORT AppletManager: public KDialog+{+ Q_OBJECT+public:+ explicit AppletManager(Plasma::Corona *corona, QWidget *parent = 0, Qt::WindowFlags f = 0);+ explicit AppletManager(Plasma::Containment *containment, QWidget *parent = 0, Qt::WindowFlags f = 0);+ virtual ~AppletManager();+ virtual void show();++protected Q_SLOTS:+ /**+ * Kills currently selected applets+ */+ void killApplet();+ void populateTree();++++private:+ void init(); + class Private;+ Private * const d;+};++} // namespace Plasma++#endif /*APPLETMANAGERWINDOW_H_*/Index: libs/plasma/CMakeLists.txt===================================================================--- libs/plasma/CMakeLists.txt (revision 724922)+++ libs/plasma/CMakeLists.txt (working copy)@@ -23,6 +23,7 @@ set(plasma_LIB_SRCS appletbrowser/kcategorizeditemsviewmodels.cpp appletbrowser/plasmaappletitemmodel.cpp appletbrowser/customdragtreeview.cpp+ appletmanager.cpp configxml.cpp containment.cpp corona.cpp@@ -95,6 +96,7 @@ set(plasma_LIB_INCLUDES animator.h applet.h appletbrowser.h+ appletmanager.h configxml.h containment.h corona.hIndex: libs/plasma/appletmanager.cpp===================================================================--- libs/plasma/appletmanager.cpp (revision 0)+++ libs/plasma/appletmanager.cpp (revision 0)@@ -0,0 +1,177 @@+/*+ * Copyright (C) 2007 Mike Evans <mike@asrc.info>+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License version 2 (or,+ * at your option, any later version) as published by the Free Software+ * Foundation+ *+ * 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 Library 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 "plasma/appletmanager.h"+++#include <KAction>+#include <KStandardAction>+#include <KConfig>+#include <KConfigGroup>+#include <QTreeWidget>++++#include "plasma/corona.h"+#include "plasma/containment.h"++class PlasmaApp;++namespace Plasma+{++class AppletManager::Private+{+public:+ Private(Corona* co, Containment* cont, AppletManager* q)+ : corona(co),+ containment(cont),+ //appletList(0),+ config("plasmarc"),+ configGroup(&config, "Applet Manager")+ {+ }++ Plasma::Corona *corona;+ Plasma::Containment *containment;+ QTreeWidget *tree;+ //KCategorizedItemsView *appletList;+ KConfig config;+ KConfigGroup configGroup;+ QList<Applet*>m_applets;++ //PlasmaAppletItemModel itemModel;+ //KCategorizedItemsViewModels::DefaultFilterModel filterModel;+++};++AppletManager::AppletManager(Plasma::Corona * corona, QWidget * parent, Qt::WindowFlags f)+ : KDialog(parent, f),+ d(new Private(corona, 0, this))+{+ init();+}++AppletManager::AppletManager(Plasma::Containment * containment, QWidget * parent, Qt::WindowFlags f)+ : KDialog(parent, f),+ d(new Private(0, containment, this))+{+ init();+}++void AppletManager::init()+{+ d->tree = new QTreeWidget();+ setMainWidget(d->tree);+ setWindowTitle("Manage Applets");++ populateTree();++ //d->appletList = new KCategorizedItemsView(this);+ //setMainWidget(d->appletList);++ setButtons(KDialog::Apply | KDialog::Close|KDialog::User1);+ setButtonText(KDialog::Apply, i18n("Kill Applet"));+ setButtonText(KDialog::User1, i18n("Refresh"));+ //setButtonText(KDialog::User1, i18n("Get New Applets")); //TODO: not overly happy with this text+ //enableButton(KDialog::User1, false); //TODO: enable when GHNS integration is implemented++ connect(this, SIGNAL(applyClicked()), this, SLOT(killApplet()));+ connect(this, SIGNAL(user1Clicked()), this, SLOT(populateTree()));++++ //QAction* quit = KStandardAction::quit(qApp, SLOT(quit()), this);+ //addAction(quit);+++}++AppletManager::~AppletManager()+{+}++void AppletManager::populateTree()+{+ QTreeWidgetItem *myitem;+ kDebug()<<"Populating Tree";+ d->tree->clear();+ d->tree->setHeaderLabels(QStringList(QString(i18n("Active Applets"))));+// if(d->corona){+// kDebug()<<"I have a corona";+// QList<Containment*>containments=d->corona->containments();+// +// }+// else if(d->containment){+ if(d->corona)+ {+ d->m_applets.clear();++ QList<Containment*>containments=d->corona->containments();+ foreach(Containment * containment,containments){ + QList<Applet*>applets=containment->applets();+ QList<QTreeWidgetItem *>items;+ QTreeWidgetItem *top=new QTreeWidgetItem();+ top->setText(0,containment->name());+ d->m_applets<<containment;+ foreach(Applet *applet,applets) {+ kDebug()<<applet->name();+ d->m_applets<<applet;+ myitem=new QTreeWidgetItem((QTreeWidget*)0,QStringList(applet->name()));+ myitem->setData(1,Qt::UserRole,QVariant::fromValue((void*)applet));+ items.append(myitem);+ }+ top->addChildren(items);+ d->tree->addTopLevelItem(top);+ }+ }++++}++void AppletManager::killApplet()+{+ Applet *applet=0;+ kDebug() << "Button KILL clicked";+ QList<QTreeWidgetItem *> items=d->tree->selectedItems();+ foreach(QTreeWidgetItem *item,items) {+ applet=(Applet*)item->data(1,Qt::UserRole).value<void*>();+ if(applet) {+ applet->destroy();+ }++ }++++}++void AppletManager::show()+{+ populateTree();+ kDebug()<<"Show me!!";+ KDialog::show();+}+++} // namespace Plasma++#include "appletmanager.moc"Index: plasma/containments/desktop/desktop.h===================================================================--- plasma/containments/desktop/desktop.h (revision 724922)+++ plasma/containments/desktop/desktop.h (working copy)@@ -35,6 +35,7 @@ class QTimeLine; namespace Plasma { class AppletBrowser;+ class AppletManager; } /*class Tool : public QObject, public QGraphicsItem@@ -92,6 +93,7 @@ public: protected Q_SLOTS: void launchExplorer(); void launchAppletBrowser();+ void launchAppletManager(); void runCommand(); void lockScreen(); void logout();@@ -99,11 +101,13 @@ protected Q_SLOTS: private: QAction *m_engineExplorerAction; QAction *m_appletBrowserAction;+ QAction *m_appletManagerAction; QAction *m_runCommandAction; QAction *m_lockAction; QAction *m_logoutAction; ToolBox *m_toolbox; Plasma::AppletBrowser *m_appletBrowser;+ Plasma::AppletManager *m_appletManager; }; #endif // PLASMA_PANEL_HIndex: plasma/containments/desktop/desktop.cpp===================================================================--- plasma/containments/desktop/desktop.cpp (revision 724922)+++ plasma/containments/desktop/desktop.cpp (working copy)@@ -27,7 +27,10 @@ #include <KRun> #include <KWindowSystem>+ #include "plasma/appletbrowser.h"+#include "plasma/appletmanager.h"+#include <plasma/corona.h> #include "plasma/phase.h" #include "plasma/widgets/pushbutton.h" #include "workspace/kworkspace.h"@@ -184,11 +187,14 @@ DefaultDesktop::DefaultDesktop(QObject * : Containment(parent, args), m_engineExplorerAction(0), m_appletBrowserAction(0),+ m_appletManagerAction(0), m_runCommandAction(0), m_lockAction(0), m_logoutAction(0),- m_toolbox(0),- m_appletBrowser(0)+ m_appletBrowser(0),+ m_appletManager(0),+ m_toolbox(0)+ { kDebug() << "!!! loading desktop"; }@@ -250,6 +256,19 @@ void DefaultDesktop::launchAppletBrowser KWindowSystem::activateWindow(m_appletBrowser->winId()); }+void DefaultDesktop::launchAppletManager()+{+ if (!m_appletManager) {+ //TODO: should we delete this after some point, so as to conserve memory+ // and any possible processing tha tmight end up in AppletBrowser?+ m_appletManager = new Plasma::AppletManager(qobject_cast<Plasma::Corona*>(scene()));+ }++ KWindowSystem::setOnDesktop(m_appletManager->winId(), KWindowSystem::currentDesktop());+ m_appletManager->show();+ KWindowSystem::activateWindow(m_appletManager->winId());+}+ void DefaultDesktop::runCommand() { if (!KAuthorized::authorizeKAction("run_command")) {@@ -291,6 +310,9 @@ QList<QAction*> DefaultDesktop::contextA m_appletBrowserAction = new QAction(i18n("Add applet"), this); connect(m_appletBrowserAction, SIGNAL(triggered(bool)), this, SLOT(launchAppletBrowser()));+ m_appletManagerAction = new QAction(i18n("Manage Applets"), this);+ connect(m_appletManagerAction, SIGNAL(triggered(bool)), this, SLOT(launchAppletManager()));+ m_runCommandAction = new QAction(i18n("Run Command..."), this); connect(m_runCommandAction, SIGNAL(triggered(bool)), this, SLOT(runCommand()));@@ -307,6 +329,7 @@ QList<QAction*> DefaultDesktop::contextA actions.append(m_engineExplorerAction); actions.append(m_appletBrowserAction);+ actions.append(m_appletManagerAction); if (KAuthorized::authorizeKAction("run_command")) { actions.append(m_runCommandAction);@@ -340,5 +363,4 @@ void DefaultDesktop::logout() } K_EXPORT_PLASMA_APPLET(desktop, DefaultDesktop)- #include "desktop.moc"