summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2012-05-08 16:56:25 -0500
committerDarrell Anderson <[email protected]>2012-05-08 16:56:25 -0500
commitc4050cef6c09c1aaf37aec25784f6120ab5f4470 (patch)
tree475cc9034d9fe73a807f0a35255364e662a62f49
parent8ecd10805a655acc958f241942b00826f71454cc (diff)
downloadtdebase-c4050cef6c09c1aaf37aec25784f6120ab5f4470.tar.gz
tdebase-c4050cef6c09c1aaf37aec25784f6120ab5f4470.zip
Add KControl (Peripherals/Storage Media/Advanced) controls to set
default mount options. Thanks to Francois Andriot. This partially resolves bug report 986.
-rw-r--r--kioslave/media/kcmodule/main.cpp1
-rw-r--r--kioslave/media/kcmodule/managermodule.cpp141
-rw-r--r--kioslave/media/kcmodule/managermodule.h15
-rw-r--r--kioslave/media/kcmodule/managermoduleview.ui273
-rw-r--r--kioslave/media/mediamanager/halbackend.cpp35
-rw-r--r--kioslave/media/propsdlgplugin/propertiespage.cpp14
-rw-r--r--kioslave/media/propsdlgplugin/propertiespagegui.ui490
7 files changed, 712 insertions, 257 deletions
diff --git a/kioslave/media/kcmodule/main.cpp b/kioslave/media/kcmodule/main.cpp
index da52ea119..48cee7ddf 100644
--- a/kioslave/media/kcmodule/main.cpp
+++ b/kioslave/media/kcmodule/main.cpp
@@ -67,6 +67,7 @@ MediaModule::MediaModule( TQWidget *parent, const char *name, const TQStringList
I18N_NOOP("(c) 2005 Jean-Remy Falleri"));
about->addAuthor("Jean-Remy Falleri", I18N_NOOP("Maintainer"), "[email protected]");
about->addAuthor("Kevin Ottens", 0, "ervin ipsquad net");
+ about->addAuthor("Valentine Sinitsyn", 0, "[email protected]");
about->addCredit("Achim Bohnet", I18N_NOOP("Help for the application design"));
setAboutData( about );
diff --git a/kioslave/media/kcmodule/managermodule.cpp b/kioslave/media/kcmodule/managermodule.cpp
index e0b30b90f..712b026f4 100644
--- a/kioslave/media/kcmodule/managermodule.cpp
+++ b/kioslave/media/kcmodule/managermodule.cpp
@@ -1,5 +1,6 @@
/* This file is part of the KDE Project
Copyright (c) 2005 K�vin Ottens <ervin ipsquad net>
+ Copyright (c) 2006 Valentine Sinitsyn <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -20,9 +21,13 @@
#include "managermodule.h"
+#include <kconfig.h>
#include <klocale.h>
#include <dcopref.h>
+#include <tqbutton.h>
#include <tqcheckbox.h>
+#include <tqcombobox.h>
+#include <tqobjectlist.h>
#include <kdirnotify_stub.h>
#include "managermoduleview.h"
@@ -31,7 +36,7 @@
ManagerModule::ManagerModule( TQWidget* parent, const char* name )
: KCModule( parent, name )
{
- ManagerModuleView *view = new ManagerModuleView( this );
+ view = new ManagerModuleView( this );
addConfig( MediaManagerSettings::self(), view );
@@ -49,12 +54,87 @@ ManagerModule::ManagerModule( TQWidget* parent, const char* name )
#endif
view->kcfg_CdPollingEnabled->setEnabled( false );
+ connect( view->option_automount, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_ro, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_quiet, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_flush, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_uid, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_utf8, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_sync, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_atime, SIGNAL( stateChanged(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_shortname, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) );
+ connect( view->option_journaling, SIGNAL( activated(int) ), this, SLOT( emitChanged() ) );
+
load();
+}
+
+
+void ManagerModule::load()
+{
+ KCModule::load();
+
+ KConfig config("mediamanagerrc");
+ config.setGroup("DefaultOptions");
+
+ view->option_automount->setChecked( config.readBoolEntry("automount", false) );
+ view->option_ro->setChecked( config.readBoolEntry("ro", false) );
+ view->option_quiet->setChecked( config.readBoolEntry("quiet", false) );
+ if (config.hasKey("flush"))
+ view->option_flush->setChecked( config.readBoolEntry("flush") );
+ else
+ view->option_flush->setNoChange();
+ view->option_uid->setChecked( config.readBoolEntry("uid", true) );
+ view->option_utf8->setChecked( config.readBoolEntry("utf8", true) );
+ if (config.hasKey("sync"))
+ view->option_sync->setChecked( config.readBoolEntry("sync") );
+ else
+ view->option_sync->setNoChange();
+ if (config.hasKey("atime"))
+ view->option_atime->setChecked( config.readBoolEntry("atime") );
+ else
+ view->option_atime->setNoChange();
+
+ QString value;
+
+ value = config.readEntry("shortname", "lower").lower();
+ for (int i = 0; i < view->option_shortname->count(); i++)
+ if (view->option_shortname->text(i).lower() == value) view->option_shortname->setCurrentItem(i);
+
+ value = config.readEntry("journaling", "ordered").lower();
+ for (int i = 0; i < view->option_journaling->count(); i++)
+ if (view->option_journaling->text(i).lower() == value) view->option_journaling->setCurrentItem(i);
+
+ rememberSettings();
}
void ManagerModule::save()
{
KCModule::save();
+
+ KConfig config("mediamanagerrc");
+ config.setGroup("DefaultOptions");
+
+ config.writeEntry("automount", view->option_automount->isChecked());
+ config.writeEntry("ro", view->option_ro->isChecked());
+ config.writeEntry("quiet", view->option_quiet->isChecked());
+ if (view->option_flush->state() == TQButton::NoChange)
+ config.deleteEntry("flush");
+ else
+ config.writeEntry("flush", view->option_flush->isChecked());
+ config.writeEntry("uid", view->option_uid->isChecked());
+ config.writeEntry("utf8", view->option_utf8->isChecked());
+ if (view->option_sync->state() == TQButton::NoChange)
+ config.deleteEntry("sync");
+ else
+ config.writeEntry("sync", view->option_sync->isChecked());
+ if (view->option_atime->state() == TQButton::NoChange)
+ config.deleteEntry("atime");
+ else
+ config.writeEntry("atime", view->option_atime->isChecked());
+ config.writeEntry("journaling", view->option_journaling->currentText().lower());
+ config.writeEntry("shortname", view->option_shortname->currentText().lower());
+
+ rememberSettings();
//Well... reloadBackends is buggy with HAL, it seems to be linked
//to a bug in the unmaintained Qt3 DBUS binding ;-/
@@ -70,5 +150,64 @@ void ManagerModule::save()
notifier.FilesAdded( "media:/" );
}
+void ManagerModule::defaults()
+{
+ KCModule::defaults();
+
+ view->option_automount->setChecked(false);
+ view->option_ro->setChecked(false);
+ view->option_quiet->setChecked(false);
+ view->option_flush->setNoChange();
+ view->option_uid->setChecked(true);
+ view->option_utf8->setChecked(true);
+ view->option_sync->setNoChange();
+ view->option_atime->setNoChange();
+ view->option_journaling->setCurrentItem(1);
+ view->option_shortname->setCurrentItem(0);
+}
+
+void ManagerModule::rememberSettings()
+{
+ TQObjectList *options = view->queryList(0, "^option_");
+ TQObject *current = 0;
+ TQObjectListIterator it(*options);
+
+ settings.clear();
+ while ( (current = it.current()) != 0 ) {
+ if (current->isA("TQCheckBox"))
+ settings[current] = ((TQCheckBox *)current)->state();
+ else if (current->isA("TQComboBox"))
+ settings[current] = ((TQComboBox *)current)->currentItem();
+ ++it;
+ }
+ delete options;
+
+}
+
+void ManagerModule::emitChanged()
+{
+ TQObjectList *options = view->queryList(0, "^option_");
+ TQObject *current = 0;
+ TQObjectListIterator it(*options);
+ int value = -1;
+ bool somethingChanged = false;
+
+ while ( (current = it.current()) != 0 ) {
+ if (current->isA("TQCheckBox"))
+ value = ((TQCheckBox *)current)->state();
+ else if (current->isA("TQComboBox"))
+ value = ((TQComboBox *)current)->currentItem();
+
+ if (settings[current] != value) {
+ somethingChanged = true;
+ break;
+ }
+
+ ++it;
+ }
+ delete options;
+
+ emit changed(somethingChanged);
+}
#include "managermodule.moc"
diff --git a/kioslave/media/kcmodule/managermodule.h b/kioslave/media/kcmodule/managermodule.h
index 0b62dfc5e..e34610c7e 100644
--- a/kioslave/media/kcmodule/managermodule.h
+++ b/kioslave/media/kcmodule/managermodule.h
@@ -1,5 +1,6 @@
/* This file is part of the KDE Project
Copyright (c) 2005 K�vin Ottens <ervin ipsquad net>
+ Copyright (c) 2006 Valentine Sinitsyn <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -19,8 +20,11 @@
#ifndef _MANAGERMODULE_H_
#define _MANAGERMODULE_H_
+#include <tqmap.h>
#include <kcmodule.h>
+class ManagerModuleView;
+
class ManagerModule : public KCModule
{
Q_OBJECT
@@ -28,7 +32,18 @@ class ManagerModule : public KCModule
public:
ManagerModule( TQWidget* parent = 0, const char* name = 0);
+ void load();
void save();
+ void defaults();
+
+private:
+ void rememberSettings();
+
+ ManagerModuleView *view;
+ TQMap<TQObject *, int> settings;
+
+private slots:
+ void emitChanged();
};
#endif
diff --git a/kioslave/media/kcmodule/managermoduleview.ui b/kioslave/media/kcmodule/managermoduleview.ui
index 8a088f7cf..afde70c75 100644
--- a/kioslave/media/kcmodule/managermoduleview.ui
+++ b/kioslave/media/kcmodule/managermoduleview.ui
@@ -12,6 +12,9 @@
<height>480</height>
</rect>
</property>
+ <property name="caption">
+ <string>ManagerModuleView</string>
+ </property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
@@ -49,6 +52,245 @@
<string>Select this if you want to enable application autostart after mounting a device.</string>
</property>
</widget>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupbox_mount</cstring>
+ </property>
+ <property name="title">
+ <string>Mount options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Here you can specify default mount options for your storage media. Please note that some options are not supported for certain filesystems and/or medium. You will be able to redefine all these options on per-volume basis later, using Properties dialog of the corresponding volume.&lt;br&gt;
+Some of the options are tristate. Leave them "undefined" to let KDE choose the best value depending on your media.</string>
+ </property>
+ <property name="alignment">
+ <set>WordBreak|AlignVCenter</set>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout30</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQCheckBox" row="1" column="0">
+ <property name="name">
+ <cstring>option_ro</cstring>
+ </property>
+ <property name="text">
+ <string>Read only</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>By default, mount all file systems read-only.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="1">
+ <property name="name">
+ <cstring>option_uid</cstring>
+ </property>
+ <property name="text">
+ <string>Mount as user</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Mount this file system as user.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>option_flush</cstring>
+ </property>
+ <property name="text">
+ <string>Flushed IO</string>
+ </property>
+ <property name="tristate">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Always flush all data to the hot plug devices immediately and don't cache it.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="3" column="0">
+ <property name="name">
+ <cstring>option_sync</cstring>
+ </property>
+ <property name="text">
+ <string>Synchronous</string>
+ </property>
+ <property name="tristate">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>All I/O to the file system should be done synchronously.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="2" column="0">
+ <property name="name">
+ <cstring>option_quiet</cstring>
+ </property>
+ <property name="text">
+ <string>Quiet</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Attempts to chown or chmod files do not return errors, although they fail. Use with caution!</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="1" column="1">
+ <property name="name">
+ <cstring>option_utf8</cstring>
+ </property>
+ <property name="text">
+ <string>UTF-8 charset</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the console. It can be be enabled for the filesystem with this option.</string>
+ </property>
+ </widget>
+ <widget class="TQLayoutWidget" row="3" column="1" rowspan="2" colspan="1">
+ <property name="name">
+ <cstring>layout29</cstring>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel" row="1" column="0">
+ <property name="name">
+ <cstring>text_shortname</cstring>
+ </property>
+ <property name="text">
+ <string>Short names:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>option_shortname</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;h2&gt;Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.&lt;/h2&gt;
+
+&lt;h3&gt;&lt;b&gt;Lower&lt;/b&gt;&lt;/h3&gt;
+Force the short name to lower case upon display; store a long name when the short name is not all upper case.
+
+&lt;h3&gt;&lt;b&gt;Windows 95&lt;/b&gt;&lt;/h3&gt;
+Force the short name to upper case upon display; store a long name when the short name is not all upper case.
+
+&lt;h3&gt;&lt;b&gt;Windows NT&lt;/b&gt;&lt;/h3&gt;
+Display the shortname as is; store a long name when the short name is not all lower case or all upper case.
+
+&lt;h3&gt;&lt;b&gt;Mixed&lt;/b&gt;&lt;/h3&gt;
+Display the short name as is; store a long name when the short name is not all upper case.</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>All Data</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Ordered</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Writeback</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>option_journaling</cstring>
+ </property>
+ <property name="currentItem">
+ <number>1</number>
+ </property>
+ </widget>
+ <widget class="TQLabel" row="0" column="0">
+ <property name="name">
+ <cstring>text_journaling</cstring>
+ </property>
+ <property name="text">
+ <string>Journaling:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>option_journaling</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;h2&gt;Specifies the journalling mode for file data. Metadata is always journaled. &lt;/h2&gt;
+
+&lt;h3&gt;&lt;b&gt;All Data&lt;/b&gt;&lt;/h3&gt;
+ All data is committed into the journal prior to being written into the main file system. This is the slowest variant with the highest data security.
+
+&lt;h3&gt;&lt;b&gt;Ordered&lt;/b&gt;&lt;/h3&gt;
+ All data is forced directly out to the main file system prior to its metadata being committed to the journal.
+
+&lt;h3&gt;&lt;b&gt;Write Back&lt;/b&gt;&lt;/h3&gt;
+ Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery.</string>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="1" column="1">
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Windows 95</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Windows NT</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mixed</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>option_shortname</cstring>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="TQCheckBox" row="0" column="0">
+ <property name="name">
+ <cstring>option_automount</cstring>
+ </property>
+ <property name="text">
+ <string>Mount automatically</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>By default, mount all file systems automatically.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox" row="4" column="0">
+ <property name="name">
+ <cstring>option_atime</cstring>
+ </property>
+ <property name="text">
+ <string>Access time updates</string>
+ </property>
+ <property name="tristate">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Update inode access time for each access.</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </vbox>
+ </widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
@@ -62,11 +304,40 @@
<property name="sizeHint">
<size>
<width>21</width>
- <height>360</height>
+ <height>130</height>
</size>
</property>
</spacer>
</vbox>
</widget>
+<connections>
+ <connection>
+ <sender>kcfg_HalBackendEnabled</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>groupbox_mount</receiver>
+ <slot>setEnabled(bool)</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>kcfg_HalBackendEnabled</tabstop>
+ <tabstop>kcfg_CdPollingEnabled</tabstop>
+ <tabstop>kcfg_AutostartEnabled</tabstop>
+ <tabstop>option_automount</tabstop>
+ <tabstop>option_ro</tabstop>
+ <tabstop>option_quiet</tabstop>
+ <tabstop>option_sync</tabstop>
+ <tabstop>option_atime</tabstop>
+ <tabstop>option_flush</tabstop>
+ <tabstop>option_utf8</tabstop>
+ <tabstop>option_uid</tabstop>
+ <tabstop>option_journaling</tabstop>
+ <tabstop>option_shortname</tabstop>
+</tabstops>
+<includes>
+ <include location="local" impldecl="in implementation">managermoduleview.ui.h</include>
+</includes>
+<functions>
+ <function access="private" specifier="non virtual">init()</function>
+</functions>
<layoutdefaults spacing="6" margin="11"/>
</UI>
diff --git a/kioslave/media/mediamanager/halbackend.cpp b/kioslave/media/mediamanager/halbackend.cpp
index a6726c8eb..8d4d6f0a7 100644
--- a/kioslave/media/mediamanager/halbackend.cpp
+++ b/kioslave/media/mediamanager/halbackend.cpp
@@ -1,5 +1,6 @@
/* This file is part of the KDE Project
Copyright (c) 2004-2005 Jérôme Lodewyck <jerome dot lodewyck at normalesup dot org>
+ Copyright (c) 2006 Valentine Sinitsyn <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -56,9 +57,7 @@ TQString libhal_device_get_property_QString(LibHalContext *ctx, const char* udi,
{
char* _ppt_string;
TQString _ppt_QString;
- DBusError error;
- dbus_error_init(&error);
- _ppt_string = libhal_device_get_property_string(ctx, udi, key, &error);
+ _ppt_string = libhal_device_get_property_string(ctx, udi, key, NULL);
if ( _ppt_string )
_ppt_QString = _ppt_string;
libhal_free_string(_ppt_string);
@@ -929,7 +928,16 @@ TQStringList HALBackend::mountoptions(const TQString &name)
}
KConfig config("mediamanagerrc");
- config.setGroup(name);
+
+ bool use_defaults = true;
+ if (config.hasGroup(name))
+ {
+ config.setGroup(name);
+ use_defaults = config.readBoolEntry("use_defaults", false);
+ }
+
+ if (use_defaults)
+ config.setGroup("DefaultOptions");
char ** array = libhal_device_get_property_strlist(m_halContext, volume_udi.latin1(), "volume.mount.valid_options", NULL);
TQMap<TQString,bool> valids;
@@ -944,6 +952,8 @@ TQStringList HALBackend::mountoptions(const TQString &name)
libhal_free_string_array(array);
TQStringList result;
TQString tmp;
+
+ result << TQString("use_defaults=%1").arg(use_defaults ? "true" : "false");
TQString fstype = libhal_device_get_property_QString(m_halContext, volume_udi.latin1(), "volume.fstype");
if (fstype.isNull())
@@ -956,9 +966,18 @@ TQStringList HALBackend::mountoptions(const TQString &name)
removable = libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.removable", NULL)
|| libhal_device_get_property_bool(m_halContext, drive_udi.latin1(), "storage.hotpluggable", NULL);
- config.setGroup(drive_udi);
- bool value = config.readBoolEntry("automount", false);
- config.setGroup(name);
+ bool value;
+ if (use_defaults)
+ {
+ value = config.readBoolEntry("automount", false);
+ }
+ else
+ {
+ QString current_group = config.group();
+ config.setGroup(drive_udi);
+ value = config.readBoolEntry("automount", false);
+ config.setGroup(current_group);
+ }
if (libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_blank", NULL)
|| libhal_device_get_property_bool(m_halContext, volume_udi.latin1(), "volume.disc.is_vcd", NULL)
@@ -1083,7 +1102,7 @@ bool HALBackend::setMountoptions(const TQString &name, const TQStringList &optio
TQMap<TQString,TQString> valids = MediaManagerUtils::splitOptions(options);
- const char *names[] = { "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 };
+ const char *names[] = { "use_defaults", "ro", "quiet", "atime", "uid", "utf8", "flush", "sync", 0 };
for (int index = 0; names[index]; ++index)
if (valids.contains(names[index]))
config.writeEntry(names[index], valids[names[index]] == "true");
diff --git a/kioslave/media/propsdlgplugin/propertiespage.cpp b/kioslave/media/propsdlgplugin/propertiespage.cpp
index 14ac2b33f..33d481ef5 100644
--- a/kioslave/media/propsdlgplugin/propertiespage.cpp
+++ b/kioslave/media/propsdlgplugin/propertiespage.cpp
@@ -140,12 +140,23 @@ PropertiesPage::PropertiesPage(TQWidget* parent, const TQString &_id)
option_automount->setChecked(options["automount"] == "true");
connect( option_automount, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) );
+ bool has_groupbox_specific = true;
if (!options.contains("journaling") &&
!options.contains("shortname") &&
!options.contains("uid") &&
!options.contains("utf8") &&
- !options.contains("flush"))
+ !options.contains("flush")) {
groupbox_specific->hide();
+ has_groupbox_specific = false;
+ }
+
+ // The order is important - we want groupboxes to hide automatically depending on use_defaults
+ // but don't want to emit changed() until user actually changes something.
+ connect( option_defaults, TQT_SIGNAL( toggled(bool) ), groupbox_generic, SLOT( setHidden(bool) ) );
+ if (has_groupbox_specific)
+ connect( option_defaults, TQT_SIGNAL( toggled(bool) ), groupbox_specific, SLOT( setHidden(bool) ) );
+ option_defaults->setChecked(options["use_defaults"] == "true");
+ connect( option_defaults, TQT_SIGNAL( stateChanged(int) ), TQT_SIGNAL( changed() ) );
} else {
@@ -198,6 +209,7 @@ bool PropertiesPage::save()
}
result << TQString("mountpoint=%1").arg(mp);
result << TQString("automount=%1").arg(option_automount->isChecked() ? "true" : "false");
+ result << TQString("use_defaults=%1").arg(option_defaults->isChecked() ? "true" : "false");
kdDebug() << result << endl;
diff --git a/kioslave/media/propsdlgplugin/propertiespagegui.ui b/kioslave/media/propsdlgplugin/propertiespagegui.ui
index 51ead3a25..2a6ff899e 100644
--- a/kioslave/media/propsdlgplugin/propertiespagegui.ui
+++ b/kioslave/media/propsdlgplugin/propertiespagegui.ui
@@ -8,207 +8,207 @@
<rect>
<x>0</x>
<y>0</y>
- <width>527</width>
- <height>476</height>
+ <width>219</width>
+ <height>446</height>
</rect>
</property>
- <hbox>
+ <property name="caption">
+ <string>PropertiesPageGUI</string>
+ </property>
+ <vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <property name="margin">
- <number>0</number>
- </property>
- <widget class="TQLayoutWidget">
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_defaults</cstring>
+ </property>
+ <property name="text">
+ <string>Use default mount options</string>
+ </property>
+ </widget>
+ <widget class="TQGroupBox">
<property name="name">
- <cstring>layout17</cstring>
+ <cstring>groupbox_generic</cstring>
+ </property>
+ <property name="title">
+ <string>Generic Mount Options</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="TQGroupBox">
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>groupbox_generic</cstring>
- </property>
- <property name="title">
- <string>Generic Mount Options</string>
+ <cstring>layout15</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_ro</cstring>
+ </property>
+ <property name="text">
+ <string>Read only</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Mount the file system read-only.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_quiet</cstring>
+ </property>
+ <property name="text">
+ <string>Quiet</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Attempts to chown or chmod files do not return errors, although they fail. Use with caution!</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_sync</cstring>
+ </property>
+ <property name="text">
+ <string>Synchronous</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>All I/O to the file system should be done synchronously.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_atime</cstring>
+ </property>
+ <property name="text">
+ <string>Access time updates</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Update inode access time for each access.</string>
+ </property>
+ </widget>
<widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout15</cstring>
+ <cstring>layout14</cstring>
</property>
- <vbox>
+ <hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_ro</cstring>
- </property>
- <property name="text">
- <string>Read only</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Mount the file system read-only.</string>
- </property>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_quiet</cstring>
- </property>
- <property name="text">
- <string>Quiet</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Attempts to chown or chmod files do not return errors, although they fail. Use with caution!</string>
- </property>
- </widget>
- <widget class="TQCheckBox">
+ <widget class="TQLabel">
<property name="name">
- <cstring>option_sync</cstring>
+ <cstring>textLabel3</cstring>
</property>
<property name="text">
- <string>Synchronous</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>All I/O to the file system should be done synchronously.</string>
+ <string>Mountpoint:</string>
</property>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_atime</cstring>
- </property>
- <property name="text">
- <string>Access time updates</string>
+ <property name="buddy" stdset="0">
+ <cstring>option_mountpoint</cstring>
</property>
<property name="whatsThis" stdset="0">
- <string>Update inode access time for each access.</string>
+ <string>Under what directory this file system shall be mounted. Please note that there is no guarantee that the system will respect your wish. For one the directory has to be below /media - and it does not yet have to exist.</string>
</property>
</widget>
- <widget class="TQLayoutWidget">
+ <widget class="TQLineEdit">
<property name="name">
- <cstring>layout14</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>Mountpoint:</string>
- </property>
- <property name="buddy" stdset="0">
- <cstring>option_mountpoint</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Under what directory this file system shall be mounted. Please note that there is no guarantee that the system will respect your wish. For one the directory has to be below /media - and it does not yet have to exist.</string>
- </property>
- </widget>
- <widget class="TQLineEdit">
- <property name="name">
- <cstring>option_mountpoint</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_automount</cstring>
+ <cstring>option_mountpoint</cstring>
</property>
<property name="text">
- <string>Mount automatically</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Mount this file system automatically.</string>
+ <string></string>
</property>
</widget>
- </vbox>
+ </hbox>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_automount</cstring>
+ </property>
+ <property name="text">
+ <string>Mount automatically</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Mount this file system automatically.</string>
+ </property>
</widget>
</vbox>
</widget>
- <widget class="TQGroupBox">
+ </vbox>
+ </widget>
+ <widget class="TQGroupBox">
+ <property name="name">
+ <cstring>groupbox_specific</cstring>
+ </property>
+ <property name="title">
+ <string>Filesystem Specific Mount Options</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLayoutWidget">
<property name="name">
- <cstring>groupbox_specific</cstring>
- </property>
- <property name="title">
- <string>Filesystem Specific Mount Options</string>
+ <cstring>layout11</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_flush</cstring>
+ </property>
+ <property name="text">
+ <string>Flushed IO</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Always flush all data to the hot plug devices immediately and don't cache it.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_utf8</cstring>
+ </property>
+ <property name="text">
+ <string>UTF-8 charset</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the console. It can be be enabled for the filesystem with this option.</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
+ <cstring>option_uid</cstring>
+ </property>
+ <property name="text">
+ <string>Mount as user</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Mount this file system as user.</string>
+ </property>
+ </widget>
<widget class="TQLayoutWidget">
<property name="name">
- <cstring>layout11</cstring>
+ <cstring>layout7</cstring>
</property>
- <vbox>
+ <hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="TQCheckBox">
+ <widget class="TQLabel">
<property name="name">
- <cstring>option_flush</cstring>
+ <cstring>text_journaling</cstring>
</property>
<property name="text">
- <string>Flushed IO</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Always flush all data to the hot plug devices immediately and don't cache it.</string>
- </property>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_utf8</cstring>
- </property>
- <property name="text">
- <string>UTF-8 charset</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>UTF8 is the filesystem safe 8-bit encoding of Unicode that is used by the console. It can be be enabled for the filesystem with this option.</string>
- </property>
- </widget>
- <widget class="TQCheckBox">
- <property name="name">
- <cstring>option_uid</cstring>
+ <string>Journaling:</string>
</property>
- <property name="text">
- <string>Mount as user</string>
+ <property name="buddy" stdset="0">
+ <cstring>option_journaling</cstring>
</property>
<property name="whatsThis" stdset="0">
- <string>Mount this file system as user.</string>
- </property>
- </widget>
- <widget class="TQLayoutWidget">
- <property name="name">
- <cstring>layout7</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>text_journaling</cstring>
- </property>
- <property name="text">
- <string>Journaling:</string>
- </property>
- <property name="buddy" stdset="0">
- <cstring>option_journaling</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>&lt;h2&gt;Specifies the journalling mode for file data. Metadata is always journaled. &lt;/h2&gt;
+ <string>&lt;h2&gt;Specifies the journalling mode for file data. Metadata is always journaled. &lt;/h2&gt;
&lt;h3&gt;&lt;b&gt;All Data&lt;/b&gt;&lt;/h3&gt;
All data is committed into the journal prior to being written into the main file system. This is the slowest variant with the highest data security.
@@ -218,29 +218,29 @@
&lt;h3&gt;&lt;b&gt;Write Back&lt;/b&gt;&lt;/h3&gt;
Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery.</string>
- </property>
- </widget>
- <widget class="TQComboBox">
- <item>
- <property name="text">
- <string>All Data</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Ordered</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Write Back</string>
- </property>
- </item>
- <property name="name">
- <cstring>option_journaling</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>&lt;h2&gt;Specifies the journalling mode for file data. Metadata is always journaled. &lt;/h2&gt;
+ </property>
+ </widget>
+ <widget class="TQComboBox">
+ <item>
+ <property name="text">
+ <string>All Data</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Ordered</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Write Back</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>option_journaling</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;h2&gt;Specifies the journalling mode for file data. Metadata is always journaled. &lt;/h2&gt;
&lt;h3&gt;&lt;b&gt;All Data&lt;/b&gt;&lt;/h3&gt;
All data is committed into the journal prior to being written into the main file system. This is the slowest variant with the highest data security.
@@ -250,30 +250,30 @@
&lt;h3&gt;&lt;b&gt;Write Back&lt;/b&gt;&lt;/h3&gt;
Data ordering is not preserved - data may be written into the main file system after its metadata has been committed to the journal. This is rumoured to be the highest-throughput option. It guarantees internal file system integrity, however it can allow old data to appear in files after a crash and journal recovery.</string>
- </property>
- </widget>
- </hbox>
+ </property>
</widget>
- <widget class="TQLayoutWidget">
+ </hbox>
+ </widget>
+ <widget class="TQLayoutWidget">
+ <property name="name">
+ <cstring>layout14</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="TQLabel">
<property name="name">
- <cstring>layout14</cstring>
+ <cstring>text_shortname</cstring>
</property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="TQLabel">
- <property name="name">
- <cstring>text_shortname</cstring>
- </property>
- <property name="text">
- <string>Short names:</string>
- </property>
- <property name="buddy" stdset="0">
- <cstring>option_shortname</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>&lt;h2&gt;Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.&lt;/h2&gt;
+ <property name="text">
+ <string>Short names:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>option_shortname</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;h2&gt;Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.&lt;/h2&gt;
&lt;h3&gt;&lt;b&gt;Lower&lt;/b&gt;&lt;/h3&gt;
Force the short name to lower case upon display; store a long name when the short name is not all upper case.
@@ -286,34 +286,34 @@ Display the shortname as is; store a long name when the short name is not all lo
&lt;h3&gt;&lt;b&gt;Mixed&lt;/b&gt;&lt;/h3&gt;
Display the short name as is; store a long name when the short name is not all upper case.</string>
- </property>
- </widget>
- <widget class="TQComboBox">
- <item>
- <property name="text">
- <string>Lower</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Windows 95</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Windows NT</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Mixed</string>
- </property>
- </item>
- <property name="name">
- <cstring>option_shortname</cstring>
- </property>
- <property name="whatsThis" stdset="0">
- <string>&lt;h2&gt;Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.&lt;/h2&gt;
+ </property>
+ </widget>
+ <widget class="TQComboBox">
+ <item>
+ <property name="text">
+ <string>Lower</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Windows 95</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Windows NT</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Mixed</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>option_shortname</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;h2&gt;Defines the behaviour for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be preferred display.&lt;/h2&gt;
&lt;h3&gt;&lt;b&gt;Lower&lt;/b&gt;&lt;/h3&gt;
Force the short name to lower case upon display; store a long name when the short name is not all upper case.
@@ -326,42 +326,40 @@ Display the shortname as is; store a long name when the short name is not all lo
&lt;h3&gt;&lt;b&gt;Mixed&lt;/b&gt;&lt;/h3&gt;
Display the short name as is; store a long name when the short name is not all upper case.</string>
- </property>
- </widget>
- </hbox>
+ </property>
</widget>
- </vbox>
+ </hbox>
</widget>
</vbox>
</widget>
- <widget class="TQLabel">
- <property name="name">
- <cstring>label_filesystem</cstring>
- </property>
- <property name="text">
- <string>Filesystem: iso9660</string>
- </property>
- </widget>
- <spacer>
- <property name="name">
- <cstring>spacer1</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
</vbox>
</widget>
- </hbox>
+ <widget class="TQLabel">
+ <property name="name">
+ <cstring>label_filesystem</cstring>
+ </property>
+ <property name="text">
+ <string>Filesystem: iso9660</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
</widget>
<connections>
<connection>