use recreateDock directly

--recreateDock is used when the visibility mode
changes and as such the window must be recreated
in order to work correctly. Any remaining code
found for such function in corona and layoutManager
is removed.
pull/2/head
Michail Vourlakos 7 years ago
parent f257512a44
commit 616b8139ff

@ -315,23 +315,15 @@ void DockConfigView::hideEvent(QHideEvent *ev)
QQuickWindow::hideEvent(ev); QQuickWindow::hideEvent(ev);
auto recreateDock = [&]() noexcept {
auto *dockCorona = qobject_cast<DockCorona *>(m_dockView->corona());
if (dockCorona) {
dockCorona->recreateDock(m_dockView->containment());
}
};
const auto mode = m_dockView->visibility()->mode(); const auto mode = m_dockView->visibility()->mode();
const auto previousDockWinBehavior = (m_dockView->flags() & Qt::BypassWindowManagerHint) ? false : true; const auto previousDockWinBehavior = (m_dockView->flags() & Qt::BypassWindowManagerHint) ? false : true;
if (mode == Dock::AlwaysVisible || mode == Dock::WindowsGoBelow) { if (mode == Dock::AlwaysVisible || mode == Dock::WindowsGoBelow) {
if (!previousDockWinBehavior) { if (!previousDockWinBehavior) {
recreateDock(); m_dockView->managedLayout()->recreateDock(m_dockView->containment());
} }
} else if (m_dockView->dockWinBehavior() != previousDockWinBehavior) { } else if (m_dockView->dockWinBehavior() != previousDockWinBehavior) {
recreateDock(); m_dockView->managedLayout()->recreateDock(m_dockView->containment());
} }
deleteLater(); deleteLater();

@ -706,11 +706,6 @@ int DockCorona::screenForContainment(const Plasma::Containment *containment) con
return -1; return -1;
} }
void DockCorona::recreateDock(Plasma::Containment *containment)
{
m_layoutManager->recreateDock(containment);
}
void DockCorona::showAlternativesForApplet(Plasma::Applet *applet) void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
{ {
const QString alternativesQML = kPackage().filePath("appletalternativesui"); const QString alternativesQML = kPackage().filePath("appletalternativesui");

@ -94,8 +94,6 @@ public:
int screenForContainment(const Plasma::Containment *containment) const override; int screenForContainment(const Plasma::Containment *containment) const override;
void recreateDock(Plasma::Containment *containment);
void closeApplication(); void closeApplication();
AbstractWindowInterface *wm() const; AbstractWindowInterface *wm() const;

@ -308,23 +308,6 @@ void LayoutManager::addDock(Plasma::Containment *containment, bool forceLoading,
} }
} }
void LayoutManager::recreateDock(Plasma::Containment *containment)
{
if (memoryUsage() == Dock::SingleLayout) {
m_activeLayouts.at(0)->recreateDock(containment);
} else if (memoryUsage() == Dock::MultipleLayouts) {
QString layoutId = containment->config().readEntry("layoutId", QString());
if (!layoutId.isEmpty()) {
auto layout = activeLayout(layoutId);
if (layout) {
layout->recreateDock(containment);
}
}
}
}
QHash<const Plasma::Containment *, DockView *> *LayoutManager::currentDockViews() const QHash<const Plasma::Containment *, DockView *> *LayoutManager::currentDockViews() const
{ {
if (memoryUsage() == Dock::SingleLayout) { if (memoryUsage() == Dock::SingleLayout) {

@ -74,7 +74,6 @@ public:
void addDock(Plasma::Containment *containment, bool forceLoading = false, int expDockScreen = -1); void addDock(Plasma::Containment *containment, bool forceLoading = false, int expDockScreen = -1);
void hideAllDocks(); void hideAllDocks();
void pauseLayout(QString layoutName); void pauseLayout(QString layoutName);
void recreateDock(Plasma::Containment *containment);
void syncDockViewsToScreens(); void syncDockViewsToScreens();
void syncActiveLayoutsToOriginalFiles(); void syncActiveLayoutsToOriginalFiles();

Loading…
Cancel
Save