]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix Bug 310465 - Can't switch view mode for non-writable paths
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Sun, 25 Nov 2012 20:44:01 +0000 (21:44 +0100)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Sun, 25 Nov 2012 20:44:01 +0000 (21:44 +0100)
BUG: 310465
FIXED-IN: 4.9.4
REVIEW: 107458

src/views/viewproperties.cpp

index ff0c274bef5df435174429f5d149b0e8dcf23e0c..30deb7277dc0931a22eaeb6496b05e238a4a012a 100644 (file)
@@ -69,8 +69,13 @@ ViewProperties::ViewProperties(const KUrl& url) :
         useDetailsViewWithPath = true;
     } else if (url.isLocalFile()) {
         m_filePath = url.toLocalFile();
-        const QFileInfo info(m_filePath);
-        if (!info.isWritable() || !isPartOfHome(m_filePath)) {
+        const QFileInfo dirInfo(m_filePath);
+        const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName);
+        // Check if the directory is writable and check if the ".directory" file exists and
+        // is read- and writable.
+        if (!dirInfo.isWritable()
+                || (fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable()))
+                || !isPartOfHome(m_filePath)) {
 #ifdef Q_OS_WIN
                        // m_filePath probably begins with C:/ - the colon is not a valid character for paths though
                        m_filePath =  QDir::separator() + m_filePath.remove(QLatin1Char(':'));