|
|
|
@ -1060,18 +1060,20 @@ void GenericLayout::updateLastUsedActivity()
|
|
|
|
|
|
|
|
|
|
void GenericLayout::assignToLayout(Latte::View *latteView, QList<Plasma::Containment *> containments)
|
|
|
|
|
{
|
|
|
|
|
if (!m_corona) {
|
|
|
|
|
if (!m_corona || containments.isEmpty()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (latteView) {
|
|
|
|
|
m_latteViews[latteView->containment()] = latteView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_containments << containments;
|
|
|
|
|
|
|
|
|
|
for (const auto containment : containments) {
|
|
|
|
|
containment->config().writeEntry("layoutId", name());
|
|
|
|
|
|
|
|
|
|
if (latteView->containment() != containment) {
|
|
|
|
|
if (!latteView || (latteView && latteView->containment() != containment)) {
|
|
|
|
|
//! assign signals only to subcontainments
|
|
|
|
|
//! the View::setLayout() is responsible for the View::Containment signals
|
|
|
|
|
connect(containment, &QObject::destroyed, this, &GenericLayout::containmentDestroyed);
|
|
|
|
@ -1080,32 +1082,33 @@ void GenericLayout::assignToLayout(Latte::View *latteView, QList<Plasma::Contain
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (latteView) {
|
|
|
|
|
latteView->setLayout(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit viewsCountChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! sync the original layout file for integrity
|
|
|
|
|
if (m_corona && m_corona->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) {
|
|
|
|
|
if (m_corona->layoutsManager()->memoryUsage() == MemoryUsage::MultipleLayouts) {
|
|
|
|
|
Layouts::Storage::self()->syncToLayoutFile(this, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<Plasma::Containment *> GenericLayout::unassignFromLayout(Latte::View *latteView)
|
|
|
|
|
QList<Plasma::Containment *> GenericLayout::unassignFromLayout(Plasma::Containment *latteContainment)
|
|
|
|
|
{
|
|
|
|
|
QList<Plasma::Containment *> containments;
|
|
|
|
|
|
|
|
|
|
if (!m_corona) {
|
|
|
|
|
if (!m_corona || !latteContainment || !contains(latteContainment)) {
|
|
|
|
|
return containments;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
containments << latteView->containment();
|
|
|
|
|
containments << latteContainment;
|
|
|
|
|
|
|
|
|
|
for (const auto containment : m_containments) {
|
|
|
|
|
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
|
|
|
|
|
|
|
|
|
|
//! add subcontainments from that latteView
|
|
|
|
|
if (parentApplet && parentApplet->containment() && parentApplet->containment() == latteView->containment()) {
|
|
|
|
|
if (parentApplet && parentApplet->containment() && parentApplet->containment() == latteContainment) {
|
|
|
|
|
containments << containment;
|
|
|
|
|
//! unassign signals only to subcontainments
|
|
|
|
|
//! the View::setLayout() is responsible for the View::Containment signals
|
|
|
|
@ -1120,7 +1123,7 @@ QList<Plasma::Containment *> GenericLayout::unassignFromLayout(Latte::View *latt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (containments.size() > 0) {
|
|
|
|
|
m_latteViews.remove(latteView->containment());
|
|
|
|
|
m_latteViews.remove(latteContainment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//! sync the original layout file for integrity
|
|
|
|
|