aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2017-03-10 14:07:35 -0500
committerKen Moore <ken@ixsystems.com>2017-03-10 14:07:35 -0500
commit2462587f45be033249cf8e036fd6a4dff91c744f (patch)
tree5a97657fa19f61af179f170660664eac625d5fca /src-qt5
parentadd alarm panel-plugin (diff)
downloadlumina-2462587f45be033249cf8e036fd6a4dff91c744f.tar.gz
lumina-2462587f45be033249cf8e036fd6a4dff91c744f.tar.bz2
lumina-2462587f45be033249cf8e036fd6a4dff91c744f.zip
Fix up the context menu policies for the notepad desktop plugin.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp16
-rw-r--r--src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h4
2 files changed, 18 insertions, 2 deletions
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index 6d321305..479cc23e 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -60,7 +60,9 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID)
edit->setReadOnly(false);
edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
vlay->addWidget(edit);
- edit->setContextMenuPolicy(Qt::NoContextMenu);
+ edit->setContextMenuPolicy(Qt::CustomContextMenu); //Need to forward the context menu request to the plugin itself
+ connect(edit, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT( showContextMenuForEdit(const QPoint&)) );
+
//Now load the new file-based system for saving notes
//qDebug() << "Saving a new setting";
@@ -328,3 +330,15 @@ void NotePadPlugin::loadIcons(){
rem->setIcon( LXDG::findIcon("document-close","") );*/
config->setIcon( LXDG::findIcon("configure","") );
}
+
+void NotePadPlugin::showContextMenuForEdit(const QPoint &pos){
+ this->setContextMenu( edit->createStandardContextMenu(pos) );
+ connect(this->contextMenu(), SIGNAL(aboutToHide()), this, SLOT(resetContextMenu()) );
+ this->showPluginMenu();
+}
+
+void NotePadPlugin::resetContextMenu(){
+ QMenu *menu = this->contextMenu();
+ this->setContextMenu(0);
+ menu->deleteLater();
+}
diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
index 5084dadf..2994cb97 100644
--- a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
+++ b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.h
@@ -29,7 +29,7 @@ public:
}
private:
QPlainTextEdit *edit;
- QToolButton *config; //*open, *add, *rem;
+ QToolButton *config; // *open, *add, *rem;
QComboBox *cnote;
QFrame *frame;
QFileSystemWatcher *watcher;
@@ -53,6 +53,8 @@ private slots:
void noteChanged();
void loadIcons();
+ void showContextMenuForEdit(const QPoint &pos);
+ void resetContextMenu();
public slots:
void LocaleChange(){
bgstack15