diff options
Diffstat (limited to 'lumina-desktop')
19 files changed, 159 insertions, 91 deletions
diff --git a/lumina-desktop/AppMenu.cpp b/lumina-desktop/AppMenu.cpp index 6c24d632..507f8f06 100644 --- a/lumina-desktop/AppMenu.cpp +++ b/lumina-desktop/AppMenu.cpp @@ -16,6 +16,7 @@ AppMenu::AppMenu(QWidget* parent) : QMenu(parent){ connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherUpdate()) ); //QTimer::singleShot(200, this, SLOT(start()) ); //Now start filling the menu start(); //do the initial run during session init so things are responsive immediately. + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(watcherUpdate()) ); } AppMenu::~AppMenu(){ @@ -30,6 +31,10 @@ QHash<QString, QList<XDGDesktop> >* AppMenu::currentAppHash(){ // PRIVATE //=========== void AppMenu::updateAppList(){ + //Make sure the title/icon are updated as well (in case of locale/icon change) + this->setTitle(tr("Applications")); + this->setIcon( LXDG::findIcon("system-run","") ); + //Now update the lists this->clear(); APPS.clear(); QList<XDGDesktop> allfiles = LXDG::systemDesktopFiles(); @@ -91,8 +96,6 @@ void AppMenu::updateAppList(){ // PRIVATE SLOTS //================= void AppMenu::start(){ - this->setTitle(tr("Applications")); - this->setIcon( LXDG::findIcon("system-run","") ); //Setup the watcher watcher->addPaths(LXDG::systemApplicationDirs()); //Now fill the menu the first time diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 7b21b862..9a8c2a6b 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -282,11 +282,10 @@ void LDesktop::InitDesktop(){ bgtimer = new QTimer(this); bgtimer->setSingleShot(true); connect(bgtimer, SIGNAL(timeout()), this, SLOT(UpdateBackground()) ); - //watcher = new QFileSystemWatcher(this); + connect(QApplication::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) ); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) ); - //watcher->addPath(settings->fileName()); - //connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(SettingsChanged()) ); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) ); if(DEBUG){ qDebug() << "Create bgWindow"; } bgWindow = new QWidget(); @@ -322,6 +321,13 @@ void LDesktop::SettingsChanged(){ QTimer::singleShot(100, this, SLOT(UnlockSettings()) ); //give it a few moments to settle before performing another sync } +void LDesktop::LocaleChanged(){ + //Update any elements which require a re-translation + UpdateMenu(false); //do the full menu refresh + + +} + void LDesktop::UpdateMenu(bool fast){ if(DEBUG){ qDebug() << " - Update Menu:" << desktopnumber; } //Put a label at the top diff --git a/lumina-desktop/LDesktop.h b/lumina-desktop/LDesktop.h index e454d03b..c602b3f2 100644 --- a/lumina-desktop/LDesktop.h +++ b/lumina-desktop/LDesktop.h @@ -81,6 +81,8 @@ private slots: void InitDesktop(); void SettingsChanged(); void UnlockSettings(){ issyncing=false; } + void LocaleChanged(); + //Menu functions void UpdateMenu(bool fast = false); void ShowMenu(){ diff --git a/lumina-desktop/SettingsMenu.cpp b/lumina-desktop/SettingsMenu.cpp index 078739a6..f9a2fa13 100644 --- a/lumina-desktop/SettingsMenu.cpp +++ b/lumina-desktop/SettingsMenu.cpp @@ -10,17 +10,21 @@ #include <LuminaOS.h> SettingsMenu::SettingsMenu() : QMenu(){ - QTimer::singleShot(100, this, SLOT(InitMenu()) ); + connect(this, SIGNAL(triggered(QAction*)), this, SLOT(runApp(QAction*)) ); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(UpdateMenu()) ); + + QTimer::singleShot(100, this, SLOT(UpdateMenu()) ); } SettingsMenu::~SettingsMenu(){ } -void SettingsMenu::InitMenu(){ +void SettingsMenu::UpdateMenu(){ + //Change the title/icon to account for locale/icon changes this->setTitle( tr("Settings") ); this->setIcon( LXDG::findIcon("configure","") ); - connect(this, SIGNAL(triggered(QAction*)), this, SLOT(runApp(QAction*)) ); + this->clear(); //Now setup the possible configuration options QAction *act = new QAction(LXDG::findIcon("preferences-desktop-screensaver",""), tr("Screensaver"), this); act->setWhatsThis("xscreensaver-demo"); @@ -54,6 +58,7 @@ void SettingsMenu::InitMenu(){ this->addAction(act); } + void SettingsMenu::runApp(QAction* act){ LSession::LaunchApplication(act->whatsThis()); } diff --git a/lumina-desktop/SettingsMenu.h b/lumina-desktop/SettingsMenu.h index 9d2d905d..eeabab85 100644 --- a/lumina-desktop/SettingsMenu.h +++ b/lumina-desktop/SettingsMenu.h @@ -20,7 +20,7 @@ public: ~SettingsMenu(); private slots: - void InitMenu(); + void UpdateMenu(); void runApp(QAction* act); }; diff --git a/lumina-desktop/SystemWindow.cpp b/lumina-desktop/SystemWindow.cpp index 18e65291..54e240c1 100644 --- a/lumina-desktop/SystemWindow.cpp +++ b/lumina-desktop/SystemWindow.cpp @@ -30,6 +30,7 @@ SystemWindow::SystemWindow() : QDialog(), ui(new Ui::SystemWindow){ //Disable buttons if necessary updateWindow(); ui->tool_suspend->setVisible(LOS::systemCanSuspend()); //does not change with time - just do a single check + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(updateWindow()) ); } SystemWindow::~SystemWindow(){ @@ -38,6 +39,7 @@ SystemWindow::~SystemWindow(){ void SystemWindow::updateWindow(){ //Disable the shutdown/restart buttons if necessary + ui->retranslateUi(this); bool ok = LOS::userHasShutdownAccess(); ui->tool_restart->setEnabled(ok); ui->tool_shutdown->setEnabled(ok); diff --git a/lumina-desktop/SystemWindow.h b/lumina-desktop/SystemWindow.h index bf7a6b94..a5130405 100644 --- a/lumina-desktop/SystemWindow.h +++ b/lumina-desktop/SystemWindow.h @@ -26,6 +26,7 @@ public: SystemWindow(); ~SystemWindow(); +public slots: void updateWindow(); private: diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp index ebed6d90..e60014d4 100644 --- a/lumina-desktop/desktop-plugins/LDPlugin.cpp +++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp @@ -15,6 +15,7 @@ LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){ settings = LSession::handle()->DesktopPluginSettings(); //Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...) this->setObjectName(id.section("---",0,0).section("::",0,0)); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); } void LDPlugin::setInitialSize(int width, int height){ diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h index f9f60c0b..9eefebf1 100644 --- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h +++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.h @@ -42,6 +42,10 @@ private slots: void increaseIconSize(); void decreaseIconSize(); void deleteFile(); - + +public slots: + void LocaleChange(){ + loadButton(true); //force reload + } }; #endif diff --git a/lumina-desktop/panel-plugins/LPPlugin.h b/lumina-desktop/panel-plugins/LPPlugin.h index dd869bf6..8d1c0024 100644 --- a/lumina-desktop/panel-plugins/LPPlugin.h +++ b/lumina-desktop/panel-plugins/LPPlugin.h @@ -15,6 +15,7 @@ #include <QWidget> #include <QString> #include <QBoxLayout> +#include <QApplication> class LPPlugin : public QWidget{ Q_OBJECT @@ -34,6 +35,7 @@ public: LY->setContentsMargins(0,0,0,0); LY->setSpacing(1); this->setLayout(LY); + connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) ); } ~LPPlugin(){ diff --git a/lumina-desktop/panel-plugins/battery/LBattery.h b/lumina-desktop/panel-plugins/battery/LBattery.h index a4586b37..3d31faad 100644 --- a/lumina-desktop/panel-plugins/battery/LBattery.h +++ b/lumina-desktop/panel-plugins/battery/LBattery.h @@ -36,6 +36,10 @@ private slots: QString getRemainingTime(); public slots: + void LocaleChange(){ + updateBattery(true); + } + void OrientationChange(){ if(this->layout()->direction()==QBoxLayout::LeftToRight){ label->setFixedSize( QSize(this->height(), this->height()) ); diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp index 71eaa8c4..d95ae2f5 100644 --- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp +++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.cpp @@ -53,9 +53,7 @@ LDeskBarPlugin::~LDeskBarPlugin(){ void LDeskBarPlugin::initializeDesktop(){ //Applications on the desktop appB = new QToolButton(this); - appB->setIcon( LXDG::findIcon("favorites", "") ); appB->setToolButtonStyle(Qt::ToolButtonIconOnly); - appB->setToolTip(tr("Favorite Applications")); appB->setAutoRaise(true); appB->setPopupMode(QToolButton::InstantPopup); appM = new QMenu(this); @@ -64,9 +62,7 @@ void LDeskBarPlugin::initializeDesktop(){ connect(appM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); //Directories on the desktop dirB = new QToolButton(this); - dirB->setIcon( LXDG::findIcon("folder", "") ); dirB->setToolButtonStyle(Qt::ToolButtonIconOnly); - dirB->setToolTip(tr("Favorite Folders")); dirB->setAutoRaise(true); dirB->setPopupMode(QToolButton::InstantPopup); dirM = new QMenu(this); @@ -74,34 +70,29 @@ void LDeskBarPlugin::initializeDesktop(){ this->layout()->addWidget(dirB); connect(dirM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); //Audio Files on the desktop - audioM = new QMenu(tr("Audio"), this); + audioM = new QMenu(this); connect(audioM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - audioM->setIcon( LXDG::findIcon("audio-x-generic","") ); //Video Files on the desktop - videoM = new QMenu(tr("Video"), this); + videoM = new QMenu(this); connect(videoM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - videoM->setIcon( LXDG::findIcon("video-x-generic","") ); //Picture Files on the desktop - pictureM = new QMenu(tr("Pictures"), this); + pictureM = new QMenu(this); connect(pictureM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - pictureM->setIcon( LXDG::findIcon("image-x-generic","") ); //Other Files on the desktop - otherM = new QMenu(tr("Other Files"), this); + otherM = new QMenu(this); connect(otherM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) ); - otherM->setIcon( LXDG::findIcon("unknown","") ); - docM = new QMenu(tr("Documents"), this); + docM = new QMenu(this); connect(docM,SIGNAL(triggered(QAction*)), this,SLOT(ActionTriggered(QAction*)) ); - docM->setIcon( LXDG::findIcon("x-office-document","") ); //All Files Button fileB = new QToolButton(this); - fileB->setIcon( LXDG::findIcon("document-multiple", "") ); fileB->setToolButtonStyle(Qt::ToolButtonIconOnly); - fileB->setToolTip(tr("Favorite Files") ); fileB->setAutoRaise(true); fileB->setPopupMode(QToolButton::InstantPopup); fileM = new QMenu(this); fileB->setMenu(fileM); this->layout()->addWidget(fileB); + + updateIcons(); //set all the text/icons } QAction* LDeskBarPlugin::newAction(QString filepath, QString name, QString iconpath){ @@ -231,3 +222,22 @@ void LDeskBarPlugin::desktopChanged(){ fileB->setVisible( !fileM->isEmpty() ); } +void LDeskBarPlugin::updateIcons(){ + //Set all the text/icons + appB->setIcon( LXDG::findIcon("favorites", "") ); + appB->setToolTip(tr("Favorite Applications")); + dirB->setIcon( LXDG::findIcon("folder", "") ); + dirB->setToolTip(tr("Favorite Folders")); + audioM->setTitle( tr("Audio") ); + audioM->setIcon( LXDG::findIcon("audio-x-generic","") ); + videoM->setTitle( tr("Video") ); + videoM->setIcon( LXDG::findIcon("video-x-generic","") ); + pictureM->setTitle( tr("Pictures") ); + pictureM->setIcon( LXDG::findIcon("image-x-generic","") ); + otherM->setTitle( tr("Other Files") ); + otherM->setIcon( LXDG::findIcon("unknown","") ); + docM->setTitle( tr("Documents") ); + docM->setIcon( LXDG::findIcon("x-office-document","") ); + fileB->setIcon( LXDG::findIcon("document-multiple", "") ); + fileB->setToolTip(tr("Favorite Files") ); +}
\ No newline at end of file diff --git a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h index 8e624dc2..57d40e4c 100644 --- a/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h +++ b/lumina-desktop/panel-plugins/desktopbar/LDeskBar.h @@ -61,8 +61,14 @@ private: private slots: void ActionTriggered(QAction* act); void desktopChanged(); - + void updateIcons(); + public slots: + void LocaleChange(){ + updateIcons(); + desktopChanged(); + } + void OrientationChange(){ QSize sz; if(this->layout()->direction()==QBoxLayout::LeftToRight){ diff --git a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h index bd23d8e9..5dd5a785 100644 --- a/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h +++ b/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h @@ -50,6 +50,10 @@ private slots: void menuActionTriggered(QAction*); public slots: + void LocaleChange(){ + createMenu(); + } + void OrientationChange(){ QSize sz; if(this->layout()->direction()==QBoxLayout::LeftToRight){ diff --git a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h index 9f1c5d18..7910f452 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h +++ b/lumina-desktop/panel-plugins/systemdashboard/LSysDashboard.h @@ -50,6 +50,11 @@ private slots: void closeMenu(); public slots: + void LocaleChange(){ + updateIcon(true); + sysmenu->UpdateMenu(); + } + void OrientationChange(){ if(this->layout()->direction()==QBoxLayout::LeftToRight){ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); diff --git a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp index 0e5867c2..c45687cd 100644 --- a/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ b/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp @@ -40,6 +40,7 @@ LSysMenuQuick::~LSysMenuQuick(){ } void LSysMenuQuick::UpdateMenu(){ + ui->retranslateUi(this); //Audio Volume int val = LOS::audioVolume(); QIcon ico; diff --git a/lumina-desktop/panel-plugins/userbutton/LUserButton.h b/lumina-desktop/panel-plugins/userbutton/LUserButton.h index fd87fe5e..31bafa78 100644 --- a/lumina-desktop/panel-plugins/userbutton/LUserButton.h +++ b/lumina-desktop/panel-plugins/userbutton/LUserButton.h @@ -62,6 +62,7 @@ public slots: void LocaleChange(){ updateButtonVisuals(); + usermenu->UpdateAll(); } void ThemeChange(){ diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index 1ea1a864..92f6178b 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -14,29 +14,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid if(parent!=0){ parent->setMouseTracking(true); } this->setMouseTracking(true); sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info - //Setup the Icons - // - favorites tab - this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) ); - this->setTabText(0,""); - // - apps tab - this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); - this->setTabText(1,""); - // - home tab - this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); - this->setTabText(2,""); - // - config tab - this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); - this->setTabText(3,""); - ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); - ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); - ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") ); - ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); - ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); - ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); - ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); - ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); - ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); + //Connect the signals/slots connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) ); connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) ); @@ -51,46 +29,15 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid connect(ui->tool_config_about, SIGNAL(clicked()), this, SLOT(openLuminaInfo()) ); //Setup the special buttons - QString APPSTORE = LOS::AppStoreShortcut(); - if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ - //Now load the info - bool ok = false; - XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok); - if(ok){ - ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); - ui->tool_app_store->setText( store.name ); - connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); - } - ui->tool_app_store->setVisible(ok); //availability - }else{ - ui->tool_app_store->setVisible(false); //not available - } - QString CONTROLPANEL = LOS::ControlPanelShortcut(); - if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ - //Now load the info - bool ok = false; - XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok); - if(ok){ - ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); - connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); - } - ui->tool_controlpanel->setVisible(ok); //availability - }else{ - ui->tool_controlpanel->setVisible(false); //not available - } - QString QTCONFIG = LOS::QtConfigShortcut(); - if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){ - ui->tool_qtconfig->setVisible(true); - ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); - connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); - }else{ - ui->tool_qtconfig->setVisible(false); - } + connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); + connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); + connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); + lastUpdate = QDateTime(); //make sure it refreshes connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu()) ); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFavItems()) ); - QTimer::singleShot(10,this, SLOT(UpdateMenu())); //make sure to load this once after initialization + QTimer::singleShot(10,this, SLOT(UpdateAll())); //make sure to load this once after initialization } UserWidget::~UserWidget(){ @@ -152,7 +99,70 @@ QIcon UserWidget::rotateIcon(QIcon ico){ //============ // PRIVATE SLOTS //============ -void UserWidget::UpdateMenu(){ +void UserWidget::UpdateAll(){ + ui->retranslateUi(this); + //Setup the Icons + // - favorites tab + this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) ); + this->setTabText(0,""); + // - apps tab + this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) ); + this->setTabText(1,""); + // - home tab + this->setTabIcon(2, rotateIcon(LXDG::findIcon("user-home","")) ); + this->setTabText(2,""); + // - config tab + this->setTabIcon(3, rotateIcon(LXDG::findIcon("preferences-system","")) ); + this->setTabText(3,""); + ui->tool_fav_apps->setIcon( LXDG::findIcon("system-run","") ); + ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); + ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); + ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") ); + ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); + ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); + ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); + ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); + ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); + ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); + + //Setup the special buttons + QString APPSTORE = LOS::AppStoreShortcut(); + if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ + //Now load the info + bool ok = false; + XDGDesktop store = LXDG::loadDesktopFile(APPSTORE, ok); + if(ok){ + ui->tool_app_store->setIcon( LXDG::findIcon(store.icon, "") ); + ui->tool_app_store->setText( store.name ); + } + ui->tool_app_store->setVisible(ok); //availability + }else{ + ui->tool_app_store->setVisible(false); //not available + } + QString CONTROLPANEL = LOS::ControlPanelShortcut(); + if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){ + //Now load the info + bool ok = false; + XDGDesktop cpan = LXDG::loadDesktopFile(CONTROLPANEL, ok); + if(ok){ + ui->tool_controlpanel->setIcon( LXDG::findIcon(cpan.icon, "") ); + } + ui->tool_controlpanel->setVisible(ok); //availability + }else{ + ui->tool_controlpanel->setVisible(false); //not available + } + QString QTCONFIG = LOS::QtConfigShortcut(); + if(QFile::exists(QTCONFIG) && !QTCONFIG.isEmpty()){ + ui->tool_qtconfig->setVisible(true); + ui->tool_qtconfig->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); + }else{ + ui->tool_qtconfig->setVisible(false); + } + //Now update the menus + UpdateMenu(); +} + +void UserWidget::UpdateMenu(bool forceall){ this->setCurrentWidget(ui->tab_fav); ui->tool_fav_apps->setChecked(true); ui->tool_fav_dirs->setChecked(false); @@ -160,15 +170,15 @@ void UserWidget::UpdateMenu(){ cfav = 0; //favorite apps updateFavItems(); QString cdir = ui->label_home_dir->whatsThis(); - if(cdir.isEmpty() || !QFile::exists(cdir) ){ + if(cdir.isEmpty() || !QFile::exists(cdir)){ //Directory deleted or nothing loaded yet ui->label_home_dir->setWhatsThis(QDir::homePath()); QTimer::singleShot(0,this, SLOT(updateHome()) ); - }else if( lastUpdate < QFileInfo(cdir).lastModified() ){ + }else if( lastUpdate < QFileInfo(cdir).lastModified() || forceall){ //Directory contents changed - reload it QTimer::singleShot(0,this, SLOT(updateHome()) ); } - if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull()){ + if(lastUpdate < LSession::handle()->applicationMenu()->lastHashUpdate || lastUpdate.isNull() || forceall){ updateAppCategories(); QTimer::singleShot(0,this, SLOT(updateApps()) ); } diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h index c2df10bf..6d01e940 100644 --- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -37,7 +37,8 @@ public: ~UserWidget(); public slots: - void UpdateMenu(); + void UpdateAll(); //for re-translation/icon changes + void UpdateMenu(bool forceall = false); //for item changes private: Ui::UserWidget *ui; |