application property

This commit is contained in:
Marco Martin 2013-10-30 11:02:54 +01:00
parent 8fbc0a4493
commit d713dc1c13
2 changed files with 16 additions and 4 deletions

View File

@ -281,8 +281,10 @@ WidgetExplorer::WidgetExplorer(QObject *parent)
: QObject(parent),
d(new WidgetExplorerPrivate(this))
{
populateWidgetList();
//FIXME: delay
setApplication();
d->initRunningApplets();
d->filterItemModel.setSortCaseSensitivity(Qt::CaseInsensitive);
d->filterItemModel.setDynamicSortFilter(true);
d->filterItemModel.setSourceModel(&d->itemModel);
@ -309,14 +311,18 @@ void WidgetExplorer::setDesktopView(DesktopView *view)
emit desktopViewChanged();
}
void WidgetExplorer::populateWidgetList(const QString &app)
void WidgetExplorer::setApplication(const QString &app)
{
if (d->application == app) {
return;
}
d->application = app;
d->itemModel.setApplication(app);
d->initFilters();
d->itemModel.setRunningApplets(d->runningApplets);
emit applicationChanged();
}
QString WidgetExplorer::application()

View File

@ -75,6 +75,11 @@ class WidgetExplorer : public QObject
*/
Q_PROPERTY(QList<QObject *> extraActions READ extraActions NOTIFY extraActionsChanged)
/**
* The application that owns the widget list. different application may show different lists
*/
Q_PROPERTY(QString application READ application WRITE setApplication NOTIFY applicationChanged)
Q_PROPERTY(DesktopView *desktopView READ desktopView WRITE setDesktopView NOTIFY desktopViewChanged)
public:
@ -90,7 +95,7 @@ public:
*
* @arg application the application which the widgets should be loaded for.
*/
void populateWidgetList(const QString &application = QString());
void setApplication(const QString &application = QString());
/**
* Changes the current default containment to add applets to
@ -131,6 +136,7 @@ Q_SIGNALS:
void extraActionsChanged();
void closed();
void desktopViewChanged();
void applicationChanged();
public Q_SLOTS:
/**