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

update pause layout in multiple layouts environment

--the new approach takes into account only the layout
appliedactivities and accepts also FreeActivities as
valid to be paused
This commit is contained in:
Michail Vourlakos 2020-08-31 21:28:07 +03:00
parent be20c63366
commit 302c6a9cc2
2 changed files with 14 additions and 6 deletions

View File

@ -455,17 +455,23 @@ void Synchronizer::hideAllViews()
void Synchronizer::pauseLayout(QString layoutName)
{
if (m_manager->memoryUsage() == MemoryUsage::MultipleLayouts) {
if (m_manager->memoryUsage() == MemoryUsage::MultipleLayouts) {
CentralLayout *layout = centralLayout(layoutName);
if (layout && !layout->activities().isEmpty()) {
if (layout->isOnAllActivities()) {
return;
}
QStringList appliedactivities = layout->appliedActivities();
if (layout && !appliedactivities.isEmpty()) {
int i = 0;
for (const auto &activityId : layout->activities()) {
for (const auto &activityid : appliedactivities) {
//! Stopping the activities must be done asynchronous because otherwise
//! the activity manager cant close multiple activities
QTimer::singleShot(i * 1000, [this, activityId]() {
m_activitiesController->stopActivity(activityId);
QTimer::singleShot(i * 1000, [this, activityid]() {
m_activitiesController->stopActivity(activityid);
});
i = i + 1;

View File

@ -372,7 +372,9 @@ void TabLayouts::updatePerLayoutButtonsState()
//! Pause Button - enabled
if (m_layoutsController->inMultipleMode()) {
if (selectedLayout.isActive && !selectedLayout.isForFreeActivities() && m_corona->layoutsManager()->synchronizer()->runningActivities().count()>1) {
if (selectedLayout.isActive
&& !selectedLayout.isOnAllActivities()
&& m_corona->layoutsManager()->synchronizer()->runningActivities().count()>1) {
setTwinProperty(m_pauseLayoutAction, TWINENABLED, true);
} else {
setTwinProperty(m_pauseLayoutAction, TWINENABLED, false);