add view config

experiment, for now has a slightly different way to find own config group compared to plasma1
This commit is contained in:
Marco Martin 2013-02-21 18:32:32 +01:00
parent 9804b223f2
commit 02aa67a990
4 changed files with 25 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <QDebug>
#include <QScreen>
#include <KGlobal>
#include <KWindowSystem>
#include <kwindoweffects.h>
@ -52,6 +53,15 @@ PanelView::~PanelView()
}
KConfigGroup PanelView::config() const
{
if (!containment()) {
return KConfigGroup();
}
KConfigGroup views(KGlobal::config(), "PlasmaViews");
return KConfigGroup(&views, QString("Panel %1").arg(containment()->id()));
}
void PanelView::init()
{
if (!corona()->package().isValid()) {

View File

@ -31,6 +31,8 @@ public:
explicit PanelView(Plasma::Corona *corona, QWindow *parent = 0);
virtual ~PanelView();
virtual KConfigGroup config() const;
virtual void init();
private Q_SLOTS:

View File

@ -24,6 +24,8 @@
#include <QTimer>
#include "plasma/pluginloader.h"
#include <KGlobal>
View::View(Plasma::Corona *corona, QWindow *parent)
: QQuickView(parent),
m_corona(corona)
@ -45,6 +47,15 @@ Plasma::Corona *View::corona() const
return m_corona;
}
KConfigGroup View::config() const
{
if (!containment()) {
return KConfigGroup();
}
KConfigGroup views(KGlobal::config(), "PlasmaViews");
return KConfigGroup(&views, QString::number(containment()->screen()));
}
void View::init()
{
if (!m_corona->package().isValid()) {

View File

@ -36,6 +36,8 @@ public:
Plasma::Corona *corona() const;
virtual KConfigGroup config() const;
//FIXME: not super nice, but we have to be sure qml assignment is done after window flags
virtual void init();