KIOSlave implementing "computer:" protocol

Review Request #6207 - Created Dec. 26, 2010 and discarded

Information
Andrius Ribas
kde
trunk
163448, 169628
Reviewers
kde-windows, kdelibs
dfaure, fredrikh, pino, ppenz, SaroEngels
A simple "computer" kioslave, showing the drive letters on "/", and redirecting to "file" otherwise.
Additionaly this patch substitutes "root" on Konqueror sidebar, by "computer", also this changes the "places" panel (see below).


(as reviewboard only supports single patches) additional patch for the "places" panel on trunk/KDE/kdelibs:

Index: kfile/kfileplacesmodel.cpp
===================================================================
--- kfile/kfileplacesmodel.cpp	(revision 1209174)
+++ kfile/kfileplacesmodel.cpp	(working copy)
@@ -120,40 +120,9 @@
                                               "Network", I18N_NOOP2("KFile System Bookmarks", "Network"),
                                               KUrl("remote:/"), "network-workgroup");
 #ifdef Q_OS_WIN
-        // adding drives
-        foreach ( const QFileInfo& info, QDir::drives() ) {
-#ifndef _WIN32_WCE
-            uint type = DRIVE_UNKNOWN;
-#endif
-            QString driveIcon = "drive-harddisk";
-#ifndef _WIN32_WCE
-            QT_WA({ type = GetDriveTypeW((wchar_t *)info.absoluteFilePath().utf16()); },
-                  { type = GetDriveTypeA(info.absoluteFilePath().toLocal8Bit()); });
-            // qDebug() << "drive " << info.absoluteFilePath() << " type: " << type;
-            switch (type) {
-                case DRIVE_REMOVABLE:
-                    driveIcon = "drive-removable-media";
-                    break;
-                case DRIVE_FIXED:
-                    driveIcon = "drive-harddisk";
-                    break;
-                case DRIVE_REMOTE:
-                    driveIcon = "network-server";
-                    break;
-                case DRIVE_CDROM:
-                    driveIcon = "drive-optical";
-                    break;
-                case DRIVE_RAMDISK:
-                case DRIVE_UNKNOWN:
-                case DRIVE_NO_ROOT_DIR:
-                default:
-                    driveIcon = "drive-harddisk";
-            }
-#endif
-            KFilePlacesItem::createSystemBookmark(d->bookmarkManager,
-                                                  info.absoluteFilePath(), info.absoluteFilePath(),
-                                                  KUrl(info.absoluteFilePath()), driveIcon);
-        }
+        KFilePlacesItem::createSystemBookmark(d->bookmarkManager,
+                                              "Computer", I18N_NOOP2("KFile System Bookmarks", "Computer"),
+                                              KUrl("computer:"), "Computer");
 #else
         KFilePlacesItem::createSystemBookmark(d->bookmarkManager,
                                               "Root", I18N_NOOP2("KFile System Bookmarks", "Root"),
Tested using MSVC 2008 on a windows 7 machine
Andrius Ribas
Review request changed
Andrius Ribas
I'll rewrite the patch for git.reviewboard.kde.org but I'd like some more feedback first.. I've got some positive feedback from SaroEngels and negative from Pino on IRC.. This protocol is intended to have functionality similar to "desktop:"... I'm not sure if it would be better to enhance "file:" protocol instead (it'd maybe be harder to integrate)... I've checked some browsers (IE, Chrome, Opera) and only opera seems to implement correctly the "root" of "file:" protocol on Windows (Opera shows drive letters, IE and Chrome gives "not found" for "file:///"; KDE points "file:///", "file:" etc.. to "C:", "file:/localhost/C:" fails and "file://c:" points to "smb:/c/", so some behaviors need to be fixed and/or more compliant to RFC 1630 and RFC 1738) . Please note Solid is still not much stable on windows so imo, we cannot use it to query the drives yet.
Loading...