diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-02-19 10:20:48 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-02-20 11:01:48 +0900 |
commit | ea52c20448639ce5f07a0504a2f7146222eaecbe (patch) | |
tree | 58a07a69a1fa8536c893a245ba96a2badf2a5fe4 /kcontrol/componentchooser | |
parent | c6b7fdebde2b08051a7c6b1c78d15c25907ba91b (diff) | |
download | tdebase-ea52c20448639ce5f07a0504a2f7146222eaecbe.tar.gz tdebase-ea52c20448639ce5f07a0504a2f7146222eaecbe.zip |
Added logic for selection of default file manager from TCC.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit a430111b101339a278dbe299b0dd5c2bc06528d8)
Diffstat (limited to 'kcontrol/componentchooser')
-rw-r--r-- | kcontrol/componentchooser/componentchooser.cpp | 63 | ||||
-rw-r--r-- | kcontrol/componentchooser/componentchooser.h | 2 | ||||
-rw-r--r-- | kcontrol/componentchooser/filemanagerconfig_ui.ui | 212 |
3 files changed, 87 insertions, 190 deletions
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 <kstandarddirs.h> #include <ktrader.h> #include <kurlrequester.h> +#include <kprocess.h> 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 @@ <property name="margin"> <number>0</number> </property> - <widget class="TQButtonGroup"> - <property name="name"> - <cstring>ButtonGroup1</cstring> - </property> - <property name="frameShape"> - <enum>NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="title"> - <string></string> - </property> - <grid> + <grid> + <widget class="TQLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>labelDescription</cstring> + </property> + <property name="text"> + <string>The default file manager can be selected by changing the preferred application for mime type inode/directory in the File Associations control module</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQLayoutWidget" row="1" column="0"> <property name="name"> - <cstring>unnamed</cstring> + <cstring>Layout4</cstring> </property> - <property name="margin"> - <number>0</number> - </property> - <spacer row="3" column="1"> + <hbox> <property name="name"> - <cstring>Spacer4</cstring> - </property> - <property name="orientation"> - <enum>Vertical</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>0</width> - <height>87</height> - </size> - </property> - </spacer> - <widget class="TQRadioButton" row="1" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>otherCB</cstring> - </property> - <property name="text"> - <string>Use a different &file manager program:</string> + <cstring>unnamed</cstring> </property> - </widget> - <spacer row="2" column="0"> - <property name="name"> - <cstring>Spacer15</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Fixed</enum> - </property> - <property name="sizeHint"> - <size> - <width>31</width> - <height>20</height> - </size> - </property> - </spacer> - <widget class="TQRadioButton" row="0" column="0" rowspan="1" colspan="2"> - <property name="name"> - <cstring>filemanagerCB</cstring> - </property> - <property name="text"> - <string>&Use Konqueror as file manager application</string> - </property> - </widget> - <widget class="TQLayoutWidget" row="2" column="1"> - <property name="name"> - <cstring>Layout4</cstring> - </property> - <hbox> + <widget class="TQPushButton"> <property name="name"> - <cstring>unnamed</cstring> + <cstring>btnOpenFileAssociations</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <widget class="TQLineEdit"> - <property name="name"> - <cstring>filemanagerLE</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>0</vsizetype> - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="whatsThis" stdset="0"> - <string>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> </string> - </property> - </widget> - <widget class="TQToolButton"> - <property name="name"> - <cstring>btnSelectFileManager</cstring> - </property> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>1</hsizetype> - <vsizetype>1</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Click here to browse for a file manager program.</string> - </property> - </widget> - </hbox> - </widget> - </grid> - </widget> + <property name="text"> + <string>Open File Associations module</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Click here to open the File Association control module.</string> + </property> + </widget> + </hbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>Spacer16</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + <spacer row="2" column="1"> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>0</width> + <height>87</height> + </size> + </property> + </spacer> + </grid> </vbox> </widget> <connections> <connection> - <sender>otherCB</sender> - <signal>toggled(bool)</signal> - <receiver>filemanagerLE</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>otherCB</sender> - <signal>toggled(bool)</signal> - <receiver>btnSelectFileManager</receiver> - <slot>setEnabled(bool)</slot> - </connection> - <connection> - <sender>btnSelectFileManager</sender> + <sender>btnOpenFileAssociations</sender> <signal>clicked()</signal> <receiver>FileManagerConfig_UI</receiver> - <slot>selectFileManagerApp()</slot> + <slot>selectFileAssociations()</slot> </connection> </connections> <tabstops> - <tabstop>filemanagerCB</tabstop> - <tabstop>otherCB</tabstop> - <tabstop>filemanagerLE</tabstop> + <tabstop>btnOpenFileAssociations</tabstop> </tabstops> <includes> <include location="local" impldecl="in implementation">kdialog.h</include> </includes> <Q_SLOTS> - <slot access="protected">selectFileManagerApp()</slot> + <slot access="protected">selectFileAssociations()</slot> </Q_SLOTS> <layoutdefaults spacing="3" margin="6"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> |