mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-29 17:47:23 +03:00
block dock hiding when alternatives are shown
This commit is contained in:
parent
b4885ceee4
commit
a430d85119
@ -372,10 +372,20 @@ void DockCorona::dockContainmentDestroyed(QObject *cont)
|
|||||||
void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
|
void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
|
||||||
{
|
{
|
||||||
const QString alternativesQML = kPackage().filePath("appletalternativesui");
|
const QString alternativesQML = kPackage().filePath("appletalternativesui");
|
||||||
|
|
||||||
if (alternativesQML.isEmpty()) {
|
if (alternativesQML.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (applet->containment()) {
|
||||||
|
DockView *view = m_dockViews[applet->containment()];
|
||||||
|
|
||||||
|
if (view) {
|
||||||
|
view->visibility()->setBlockHiding(true);
|
||||||
|
m_alternativesContaiment = applet->containment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
KDeclarative::QmlObject *qmlObj = new KDeclarative::QmlObject(this);
|
KDeclarative::QmlObject *qmlObj = new KDeclarative::QmlObject(this);
|
||||||
qmlObj->setInitializationDelayed(true);
|
qmlObj->setInitializationDelayed(true);
|
||||||
qmlObj->setSource(QUrl::fromLocalFile(alternativesQML));
|
qmlObj->setSource(QUrl::fromLocalFile(alternativesQML));
|
||||||
@ -388,13 +398,16 @@ void DockCorona::showAlternativesForApplet(Plasma::Applet *applet)
|
|||||||
connect(qmlObj->rootObject(), SIGNAL(visibleChanged(bool)),
|
connect(qmlObj->rootObject(), SIGNAL(visibleChanged(bool)),
|
||||||
this, SLOT(alternativesVisibilityChanged(bool)));
|
this, SLOT(alternativesVisibilityChanged(bool)));
|
||||||
|
|
||||||
connect(applet, &Plasma::Applet::destroyedChanged, this, [this, qmlObj] (bool destroyed) {
|
connect(applet, &Plasma::Applet::destroyedChanged, this, [this, qmlObj](bool destroyed) {
|
||||||
if (!destroyed) {
|
if (!destroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMutableListIterator<KDeclarative::QmlObject *> it(m_alternativesObjects);
|
QMutableListIterator<KDeclarative::QmlObject *> it(m_alternativesObjects);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
KDeclarative::QmlObject *obj = it.next();
|
KDeclarative::QmlObject *obj = it.next();
|
||||||
|
|
||||||
if (obj == qmlObj) {
|
if (obj == qmlObj) {
|
||||||
it.remove();
|
it.remove();
|
||||||
obj->deleteLater();
|
obj->deleteLater();
|
||||||
@ -409,11 +422,23 @@ void DockCorona::alternativesVisibilityChanged(bool visible)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_alternativesContaiment) {
|
||||||
|
DockView *view = m_dockViews[m_alternativesContaiment];
|
||||||
|
|
||||||
|
if (view) {
|
||||||
|
view->visibility()->setBlockHiding(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_alternativesContaiment = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
QObject *root = sender();
|
QObject *root = sender();
|
||||||
|
|
||||||
QMutableListIterator<KDeclarative::QmlObject *> it(m_alternativesObjects);
|
QMutableListIterator<KDeclarative::QmlObject *> it(m_alternativesObjects);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
KDeclarative::QmlObject *obj = it.next();
|
KDeclarative::QmlObject *obj = it.next();
|
||||||
|
|
||||||
if (obj->rootObject() == root) {
|
if (obj->rootObject() == root) {
|
||||||
it.remove();
|
it.remove();
|
||||||
obj->deleteLater();
|
obj->deleteLater();
|
||||||
|
@ -96,6 +96,8 @@ private:
|
|||||||
|
|
||||||
KActivities::Consumer *m_activityConsumer;
|
KActivities::Consumer *m_activityConsumer;
|
||||||
QPointer<KAboutApplicationDialog> aboutDialog;
|
QPointer<KAboutApplicationDialog> aboutDialog;
|
||||||
|
|
||||||
|
QPointer<Plasma::Containment> m_alternativesContaiment;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user