mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kfile: remove archive KIO slaves leftovers
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
637366d0a1
commit
bfa8788988
4 changed files with 2 additions and 78 deletions
|
@ -127,7 +127,7 @@ public:
|
|||
* Returns whether the protocol can act as a filter protocol.
|
||||
*
|
||||
* A filter protocol can operate on data that is passed to it
|
||||
* but does not retrieve/store data itself, like gzip.
|
||||
* but does not retrieve/store data itself, like sftp.
|
||||
* A filter protocol is the opposite of a source protocol.
|
||||
*
|
||||
* The "source=" field in the protocol description file determines
|
||||
|
@ -136,7 +136,7 @@ public:
|
|||
* "false" for filter protocol.
|
||||
*
|
||||
* @param url the url to check
|
||||
* @return true if the protocol is a filter (e.g. gzip), false if the
|
||||
* @return true if the protocol is a filter (e.g. sftp), false if the
|
||||
* protocol is a helper or source
|
||||
*/
|
||||
static bool isFilterProtocol( const KUrl &url );
|
||||
|
|
|
@ -146,12 +146,6 @@ public:
|
|||
*/
|
||||
QString retrievePlacePath() const;
|
||||
|
||||
/**
|
||||
* Returns true, if the MIME type of the path represents a
|
||||
* compressed file like TAR or ZIP.
|
||||
*/
|
||||
bool isCompressedPath(const KUrl& path) const;
|
||||
|
||||
void removeTrailingSlash(QString& url) const;
|
||||
|
||||
/**
|
||||
|
@ -762,20 +756,6 @@ QString KUrlNavigator::Private::retrievePlacePath() const
|
|||
return placePath;
|
||||
}
|
||||
|
||||
bool KUrlNavigator::Private::isCompressedPath(const KUrl& url) const
|
||||
{
|
||||
const KMimeType::Ptr mime = KMimeType::findByPath(url.path(KUrl::RemoveTrailingSlash));
|
||||
// Note: this list of MIME types depends on the protocols implemented by kio_archive
|
||||
return mime->is("application/x-compressed-tar") ||
|
||||
mime->is("application/x-bzip-compressed-tar") ||
|
||||
mime->is("application/x-lzma-compressed-tar") ||
|
||||
mime->is("application/x-xz-compressed-tar") ||
|
||||
mime->is("application/x-tar") ||
|
||||
mime->is("application/x-tarz") ||
|
||||
mime->is("application/zip") ||
|
||||
mime->is("application/x-archive");
|
||||
}
|
||||
|
||||
void KUrlNavigator::Private::removeTrailingSlash(QString& url) const
|
||||
{
|
||||
const int length = url.length();
|
||||
|
@ -991,30 +971,6 @@ void KUrlNavigator::setLocationUrl(const KUrl& newUrl)
|
|||
KUrl url = newUrl;
|
||||
url.cleanPath();
|
||||
|
||||
if ((url.protocol() == QLatin1String("tar")) || (url.protocol() == QLatin1String("zip"))) {
|
||||
// The URL represents a tar- or zip-file. Check whether
|
||||
// the URL is really part of the tar- or zip-file, otherwise
|
||||
// replace it by the local path again.
|
||||
bool insideCompressedPath = d->isCompressedPath(url);
|
||||
if (!insideCompressedPath) {
|
||||
KUrl prevUrl = url;
|
||||
KUrl parentUrl = url.upUrl();
|
||||
while (parentUrl != prevUrl) {
|
||||
if (d->isCompressedPath(parentUrl)) {
|
||||
insideCompressedPath = true;
|
||||
break;
|
||||
}
|
||||
prevUrl = parentUrl;
|
||||
parentUrl = parentUrl.upUrl();
|
||||
}
|
||||
}
|
||||
if (!insideCompressedPath) {
|
||||
// drop the tar: or zip: protocol since we are not
|
||||
// inside the compressed path
|
||||
url.setProtocol("file");
|
||||
}
|
||||
}
|
||||
|
||||
// Check whether current history element has the same URL.
|
||||
// If this is the case, just ignore setting the URL.
|
||||
const LocationData& data = d->m_history[d->m_historyIndex];
|
||||
|
|
|
@ -159,34 +159,4 @@ void KUrlNavigatorTest::testHistoryInsert()
|
|||
QCOMPARE(m_navigator->historySize(), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* When the current URL is inside an archive and the user goes "up", it is expected
|
||||
* that the new URL is that of the folder containing the archive (unless the URL was
|
||||
* in a subfolder inside the archive). Furthermore, the protocol should be "file".
|
||||
* An empty protocol would lead to problems in Dolphin, see
|
||||
*
|
||||
* https://bugs.kde.org/show_bug.cgi?id=251553
|
||||
*/
|
||||
|
||||
void KUrlNavigatorTest::bug251553_goUpFromArchive()
|
||||
{
|
||||
m_navigator->setLocationUrl(KUrl("zip:/test/archive.zip"));
|
||||
QCOMPARE(m_navigator->locationUrl().path(), QLatin1String("/test/archive.zip"));
|
||||
QCOMPARE(m_navigator->locationUrl().protocol(), QLatin1String("zip"));
|
||||
|
||||
bool ok = m_navigator->goUp();
|
||||
QVERIFY(ok);
|
||||
QCOMPARE(m_navigator->locationUrl().path(KUrl::AddTrailingSlash), QLatin1String("/test/"));
|
||||
QCOMPARE(m_navigator->locationUrl().protocol(), QLatin1String("file"));
|
||||
|
||||
m_navigator->setLocationUrl(KUrl("tar:/test/archive.tar.gz"));
|
||||
QCOMPARE(m_navigator->locationUrl().path(), QLatin1String("/test/archive.tar.gz"));
|
||||
QCOMPARE(m_navigator->locationUrl().protocol(), QLatin1String("tar"));
|
||||
|
||||
ok = m_navigator->goUp();
|
||||
QVERIFY(ok);
|
||||
QCOMPARE(m_navigator->locationUrl().path(KUrl::AddTrailingSlash), QLatin1String("/test/"));
|
||||
QCOMPARE(m_navigator->locationUrl().protocol(), QLatin1String("file"));
|
||||
}
|
||||
|
||||
#include "moc_kurlnavigatortest.cpp"
|
||||
|
|
|
@ -36,8 +36,6 @@ private slots:
|
|||
void testGoForward();
|
||||
void testHistoryInsert();
|
||||
|
||||
void bug251553_goUpFromArchive();
|
||||
|
||||
private:
|
||||
KUrlNavigator* m_navigator;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue