- remove AppletBrowser-the-wrapper-class

- change AppletBrowserWindow to be AppletBrowser

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=717959
This commit is contained in:
Aaron J. Seigo 2007-09-27 19:48:51 +00:00
parent 7ec22e70a1
commit a64cea3758
6 changed files with 17 additions and 165 deletions

View File

@ -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

View File

@ -1,90 +0,0 @@
/*
* Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
*
* 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 <appletbrowser.h>
#include <appletbrowser/appletbrowserwindow_p.h>
#include <corona.h>
#include <containment.h>
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

View File

@ -1,57 +0,0 @@
/*
* Copyright (C) 2007 Ivan Cukic <ivan.cukic+kde@gmail.com>
*
* 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

View File

@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "appletbrowserwindow_p.h"
#include "appletbrowser.h"
#include <KAction>
#include <KStandardAction>
@ -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"

View File

@ -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();

View File

@ -49,7 +49,7 @@
#include "ksmserver_interface.h"
#include "screensaver_interface.h"
#include "appletbrowser.h"
#include "appletbrowser/appletbrowser.h"
namespace Plasma
{