mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 13:33:50 +03:00
fix context menu for applet if group plasmoid
--the new code can understand ALL applets that are inside an internal containment style applets such as plasma, nomad systrays and group plasmoid FIXED-IN:0.9.10
This commit is contained in:
parent
705e3d2d1e
commit
90d1cedc1e
@ -186,6 +186,32 @@ bool GenericLayout::isCurrent() const
|
|||||||
return name() == m_corona->layoutsManager()->currentLayoutName();
|
return name() == m_corona->layoutsManager()->currentLayoutName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GenericLayout::isInternalContainment(Plasma::Applet *applet) const
|
||||||
|
{
|
||||||
|
for (const auto containment : m_containments) {
|
||||||
|
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
|
||||||
|
if (parentApplet && parentApplet == applet) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plasma::Containment *GenericLayout::internalContainmentOf(Plasma::Applet *applet) const
|
||||||
|
{
|
||||||
|
if (isInternalContainment(applet)) {
|
||||||
|
for (const auto containment : m_containments) {
|
||||||
|
Plasma::Applet *parentApplet = qobject_cast<Plasma::Applet *>(containment->parent());
|
||||||
|
if (parentApplet && parentApplet == applet) {
|
||||||
|
return containment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int GenericLayout::viewsCount(int screen) const
|
int GenericLayout::viewsCount(int screen) const
|
||||||
{
|
{
|
||||||
if (!m_corona) {
|
if (!m_corona) {
|
||||||
|
@ -87,6 +87,9 @@ public:
|
|||||||
bool isWritable() const;
|
bool isWritable() const;
|
||||||
bool layoutIsBroken() const;
|
bool layoutIsBroken() const;
|
||||||
|
|
||||||
|
bool isInternalContainment(Plasma::Applet *applet) const;
|
||||||
|
Plasma::Containment *internalContainmentOf(Plasma::Applet *applet) const;
|
||||||
|
|
||||||
virtual bool configViewIsShown() const;
|
virtual bool configViewIsShown() const;
|
||||||
|
|
||||||
virtual int viewsCount(int screen) const;
|
virtual int viewsCount(int screen) const;
|
||||||
|
@ -141,18 +141,11 @@ bool ContextMenu::mousePressEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
if (ai && ai->isVisible() && appletContainsMouse) {
|
if (ai && ai->isVisible() && appletContainsMouse) {
|
||||||
applet = ai->applet();
|
applet = ai->applet();
|
||||||
KPluginMetaData meta = applet->kPackage().metadata();
|
if (m_latteView && m_latteView->layout() && m_latteView->layout()->isInternalContainment(applet)) {
|
||||||
|
Plasma::Containment *internalC = m_latteView->layout()->internalContainmentOf(applet);
|
||||||
|
|
||||||
//Try to find applets inside a systray
|
if (internalC) {
|
||||||
if (meta.pluginId() == "org.kde.plasma.systemtray" ||
|
for (const Plasma::Applet *appletCont : internalC->applets()) {
|
||||||
meta.pluginId() == "org.nomad.systemtray") {
|
|
||||||
auto systrayId = applet->config().readEntry("SystrayContainmentId");
|
|
||||||
applet = 0;
|
|
||||||
inSystray = true;
|
|
||||||
Plasma::Containment *cont = containmentById(systrayId.toInt());
|
|
||||||
|
|
||||||
if (cont) {
|
|
||||||
for (const Plasma::Applet *appletCont : cont->applets()) {
|
|
||||||
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
PlasmaQuick::AppletQuickItem *ai2 = appletCont->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
|
||||||
|
|
||||||
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) {
|
if (ai2 && ai2->isVisible() && ai2->contains(ai2->mapFromItem(m_latteView->contentItem(), event->pos()))) {
|
||||||
|
Loading…
Reference in New Issue
Block a user