Browse Source

Added logic for selection of default file manager from TCC.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/133/head
Michele Calgaro 5 months ago
parent
commit
a430111b10
Signed by: MicheleC <michele.calgaro@yahoo.it> GPG Key ID: 2A75B7CA8ADED5CF
3 changed files with 87 additions and 190 deletions
  1. +15
    -48
      kcontrol/componentchooser/componentchooser.cpp
  2. +1
    -1
      kcontrol/componentchooser/componentchooser.h
  3. +71
    -141
      kcontrol/componentchooser/filemanagerconfig_ui.ui

+ 15
- 48
kcontrol/componentchooser/componentchooser.cpp View File

@@ -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


+ 1
- 1
kcontrol/componentchooser/componentchooser.h View File

@@ -96,7 +96,7 @@ public:
virtual void defaults();

protected slots:
void selectFileManagerApp();
void selectFileAssociations();
void configChanged();

signals:


+ 71
- 141
kcontrol/componentchooser/filemanagerconfig_ui.ui View File

@@ -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 &amp;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>&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>
<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.&lt;br&gt; </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"/>


Loading…
Cancel
Save