aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp18
-rw-r--r--lumina-desktop/panel-plugins/systemstart/ItemWidget.h4
-rw-r--r--lumina-desktop/panel-plugins/systemstart/LStartButton.cpp51
-rw-r--r--lumina-desktop/panel-plugins/systemstart/LStartButton.h6
-rw-r--r--lumina-desktop/panel-plugins/systemstart/StartMenu.cpp18
-rw-r--r--lumina-desktop/panel-plugins/systemstart/StartMenu.h5
-rw-r--r--lumina-desktop/panel-plugins/systemtray/LSysTray.cpp4
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp6
8 files changed, 106 insertions, 6 deletions
diff --git a/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp b/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
index 94c7bfc6..6127bfc9 100644
--- a/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/systemstart/ItemWidget.cpp
@@ -7,6 +7,7 @@
#include "ItemWidget.h"
#include <LuminaUtils.h>
#include <QMenu>
+#include "../../LSession.h"
#define TEXTCUTOFF 165
ItemWidget::ItemWidget(QWidget *parent, QString itemPath, QString type, bool goback) : QFrame(parent){
@@ -93,7 +94,6 @@ ItemWidget::ItemWidget(QWidget *parent, XDGDesktop item) : QFrame(parent){
ItemWidget::~ItemWidget(){
}
-
void ItemWidget::createWidget(){
//Initialize the widgets
gooditem = true;
@@ -139,6 +139,13 @@ void ItemWidget::setupContextMenu(){
//This file does not have a shortcut yet -- allow the user to add it
contextMenu->addAction( LXDG::findIcon("bookmark-toolbar",""), tr("Add to Favorites"), this, SLOT(AddFavorite()) );
}
+ //QuickLaunch Item
+ if(LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList().contains(icon->whatsThis()) ){ //Favorite Item - can always remove this
+ contextMenu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove from Quicklaunch"), this, SLOT(RemoveQL()) );
+ }else{
+ //This file does not have a shortcut yet -- allow the user to add it
+ contextMenu->addAction( LXDG::findIcon("quickopen",""), tr("Add to Quicklaunch"), this, SLOT(AddQL()) );
+ }
}
void ItemWidget::setupActions(XDGDesktop app){
@@ -176,6 +183,15 @@ void ItemWidget::AddFavorite(){
}
}
+void ItemWidget::RemoveQL(){
+ qDebug() << "Remove QuickLaunch Button:" << icon->whatsThis();
+ emit toggleQuickLaunch(icon->whatsThis(), false);
+}
+
+void ItemWidget::AddQL(){
+ qDebug() << "Add QuickLaunch Button:" << icon->whatsThis();
+ emit toggleQuickLaunch(icon->whatsThis(), true);
+}
void ItemWidget::ItemClicked(){
diff --git a/lumina-desktop/panel-plugins/systemstart/ItemWidget.h b/lumina-desktop/panel-plugins/systemstart/ItemWidget.h
index 6aa8b037..6f64c7fb 100644
--- a/lumina-desktop/panel-plugins/systemstart/ItemWidget.h
+++ b/lumina-desktop/panel-plugins/systemstart/ItemWidget.h
@@ -32,6 +32,7 @@ public:
~ItemWidget();
bool gooditem;
+
private:
QToolButton *actButton;
QMenu *contextMenu;
@@ -49,6 +50,8 @@ private slots:
void PinToDesktop();
void RemoveFavorite();
void AddFavorite();
+ void RemoveQL();
+ void AddQL();
void ItemClicked();
void actionClicked(QAction*);
//Functions to fix the submenu open/close issues
@@ -74,6 +77,7 @@ signals:
void NewShortcut();
void RemovedShortcut();
void RunItem(QString cmd);
+ void toggleQuickLaunch(QString path, bool ok);
};
diff --git a/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
index 673c04ec..d578e3b5 100644
--- a/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
+++ b/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -7,6 +7,8 @@
#include "LStartButton.h"
#include "../../LSession.h"
+#include <LuminaXDG.h>
+
LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
button = new QToolButton(this);
button->setAutoRaise(true);
@@ -20,6 +22,7 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon
connect(menu, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
startmenu = new StartMenu(this);
connect(startmenu, SIGNAL(CloseMenu()), this, SLOT(closeMenu()) );
+ connect(startmenu, SIGNAL(UpdateQuickLaunch(QStringList)), this, SLOT(updateQuickLaunch(QStringList)));
mact = new QWidgetAction(this);
mact->setDefaultWidget(startmenu);
menu->addAction(mact);
@@ -27,6 +30,7 @@ LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizon
button->setMenu(menu);
connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) );
QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
+ QTimer::singleShot(0, startmenu, SLOT(ReLoadQuickLaunch()) );
}
LStartButtonPlugin::~LStartButtonPlugin(){
@@ -39,6 +43,53 @@ void LStartButtonPlugin::updateButtonVisuals(){
button->setIcon( LXDG::findIcon("pcbsd","Lumina-DE") ); //force icon refresh
}
+void LStartButtonPlugin::updateQuickLaunch(QStringList apps){
+ //First clear any obsolete apps
+ QStringList old;
+ for(int i=0; i<QUICKL.length(); i++){
+ if( !apps.contains(QUICKL[i]->whatsThis()) ){
+ //App was removed
+ delete QUICKL.takeAt(i);
+ i--;
+ }else{
+ //App still listed - update the button
+ old << QUICKL[i]->defaultAction()->whatsThis(); //add the list of current buttons
+ LFileInfo info(QUICKL[i]->whatsThis());
+ QUICKL[i]->defaultAction()->setIcon( LXDG::findIcon(info.iconfile(),"unknown") );
+ if(info.isDesktopFile()){ QUICKL[i]->defaultAction()->setToolTip( info.XDG()->name ); }
+ else{ QUICKL[i]->defaultAction()->setToolTip( info.fileName() ); }
+ }
+ }
+ //Now go through and create any new buttons
+ for(int i=0; i<apps.length(); i++){
+ if( !old.contains(apps[i]) ){
+ //New App
+ QToolButton *tmp = new QToolButton(this);
+ QAction *act = new QAction(tmp);
+ tmp->setDefaultAction(act);
+ act->setWhatsThis(apps[i]);
+ QUICKL << tmp;
+ LFileInfo info(apps[i]);
+ act->setIcon( LXDG::findIcon( info.iconfile() ) );
+ if(info.isDesktopFile()){ act->setToolTip( info.XDG()->name ); }
+ else{ act->setToolTip( info.fileName() ); }
+ //Now add the button to the layout and connect the signal/slots
+ this->layout()->insertWidget(i+1,tmp); //"button" is always in slot 0
+ connect(tmp, SIGNAL(triggered(QAction*)), this, SLOT(LaunchQuick(QAction*)) );
+ }
+ }
+ QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
+}
+
+void LStartButtonPlugin::LaunchQuick(QAction* act){
+ //Need to get which button was clicked
+ qDebug() << "Quick Launch triggered:" << act->whatsThis();
+ if(!act->whatsThis().isEmpty()){
+ LSession::LaunchApplication("lumina-open \""+act->whatsThis()+"\"");
+ emit MenuClosed();
+ }
+}
+
// ========================
// PRIVATE FUNCTIONS
// ========================
diff --git a/lumina-desktop/panel-plugins/systemstart/LStartButton.h b/lumina-desktop/panel-plugins/systemstart/LStartButton.h
index 61a43731..6a9cdaba 100644
--- a/lumina-desktop/panel-plugins/systemstart/LStartButton.h
+++ b/lumina-desktop/panel-plugins/systemstart/LStartButton.h
@@ -40,6 +40,7 @@ private:
QWidgetAction *mact;
StartMenu *startmenu;
QToolButton *button;
+ QList<QToolButton*> QUICKL;
private slots:
void openMenu();
@@ -47,14 +48,19 @@ private slots:
void updateButtonVisuals();
+ void updateQuickLaunch(QStringList);
+ void LaunchQuick(QAction*);
+
public slots:
void OrientationChange(){
if(this->layout()->direction()==QBoxLayout::LeftToRight){
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
button->setIconSize( QSize(this->height(), this->height()) );
+ for(int i=0; i<QUICKL.length(); i++){ QUICKL[i]->setIconSize(QSize(this->height(), this->height())); }
}else{
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
button->setIconSize( QSize(this->width(), this->width()) );
+ for(int i=0; i<QUICKL.length(); i++){ QUICKL[i]->setIconSize(QSize(this->width(), this->width())); }
}
this->layout()->update();
updateButtonVisuals();
diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
index 1c401813..5bab9377 100644
--- a/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
+++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp
@@ -105,6 +105,7 @@ void StartMenu::UpdateAll(){
//Lumina Utilities
ui->tool_launch_desksettings->setVisible(LUtils::isValidBinary("lumina-config"));
ui->tool_launch_deskinfo->setVisible(LUtils::isValidBinary("lumina-info"));
+
}
void StartMenu::UpdateMenu(bool forceall){
@@ -117,6 +118,11 @@ void StartMenu::UpdateMenu(bool forceall){
on_stackedWidget_currentChanged(0); //refresh/update the main page every time
}
}
+
+void StartMenu::ReLoadQuickLaunch(){
+ emit UpdateQuickLaunch( LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList() );
+}
+
// ==========================
// PRIVATE FUNCTIONS
// ==========================
@@ -172,6 +178,15 @@ void StartMenu::LaunchItem(QString path, bool fix){
}
}
+void StartMenu::UpdateQuickLaunch(QString path, bool keep){
+ QStringList QL = LSession::handle()->sessionSettings()->value("QuicklaunchApps",QStringList()).toStringList();
+ if(keep){QL << path; }
+ else{ QL.removeAll(path); }
+ QL.removeDuplicates();
+ LSession::handle()->sessionSettings()->setValue("QuicklaunchApps",QL);
+ emit UpdateQuickLaunch(QL);
+}
+
//Listing Update routines
void StartMenu::UpdateApps(){
ClearScrollArea(ui->scroll_apps);
@@ -179,6 +194,7 @@ void StartMenu::UpdateApps(){
QStringList cats = sysapps->keys();
cats.sort();
cats.removeAll("All");
+ //QStringList QL = LSession::handle()->sessionSettings()->value("QuickLaunchApps",QStringList()).toStringList();
for(int c=0; c<cats.length(); c++){
QList<XDGDesktop> apps = sysapps->value(cats[c]);
if(apps.isEmpty()){ continue; }
@@ -194,6 +210,7 @@ void StartMenu::UpdateApps(){
connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) );
connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) );
connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) );
}
}
@@ -222,6 +239,7 @@ void StartMenu::UpdateFavs(){
connect(it, SIGNAL(NewShortcut()), this, SLOT(UpdateFavs()) );
connect(it, SIGNAL(RemovedShortcut()), this, SLOT(UpdateFavs()) );
connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(toggleQuickLaunch(QString, bool)), this, SLOT(UpdateQuickLaunch(QString, bool)) );
}
QApplication::processEvents();
}
diff --git a/lumina-desktop/panel-plugins/systemstart/StartMenu.h b/lumina-desktop/panel-plugins/systemstart/StartMenu.h
index 20ed2fb7..ebf2ad9c 100644
--- a/lumina-desktop/panel-plugins/systemstart/StartMenu.h
+++ b/lumina-desktop/panel-plugins/systemstart/StartMenu.h
@@ -26,6 +26,8 @@ public slots:
void UpdateAll(); //for re-translation/icon changes
void UpdateMenu(bool forceall = false); //for item changes
+ void ReLoadQuickLaunch();
+
private:
Ui::StartMenu *ui;
QHash<QString, QList<XDGDesktop> > *sysapps;
@@ -37,6 +39,7 @@ private:
private slots:
void LaunchItem(QString path, bool fix = true);
+ void UpdateQuickLaunch(QString, bool);
//Application/Favorite Listings
void UpdateApps();
@@ -84,6 +87,8 @@ private slots:
signals:
void CloseMenu();
+ void UpdateQuickLaunch(QStringList);
+
};
#endif \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
index 05c601e1..2befba0d 100644
--- a/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/LSysTray.cpp
@@ -149,7 +149,7 @@ void LSysTray::UpdateTrayWindow(WId win){
if(!isRunning || stopping || checking){ return; }
for(int i=0; i<trayIcons.length(); i++){
if(trayIcons[i]->appID()==win){
- qDebug() << "System Tray: Update Window " << win;
+ //qDebug() << "System Tray: Update Window " << win;
trayIcons[i]->repaint(); //don't use update() because we need an instant repaint (not a cached version)
//QTimer::singleShot(10, trayIcons[i], SLOT(repaint()) ); //re-paint in 10ms (give it a moment to settle)
//QTimer::singleShot(1000, trayIcons[i], SLOT(update()) );
@@ -157,7 +157,7 @@ void LSysTray::UpdateTrayWindow(WId win){
}
}
//Could not find tray in the list, run the checkall routine to make sure we are not missing any
- qDebug() << "System Tray: Missing Window - check all";
+ //qDebug() << "System Tray: Missing Window - check all";
QTimer::singleShot(0,this, SLOT(checkAll()) );
}
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
index a8117b84..78d90524 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
@@ -46,7 +46,7 @@ void TrayIcon::attachApp(WId id){
}
void TrayIcon::setSizeSquare(int side){
- qDebug() << " Set Fixes Systray size:" << side;
+ //qDebug() << " Set Fixed Systray size:" << side;
this->setFixedSize( QSize(side, side) );
}
@@ -107,8 +107,8 @@ void TrayIcon::paintEvent(QPaintEvent *event){
qDebug() << "Null Qt Pixmap - Use XCB grab image:";
pix = LSession::handle()->XCB->TrayImage(AID);
}*/
- qDebug() << " - Pix size:" << pix.size().width() << pix.size().height();
- qDebug() << " - Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height();
+ //qDebug() << " - Pix size:" << pix.size().width() << pix.size().height();
+ //qDebug() << " - Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height();
if(!pix.isNull()){
if(this->size() != pix.size()){ QTimer::singleShot(10, this, SLOT(updateIcon())); }
painter.drawPixmap(0,0,this->width(), this->height(), pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
bgstack15