view:drop contextmenu class

--use ContextMenuLayer internal quickitem
that is responsible for applets and containments
context menus from now on.
pull/24/head
Michail Vourlakos 3 years ago
parent 90e4ea28c4
commit 02d3c37f93

@ -102,18 +102,6 @@ void CanvasConfigView::syncGeometry()
} }
} }
void CanvasConfigView::mousePressEvent(QMouseEvent *event)
{
if (!m_latteView) {
return;
}
bool result = m_latteView->contextMenu()->mousePressEventForContainmentMenu(this, event);
QQuickView::mousePressEvent(event);
}
bool CanvasConfigView::event(QEvent *e) bool CanvasConfigView::event(QEvent *e)
{ {
bool result = SubConfigView::event(e); bool result = SubConfigView::event(e);

@ -68,7 +68,6 @@ protected:
void showEvent(QShowEvent *ev) override; void showEvent(QShowEvent *ev) override;
void focusOutEvent(QFocusEvent *ev) override; void focusOutEvent(QFocusEvent *ev) override;
bool event(QEvent *ev) override; bool event(QEvent *ev) override;
void mousePressEvent(QMouseEvent *event) override;
void init() override; void init() override;
void initParentView(Latte::View *view) override; void initParentView(Latte::View *view) override;

@ -8,7 +8,6 @@
#include "view.h" #include "view.h"
// local // local
#include "contextmenu.h"
#include "effects.h" #include "effects.h"
#include "positioner.h" #include "positioner.h"
#include "visibilitymanager.h" #include "visibilitymanager.h"
@ -67,7 +66,6 @@ namespace Latte {
//! are needed in order for window flags to be set correctly //! are needed in order for window flags to be set correctly
View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM) View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM)
: PlasmaQuick::ContainmentView(corona), : PlasmaQuick::ContainmentView(corona),
m_contextMenu(new ViewPart::ContextMenu(this)),
m_effects(new ViewPart::Effects(this)), m_effects(new ViewPart::Effects(this)),
m_interface(new ViewPart::ContainmentInterface(this)), m_interface(new ViewPart::ContainmentInterface(this)),
m_parabolic(new ViewPart::Parabolic(this)), m_parabolic(new ViewPart::Parabolic(this)),
@ -120,7 +118,6 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassX11WM)
m_releaseGrabTimer.setSingleShot(true); m_releaseGrabTimer.setSingleShot(true);
connect(&m_releaseGrabTimer, &QTimer::timeout, this, &View::releaseGrab); connect(&m_releaseGrabTimer, &QTimer::timeout, this, &View::releaseGrab);
connect(m_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::updateTransientWindowsTracking);
connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::updateTransientWindowsTracking); connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::updateTransientWindowsTracking);
connect(this, &View::containmentChanged, this, &View::groupIdChanged); connect(this, &View::containmentChanged, this, &View::groupIdChanged);
@ -251,10 +248,6 @@ View::~View()
delete m_appletConfigView; delete m_appletConfigView;
} }
if (m_contextMenu) {
delete m_contextMenu;
}
//needs to be deleted before Effects because it catches some of its signals //needs to be deleted before Effects because it catches some of its signals
if (m_positioner) { if (m_positioner) {
delete m_positioner; delete m_positioner;
@ -1443,11 +1436,6 @@ ViewPart::Indicator *View::indicator() const
return m_indicator; return m_indicator;
} }
ViewPart::ContextMenu *View::contextMenu() const
{
return m_contextMenu;
}
ViewPart::ContainmentInterface *View::extendedInterface() const ViewPart::ContainmentInterface *View::extendedInterface() const
{ {
return m_interface; return m_interface;
@ -1721,13 +1709,6 @@ void View::verticalUnityViewHasFocus()
//!BEGIN overriding context menus behavior //!BEGIN overriding context menus behavior
void View::mousePressEvent(QMouseEvent *event) void View::mousePressEvent(QMouseEvent *event)
{ {
//bool result = m_contextMenu->mousePressEvent(event);
//if (result) {
// PlasmaQuick::ContainmentView::mousePressEvent(event);
//updateTransientWindowsTracking();
//}
PlasmaQuick::ContainmentView::mousePressEvent(event); PlasmaQuick::ContainmentView::mousePressEvent(event);
verticalUnityViewHasFocus(); verticalUnityViewHasFocus();
} }

@ -58,10 +58,6 @@ namespace Latte {
class Corona; class Corona;
class Interfaces; class Interfaces;
class GenericLayout; class GenericLayout;
namespace ViewPart {
class ContextMenu;
}
} }
namespace Latte { namespace Latte {
@ -241,7 +237,6 @@ public:
virtual Latte::Data::View data() const; virtual Latte::Data::View data() const;
ViewPart::Effects *effects() const; ViewPart::Effects *effects() const;
ViewPart::ContextMenu *contextMenu() const;
ViewPart::ContainmentInterface *extendedInterface() const; ViewPart::ContainmentInterface *extendedInterface() const;
virtual ViewPart::Indicator *indicator() const; virtual ViewPart::Indicator *indicator() const;
ViewPart::Parabolic *parabolic() const; ViewPart::Parabolic *parabolic() const;
@ -448,7 +443,6 @@ private:
QPointer<PlasmaQuick::ConfigView> m_appletConfigView; QPointer<PlasmaQuick::ConfigView> m_appletConfigView;
QPointer<ViewPart::PrimaryConfigView> m_primaryConfigView; QPointer<ViewPart::PrimaryConfigView> m_primaryConfigView;
QPointer<ViewPart::ContextMenu> m_contextMenu;
QPointer<ViewPart::Effects> m_effects; QPointer<ViewPart::Effects> m_effects;
QPointer<ViewPart::Indicator> m_indicator; QPointer<ViewPart::Indicator> m_indicator;
QPointer<ViewPart::ContainmentInterface> m_interface; QPointer<ViewPart::ContainmentInterface> m_interface;

@ -9,6 +9,7 @@ import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.latte.private.app 0.1 as LatteApp
import org.kde.latte.core 0.2 as LatteCore import org.kde.latte.core 0.2 as LatteCore
import org.kde.latte.private.containment 0.1 as LatteContainment import org.kde.latte.private.containment 0.1 as LatteContainment
@ -82,6 +83,12 @@ Loader {
} }
} }
LatteApp.ContextMenuLayer {
id: contextMenuLayer
anchors.fill: parent
view: latteView
}
MouseArea { MouseArea {
id: editBackMouseArea id: editBackMouseArea
anchors.fill: imageTiler anchors.fill: imageTiler

Loading…
Cancel
Save