don't bother with a corona only option
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=750746
This commit is contained in:
parent
9038914bd6
commit
25d2977510
@ -38,8 +38,7 @@ class AppletBrowserWidget::Private
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Private(Corona* co, Containment* cont, AppletBrowserWidget* w)
|
Private(Corona* co, Containment* cont, AppletBrowserWidget* w)
|
||||||
: corona(co),
|
: containment(cont),
|
||||||
containment(cont),
|
|
||||||
appletList(0),
|
appletList(0),
|
||||||
config("plasmarc"),
|
config("plasmarc"),
|
||||||
configGroup(&config, "Applet Browser"),
|
configGroup(&config, "Applet Browser"),
|
||||||
@ -53,7 +52,6 @@ public:
|
|||||||
void updateRunningApplets();
|
void updateRunningApplets();
|
||||||
|
|
||||||
QString application;
|
QString application;
|
||||||
Plasma::Corona *corona;
|
|
||||||
Plasma::Containment *containment;
|
Plasma::Containment *containment;
|
||||||
KCategorizedItemsView *appletList;
|
KCategorizedItemsView *appletList;
|
||||||
QMultiHash<QString,Plasma::Applet*> runningApplets;
|
QMultiHash<QString,Plasma::Applet*> runningApplets;
|
||||||
@ -124,7 +122,7 @@ void AppletBrowserWidget::Private::updateRunningApplets()
|
|||||||
itemModel.setRunningApplets(appCount);
|
itemModel.setRunningApplets(appCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
AppletBrowserWidget::AppletBrowserWidget(Plasma::Corona * corona, bool showButtons, QWidget * parent, Qt::WindowFlags f)
|
AppletBrowserWidget::AppletBrowserWidget(Plasma::Corona * corona, bool showButtons, QWidget * parent, Qt::WindowFlags f)
|
||||||
: QWidget(parent, f),
|
: QWidget(parent, f),
|
||||||
d(new Private(corona, 0, this)),
|
d(new Private(corona, 0, this)),
|
||||||
@ -132,7 +130,7 @@ AppletBrowserWidget::AppletBrowserWidget(Plasma::Corona * corona, bool showButto
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
AppletBrowserWidget::AppletBrowserWidget(Plasma::Containment * containment, bool showButtons, QWidget * parent, Qt::WindowFlags f)
|
AppletBrowserWidget::AppletBrowserWidget(Plasma::Containment * containment, bool showButtons, QWidget * parent, Qt::WindowFlags f)
|
||||||
: QWidget(parent, f),
|
: QWidget(parent, f),
|
||||||
d(new Private(0, containment, this)),
|
d(new Private(0, containment, this)),
|
||||||
@ -188,17 +186,16 @@ void AppletBrowserWidget::initRunningApplets()
|
|||||||
//get applets from corona, count them, send results to model
|
//get applets from corona, count them, send results to model
|
||||||
kDebug() << d->runningApplets.count();
|
kDebug() << d->runningApplets.count();
|
||||||
QHash<QString,int> appCount;
|
QHash<QString,int> appCount;
|
||||||
Plasma::Corona *c=d->corona;
|
Plasma::Corona *c = d->containment->corona();
|
||||||
if (!c && d->containment) {
|
|
||||||
c=d->containment->corona();
|
|
||||||
}
|
|
||||||
//we've tried our best to get a corona
|
//we've tried our best to get a corona
|
||||||
//we don't want just one containment, we want them all
|
//we don't want just one containment, we want them all
|
||||||
if (!c) {
|
if (!c) {
|
||||||
kDebug() << "can't happen";
|
kDebug() << "can't happen";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QList<Containment*>containments=c->containments();
|
|
||||||
|
QList<Containment*> containments = c->containments();
|
||||||
foreach (Containment * containment,containments) {
|
foreach (Containment * containment,containments) {
|
||||||
connect(containment, SIGNAL(appletAdded(Plasma::Applet*)), this, SLOT(appletAdded(Plasma::Applet*)));
|
connect(containment, SIGNAL(appletAdded(Plasma::Applet*)), this, SLOT(appletAdded(Plasma::Applet*)));
|
||||||
//TODO track containments too?
|
//TODO track containments too?
|
||||||
@ -232,23 +229,18 @@ QString AppletBrowserWidget::application()
|
|||||||
{
|
{
|
||||||
return d->application;
|
return d->application;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppletBrowserWidget::addApplet()
|
void AppletBrowserWidget::addApplet()
|
||||||
{
|
{
|
||||||
kDebug() << "Button ADD clicked";
|
kDebug() << "Button ADD clicked";
|
||||||
|
if (!d->containment) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (AbstractItem *item, d->appletList->selectedItems()) {
|
foreach (AbstractItem *item, d->appletList->selectedItems()) {
|
||||||
PlasmaAppletItem *selectedItem = (PlasmaAppletItem *) item;
|
PlasmaAppletItem *selectedItem = (PlasmaAppletItem *) item;
|
||||||
kDebug() << "Adding applet " << selectedItem->name();
|
kDebug() << "Adding applet " << selectedItem->name() << "to containment";
|
||||||
if (d->corona) {
|
d->containment->addApplet(selectedItem->pluginName(), selectedItem->arguments());
|
||||||
kDebug() << " to corona\n";
|
|
||||||
d->corona->addApplet(selectedItem->pluginName(),
|
|
||||||
selectedItem->arguments());
|
|
||||||
} else if (d->containment) {
|
|
||||||
kDebug() << " to containment\n";
|
|
||||||
d->containment->addApplet(selectedItem->pluginName(),
|
|
||||||
selectedItem->arguments());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,14 +291,14 @@ void AppletBrowserWidget::downloadApplets()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
AppletBrowser::AppletBrowser(Plasma::Corona * corona, QWidget * parent, Qt::WindowFlags f)
|
/*AppletBrowser::AppletBrowser(Plasma::Corona * corona, QWidget * parent, Qt::WindowFlags f)
|
||||||
: KDialog(parent, f),
|
: KDialog(parent, f),
|
||||||
m_widget(new AppletBrowserWidget(corona, false, this))
|
m_widget(new AppletBrowserWidget(corona, false, this))
|
||||||
{
|
{
|
||||||
winId(); // this is to get us a win id so that the next line doesn't abort on us
|
winId(); // this is to get us a win id so that the next line doesn't abort on us
|
||||||
setWindowRole("appletbrowser");
|
setWindowRole("appletbrowser");
|
||||||
init();
|
init();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
AppletBrowser::AppletBrowser(Plasma::Containment * containment, QWidget * parent, Qt::WindowFlags f)
|
AppletBrowser::AppletBrowser(Plasma::Containment * containment, QWidget * parent, Qt::WindowFlags f)
|
||||||
: KDialog(parent, f),
|
: KDialog(parent, f),
|
||||||
|
@ -35,8 +35,7 @@ class PLASMA_EXPORT AppletBrowserWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AppletBrowserWidget( Plasma::Corona *corona, bool showButtons, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
AppletBrowserWidget(Plasma::Containment *containment, bool showButtons, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||||
explicit AppletBrowserWidget(Plasma::Containment *containment, bool showButtons, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
||||||
virtual ~AppletBrowserWidget();
|
virtual ~AppletBrowserWidget();
|
||||||
|
|
||||||
void setApplication(const QString& application = QString());
|
void setApplication(const QString& application = QString());
|
||||||
@ -80,7 +79,6 @@ class PLASMA_EXPORT AppletBrowser: public KDialog
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AppletBrowser(Plasma::Corona *corona, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
|
||||||
explicit AppletBrowser(Plasma::Containment *containment, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
explicit AppletBrowser(Plasma::Containment *containment, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||||
virtual ~AppletBrowser();
|
virtual ~AppletBrowser();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user