]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixes the URL handling in this model. QVariant breaks KUrl in strange
authorKevin Ottens <ervin@kde.org>
Mon, 2 Apr 2007 08:45:08 +0000 (08:45 +0000)
committerKevin Ottens <ervin@kde.org>
Mon, 2 Apr 2007 08:45:08 +0000 (08:45 +0000)
ways, hence the nasty code. If anybody has a better idea feel free to
point me to the right solution.

svn path=/trunk/KDE/kdebase/apps/; revision=649200

src/kfileplacesmodel.cpp

index 00ee52d431779ceabef920b0bb759d2010efc806..9199057bde405c11f8a8f31aa259447ab5d03bd0 100644 (file)
@@ -151,9 +151,9 @@ QModelIndex KFilePlacesModel::closestItem(const KUrl &url) const
         KUrl itemUrl;
 
         if (item->isDevice()) {
         KUrl itemUrl;
 
         if (item->isDevice()) {
-            itemUrl = KUrl(d->deviceData(item->deviceIndex(), UrlRole).toString());
+            itemUrl = KUrl(d->deviceData(item->deviceIndex(), UrlRole).toUrl());
         } else {
         } else {
-            itemUrl = KUrl(d->bookmarkData(item->bookmarkAddress(), UrlRole).toString());
+            itemUrl = KUrl(d->bookmarkData(item->bookmarkAddress(), UrlRole).toUrl());
         }
 
         if (itemUrl.isParentOf(url)) {
         }
 
         if (itemUrl.isParentOf(url)) {
@@ -184,7 +184,7 @@ QVariant KFilePlacesModel::Private::bookmarkData(const QString &address, int rol
     case Qt::DecorationRole:
         return KIcon(bookmark.icon());
     case UrlRole:
     case Qt::DecorationRole:
         return KIcon(bookmark.icon());
     case UrlRole:
-        return bookmark.url();
+        return QUrl(bookmark.url());
     case MountNeededRole:
         return false;
     default:
     case MountNeededRole:
         return false;
     default:
@@ -198,7 +198,7 @@ QVariant KFilePlacesModel::Private::deviceData(const QPersistentModelIndex &inde
         switch (role)
         {
         case UrlRole:
         switch (role)
         {
         case UrlRole:
-            return KUrl(deviceModel->deviceForIndex(index).as<Solid::Volume>()->mountPoint());
+            return QUrl(KUrl(deviceModel->deviceForIndex(index).as<Solid::Volume>()->mountPoint()));
         case MountNeededRole:
             return !deviceModel->deviceForIndex(index).as<Solid::Volume>()->isMounted();
         default:
         case MountNeededRole:
             return !deviceModel->deviceForIndex(index).as<Solid::Volume>()->isMounted();
         default: