1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-10 21:18:19 +03:00

block hiding when alternatives is shown

This commit is contained in:
Michail Vourlakos 2017-08-09 03:33:03 +03:00
parent f4fa8cf0c7
commit f2ab6cbc9c
6 changed files with 62 additions and 5 deletions

View File

@ -346,6 +346,11 @@ void DockConfigView::immutabilityChanged(Plasma::Types::ImmutabilityType type)
hideConfigWindow();
}
bool DockConfigView::sticker() const
{
return m_blockFocusLost;
}
void DockConfigView::setSticker(bool blockFocusLost)
{
if (m_blockFocusLost == blockFocusLost)

View File

@ -57,6 +57,8 @@ public:
void init() override;
Qt::WindowFlags wFlags() const;
bool sticker() const;
public slots:
Q_INVOKABLE void addPanelSpacer();
Q_INVOKABLE void hideConfigWindow();

View File

@ -1010,6 +1010,17 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
m_alternativesObjects << qmlObj;
qmlObj->completeInitialization();
DockView *dockView = m_dockViews[applet->containment()];
if (dockView) {
dockView->setAlternativesIsShown(true);
}
connect(helper, &QObject::destroyed, this, [dockView]() {
dockView->setAlternativesIsShown(false);
});
connect(qmlObj->rootObject(), SIGNAL(visibleChanged(bool)),
this, SLOT(alternativesVisibilityChanged(bool)));

View File

@ -790,6 +790,23 @@ void DockView::statusChanged(Plasma::Types::ItemStatus status)
}
}
bool DockView::alternativesIsShown() const
{
return m_alternativesIsShown;
}
void DockView::setAlternativesIsShown(bool show)
{
if (m_alternativesIsShown == show) {
return;
}
m_alternativesIsShown = show;
setBlockHiding(show);
emit alternativesIsShownChanged();
}
bool DockView::contextMenuIsShown() const
{
return m_contextMenu;
@ -1139,6 +1156,21 @@ void DockView::setShadow(int shadow)
emit shadowChanged();
}
void DockView::setBlockHiding(bool block)
{
if (!block) {
auto *configView = qobject_cast<DockConfigView *>(m_configView);
if (m_alternativesIsShown || (configView && configView->sticker())) {
return;
}
m_visibility->setBlockHiding(false);
} else {
m_visibility->setBlockHiding(true);
}
}
void DockView::updateEffects()
{
if (!m_behaveAsPlasmaPanel) {

View File

@ -21,8 +21,8 @@
#ifndef DOCKVIEW_H
#define DOCKVIEW_H
#include "plasmaquick/configview.h"
#include "plasmaquick/containmentview.h"
#include "plasmaquick/configview.h"
#include "visibilitymanager.h"
#include "../liblattedock/dock.h"
@ -52,6 +52,7 @@ namespace Latte {
class DockView : public PlasmaQuick::ContainmentView {
Q_OBJECT
Q_PROPERTY(bool alternativesIsShown READ alternativesIsShown NOTIFY alternativesIsShownChanged)
Q_PROPERTY(bool behaveAsPlasmaPanel READ behaveAsPlasmaPanel WRITE setBehaveAsPlasmaPanel NOTIFY behaveAsPlasmaPanelChanged)
Q_PROPERTY(bool contextMenuIsShown READ contextMenuIsShown NOTIFY contextMenuIsShownChanged)
Q_PROPERTY(bool dockWinBehavior READ dockWinBehavior WRITE setDockWinBehavior NOTIFY dockWinBehaviorChanged)
@ -97,6 +98,9 @@ public:
void resizeWindow(QRect availableScreenRect = QRect());
void syncGeometry();
bool alternativesIsShown() const;
void setAlternativesIsShown(bool show);
bool onPrimary() const;
void setOnPrimary(bool flag);
@ -173,6 +177,7 @@ public slots:
Q_INVOKABLE void deactivateApplets();
Q_INVOKABLE void removeTasksPlasmoid();
Q_INVOKABLE void setBlockHiding(bool block);
Q_INVOKABLE void toggleAppletExpanded(const int id);
Q_INVOKABLE void updateEnabledBorders();
@ -200,6 +205,7 @@ signals:
void removeInternalViewSplitter();
void eventTriggered(QEvent *ev);
void alternativesIsShownChanged();
void alignmentChanged();
void behaveAsPlasmaPanelChanged();
void contextMenuIsShownChanged();
@ -253,6 +259,7 @@ private:
private:
Plasma::Containment *containmentById(uint id);
bool m_alternativesIsShown{false};
bool m_behaveAsPlasmaPanel{false};
bool m_forceDrawCenteredBorders{false};
bool m_dockWinBehavior{true};

View File

@ -579,7 +579,7 @@ DragDrop.DropArea {
// console.debug("user configuring", plasmoid.userConfiguring)
if (plasmoid.userConfiguring) {
dock.visibility.blockHiding = true;
dock.setBlockHiding(true);
// console.log("applets------");
for (var i = 0; i < plasmoid.applets.length; ++i) {
@ -599,7 +599,7 @@ DragDrop.DropArea {
dragOverlay.visible = true;
}
} else {
dock.visibility.blockHiding = false;
dock.setBlockHiding(false);
if (dock.visibility.isHidden) {
dock.visibility.mustBeShown();
@ -971,10 +971,10 @@ DragDrop.DropArea {
actionsBlockHiding = Math.max(actionsBlockHiding + step, 0);
if (actionsBlockHiding > 0){
dock.visibility.blockHiding = true;
dock.setBlockHiding(true);
} else {
if (!root.editMode)
dock.visibility.blockHiding = false;
dock.visibiliy.setBlockHiding(false);
}
}