]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Make it configurable whether a browsing through archives should be done. The default...
authorPeter Penz <peter.penz19@gmail.com>
Mon, 21 Jan 2008 16:07:45 +0000 (16:07 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 21 Jan 2008 16:07:45 +0000 (16:07 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=764378

src/dolphin_generalsettings.kcfg
src/dolphinviewcontainer.cpp
src/generalsettingspage.cpp
src/generalsettingspage.h

index 19474065aaa856ae1e20101122cdb47ed04bbd19..7bf41d03044a06afc8ce6908694838f2065c23b8 100644 (file)
             <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>
index b9caa7b8e6fdafd27cd0ae7b80abeb27afc31868..1059f0f9a7bd211c4d00afd4d0f08ee41f0237c3 100644 (file)
@@ -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"
index f856de1b17894e8135115bf084abf86dd7b6d31c..ac24f2a574ff0605d7d692ddee9dcd60416a3ff0 100644 (file)
@@ -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"
index 7bcf75c9e3835d11b3b80646733de04e5d4a883d..824cfa9b7ececb811822160fe5e3c00449432dc5 100644 (file)
@@ -65,6 +65,8 @@ private:
     QCheckBox* m_showDeleteCommand;
     QCheckBox* m_confirmMoveToTrash;
     QCheckBox* m_confirmDelete;
+
+    QCheckBox* m_browseThroughArchives;
 };
 
 #endif