From: Peter Penz Date: Mon, 21 Jan 2008 16:07:45 +0000 (+0000) Subject: Make it configurable whether a browsing through archives should be done. The default... X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/8ba61eb0c77221f94b42f2f6a532e70da3d27ccb?ds=inline 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 --- 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 @@ false + + + false + 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