1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-16 22:04:08 +03:00

fix currentActivitiId issues on startup

This commit is contained in:
Michail Vourlakos 2018-01-14 13:21:11 +02:00
parent 896e46dcd9
commit dc4a223f27
6 changed files with 19 additions and 13 deletions

View File

@ -1298,6 +1298,7 @@ void DockView::setManagedLayout(Layout *layout)
if (m_managedLayout) {
qDebug() << "DOCK VIEW FROM LAYOUT ::: " << layout->name() << " - activities: " << layout->appliedActivities();
m_visibility->setDockOnActivities(layout->appliedActivities());
emit activitiesChanged();
}
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
@ -1306,14 +1307,16 @@ void DockView::setManagedLayout(Layout *layout)
connect(dockCorona->activitiesConsumer(), &KActivities::Consumer::runningActivitiesChanged, this, [&]() {
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
emit activitiesChanged();
}
});
/* connect(m_managedLayout, &Layout::activitiesChanged, this, [&]() {
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
}
});*/
connect(m_managedLayout, &Layout::activitiesChanged, this, [&]() {
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
emit activitiesChanged();
}
});
//!IMPORTANT!!! ::: This fixes a bug when closing an Activity all docks from all Activities are
//! disappearing! With this they reappear!!!
@ -1325,6 +1328,7 @@ void DockView::setManagedLayout(Layout *layout)
if (m_managedLayout) {
m_visibility->setDockOnActivities(m_managedLayout->appliedActivities());
emit activitiesChanged();
}
}
});

View File

@ -235,6 +235,7 @@ signals:
void showDockAfterLocationChangeFinished();
void showDockAfterScreenChangeFinished();
void activitiesChanged();
void alternativesIsShownChanged();
void alignmentChanged();
void behaveAsPlasmaPanelChanged();

View File

@ -369,6 +369,8 @@ void Layout::loadConfig()
m_showInMenu = m_layoutGroup.readEntry("showInMenu", false);
m_activities = m_layoutGroup.readEntry("activities", QStringList());
m_launchers = m_layoutGroup.readEntry("launchers", QStringList());
emit activitiesChanged();
}
void Layout::saveConfig()

View File

@ -55,8 +55,6 @@ LayoutManager::LayoutManager(QObject *parent)
m_dynamicSwitchTimer.setSingleShot(true);
showInfoWindowChanged();
connect(&m_dynamicSwitchTimer, &QTimer::timeout, this, &LayoutManager::confirmDynamicSwitch);
m_currentActivityId = m_corona->m_activityConsumer->currentActivity();
}
}
@ -178,7 +176,7 @@ QString LayoutManager::currentLayoutName() const
return m_corona->universalSettings()->currentLayoutName();
} else if (memoryUsage() == Dock::MultipleLayouts) {
foreach (auto layout, m_activeLayouts) {
if (layout->activities().contains(m_currentActivityId)) {
if (layout->isOriginalLayout() && layout->activities().contains(m_corona->activitiesConsumer()->currentActivity())) {
return layout->name();
}
}
@ -190,6 +188,7 @@ QString LayoutManager::currentLayoutName() const
}
}
qDebug() << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! CURRENT LAYOUT NAME :::: ";
return QString();
}
@ -326,7 +325,7 @@ QHash<const Plasma::Containment *, DockView *> *LayoutManager::currentDockViews(
return m_activeLayouts.at(0)->dockViews();
} else {
foreach (auto layout, m_activeLayouts) {
if (layout->activities().contains(m_currentActivityId)) {
if (layout->activities().contains(m_corona->m_activityConsumer->currentActivity())) {
return layout->dockViews();
}
}
@ -380,8 +379,6 @@ int LayoutManager::activeLayoutPos(QString id) const
void LayoutManager::currentActivityChanged(const QString &id)
{
m_currentActivityId = id;
if (memoryUsage() == Dock::SingleLayout) {
qDebug() << "activity changed :: " << id;

View File

@ -157,7 +157,6 @@ private:
bool layoutIsAssigned(QString layoutName);
QStringList validActivities(QStringList currentList);
QString m_currentActivityId;
QStringList m_layouts;
QStringList m_menuLayouts;
QStringList m_presetsPaths;

View File

@ -133,6 +133,9 @@ inline void VisibilityManagerPrivate::setMode(Dock::Visibility mode)
updateStrutsBasedOnLayoutsAndActivities();
});
connections[3] = connect(dockView, &DockView::activitiesChanged, this, [&]() {
updateStrutsBasedOnLayoutsAndActivities();
});
}
raiseDock(true);
@ -200,7 +203,7 @@ void VisibilityManagerPrivate::updateStrutsBasedOnLayoutsAndActivities()
{
bool multipleLayoutsAndCurrent = (dockCorona->layoutManager()->memoryUsage() == Dock::MultipleLayouts
&& dockView->managedLayout()
&& dockCorona->layoutManager()->currentLayoutName() == dockView->managedLayout()->name());
&& dockView->managedLayout()->name() == dockCorona->layoutManager()->currentLayoutName());
if (dockCorona->layoutManager()->memoryUsage() == Dock::SingleLayout || multipleLayoutsAndCurrent) {
wm->setDockStruts(*view, dockGeometry, view->location());