move explicitDockOccupyEdge to layout

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

@ -758,22 +758,6 @@ int DockCorona::screenForContainment(const Plasma::Containment *containment) con
return -1; return -1;
} }
bool DockCorona::explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const
{
foreach (auto containment, containments()) {
bool onPrimary = containment->config().readEntry("onPrimary", true);
int id = containment->lastScreen();
Plasma::Types::Location contLocation = containment->location();
if (!onPrimary && id == screen && contLocation == location) {
return true;
}
}
return false;
}
void DockCorona::recreateDock(Plasma::Containment *containment) void DockCorona::recreateDock(Plasma::Containment *containment)
{ {
m_layoutManager->recreateDock(containment); m_layoutManager->recreateDock(containment);

@ -133,7 +133,6 @@ private:
bool appletExists(uint containmentId, uint appletId) const; bool appletExists(uint containmentId, uint appletId) const;
bool containmentExists(uint id) const; bool containmentExists(uint id) const;
bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location)const;
int noOfDocks(); int noOfDocks();
int primaryScreenId() const; int primaryScreenId() const;

@ -672,7 +672,7 @@ void Layout::addDock(Plasma::Containment *containment, bool forceLoading, int ex
return; return;
} }
} else if (onPrimary) { } else if (onPrimary) {
if (m_corona->explicitDockOccupyEdge(m_corona->screenPool()->primaryScreenId(), containment->location())) { if (explicitDockOccupyEdge(m_corona->screenPool()->primaryScreenId(), containment->location())) {
qDebug() << "CORONA ::: adding dock rejected, the edge is occupied by explicit dock ! : " << containment->location(); qDebug() << "CORONA ::: adding dock rejected, the edge is occupied by explicit dock ! : " << containment->location();
//we must check that an onPrimary dock should never catch up the same edge on //we must check that an onPrimary dock should never catch up the same edge on
//the same screen with an explicit dock //the same screen with an explicit dock
@ -1403,8 +1403,34 @@ QList<Plasma::Types::Location> Layout::freeEdges(int screen) const
return edges; return edges;
} }
bool Layout::explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const
{
if (!m_corona) {
return false;
}
foreach (auto containment, m_containments) {
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") {
bool onPrimary = containment->config().readEntry("onPrimary", true);
int id = containment->lastScreen();
Plasma::Types::Location contLocation = containment->location();
if (!onPrimary && id == screen && contLocation == location) {
return true;
}
}
}
return false;
}
int Layout::noDocksWithTasks() const int Layout::noDocksWithTasks() const
{ {
if (!m_corona) {
return 0;
}
int result = 0; int result = 0;
foreach (auto view, m_dockViews) { foreach (auto view, m_dockViews) {

@ -142,6 +142,8 @@ private:
void setName(QString name); void setName(QString name);
void setFile(QString file); void setFile(QString file);
bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const;
QString availableId(QStringList all, QStringList assigned, int base); QString availableId(QStringList all, QStringList assigned, int base);
//! provides a new file path based the provided file. The new file //! provides a new file path based the provided file. The new file
//! has updated ids for containments and applets based on the corona //! has updated ids for containments and applets based on the corona

Loading…
Cancel
Save