mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-13 05:17:48 +03:00
remove noDocksWithTasks from corona
This commit is contained in:
parent
09691438e2
commit
6a1c8173e2
@ -532,25 +532,6 @@ QRect DockCorona::availableScreenRectWithCriteria(int id, QList<Dock::Visibility
|
||||
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)
|
||||
{
|
||||
Q_ASSERT(screen);
|
||||
|
@ -89,7 +89,6 @@ public:
|
||||
int docksCount(int screen) const;
|
||||
int docksCount(QScreen *screen) const;
|
||||
|
||||
int noDocksWithTasks() const;
|
||||
int screenForContainment(const Plasma::Containment *containment) const override;
|
||||
|
||||
void recreateDock(Plasma::Containment *containment);
|
||||
|
@ -476,10 +476,12 @@ void DockView::reconsiderScreen()
|
||||
|
||||
qDebug() << "dock screen exists ::: " << screenExists;
|
||||
|
||||
int docksWithTasks = m_managedLayout ? m_managedLayout->noDocksWithTasks() : 0;
|
||||
|
||||
//! 1.a primary dock must be 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
|
||||
if ((m_onPrimary || (tasksPresent() && dockCorona->noDocksWithTasks() == 1 && !screenExists))
|
||||
if ((m_onPrimary || (tasksPresent() && docksWithTasks == 1 && !screenExists))
|
||||
&& (m_screenToFollowId != qGuiApp->primaryScreen()->name()
|
||||
|| m_screenToFollow != qGuiApp->primaryScreen())) {
|
||||
using Plasma::Types;
|
||||
@ -495,7 +497,7 @@ void DockView::reconsiderScreen()
|
||||
|
||||
if (edges.contains(location())) {
|
||||
//! 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...";
|
||||
setScreenToFollow(qGuiApp->primaryScreen(), false);
|
||||
} else {
|
||||
@ -1082,10 +1084,10 @@ int DockView::docksWithTasks()
|
||||
{
|
||||
auto dockCorona = qobject_cast<DockCorona *>(corona());
|
||||
|
||||
if (!dockCorona)
|
||||
if (!dockCorona || !m_managedLayout)
|
||||
return 0;
|
||||
|
||||
return dockCorona->noDocksWithTasks();
|
||||
return m_managedLayout->noDocksWithTasks();
|
||||
}
|
||||
|
||||
void DockView::updateFormFactor()
|
||||
|
@ -1250,7 +1250,7 @@ void Layout::syncDockViewsToScreens()
|
||||
}
|
||||
|
||||
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 (preserveContainmentId == -1)
|
||||
preserveContainmentId = view->containment()->id();
|
||||
@ -1280,7 +1280,7 @@ void Layout::syncDockViewsToScreens()
|
||||
|
||||
//! which explicit docks can be deleted
|
||||
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
|
||||
if (dockWithTasksWillBeShown || preserveContainmentId != view->containment()->id()) {
|
||||
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;
|
||||
}
|
||||
|
||||
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(int screen) const;
|
||||
|
||||
int noDocksWithTasks() const;
|
||||
|
||||
signals:
|
||||
void activitiesChanged();
|
||||
void colorChanged();
|
||||
|
Loading…
Reference in New Issue
Block a user