diff options
Diffstat (limited to 'lumina-desktop/panel-plugins/userbutton')
3 files changed, 22 insertions, 4 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/LUserButton.h b/lumina-desktop/panel-plugins/userbutton/LUserButton.h index 31bafa78..c5612e15 100644 --- a/lumina-desktop/panel-plugins/userbutton/LUserButton.h +++ b/lumina-desktop/panel-plugins/userbutton/LUserButton.h @@ -67,6 +67,7 @@ public slots: void ThemeChange(){ updateButtonVisuals(); + usermenu->UpdateAll(); } }; diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 76a0b4cf..f0d87611 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -66,6 +66,10 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){ createWidget(); + menuopen = false; + menureset = new QTimer(this); + menureset->setSingleShot(true); + menureset->setInterval(1000); //1 second isDirectory = false; if(LUtils::isFavorite(item.filePath)){ linkPath = item.filePath; @@ -108,8 +112,8 @@ void UserItemWidget::createWidget(){ //Add them to the layout this->setLayout(new QHBoxLayout()); this->layout()->setContentsMargins(1,1,1,1); - this->layout()->addWidget(actButton); this->layout()->addWidget(icon); + this->layout()->addWidget(actButton); this->layout()->addWidget(name); this->layout()->addWidget(button); //Set a custom object name so this can be tied into the Lumina Theme stylesheets @@ -159,6 +163,8 @@ void UserItemWidget::setupActions(XDGDesktop app){ actButton->menu()->addAction(act); } connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); + connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); + connect(actButton->menu(), SIGNAL(aboutToHide()), this, SLOT(actionMenuClosed()) ); } void UserItemWidget::buttonClicked(){ diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h index b3c5aea7..6d73401d 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.h @@ -19,7 +19,8 @@ #include <QFile> #include <QMouseEvent> #include <QAction> - +#include <QMenu> +#include <QTimer> #include <LuminaXDG.h> @@ -33,8 +34,9 @@ public: private: QToolButton *button, *actButton; QLabel *icon, *name; - bool isDirectory, isShortcut; + bool isDirectory, isShortcut, menuopen; QString linkPath; + QTimer *menureset; void createWidget(); void setupButton(bool disable = false); @@ -44,10 +46,19 @@ private slots: void buttonClicked(); void ItemClicked(); void actionClicked(QAction*); + //Functions to fix the submenu open/close issues + void actionMenuOpen(){ + menuopen = true; + if(menureset->isActive()){ menureset->stop(); } + } + void resetmenuflag(){ menuopen = false; } //tied to the "menureset" timer + void actionMenuClosed(){ menureset->start(); } + protected: void mouseReleaseEvent(QMouseEvent *event){ - if(event->button() != Qt::NoButton){ ItemClicked(); } + if(menuopen){ resetmenuflag(); } //skip this event if a submenu was open + else if(event->button() != Qt::NoButton){ ItemClicked(); } } signals: |