remove noDocksWithTasks from corona

pull/2/head
Michail Vourlakos 7 years ago
parent 09691438e2
commit 6a1c8173e2

@ -532,25 +532,6 @@ QRect DockCorona::availableScreenRectWithCriteria(int id, QList<Dock::Visibility
return available; return available;
} }
//! the number of currently running docks containing
//! tasks plasmoid
int DockCorona::noDocksWithTasks() const
{
QHash<const Plasma::Containment *, DockView *> *views = m_layoutManager->currentDockViews();
int result = 0;
if (views) {
foreach (auto view, *views) {
if (view->tasksPresent()) {
result++;
}
}
}
return result;
}
void DockCorona::addOutput(QScreen *screen) void DockCorona::addOutput(QScreen *screen)
{ {
Q_ASSERT(screen); Q_ASSERT(screen);

@ -89,7 +89,6 @@ public:
int docksCount(int screen) const; int docksCount(int screen) const;
int docksCount(QScreen *screen) const; int docksCount(QScreen *screen) const;
int noDocksWithTasks() const;
int screenForContainment(const Plasma::Containment *containment) const override; int screenForContainment(const Plasma::Containment *containment) const override;
void recreateDock(Plasma::Containment *containment); void recreateDock(Plasma::Containment *containment);

@ -476,10 +476,12 @@ void DockView::reconsiderScreen()
qDebug() << "dock screen exists ::: " << screenExists; qDebug() << "dock screen exists ::: " << screenExists;
int docksWithTasks = m_managedLayout ? m_managedLayout->noDocksWithTasks() : 0;
//! 1.a primary dock must be always on the primary screen //! 1.a primary dock must be always on the primary screen
//! 2.the last tasks dock must also always on the primary screen //! 2.the last tasks dock must also always on the primary screen
//! even though it has been configured as an explicit //! even though it has been configured as an explicit
if ((m_onPrimary || (tasksPresent() && dockCorona->noDocksWithTasks() == 1 && !screenExists)) if ((m_onPrimary || (tasksPresent() && docksWithTasks == 1 && !screenExists))
&& (m_screenToFollowId != qGuiApp->primaryScreen()->name() && (m_screenToFollowId != qGuiApp->primaryScreen()->name()
|| m_screenToFollow != qGuiApp->primaryScreen())) { || m_screenToFollow != qGuiApp->primaryScreen())) {
using Plasma::Types; using Plasma::Types;
@ -495,7 +497,7 @@ void DockView::reconsiderScreen()
if (edges.contains(location())) { if (edges.contains(location())) {
//! case 2 //! case 2
if (!m_onPrimary && !screenExists && tasksPresent() && (dockCorona->noDocksWithTasks() == 1)) { if (!m_onPrimary && !screenExists && tasksPresent() && (docksWithTasks == 1)) {
qDebug() << "reached case 2 of updating dock primary screen..."; qDebug() << "reached case 2 of updating dock primary screen...";
setScreenToFollow(qGuiApp->primaryScreen(), false); setScreenToFollow(qGuiApp->primaryScreen(), false);
} else { } else {
@ -1082,10 +1084,10 @@ int DockView::docksWithTasks()
{ {
auto dockCorona = qobject_cast<DockCorona *>(corona()); auto dockCorona = qobject_cast<DockCorona *>(corona());
if (!dockCorona) if (!dockCorona || !m_managedLayout)
return 0; return 0;
return dockCorona->noDocksWithTasks(); return m_managedLayout->noDocksWithTasks();
} }
void DockView::updateFormFactor() void DockView::updateFormFactor()

@ -1250,7 +1250,7 @@ void Layout::syncDockViewsToScreens()
} }
if (!found && !view->onPrimary() && (m_dockViews.size() > 1) && m_dockViews.contains(view->containment()) if (!found && !view->onPrimary() && (m_dockViews.size() > 1) && m_dockViews.contains(view->containment())
&& !(view->tasksPresent() && m_corona->noDocksWithTasks() == 1)) { //do not delete last dock containing tasks && !(view->tasksPresent() && noDocksWithTasks() == 1)) { //do not delete last dock containing tasks
if (view->tasksPresent()) { if (view->tasksPresent()) {
if (preserveContainmentId == -1) if (preserveContainmentId == -1)
preserveContainmentId = view->containment()->id(); preserveContainmentId = view->containment()->id();
@ -1280,7 +1280,7 @@ void Layout::syncDockViewsToScreens()
//! which explicit docks can be deleted //! which explicit docks can be deleted
if (!found && !view->onPrimary() && (m_dockViews.size() > 1) && m_dockViews.contains(view->containment()) if (!found && !view->onPrimary() && (m_dockViews.size() > 1) && m_dockViews.contains(view->containment())
&& !(view->tasksPresent() && m_corona->noDocksWithTasks() == 1)) { && !(view->tasksPresent() && noDocksWithTasks() == 1)) {
//do not delete last dock containing tasks //do not delete last dock containing tasks
if (dockWithTasksWillBeShown || preserveContainmentId != view->containment()->id()) { if (dockWithTasksWillBeShown || preserveContainmentId != view->containment()->id()) {
qDebug() << "screen Count signal: view must be deleted... for:" << view->currentScreen(); qDebug() << "screen Count signal: view must be deleted... for:" << view->currentScreen();
@ -1403,4 +1403,17 @@ QList<Plasma::Types::Location> Layout::freeEdges(int screen) const
return edges; return edges;
} }
int Layout::noDocksWithTasks() const
{
int result = 0;
foreach (auto view, m_dockViews) {
if (view->tasksPresent()) {
result++;
}
}
return result;
}
} }

@ -114,6 +114,8 @@ public:
QList<Plasma::Types::Location> freeEdges(QScreen *screen) const; QList<Plasma::Types::Location> freeEdges(QScreen *screen) const;
QList<Plasma::Types::Location> freeEdges(int screen) const; QList<Plasma::Types::Location> freeEdges(int screen) const;
int noDocksWithTasks() const;
signals: signals:
void activitiesChanged(); void activitiesChanged();
void colorChanged(); void colorChanged();

Loading…
Cancel
Save