[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kfile
From:       Frank Reininghaus <frank78ac () googlemail ! com>
Date:       2010-11-15 18:40:52
Message-ID: 20101115184052.0BF08AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1197418 by freininghaus:

When going "up" out of an archive, set the protocol to "file". Fixes
the problem that Dolphin reports an "invalid protocol" and is unable
to view the folder containing the archive.

This is a fix for a regression caused by r1168855. Unit test included.


 M  +2 -2      kurlnavigator.cpp  
 M  +30 -0     tests/kurlnavigatortest.cpp  
 M  +2 -0      tests/kurlnavigatortest.h  


--- trunk/KDE/kdelibs/kfile/kurlnavigator.cpp #1197417:1197418
@@ -1005,8 +1005,8 @@
         }
         if (!insideCompressedPath) {
             // drop the tar: or zip: protocol since we are not
-            // inside the compressed path anymore
-            url.setProtocol(QString());
+            // inside the compressed path
+            url.setProtocol("file");
         }
     }
 
--- trunk/KDE/kdelibs/kfile/tests/kurlnavigatortest.cpp #1197417:1197418
@@ -159,4 +159,34 @@
     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 "kurlnavigatortest.moc"
--- trunk/KDE/kdelibs/kfile/tests/kurlnavigatortest.h #1197417:1197418
@@ -36,6 +36,8 @@
     void testGoForward();
     void testHistoryInsert();
 
+    void bug251553_goUpFromArchive();
+
 private:
     KUrlNavigator* m_navigator;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic