From fcfd54ecadd459b6a055688ad84c28a211f7d439 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 8 Oct 2015 13:51:32 -0400 Subject: Update the new ResizeMenu and startmenu a bit: Now it better performes resizing and the startmenu savees it's size between sessions. --- .../panel-plugins/systemstart/LStartButton.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lumina-desktop/panel-plugins/systemstart/LStartButton.cpp') diff --git a/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp index 3e644803..cf37cf88 100644 --- a/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp +++ b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp @@ -8,7 +8,7 @@ #include "../../LSession.h" #include -#include +#include //This contains the "ResizeMenu" class LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){ button = new QToolButton(this); @@ -21,14 +21,14 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon menu = new ResizeMenu(this); menu->setContentsMargins(1,1,1,1); connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed())); + connect(menu, SIGNAL(MenuResized(QSize)), this, SLOT(SaveMenuSize(QSize)) ); startmenu = new StartMenu(this); connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) ); connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList))); menu->setContents(startmenu); - /*mact = new QWidgetAction(this); - mact->setDefaultWidget(startmenu); - menu->addAction(mact);*/ - + QSize saved = LSession::handle()->DesktopPluginSettings()->value("panelPlugs/"+this->type()+"/MenuSize", QSize(0,0)).toSize(); + if(!saved.isNull()){ startmenu->setFixedSize(saved); } //re-load the previously saved value + button->setMenu(menu); connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) ); QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes @@ -100,10 +100,16 @@ void LStartButtonPlugin::RemoveQuick(QString file){ } } +void LStartButtonPlugin::SaveMenuSize(QSize sz){ + //Save this size for the menu + LSession::handle()->DesktopPluginSettings()->setValue("panelPlugs/"+this->type()+"/MenuSize", sz); +} + // ======================== // PRIVATE FUNCTIONS // ======================== void LStartButtonPlugin::openMenu(){ + if(menu->isVisible()){ return; } //don't re-show it - already open startmenu->UpdateMenu(); button->showMenu(); } -- cgit