use Containment::action("remove") directly

--update Layout::removeView implementation in order
to call containment "remove" function directly.
That approach works more reliable than the previous
one and we are that in the end no orphaned containment
config data will be present in the layout file.
work/spdx
Michail Vourlakos 4 years ago
parent e65c1f6385
commit a25760df5d

@ -42,6 +42,7 @@
#include <Plasma/Containment> #include <Plasma/Containment>
// KDE // KDE
#include <KActionCollection>
#include <KConfigGroup> #include <KConfigGroup>
namespace Latte { namespace Latte {
@ -1643,40 +1644,14 @@ void GenericLayout::removeView(const Latte::Data::View &viewData)
return; return;
} }
Latte::View *view = viewForContainment(viewData.id.toUInt());
if (view) {
//! viewMustBeDeleted
m_latteViews.remove(view->containment());
view->disconnectSensitiveSignals();
view->positioner()->hideOnExit();
delete view;
}
//! delete also the relevant containments
Plasma::Containment *viewcontainment = containmentForId(viewData.id.toUInt()); Plasma::Containment *viewcontainment = containmentForId(viewData.id.toUInt());
if (viewcontainment) { if (viewcontainment) {
m_containments.removeAll(viewcontainment); QAction *removeaction = viewcontainment->actions()->action("remove");
delete viewcontainment; if (removeaction) {
} removeaction->trigger();
for (int i=0; i<viewData.subcontainments.rowCount(); ++i) {
Plasma::Containment *subcontainment = containmentForId(viewData.subcontainments[i].id.toUInt());
if (subcontainment) {
m_containments.removeAll(subcontainment);
delete subcontainment;
} }
} }
if (m_corona->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) {
QString multiplelayoutfile = Layouts::Importer::layoutUserFilePath(Layout::MULTIPLELAYOUTSHIDDENNAME);
Layouts::Storage::self()->removeView(multiplelayoutfile, viewData);
} else {
//! remove from storage
Layouts::Storage::self()->removeView(file(), viewData);
}
} }
QString GenericLayout::storedView(const int &containmentId) QString GenericLayout::storedView(const int &containmentId)

Loading…
Cancel
Save