┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2008-01-21 16:07:45 +0000
committerPeter Penz <[email protected]>2008-01-21 16:07:45 +0000
commit8ba61eb0c77221f94b42f2f6a532e70da3d27ccb (patch)
treea413fe13e87968411cc1343b6c120bebe1e4bf7f /src
parent1daef0dc52a18b03e2bc5b4ce85944356b6b5da3 (diff)
Make it configurable whether a browsing through archives should be done. The default setting is 'off'. TODO: cleanup the "General Settings" dialog and split it as "General" and "Startup".
svn path=/trunk/KDE/kdebase/apps/; revision=764378
Diffstat (limited to 'src')
-rw-r--r--src/dolphin_generalsettings.kcfg4
-rw-r--r--src/dolphinviewcontainer.cpp29
-rw-r--r--src/generalsettingspage.cpp9
-rw-r--r--src/generalsettingspage.h2
4 files changed, 31 insertions, 13 deletions
diff --git a/src/dolphin_generalsettings.kcfg b/src/dolphin_generalsettings.kcfg
index 19474065a..7bf41d030 100644
--- a/src/dolphin_generalsettings.kcfg
+++ b/src/dolphin_generalsettings.kcfg
@@ -27,6 +27,10 @@
<label context="@label">Should the view properties used for all directories</label>
<default>false</default>
</entry>
+ <entry name="BrowseThroughArchives" type="Bool">
+ <label context="@label">Browse through archives</label>
+ <default>false</default>
+ </entry>
<entry name="ViewPropsTimestamp" type="DateTime" >
<label context="@label">Timestamp since when the view properties are valid</label>
</entry>
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index b9caa7b8e..1059f0f9a 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -399,10 +399,13 @@ void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
if (item.isDir()) {
m_view->setUrl(url);
- } else if (item.isFile() && url.isLocalFile()) {
- // allow to browse through ZIP and tar files
- // TODO: make this configurable for Dolphin in KDE 4.1
+ return;
+ }
+ const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
+ const bool browseThroughArchives = settings->browseThroughArchives() &&
+ item.isFile() && url.isLocalFile();
+ if (browseThroughArchives) {
KMimeType::Ptr mime = item.mimeTypePtr();
// Don't use mime->is("application/zip"), as this would
@@ -410,19 +413,21 @@ void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
if (mime->name() == "application/zip") {
url.setProtocol("zip");
m_view->setUrl(url);
- } else if (mime->is("application/x-tar") ||
- mime->is("application/x-tarz") ||
- mime->is("application/x-bzip-compressed-tar") ||
- mime->is("application/x-compressed-tar") ||
- mime->is("application/x-tzo")) {
+ return;
+ }
+
+ if (mime->is("application/x-tar") ||
+ mime->is("application/x-tarz") ||
+ mime->is("application/x-bzip-compressed-tar") ||
+ mime->is("application/x-compressed-tar") ||
+ mime->is("application/x-tzo")) {
url.setProtocol("tar");
m_view->setUrl(url);
- } else {
- item.run();
+ return;
}
- } else {
- item.run();
}
+
+ item.run();
}
#include "dolphinviewcontainer.moc"
diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp
index f856de1b1..ac24f2a57 100644
--- a/src/generalsettingspage.cpp
+++ b/src/generalsettingspage.cpp
@@ -48,7 +48,8 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
m_filterBar(0),
m_showDeleteCommand(0),
m_confirmMoveToTrash(0),
- m_confirmDelete(0)
+ m_confirmDelete(0),
+ m_browseThroughArchives(0)
{
const int spacing = KDialog::spacingHint();
@@ -109,6 +110,8 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* pa
// create 'Show the command 'Delete' in context menu' checkbox
m_showDeleteCommand = new QCheckBox(i18nc("@option:check", "Show 'Delete' command in context menu"), vBox);
+ m_browseThroughArchives = new QCheckBox(i18nc("option:check", "Browse through archives"), vBox);
+
// Add a dummy widget with no restriction regarding
// a vertical resizing. This assures that the dialog layout
// is not stretched vertically.
@@ -146,6 +149,8 @@ void GeneralSettingsPage::applySettings()
KConfigGroup kdeConfig(KGlobal::config(), "KDE");
kdeConfig.writeEntry("ShowDeleteCommand", m_showDeleteCommand->isChecked());
kdeConfig.sync();
+
+ settings->setBrowseThroughArchives(m_browseThroughArchives->isChecked());
}
void GeneralSettingsPage::restoreDefaults()
@@ -193,6 +198,8 @@ void GeneralSettingsPage::loadSettings()
const KConfigGroup kdeConfig(KGlobal::config(), "KDE");
m_showDeleteCommand->setChecked(kdeConfig.readEntry("ShowDeleteCommand", false));
+
+ m_browseThroughArchives->setChecked(settings->browseThroughArchives());
}
#include "generalsettingspage.moc"
diff --git a/src/generalsettingspage.h b/src/generalsettingspage.h
index 7bcf75c9e..824cfa9b7 100644
--- a/src/generalsettingspage.h
+++ b/src/generalsettingspage.h
@@ -65,6 +65,8 @@ private:
QCheckBox* m_showDeleteCommand;
QCheckBox* m_confirmMoveToTrash;
QCheckBox* m_confirmDelete;
+
+ QCheckBox* m_browseThroughArchives;
};
#endif