Changeset View
Changeset View
Standalone View
Standalone View
src/scriptengines/qml/plasmoid/appletinterface.cpp
Show First 20 Lines • Show All 778 Lines • ▼ Show 20 Line(s) | 728 | if (event->type() == QEvent::KeyPress) { | |||
---|---|---|---|---|---|
779 | if (!keySequenceUsed) { | 779 | if (!keySequenceUsed) { | ||
780 | m_oldKeyboardShortcut = 0; | 780 | m_oldKeyboardShortcut = 0; | ||
781 | } | 781 | } | ||
782 | } | 782 | } | ||
783 | 783 | | |||
784 | return AppletQuickItem::event(event); | 784 | return AppletQuickItem::event(event); | ||
785 | } | 785 | } | ||
786 | 786 | | |||
787 | void AppletInterface::prepareContextualActions() | ||||
788 | { | ||||
789 | emit applet()->contextualActionsAboutToShow(); | ||||
790 | } | ||||
791 | | ||||
787 | bool AppletInterface::eventFilter(QObject *watched, QEvent *event) | 792 | bool AppletInterface::eventFilter(QObject *watched, QEvent *event) | ||
788 | { | 793 | { | ||
789 | if (event->type() == QEvent::MouseButtonPress) { | 794 | if (event->type() == QEvent::MouseButtonPress) { | ||
790 | QMouseEvent *e = static_cast<QMouseEvent *>(event); | 795 | QMouseEvent *e = static_cast<QMouseEvent *>(event); | ||
791 | 796 | | |||
792 | //pass it up to the applet | 797 | //pass it up to the applet | ||
793 | //well, actually we have to pass it to the *containment* | 798 | //well, actually we have to pass it to the *containment* | ||
794 | //because all the code for showing an applet's contextmenu is actually in Containment. | 799 | //because all the code for showing an applet's contextmenu is actually in Containment. | ||
Show All 25 Lines | 816 | if (plugin->contextualActions().length() == 1) { | |||
820 | action->trigger(); | 825 | action->trigger(); | ||
821 | return true; | 826 | return true; | ||
822 | } | 827 | } | ||
823 | 828 | | |||
824 | QMenu *desktopMenu = new QMenu; | 829 | QMenu *desktopMenu = new QMenu; | ||
825 | if (desktopMenu->winId()) { | 830 | if (desktopMenu->winId()) { | ||
826 | desktopMenu->windowHandle()->setTransientParent(window()); | 831 | desktopMenu->windowHandle()->setTransientParent(window()); | ||
827 | } | 832 | } | ||
828 | emit applet()->contextualActionsAboutToShow(); | 833 | prepareContextualActions(); | ||
829 | ci->addAppletActions(desktopMenu, applet(), event); | 834 | ci->addAppletActions(desktopMenu, applet(), event); | ||
830 | 835 | | |||
831 | if (!desktopMenu->isEmpty()) { | 836 | if (!desktopMenu->isEmpty()) { | ||
832 | desktopMenu->setAttribute(Qt::WA_DeleteOnClose); | 837 | desktopMenu->setAttribute(Qt::WA_DeleteOnClose); | ||
833 | desktopMenu->popup(e->globalPos()); | 838 | desktopMenu->popup(e->globalPos()); | ||
834 | return true; | 839 | return true; | ||
835 | } | 840 | } | ||
836 | 841 | | |||
Show All 10 Lines |