aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2014-10-08 09:16:10 -0400
committerKen Moore <moorekou@gmail.com>2014-10-08 09:16:10 -0400
commit4897f2a844a9901e6278665f83716b3974a5078b (patch)
treeefb98920ebd16cfa9342dd392601a25fa9f12916
parentMerge pull request #15 from Nanolx/master (diff)
parentmake file-manager user-chooseable (diff)
downloadlumina-4897f2a844a9901e6278665f83716b3974a5078b.tar.gz
lumina-4897f2a844a9901e6278665f83716b3974a5078b.tar.bz2
lumina-4897f2a844a9901e6278665f83716b3974a5078b.zip
Merge pull request #16 from Nanolx/side-work
make file-manager user-chooseable
-rw-r--r--lumina-config/mainUI.cpp24
-rw-r--r--lumina-config/mainUI.h1
-rw-r--r--lumina-config/mainUI.ui62
-rw-r--r--lumina-desktop/AppMenu.cpp6
-rw-r--r--lumina-desktop/AppMenu.h8
-rw-r--r--lumina-desktop/LDesktop.cpp3
-rw-r--r--lumina-open/main.cpp7
7 files changed, 82 insertions, 29 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index eb29ee8f..ada56df2 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -101,6 +101,7 @@ void MainUI::setupIcons(){
ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") );
ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") );
ui->tool_menu_findterm->setIcon( LXDG::findIcon("system-search","") );
+ ui->tool_menu_findfm->setIcon( LXDG::findIcon("system-search","") );
//Shortcuts Page
ui->tool_shortcut_set->setIcon( LXDG::findIcon("input-keyboard","") );
@@ -168,8 +169,10 @@ void MainUI::setupConnections(){
connect(ui->tool_menu_up, SIGNAL(clicked()), this, SLOT(upmenuplugin()) );
connect(ui->tool_menu_dn, SIGNAL(clicked()), this, SLOT(downmenuplugin()) );
connect(ui->tool_menu_findterm, SIGNAL(clicked()), this, SLOT(findmenuterminal()) );
+ connect(ui->tool_menu_findfm, SIGNAL(clicked()), this, SLOT(findmenufilemanager()) );
connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) );
connect(ui->line_menu_term, SIGNAL(textChanged(QString)), this, SLOT(checkmenuicons()) );
+ connect(ui->line_menu_fm, SIGNAL(textChanged(QString)), this, SLOT(checkmenuicons()) );
//Shortcuts Page
connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) );
@@ -503,8 +506,9 @@ void MainUI::loadCurrentSettings(bool screenonly){
if(!screenonly){
// Menu Page
- //Default terminal binary
+ //Default terminal and filemanager binary
ui->line_menu_term->setText( settings->value("default-terminal","xterm").toString() );
+ ui->line_menu_fm->setText( settings->value("default-filemanager","lumina-fm").toString() );
//Menu Items
QStringList items = settings->value("menu/itemlist", QStringList() ).toStringList();
if(items.isEmpty()){ items << "terminal" << "filemanager" << "applications" << "line" << "settings"; }
@@ -616,6 +620,7 @@ void MainUI::saveCurrentSettings(bool screenonly){
// Menu Page
if(modmenu && !screenonly){
settings->setValue("default-terminal", ui->line_menu_term->text() );
+ settings->setValue("default-filemanager", ui->line_menu_fm->text() );
QStringList items;
for(int i=0; i<ui->list_menu->count(); i++){
items << ui->list_menu->item(i)->whatsThis();
@@ -1005,11 +1010,26 @@ void MainUI::findmenuterminal(){
modmenu = true;
}
+void MainUI::findmenufilemanager(){
+ QString chkpath = LOS::AppPrefix() + "bin";
+ if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); }
+ QString bin = QFileDialog::getOpenFileName(this, tr("Set Default File MAnager"), chkpath, tr("Application Binaries (*)") );
+ if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled
+ if( !QFileInfo(bin).isExecutable() ){
+ QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!"));
+ return;
+ }
+ ui->line_menu_fm->setText(bin);
+ ui->push_save->setEnabled(true);
+ modmenu = true;
+}
+
void MainUI::checkmenuicons(){
ui->tool_menu_up->setEnabled( ui->list_menu->currentRow() > 0 );
ui->tool_menu_dn->setEnabled( ui->list_menu->currentRow() < (ui->list_menu->count()-1) );
ui->tool_menu_rm->setEnabled( ui->list_menu->currentRow() >=0 );
- if(settings->value("default-terminal","").toString()!=ui->line_menu_term->text()){
+ if( settings->value("default-terminal","").toString() != ui->line_menu_term->text() ||
+ settings->value("default-filemanager","").toString() != ui->line_menu_fm->text()){
ui->push_save->setEnabled(true);
modmenu = true;
}
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 565a3c61..d40438db 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -121,6 +121,7 @@ private slots:
void upmenuplugin();
void downmenuplugin();
void findmenuterminal();
+ void findmenufilemanager();
void checkmenuicons();
//Shortcuts Page
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index f1fd2542..7dd97862 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>573</width>
- <height>385</height>
+ <width>579</width>
+ <height>392</height>
</rect>
</property>
<property name="windowTitle">
@@ -94,7 +94,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="currentIndex">
- <number>5</number>
+ <number>2</number>
</property>
<widget class="QWidget" name="page_desktop">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -372,8 +372,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>157</width>
- <height>90</height>
+ <width>166</width>
+ <height>92</height>
</rect>
</property>
<attribute name="label">
@@ -454,8 +454,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>106</height>
+ <width>194</width>
+ <height>107</height>
</rect>
</property>
<attribute name="label">
@@ -592,8 +592,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>157</width>
- <height>90</height>
+ <width>166</width>
+ <height>92</height>
</rect>
</property>
<attribute name="label">
@@ -674,8 +674,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>177</width>
- <height>106</height>
+ <width>194</width>
+ <height>107</height>
</rect>
</property>
<attribute name="label">
@@ -782,7 +782,7 @@
</item>
</layout>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -795,10 +795,10 @@
</property>
</spacer>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QListWidget" name="list_menu"/>
</item>
- <item row="1" column="2">
+ <item row="2" column="2">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -811,7 +811,7 @@
</property>
</spacer>
</item>
- <item row="2" column="1">
+ <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QToolButton" name="tool_menu_add">
@@ -856,6 +856,30 @@
</item>
</layout>
</item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_18">
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>File Manager:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="line_menu_fm"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_menu_findfm">
+ <property name="text">
+ <string>find</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="page_shortcuts">
@@ -1266,8 +1290,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>509</width>
- <height>71</height>
+ <width>491</width>
+ <height>59</height>
</rect>
</property>
<property name="sizePolicy">
@@ -1373,8 +1397,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>573</width>
- <height>20</height>
+ <width>579</width>
+ <height>19</height>
</rect>
</property>
</widget>
diff --git a/lumina-desktop/AppMenu.cpp b/lumina-desktop/AppMenu.cpp
index 496d0932..2b14edec 100644
--- a/lumina-desktop/AppMenu.cpp
+++ b/lumina-desktop/AppMenu.cpp
@@ -6,6 +6,7 @@
//===========================================
#include "AppMenu.h"
#include "LSession.h"
+#include "LDesktop.h"
#include <LuminaOS.h>
AppMenu::AppMenu(QWidget* parent) : QMenu(parent){
@@ -111,8 +112,9 @@ void AppMenu::launchControlPanel(){
}
void AppMenu::launchFileManager(){
- LSession::LaunchApplication("lumina-fm");
- //QProcess::startDetached("lumina-fm");
+ QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
+ QString fm = QSettings("LuminaDE", "desktopsettings").value("default-filemanager","lumina-fm").toString();
+ LSession::LaunchApplication(fm);
}
void AppMenu::launchApp(QAction *act){
diff --git a/lumina-desktop/AppMenu.h b/lumina-desktop/AppMenu.h
index 1657d9e2..2d737284 100644
--- a/lumina-desktop/AppMenu.h
+++ b/lumina-desktop/AppMenu.h
@@ -19,6 +19,7 @@
#include <QDateTime>
#include <QHash>
#include <QAction>
+#include <QSettings>
//#include <QProcess>
// libLumina includes
@@ -29,18 +30,19 @@ class AppMenu : public QMenu{
public:
AppMenu(QWidget *parent = 0);
~AppMenu();
-
+
QHash<QString, QList<XDGDesktop> > *currentAppHash();
QDateTime lastHashUpdate;
private:
+ QSettings *settings;
QFileSystemWatcher *watcher;
QString appstorelink, controlpanellink;
QList<QMenu> MLIST;
QHash<QString, QList<XDGDesktop> > APPS;
-
+
void updateAppList(); //completely update the menu lists
-
+
private slots:
void start(); //This is called in a new thread after initialization
void watcherUpdate();
diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp
index 22606cf4..a76edb53 100644
--- a/lumina-desktop/LDesktop.cpp
+++ b/lumina-desktop/LDesktop.cpp
@@ -91,7 +91,8 @@ void LDesktop::SystemTerminal(){
}
void LDesktop::SystemFileManager(){
- LSession::LaunchApplication("lumina-fm");
+ QString fm = settings->value("default-filemanager","lumina-fm").toString();
+ LSession::LaunchApplication(fm);
}
void LDesktop::SystemApplication(QAction* act){
diff --git a/lumina-open/main.cpp b/lumina-open/main.cpp
index c34a2c6a..eef32589 100644
--- a/lumina-open/main.cpp
+++ b/lumina-open/main.cpp
@@ -23,6 +23,7 @@
#include <QColor>
#include <QFont>
#include <QTextCodec>
+#include <QSettings>
#include "LFileDialog.h"
@@ -73,11 +74,12 @@ void showOSD(int argc, char **argv, QString message){
}
QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QString& path, bool showDLG=false){
+ QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
//First check to see if there is a default for this extension
QString defApp = LFileDialog::getDefaultApp(extension);
if(extension=="directory" && defApp.isEmpty() && !showDLG){
//Just use the Lumina File Manager
- return "lumina-fm";
+ return QSettings("LuminaDE", "desktopsettings").value("default-filemanager","lumina-fm").toString();
}else if( !defApp.isEmpty() && !showDLG ){
bool ok = false;
XDGDesktop DF = LXDG::loadDesktopFile(defApp, ok);
@@ -137,6 +139,7 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS
void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& path){
//Get the input file
QString inFile;
+ QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
bool showDLG = false; //flag to bypass any default application setting
if(argc > 1){
for(int i=1; i<argc; i++){
@@ -197,7 +200,7 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat
QString cmd;
bool useInputFile = false;
if(extension=="directory" && !showDLG){
- cmd = "lumina-fm";
+ cmd = QSettings("LuminaDE", "desktopsettings").value("default-filemanager","lumina-fm").toString();
useInputFile=true;
}else if(extension=="desktop" && !showDLG){
bool ok = false;
bgstack15