diff --git a/CMakeLists.txt b/CMakeLists.txt index e2103028c..a02e99901 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,7 @@ set(plasma_LIB_SRCS abstractrunner.cpp animator.cpp applet.cpp - appletbrowser.cpp - appletbrowser/appletbrowserwindow.cpp + appletbrowser/appletbrowser.cpp appletbrowser/kcategorizeditemsview.cpp appletbrowser/kcategorizeditemsviewdelegate.cpp appletbrowser/kcategorizeditemsviewmodels.cpp @@ -103,7 +102,7 @@ set(plasma_LIB_INCLUDES abstractrunner.h animator.h applet.h - appletbrowser.h + appletbrowser/appletbrowser.h configxml.h containment.h corona.h diff --git a/appletbrowser.cpp b/appletbrowser.cpp deleted file mode 100644 index 265c06d92..000000000 --- a/appletbrowser.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2007 Ivan Cukic - * - * 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 -#include - -#include -#include - -namespace Plasma -{ - -class AppletBrowser::Private -{ -public: - Private(AppletBrowser *parent, Corona *c) - : q(parent), corona(c), containment(NULL), m_window(NULL) - {} - - Private(AppletBrowser *parent, Containment *c) - : q(parent), corona(NULL), containment(c), m_window(NULL) - {} - - ~Private() - { - delete m_window; - } - - AppletBrowserWindow *window() { - if (!m_window) { - if (corona) { - m_window = new AppletBrowserWindow(corona); - } else { - m_window = new AppletBrowserWindow(containment); - } - } - return m_window; - } - - AppletBrowser *q; - -private: - Containment *containment; - Corona *corona; - AppletBrowserWindow *m_window; -}; - -AppletBrowser::AppletBrowser(Corona * corona) - : d(new Private(this, corona)) -{ -} - -AppletBrowser::AppletBrowser(Containment * containment) - : d(new Private(this, containment)) -{ -} - -AppletBrowser::~AppletBrowser() -{ - delete d; -} - -void AppletBrowser::show() -{ - d->window()->show(); -} - -void AppletBrowser::hide() -{ - d->window()->hide(); -} - - -} // namespace Plasma diff --git a/appletbrowser.h b/appletbrowser.h deleted file mode 100644 index b81285ba3..000000000 --- a/appletbrowser.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2007 Ivan Cukic - * - * 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 PLASMA_APPLET_BROWSER_H -#define PLASMA_APPLET_BROWSER_H - -namespace Plasma -{ - -class Corona; -class Containment; - -/** - * Interface for applet browser - * - */ -class AppletBrowser -{ -public: - explicit AppletBrowser(Corona * corona); - explicit AppletBrowser(Containment * corona); - virtual ~AppletBrowser(); - - /** - * Displays the applet browser window - */ - void show(); - - /** - * Hides the applet browser window - */ - void hide(); - -private: - class Private; - Private * const d; -}; - -} // namespace Plasma - -#endif // PLASMA_APPLET_BROWSER_H diff --git a/appletbrowser/appletbrowserwindow.cpp b/appletbrowser/appletbrowser.cpp similarity index 88% rename from appletbrowser/appletbrowserwindow.cpp rename to appletbrowser/appletbrowser.cpp index 4a6d03ec8..085682541 100644 --- a/appletbrowser/appletbrowserwindow.cpp +++ b/appletbrowser/appletbrowser.cpp @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "appletbrowserwindow_p.h" +#include "appletbrowser.h" #include #include @@ -31,10 +31,10 @@ namespace Plasma { -class AppletBrowserWindow::Private +class AppletBrowser::Private { public: - Private(Corona* co, Containment* cont, AppletBrowserWindow* q) + Private(Corona* co, Containment* cont, AppletBrowser* q) : corona(co), containment(cont), appletList(0), @@ -51,21 +51,21 @@ public: KCategorizedItemsViewModels::DefaultFilterModel filterModel; }; -AppletBrowserWindow::AppletBrowserWindow(Plasma::Corona * corona, QWidget * parent, Qt::WindowFlags f) +AppletBrowser::AppletBrowser(Plasma::Corona * corona, QWidget * parent, Qt::WindowFlags f) : KDialog(parent, f), d(new Private(corona, 0, this)) { init(); } -AppletBrowserWindow::AppletBrowserWindow(Plasma::Containment * containment, QWidget * parent, Qt::WindowFlags f) +AppletBrowser::AppletBrowser(Plasma::Containment * containment, QWidget * parent, Qt::WindowFlags f) : KDialog(parent, f), d(new Private(0, containment, this)) { init(); } -void AppletBrowserWindow::init() +void AppletBrowser::init() { d->appletList = new KCategorizedItemsView(this); setMainWidget(d->appletList); @@ -111,11 +111,11 @@ void AppletBrowserWindow::init() d->appletList->setItemModel(&d->itemModel); } -AppletBrowserWindow::~AppletBrowserWindow() +AppletBrowser::~AppletBrowser() { } -void AppletBrowserWindow::addApplet() +void AppletBrowser::addApplet() { kDebug() << "Button ADD clicked"; @@ -133,7 +133,7 @@ void AppletBrowserWindow::addApplet() } } -void AppletBrowserWindow::downloadApplets() +void AppletBrowser::downloadApplets() { //TODO: implement kDebug() << "GHNS button clicked"; @@ -141,4 +141,4 @@ void AppletBrowserWindow::downloadApplets() } // namespace Plasma -#include "appletbrowserwindow_p.moc" +#include "appletbrowser.moc" diff --git a/appletbrowser/appletbrowserwindow_p.h b/appletbrowser/appletbrowser.h similarity index 79% rename from appletbrowser/appletbrowserwindow_p.h rename to appletbrowser/appletbrowser.h index 46f6e3291..5fa075ccb 100644 --- a/appletbrowser/appletbrowserwindow_p.h +++ b/appletbrowser/appletbrowser.h @@ -28,13 +28,13 @@ namespace Plasma class Corona; class Containment; -class AppletBrowserWindow: public KDialog +class AppletBrowser: public KDialog { Q_OBJECT public: - explicit AppletBrowserWindow(Plasma::Corona *corona, QWidget *parent = 0, Qt::WindowFlags f = 0); - explicit AppletBrowserWindow(Plasma::Containment *containment, QWidget *parent = 0, Qt::WindowFlags f = 0); - virtual ~AppletBrowserWindow(); + explicit AppletBrowser(Plasma::Corona *corona, QWidget *parent = 0, Qt::WindowFlags f = 0); + explicit AppletBrowser(Plasma::Containment *containment, QWidget *parent = 0, Qt::WindowFlags f = 0); + virtual ~AppletBrowser(); protected Q_SLOTS: void addApplet(); diff --git a/containment.cpp b/containment.cpp index 6987fdf8e..a2aafb460 100644 --- a/containment.cpp +++ b/containment.cpp @@ -49,7 +49,7 @@ #include "ksmserver_interface.h" #include "screensaver_interface.h" -#include "appletbrowser.h" +#include "appletbrowser/appletbrowser.h" namespace Plasma {