aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp4
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp50
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.h16
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.ui133
4 files changed, 182 insertions, 21 deletions
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
index eb6a7db0..a9cf3b25 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -113,7 +113,7 @@ void UserItemWidget::buttonClicked(){
}
void UserItemWidget::ItemClicked(){
- if(!linkPath.isEmpty()){ emit RunItem("lumina-open \""+linkPath+"\"" ); }
- else{ emit RunItem("lumina-open \""+icon->whatsThis()+"\"" ); }
+ if(!linkPath.isEmpty()){ emit RunItem(linkPath); }
+ else{ emit RunItem(icon->whatsThis()); }
} \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index d1cf82d4..6f2d6526 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -32,6 +32,9 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
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_home_gohome->setIcon( LXDG::findIcon("go-home","") );
+ ui->tool_home_goup->setIcon( LXDG::findIcon("go-previous","") );
+ ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") );
//Connect the signals/slots
connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) );
@@ -40,6 +43,10 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
connect(ui->tool_fav_files, SIGNAL(clicked()), this, SLOT(FavChanged()) );
connect(ui->tool_fav_dirs, SIGNAL(clicked()), this, SLOT(FavChanged()) );
connect(ui->combo_app_cats, SIGNAL(currentIndexChanged(int)), this, SLOT(updateApps()) );
+ connect(ui->tool_home_gohome, SIGNAL(clicked()), this, SLOT(slotGoHome()) );
+ connect(ui->tool_home_goup, SIGNAL(clicked()), this, SLOT(slotGoUp()) );
+ connect(ui->tool_home_browse, SIGNAL(clicked()), this, SLOT(slotOpenDir()) );
+
//Setup the special buttons
QString APPSTORE = LOS::AppStoreShortcut();
if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){
@@ -118,6 +125,7 @@ void UserWidget::UpdateMenu(){
ui->tool_fav_files->setChecked(false);
cfav = 0; //favorite apps
updateFavItems();
+ ui->label_home_dir->setWhatsThis(QDir::homePath());
updateHome();
if(lastUpdate < LSession::applicationMenu()->lastHashUpdate || lastUpdate.isNull()){
updateAppCategories();
@@ -126,10 +134,11 @@ void UserWidget::UpdateMenu(){
lastUpdate = QDateTime::currentDateTime();
}
-void UserWidget::LaunchItem(QString cmd){
- if(!cmd.isEmpty()){
- qDebug() << "Launch Application:" << cmd;
- LSession::LaunchApplication(cmd);
+void UserWidget::LaunchItem(QString path, bool fix){
+ if(!path.isEmpty()){
+ qDebug() << "Launch Application:" << path;
+ if(fix){ LSession::LaunchApplication("lumina-open \""+path+"\""); }
+ else{ LSession::LaunchApplication(path); }
emit CloseMenu(); //so the menu container will close
}
}
@@ -227,19 +236,48 @@ void UserWidget::updateApps(){
//Home Tab
void UserWidget::updateHome(){
ClearScrollArea(ui->scroll_home);
- QDir homedir = QDir::home();
+ QDir homedir(ui->label_home_dir->whatsThis());
+ if(QDir::homePath() == homedir.absolutePath()){
+ ui->label_home_dir->setText(tr("Home"));
+ ui->tool_home_gohome->setVisible(false);
+ ui->tool_home_goup->setVisible(false);
+ }else{
+ ui->label_home_dir->setText(homedir.dirName());
+ ui->tool_home_gohome->setVisible(true);
+ ui->tool_home_goup->setVisible(true);
+ }
+ ui->label_home_dir->setToolTip(ui->label_home_dir->whatsThis());
QStringList items = homedir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
for(int i=0; i<items.length(); i++){
//qDebug() << "New Home subdir:" << homedir.absoluteFilePath(items[i]);
UserItemWidget *it = new UserItemWidget(ui->scroll_home->widget(), homedir.absoluteFilePath(items[i]), true);
ui->scroll_home->widget()->layout()->addWidget(it);
- connect(it, SIGNAL(RunItem(QString)), this, SLOT(LaunchItem(QString)) );
+ connect(it, SIGNAL(RunItem(QString)), this, SLOT(slotGoToDir(QString)) );
connect(it, SIGNAL(NewShortcut()), this, SLOT(updateFavItems()) );
connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
}
static_cast<QBoxLayout*>(ui->scroll_home->widget()->layout())->addStretch();
}
+void UserWidget::slotGoToDir(QString dir){
+ ui->label_home_dir->setWhatsThis(dir);
+ updateHome();
+}
+
+void UserWidget::slotGoHome(){
+ slotGoToDir(QDir::homePath());
+}
+
+void UserWidget::slotGoUp(){
+ QString dir = ui->label_home_dir->whatsThis();
+ dir.chop( dir.section("/",-1).length() );
+ slotGoToDir(dir);
+}
+
+void UserWidget::slotOpenDir(){
+ LaunchItem(ui->label_home_dir->whatsThis());
+}
+
void UserWidget::mouseMoveEvent( QMouseEvent *event){
QTabBar *wid = tabBar();
qDebug() << "Mouse Move Event:";
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
index a2cedb03..232b5e8b 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.h
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.h
@@ -51,7 +51,7 @@ private:
QIcon rotateIcon(QIcon);
private slots:
- void LaunchItem(QString cmd);
+ void LaunchItem(QString path, bool fix = true);
//Favorites Tab
void FavChanged(); //for ensuring radio-button-like behaviour
@@ -63,22 +63,26 @@ private slots:
//Home Tab
void updateHome();
+ void slotGoToDir(QString dir);
+ void slotGoHome();
+ void slotGoUp();
+ void slotOpenDir();
//Slots for the special buttons
void openStore(){
- LaunchItem("lumina-open \""+LOS::AppStoreShortcut()+"\"");
+ LaunchItem(LOS::AppStoreShortcut());
}
void openControlPanel(){
- LaunchItem("lumina-open \""+LOS::ControlPanelShortcut()+"\"");
+ LaunchItem(LOS::ControlPanelShortcut());
}
void openDeskSettings(){
- LaunchItem("lumina-config");
+ LaunchItem("lumina-config", false);
}
void openQtConfig(){
- LaunchItem( LOS::QtConfigShortcut() );
+ LaunchItem( LOS::QtConfigShortcut(), false);
}
void openScreenSaverConfig(){
- LaunchItem(SSAVER);
+ LaunchItem(SSAVER, false);
}
protected:
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
index 5e62ffd1..cecb43f4 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.ui
@@ -17,7 +17,7 @@
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="tab_fav">
<attribute name="title">
@@ -161,8 +161,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>262</width>
- <height>245</height>
+ <width>96</width>
+ <height>26</height>
</rect>
</property>
</widget>
@@ -178,6 +178,12 @@
<string>System Applications</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@@ -252,8 +258,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>252</width>
- <height>231</height>
+ <width>96</width>
+ <height>26</height>
</rect>
</property>
</widget>
@@ -269,6 +275,119 @@
<string>Home Directory</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>2</number>
+ </property>
+ <property name="margin">
+ <number>1</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="tool_home_goup">
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Go back</string>
+ </property>
+ <property name="text">
+ <string notr="true">up</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_home_gohome">
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Go back to home directory</string>
+ </property>
+ <property name="text">
+ <string notr="true">home</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="autoRaise">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_home_dir">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string notr="true">&lt;current dir&gt;</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ <property name="margin">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_home_browse">
+ <property name="minimumSize">
+ <size>
+ <width>30</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Open Directory</string>
+ </property>
+ <property name="text">
+ <string notr="true">Browse</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="toolButtonStyle">
+ <enum>Qt::ToolButtonTextBesideIcon</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QScrollArea" name="scroll_home">
<property name="widgetResizable">
@@ -279,8 +398,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>252</width>
- <height>269</height>
+ <width>262</width>
+ <height>245</height>
</rect>
</property>
</widget>
bgstack15