From 91cbfe642b48aba712f4f60a827bfbef80aca125 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Tue, 7 Oct 2014 19:02:43 +0200 Subject: make file-manager user-chooseable --- lumina-config/mainUI.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'lumina-config/mainUI.cpp') 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; ilist_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; } -- cgit