dolphin: drop support for opening archives as folder

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-06 14:13:24 +03:00
parent 24fa558df4
commit 5ad83d26f5
6 changed files with 9 additions and 35 deletions

View file

@ -443,10 +443,10 @@ void DolphinViewContainer::slotUrlIsFileError(const KUrl& url)
{
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
// Find out if the file can be opened in the view (for example, this is the
// case if the file is an archive). The mime type must be known for that.
// Find out if the file can be opened in the view. The mime type must be
// known for that.
item.determineMimeType();
const KUrl& folderUrl = DolphinView::openItemAsFolderUrl(item, true);
const KUrl& folderUrl = DolphinView::openItemAsFolderUrl(item);
if (!folderUrl.isEmpty()) {
m_view->setUrl(folderUrl);
} else {
@ -461,7 +461,7 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item)
// results in an active view.
m_view->setActive(true);
const KUrl& url = DolphinView::openItemAsFolderUrl(item, GeneralSettings::browseThroughArchives());
const KUrl& url = DolphinView::openItemAsFolderUrl(item);
if (!url.isEmpty()) {
m_view->setUrl(url);
return;

View file

@ -45,10 +45,6 @@
<label>Should the view properties be used for all directories</label>
<default>false</default>
</entry>
<entry name="BrowseThroughArchives" type="Bool">
<label>Browse through archives</label>
<default>false</default>
</entry>
<entry name="ConfirmClosingMultipleTabs" type="Bool">
<label>Ask for confirmation when closing windows with multiple tabs.</label>
<default>true</default>

View file

@ -34,7 +34,6 @@
NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
SettingsPageBase(parent),
m_openArchivesAsFolder(0),
m_autoExpandFolders(0)
{
const int spacing = KDialog::spacingHint();
@ -55,8 +54,6 @@ NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
mouseBoxLayout->addWidget(m_singleClick);
mouseBoxLayout->addWidget(m_doubleClick);
m_openArchivesAsFolder = new QCheckBox(i18nc("@option:check", "Open archives as folder"), vBox);
m_autoExpandFolders = new QCheckBox(i18nc("option:check", "Open folders during drag operations"), vBox);
// Add a dummy widget with no restriction regarding
@ -70,7 +67,6 @@ NavigationSettingsPage::NavigationSettingsPage(QWidget* parent) :
connect(m_singleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_doubleClick, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_openArchivesAsFolder, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
connect(m_autoExpandFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
}
@ -87,7 +83,6 @@ void NavigationSettingsPage::applySettings()
KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged, KGlobalSettings::SETTINGS_MOUSE);
GeneralSettings* settings = GeneralSettings::self();
settings->setBrowseThroughArchives(m_openArchivesAsFolder->isChecked());
settings->setAutoExpandFolders(m_autoExpandFolders->isChecked());
settings->writeConfig();
@ -111,7 +106,6 @@ void NavigationSettingsPage::loadSettings()
const bool singleClick = KGlobalSettings::singleClick();
m_singleClick->setChecked(singleClick);
m_doubleClick->setChecked(!singleClick);
m_openArchivesAsFolder->setChecked(GeneralSettings::browseThroughArchives());
m_autoExpandFolders->setChecked(GeneralSettings::autoExpandFolders());
}

View file

@ -47,7 +47,6 @@ private:
private:
QRadioButton* m_singleClick;
QRadioButton* m_doubleClick;
QCheckBox* m_openArchivesAsFolder;
QCheckBox* m_autoExpandFolders;
};

View file

@ -1185,7 +1185,7 @@ QString DolphinView::viewPropertiesContext() const
return m_viewPropertiesContext;
}
KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives)
KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item)
{
if (item.isNull()) {
return KUrl();
@ -1198,22 +1198,7 @@ KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
}
if (item.isMimeTypeKnown()) {
const QString& mimetype = item.mimetype();
if (browseThroughArchives && item.isFile() && url.isLocalFile()) {
// Generic mechanism for redirecting to tar:/<path>/ when clicking on a tar file,
// zip:/<path>/ when clicking on a zip file, etc.
// The .protocol file specifies the mimetype that the kioslave handles.
// Note that we don't use mimetype inheritance since we don't want to
// open OpenDocument files as zip folders...
const QString& protocol = KProtocolManager::protocolForArchiveMimetype(mimetype);
if (!protocol.isEmpty()) {
url.setProtocol(protocol);
return url;
}
}
if (mimetype == QLatin1String("application/x-desktop")) {
if (item.mimetype() == QLatin1String("application/x-desktop")) {
// Redirect to the URL in Type=Link desktop files, unless it is a http(s) URL.
KDesktopFile desktopFile(url.toLocalFile());
if (desktopFile.hasLinkType()) {

View file

@ -303,12 +303,12 @@ public:
QString viewPropertiesContext() const;
/**
* Checks if the given \a item can be opened as folder (e.g. archives).
* This function will also adjust the \a url (e.g. change the protocol).
* Checks if the given \a item can be opened as folder. This function
* will also adjust the \a url (e.g. change the protocol).
* @return a valid and adjusted url if the item can be opened as folder,
* otherwise return an empty url.
*/
static KUrl openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives = true);
static KUrl openItemAsFolderUrl(const KFileItem& item);
public slots:
/**