From ea52c20448639ce5f07a0504a2f7146222eaecbe Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 19 Feb 2020 10:20:48 +0900 Subject: Added logic for selection of default file manager from TCC. Signed-off-by: Michele Calgaro (cherry picked from commit a430111b101339a278dbe299b0dd5c2bc06528d8) --- kcontrol/componentchooser/componentchooser.cpp | 63 ++----- kcontrol/componentchooser/componentchooser.h | 2 +- kcontrol/componentchooser/filemanagerconfig_ui.ui | 212 ++++++++-------------- 3 files changed, 87 insertions(+), 190 deletions(-) (limited to 'kcontrol/componentchooser') diff --git a/kcontrol/componentchooser/componentchooser.cpp b/kcontrol/componentchooser/componentchooser.cpp index bee7797e1..c084c2fce 100644 --- a/kcontrol/componentchooser/componentchooser.cpp +++ b/kcontrol/componentchooser/componentchooser.cpp @@ -37,6 +37,7 @@ #include #include #include +#include class MyListBoxItem: public TQListBoxText { @@ -211,13 +212,13 @@ void CfgEmailClient::save(TDEConfig *) //BEGIN File Manager Configuration -CfgFileManager::CfgFileManager(TQWidget *parent) : FileManagerConfig_UI(parent), CfgPlugin() { - connect(filemanagerLE, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(configChanged())); - connect(filemanagerCB, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); - connect(otherCB, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged())); +CfgFileManager::CfgFileManager(TQWidget *parent) : FileManagerConfig_UI(parent), CfgPlugin() +{ + btnOpenFileAssociations->setEnabled(true); } -CfgFileManager::~CfgFileManager() { +CfgFileManager::~CfgFileManager() +{ } void CfgFileManager::configChanged() @@ -227,57 +228,23 @@ void CfgFileManager::configChanged() void CfgFileManager::defaults() { - load(0L); + load(0L); } -void CfgFileManager::load(TDEConfig *) { - TDEConfig *config = new TDEConfig("kdeglobals", true); - config->setGroup("General"); - TQString filemanager = config->readPathEntry("FileManagerApplication","konqueror"); - if (filemanager == "konqueror") - { - filemanagerLE->setText(""); - filemanagerCB->setChecked(true); - } - else - { - filemanagerLE->setText(filemanager); - otherCB->setChecked(true); - } - delete config; - - emit changed(false); +void CfgFileManager::load(TDEConfig *) +{ } -void CfgFileManager::save(TDEConfig *) { - - TDEConfig *config = new TDEConfig("kdeglobals"); - config->setGroup("General"); - config->writePathEntry("FileManagerApplication", filemanagerCB->isChecked() ? "konqueror" : filemanagerLE->text(), - true, true); - config->sync(); - delete config; - - KIPC::sendMessageAll(KIPC::SettingsChanged); - kapp->dcopClient()->send("tdelauncher", "tdelauncher","reparseConfiguration()", TQString::null); - - emit changed(false); +void CfgFileManager::save(TDEConfig *) +{ } -void CfgFileManager::selectFileManagerApp() +void CfgFileManager::selectFileAssociations() { - KURL::List urlList; - KOpenWithDlg dlg(urlList, i18n("Select preferred file manager application:"), TQString::null, this); - // hide "Run in &terminal" here, we don't need it for a File Manager Application - dlg.hideRunInTerminal(); - if (dlg.exec() != TQDialog::Accepted) return; - TQString client = dlg.text(); - - if (!client.isEmpty()) - { - filemanagerLE->setText(client); - } + TDEProcess p; + p << "tdecmshell" << "filetypes"; + p.start(TDEProcess::DontCare); } //END File Manager Configuration diff --git a/kcontrol/componentchooser/componentchooser.h b/kcontrol/componentchooser/componentchooser.h index 0407a9295..3649ca218 100644 --- a/kcontrol/componentchooser/componentchooser.h +++ b/kcontrol/componentchooser/componentchooser.h @@ -96,7 +96,7 @@ public: virtual void defaults(); protected slots: - void selectFileManagerApp(); + void selectFileAssociations(); void configChanged(); signals: diff --git a/kcontrol/componentchooser/filemanagerconfig_ui.ui b/kcontrol/componentchooser/filemanagerconfig_ui.ui index a5845f283..fbcd23d43 100644 --- a/kcontrol/componentchooser/filemanagerconfig_ui.ui +++ b/kcontrol/componentchooser/filemanagerconfig_ui.ui @@ -27,167 +27,97 @@ 0 - - - ButtonGroup1 - - - NoFrame - - - 0 - - - - - + + + + labelDescription + + + The default file manager can be selected by changing the preferred application for mime type inode/directory in the File Associations control module + + + WordBreak|AlignVCenter + + + - unnamed + Layout4 - - 0 - - + - Spacer4 - - - Vertical - - - Expanding - - - - 0 - 87 - - - - - - otherCB - - - Use a different &file manager program: + unnamed - - - - Spacer15 - - - Horizontal - - - Fixed - - - - 31 - 20 - - - - - - filemanagerCB - - - &Use Konqueror as file manager application - - - - - Layout4 - - + - unnamed + btnOpenFileAssociations + + + false + + + + 1 + 1 + 0 + 0 + - - - filemanagerLE - - - false - - - - 1 - 0 - 1 - 0 - - - - - 0 - 0 - - - - Press this button to select your favorite file manager client. Please note that the file you select has to have the executable attribute set in order to be accepted.<br> - - - - - btnSelectFileManager - - - false - - - - 1 - 1 - 0 - 0 - - - - ... - - - Click here to browse for a file manager program. - - - - - - + + Open File Associations module + + + Click here to open the File Association control module. + + + + + + + Spacer16 + + + Horizontal + + + Expanding + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 0 + 87 + + + + - otherCB - toggled(bool) - filemanagerLE - setEnabled(bool) - - - otherCB - toggled(bool) - btnSelectFileManager - setEnabled(bool) - - - btnSelectFileManager + btnOpenFileAssociations clicked() FileManagerConfig_UI - selectFileManagerApp() + selectFileAssociations() - filemanagerCB - otherCB - filemanagerLE + btnOpenFileAssociations kdialog.h - selectFileManagerApp() + selectFileAssociations() -- cgit v1.2.1