From fd9c5fd27f8a7b90baf14cc3c417d680692e598d Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Sun, 12 Sep 2010 20:15:29 +0000 Subject: [PATCH] it's an example, move it where it belongs svn path=/trunk/KDE/kdebase/runtime/; revision=1174551 --- kpart/shell/CMakeLists.txt | 17 ---- kpart/shell/appletselector.cpp | 67 --------------- kpart/shell/appletselector.h | 44 ---------- kpart/shell/appletselector.ui | 44 ---------- kpart/shell/containmentshell.cpp | 109 ------------------------- kpart/shell/containmentshell.h | 51 ------------ kpart/shell/main.cpp | 44 ---------- kpart/shell/plasma-default-layoutrc | 61 -------------- kpart/shell/plasma-kpart-shell.desktop | 24 ------ kpart/shell/plasma-kpart-shellui.rc | 31 ------- kpart/shell/testshellpluginloader.cpp | 49 ----------- kpart/shell/testshellpluginloader.h | 35 -------- 12 files changed, 576 deletions(-) delete mode 100644 kpart/shell/CMakeLists.txt delete mode 100644 kpart/shell/appletselector.cpp delete mode 100644 kpart/shell/appletselector.h delete mode 100644 kpart/shell/appletselector.ui delete mode 100644 kpart/shell/containmentshell.cpp delete mode 100644 kpart/shell/containmentshell.h delete mode 100644 kpart/shell/main.cpp delete mode 100644 kpart/shell/plasma-default-layoutrc delete mode 100644 kpart/shell/plasma-kpart-shell.desktop delete mode 100644 kpart/shell/plasma-kpart-shellui.rc delete mode 100644 kpart/shell/testshellpluginloader.cpp delete mode 100644 kpart/shell/testshellpluginloader.h diff --git a/kpart/shell/CMakeLists.txt b/kpart/shell/CMakeLists.txt deleted file mode 100644 index 3d417a134..000000000 --- a/kpart/shell/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(plasma_kpart_shell_SRCS - main.cpp - containmentshell.cpp - testshellpluginloader.cpp - appletselector.cpp -) - -kde4_add_ui_files(plasma_kpart_shell_SRCS appletselector.ui) -kde4_add_executable(plasma-kpart-shell ${plasma_kpart_shell_SRCS}) - -target_link_libraries(plasma-kpart-shell ${KDE4_KDEUI_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_PLASMA_LIBS} ) - -########### install files ############### -install(TARGETS plasma-kpart-shell ${INSTALL_TARGETS_DEFAULT_ARGS} ) -install( FILES plasma-kpart-shell.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) -install(FILES plasma-default-layoutrc DESTINATION ${DATA_INSTALL_DIR}/plasma-kpart-shell/) -install( FILES plasma-kpart-shellui.rc DESTINATION ${DATA_INSTALL_DIR}/plasma-kpart-shell/ ) diff --git a/kpart/shell/appletselector.cpp b/kpart/shell/appletselector.cpp deleted file mode 100644 index 87263a975..000000000 --- a/kpart/shell/appletselector.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2010 Aleix Pol Gonzalez - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "appletselector.h" -#include "ui_appletselector.h" - -#include -#include - -AppletSelector::AppletSelector(QObject* parent, const QVariantList& args) - : KDialog() -{ - Q_UNUSED(args); - - setButtons(Close); - QWidget* w = new QWidget(this); - - m_ui = new Ui::AppletSelector; - m_ui->setupUi(w); - - m_ui->plugins->header()->setSortIndicator(0, Qt::AscendingOrder); - - setMainWidget(w); - - QStandardItemModel* model = new QStandardItemModel(this); - const KPluginInfo::List list= Plasma::Applet::listAppletInfo(); - foreach(const KPluginInfo& info, list) { - QStandardItem* item = new QStandardItem(KIcon(info.icon()), info.name()); - item->setEditable(false); - item->setToolTip(info.comment()); - item->setData(info.pluginName(), Qt::UserRole+1); - - model->appendRow(item); - } - - m_ui->plugins->setModel(model); - - connect(m_ui->plugins, SIGNAL(doubleClicked(QModelIndex)), SLOT(selected(QModelIndex))); -} - -AppletSelector::~AppletSelector() -{ - delete m_ui; -} - -void AppletSelector::selected(const QModelIndex& idx) -{ - emit addApplet(idx.data(Qt::UserRole+1).toString()); -} - -#include "appletselector.moc" diff --git a/kpart/shell/appletselector.h b/kpart/shell/appletselector.h deleted file mode 100644 index b646b359e..000000000 --- a/kpart/shell/appletselector.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of KDevelop - Copyright 2010 Aleix Pol Gonzalez - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef APPLETSELECTOR_H -#define APPLETSELECTOR_H - -#include - -class QModelIndex; -namespace Ui { class AppletSelector; } - -class AppletSelector : public KDialog -{ -Q_OBJECT -public: - explicit AppletSelector(QObject* parent = 0, const QVariantList& args = QVariantList()); - ~AppletSelector(); -public slots: - void selected(const QModelIndex& idx); - -signals: - void addApplet(const QString& name); - -private: - Ui::AppletSelector* m_ui; -}; - -#endif // APPLETSELECTOR_H diff --git a/kpart/shell/appletselector.ui b/kpart/shell/appletselector.ui deleted file mode 100644 index 19742409a..000000000 --- a/kpart/shell/appletselector.ui +++ /dev/null @@ -1,44 +0,0 @@ - - - AppletSelector - - - - 0 - 0 - 400 - 300 - - - - - - - Double-click on the widget you want to add: - - - - - - - false - - - false - - - true - - - false - - - false - - - - - - - - diff --git a/kpart/shell/containmentshell.cpp b/kpart/shell/containmentshell.cpp deleted file mode 100644 index 88036f0fe..000000000 --- a/kpart/shell/containmentshell.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* -* Copyright 2010 Ryan Rix -* Copyright 2010 Siddharth Sharma -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License version 2 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 "containmentshell.h" -#include "testshellpluginloader.h" -#include "appletselector.h" - -#include -#include -#include -#include -#include - - -#include - -#include - -ContainmentShell::ContainmentShell() - : KParts::MainWindow( ), - m_dialog(0) -{ - setXMLFile("plasma-kpart-shellui.rc"); - - - KAction* action = KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); - - action = new KAction("&Configure", actionCollection()); - connect(action, SIGNAL(triggered()), this, SLOT(optionsPreferences())); - actionCollection()->addAction("options_configure", action); - - // this routine will find and load our Part. it finds the Part by - // name which is a bad idea usually.. but it's alright in this - // case since our Part is made for this Shell - KService::Ptr service = KService::serviceByDesktopPath( "plasma-kpart.desktop" ); - - if (service) - { - Plasma::PluginLoader* loader = new TestShellPluginLoader(); - - QVariantList args = QVariantList() << qVariantFromValue(loader) << "Online Services"; - - // now that the Part is loaded, we cast it to a Part to get - // our hands on it - m_part = service->createInstance(0, args); - if (m_part) - { - // tell the KParts::MainWindow that this is indeed the main widget - setCentralWidget(m_part->widget()); - - // and integrate the part's GUI with the shell's - createGUI(m_part); - - } - else - { - // For whatever reason the part didn't load - KMessageBox::error(this, "Could not instantiate our Part!"); - qApp->quit(); - } - } - else - { - // if we couldn't find our Part, we exit since the Shell by - // itself can't do anything useful - KMessageBox::error(this, "Could not find our Part!"); - qApp->quit(); - // we return here, cause qApp->quit() only means "exit the - // next time we enter the event loop... - return; - } - - // apply the saved mainwindow settings, if any, and ask the mainwindow - // to automatically save settings if changed: window size, toolbar - // position, icon size, etc. - setAutoSaveSettings(); -} - -ContainmentShell::~ContainmentShell() -{ -} - -void ContainmentShell::optionsPreferences() -{ - if( !m_dialog ) - { - m_dialog = new AppletSelector( m_part ); - connect( m_dialog, SIGNAL(addApplet(QString)), m_part, SLOT(addApplet(QString)) ); - } - m_dialog->show(); -} - -#include "containmentshell.moc" diff --git a/kpart/shell/containmentshell.h b/kpart/shell/containmentshell.h deleted file mode 100644 index 3811424ed..000000000 --- a/kpart/shell/containmentshell.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright 2010 Ryan Rix -* Copyright 2010 Siddharth Sharma -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License version 2 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 CONTAINMENTSHELL_H -#define CONTAINMENTSHELL_H - -#include "../plasmakpart.h" - -#include -#include - -/** - * This is the application "Shell". It has a menubar, toolbar, and - * statusbar but relies on the "Part" to do all the real work. - * - * @short Generic Application Shell - * @author Ryan Rix - * @version 0.01 - */ -class ContainmentShell : public KParts::MainWindow -{ -Q_OBJECT -public: - ContainmentShell(); - virtual ~ContainmentShell(); - -public Q_SLOTS: - void optionsPreferences(); - -private: - KParts::Part* m_part; - KDialog* m_dialog; -}; - -#endif // CONTAINMENTSHELL_H diff --git a/kpart/shell/main.cpp b/kpart/shell/main.cpp deleted file mode 100644 index 343ab119b..000000000 --- a/kpart/shell/main.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* -* Copyright 2010 Ryan Rix -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License version 2 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 "containmentshell.h" -#include -#include -#include - -static const char version[] = "0.1"; - -int main(int argc, char** argv) -{ - KAboutData about("plasma-kpart-shell", 0, ki18n("Plasma KPart Shell"), version, ki18n("A KDE KPart Application"), KAboutData::License_GPL, ki18n("(C) 2010 Ryan Rix"), KLocalizedString(), 0, "ry@n.rix.si"); - about.addAuthor( ki18n("Ryan Rix"), KLocalizedString(), "ry@n.rix.si" ); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - // see if we are starting with session management - if (app.isSessionRestored()) - RESTORE(ContainmentShell) - else - { - ContainmentShell* widget = new ContainmentShell; - widget->show(); - } - - return app.exec(); -} diff --git a/kpart/shell/plasma-default-layoutrc b/kpart/shell/plasma-default-layoutrc deleted file mode 100644 index 500c8c789..000000000 --- a/kpart/shell/plasma-default-layoutrc +++ /dev/null @@ -1,61 +0,0 @@ -[Containments][1] -activity=Newspaper -desktop=-1 -formfactor=0 -geometry=806,0,800,480 -immutability=1 -location=0 -plugin=newspaper -screen=0 -wallpaperplugin=image -wallpaperpluginmode=SingleImage -zvalue=0 - -[Containments][1][ToolBox] -corner=7 -offset=0 - -[Containments][1][Applets][1] -geometry=14,38,343,236 -immutability=1 -plugin=news -zvalue=52 - -[Containments][1][Applets][1][LayoutInformation] -Column=0 -Order=0 - - -[Containments][1][Applets][2] -geometry=14,278,343,188 -immutability=1 -plugin=weather -zvalue=57 - -[Containments][1][Applets][2][LayoutInformation] -Column=0 -Order=1 - -[Containments][1][Applets][3] -geometry=1000,38,424,241 -immutability=1 -plugin=opendesktop -zvalue=47 - -[Containments][1][Applets][3][LayoutInformation] -Column=1 -Order=0 - -[Containments][1][Applets][4] -geometry=1000,283,424,182 -immutability=1 -plugin=knowledgebase -zvalue=47 - -[Containments][1][Applets][4][LayoutInformation] -Column=1 -Order=1 - - -[General] -immutability=1 diff --git a/kpart/shell/plasma-kpart-shell.desktop b/kpart/shell/plasma-kpart-shell.desktop deleted file mode 100644 index dd17d8470..000000000 --- a/kpart/shell/plasma-kpart-shell.desktop +++ /dev/null @@ -1,24 +0,0 @@ -[Desktop Entry] -Name=plasma-kpart-shell -Name[en_GB]=plasma-kpart-shell -Name[ia]=plasma-kpart-shell -Name[nl]=plasma-kpart-shell -Name[pt]=plasma-kpart-shell -Name[pt_BR]=plasma-kpart-shell -Name[sv]=Plasma-delprogramskal -Name[uk]=plasma-kpart-shell -Name[x-test]=xxplasma-kpart-shellxx -Exec=plasma-kpart-shell %i -caption "%c" -Icon=plasma-kpart-shell -Type=Application -X-DocPath=plasma-kpart-shell/index.html -GenericName=A KPart shell for Plasma -GenericName[en_GB]=A KPart shell for Plasma -GenericName[ia]=Un shell de KPart pro Plasma -GenericName[nl]=Een KPart-shell voor Plasma -GenericName[pt]=Uma consola de KParts para o Plasma -GenericName[pt_BR]=Uma shell de KPart para o Plasma -GenericName[sv]=Ett delprogramskal för Plasma -GenericName[uk]=Оболонка модулів для Плазми -GenericName[x-test]=xxA KPart shell for Plasmaxx -Terminal=false diff --git a/kpart/shell/plasma-kpart-shellui.rc b/kpart/shell/plasma-kpart-shellui.rc deleted file mode 100644 index 8255d4434..000000000 --- a/kpart/shell/plasma-kpart-shellui.rc +++ /dev/null @@ -1,31 +0,0 @@ - - - - &File - - - - - - - - &Settings - - - - - - - - - - - - -Main Toolbar - - - - - - diff --git a/kpart/shell/testshellpluginloader.cpp b/kpart/shell/testshellpluginloader.cpp deleted file mode 100644 index 084f6a32d..000000000 --- a/kpart/shell/testshellpluginloader.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright 2010 Ryan Rix -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License version 2 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 "testshellpluginloader.h" - -#include - -#include -#include -#include -#include - -TestShellPluginLoader::~TestShellPluginLoader() -{ -} - -Plasma::Applet* TestShellPluginLoader::internalLoadApplet (const QString &name, uint appletId, const QVariantList &args) -{ - kDebug() << "loadApplet called with" << name << appletId << args; - return 0; -} - -Plasma::DataEngine* TestShellPluginLoader::internalLoadDataEngine(const QString &name) -{ - kDebug() << "loadEngine called with" << name; - return 0; -} - -Plasma::Service* TestShellPluginLoader::internalLoadService(const QString &name, const QVariantList &args, QObject *parent) -{ - kDebug() << "loadService called with" << name << args << parent; - return 0; -} - diff --git a/kpart/shell/testshellpluginloader.h b/kpart/shell/testshellpluginloader.h deleted file mode 100644 index 01fd4ae80..000000000 --- a/kpart/shell/testshellpluginloader.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -* Copyright 2010 Ryan Rix -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License version 2 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 TESTSHELLPLUGINLOADER_H -#define TESTSHELLPLUGINLOADER_H - -#include - -class TestShellPluginLoader : public Plasma::PluginLoader -{ -public: - ~TestShellPluginLoader(); - - Plasma::Applet* internalLoadApplet (const QString &name, uint appletId = 0, - const QVariantList &args = QVariantList()); - Plasma::DataEngine* internalLoadDataEngine(const QString &name); - Plasma::Service* internalLoadService(const QString &name, const QVariantList &args, QObject *parent = 0); -}; - -#endif