Added logic for selection of default file manager from TCC.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/133/head
Michele Calgaro 4 years ago
parent d4b559f918
commit a430111b10
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -37,6 +37,7 @@
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <ktrader.h> #include <ktrader.h>
#include <kurlrequester.h> #include <kurlrequester.h>
#include <kprocess.h>
class MyListBoxItem: public TQListBoxText class MyListBoxItem: public TQListBoxText
{ {
@ -211,13 +212,13 @@ void CfgEmailClient::save(TDEConfig *)
//BEGIN File Manager Configuration //BEGIN File Manager Configuration
CfgFileManager::CfgFileManager(TQWidget *parent) : FileManagerConfig_UI(parent), CfgPlugin() { 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())); btnOpenFileAssociations->setEnabled(true);
connect(otherCB, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(configChanged()));
} }
CfgFileManager::~CfgFileManager() { CfgFileManager::~CfgFileManager()
{
} }
void CfgFileManager::configChanged() void CfgFileManager::configChanged()
@ -227,57 +228,23 @@ void CfgFileManager::configChanged()
void CfgFileManager::defaults() void CfgFileManager::defaults()
{ {
load(0L); load(0L);
} }
void CfgFileManager::load(TDEConfig *) { 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::save(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::selectFileManagerApp() void CfgFileManager::selectFileAssociations()
{ {
KURL::List urlList; TDEProcess p;
KOpenWithDlg dlg(urlList, i18n("Select preferred file manager application:"), TQString::null, this); p << "tdecmshell" << "filetypes";
// hide "Run in &terminal" here, we don't need it for a File Manager Application p.start(TDEProcess::DontCare);
dlg.hideRunInTerminal();
if (dlg.exec() != TQDialog::Accepted) return;
TQString client = dlg.text();
if (!client.isEmpty())
{
filemanagerLE->setText(client);
}
} }
//END File Manager Configuration //END File Manager Configuration

@ -96,7 +96,7 @@ public:
virtual void defaults(); virtual void defaults();
protected slots: protected slots:
void selectFileManagerApp(); void selectFileAssociations();
void configChanged(); void configChanged();
signals: signals:

@ -27,167 +27,97 @@
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<widget class="TQButtonGroup"> <grid>
<property name="name"> <widget class="TQLabel" row="0" column="0" rowspan="1" colspan="2">
<cstring>ButtonGroup1</cstring> <property name="name">
</property> <cstring>labelDescription</cstring>
<property name="frameShape"> </property>
<enum>NoFrame</enum> <property name="text">
</property> <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 name="lineWidth"> </property>
<number>0</number> <property name="alignment">
</property> <set>WordBreak|AlignVCenter</set>
<property name="title"> </property>
<string></string> </widget>
</property> <widget class="TQLayoutWidget" row="1" column="0">
<grid>
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>Layout4</cstring>
</property> </property>
<property name="margin"> <hbox>
<number>0</number>
</property>
<spacer row="3" column="1">
<property name="name"> <property name="name">
<cstring>Spacer4</cstring> <cstring>unnamed</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 &amp;file manager program:</string>
</property> </property>
</widget> <widget class="TQPushButton">
<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>&amp;Use Konqueror as file manager application</string>
</property>
</widget>
<widget class="TQLayoutWidget" row="2" column="1">
<property name="name">
<cstring>Layout4</cstring>
</property>
<hbox>
<property name="name"> <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> </property>
<widget class="TQLineEdit"> <property name="text">
<property name="name"> <string>Open File Associations module</string>
<cstring>filemanagerLE</cstring> </property>
</property> <property name="whatsThis" stdset="0">
<property name="enabled"> <string>Click here to open the File Association control module.</string>
<bool>false</bool> </property>
</property> </widget>
<property name="sizePolicy"> </hbox>
<sizepolicy> </widget>
<hsizetype>1</hsizetype> <spacer row="1" column="1">
<vsizetype>0</vsizetype> <property name="name">
<horstretch>1</horstretch> <cstring>Spacer16</cstring>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="orientation">
</property> <enum>Horizontal</enum>
<property name="minimumSize"> </property>
<size> <property name="sizeType">
<width>0</width> <enum>Expanding</enum>
<height>0</height> </property>
</size> </spacer>
</property> <spacer row="2" column="1">
<property name="whatsThis" stdset="0"> <property name="name">
<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.&lt;br&gt; </string> <cstring>Spacer4</cstring>
</property> </property>
</widget> <property name="orientation">
<widget class="TQToolButton"> <enum>Vertical</enum>
<property name="name"> </property>
<cstring>btnSelectFileManager</cstring> <property name="sizeType">
</property> <enum>Expanding</enum>
<property name="enabled"> </property>
<bool>false</bool> <property name="sizeHint">
</property> <size>
<property name="sizePolicy"> <width>0</width>
<sizepolicy> <height>87</height>
<hsizetype>1</hsizetype> </size>
<vsizetype>1</vsizetype> </property>
<horstretch>0</horstretch> </spacer>
<verstretch>0</verstretch> </grid>
</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>
</vbox> </vbox>
</widget> </widget>
<connections> <connections>
<connection> <connection>
<sender>otherCB</sender> <sender>btnOpenFileAssociations</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>
<signal>clicked()</signal> <signal>clicked()</signal>
<receiver>FileManagerConfig_UI</receiver> <receiver>FileManagerConfig_UI</receiver>
<slot>selectFileManagerApp()</slot> <slot>selectFileAssociations()</slot>
</connection> </connection>
</connections> </connections>
<tabstops> <tabstops>
<tabstop>filemanagerCB</tabstop> <tabstop>btnOpenFileAssociations</tabstop>
<tabstop>otherCB</tabstop>
<tabstop>filemanagerLE</tabstop>
</tabstops> </tabstops>
<includes> <includes>
<include location="local" impldecl="in implementation">kdialog.h</include> <include location="local" impldecl="in implementation">kdialog.h</include>
</includes> </includes>
<Q_SLOTS> <Q_SLOTS>
<slot access="protected">selectFileManagerApp()</slot> <slot access="protected">selectFileAssociations()</slot>
</Q_SLOTS> </Q_SLOTS>
<layoutdefaults spacing="3" margin="6"/> <layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>

Loading…
Cancel
Save