1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

fix #5, correct loadDefaultLayout

This commit is contained in:
Michail Vourlakos 2016-12-28 15:17:36 +02:00
parent 62de24f183
commit 2541d7cb45

View File

@ -54,6 +54,7 @@ NowDockCorona::NowDockCorona(QObject *parent)
setKPackage(package);
qmlRegisterTypes();
connect(this, &Corona::containmentAdded, this, &NowDockCorona::addDock);
loadLayout();
@ -156,6 +157,12 @@ void NowDockCorona::addDock(Plasma::Containment *containment)
return;
}
foreach (NowDockView *dock, m_containments) {
if (dock->containment() == containment) {
return;
}
}
qWarning() << "Adding dock for container...";
auto dockView = new NowDockView(this);
@ -176,6 +183,7 @@ void NowDockCorona::loadDefaultLayout()
QVariantList args;
auto defaultContainment = createContainmentDelayed("org.kde.latte.containment", args);
//auto defaultContainment = createContainment("org.kde.latte.containment");
//auto defaultContainment = createContainmentDelayed("org.kde.panel", args);
defaultContainment->setContainmentType(Plasma::Types::PanelContainment);
defaultContainment->init();
@ -184,12 +192,9 @@ void NowDockCorona::loadDefaultLayout()
qWarning() << "the requested containment plugin can not be located or loaded";
return;
}
auto config = defaultContainment->config();
config.writeEntry("dock", "initial");
// config.writeEntry("alignment", (int)Dock::Center);
// config.deleteEntry("wallpaperplugin");
defaultContainment->restore(config);
switch (containments().size()) {
case 1:
@ -209,9 +214,17 @@ void NowDockCorona::loadDefaultLayout()
break;
}
auto cfg = defaultContainment->config();
defaultContainment->save(cfg);
//config.writeEntry("dock", "initial");
//config.writeEntry("alignment", (int)Dock::Center);
//config.deleteEntry("wallpaperplugin");
defaultContainment->updateConstraints(Plasma::Types::StartupCompletedConstraint);
defaultContainment->save(config);
requestConfigSync();
defaultContainment->flushPendingConstraintsEvents();
emit containmentAdded(defaultContainment);
emit containmentCreated(defaultContainment);
addDock(defaultContainment);
defaultContainment->createApplet(QStringLiteral("org.kde.store.nowdock.plasmoid"));