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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/generic/runners/bookmarks
From:       Matthias Fuchs <mat69 () gmx ! net>
Date:       2010-12-05 11:06:50
Message-ID: 20101205110650.BDA2FAC8A4 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1203733 by mfuchs:

Supports bookmarks that have no protocol set.
BUG:228454

 M  +23 -1     bookmarksrunner.cpp  


--- trunk/KDE/kdebase/workspace/plasma/generic/runners/bookmarks/bookmarksrunner.cpp #1203732:1203733
@@ -467,7 +467,29 @@
 void BookmarksRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action)
 {
     Q_UNUSED(context);
-    KUrl url = (KUrl)action.data().toString();
+    const QString term = action.data().toString();
+    KUrl url = KUrl(term);
+
+    //support urls like "kde.org" by transforming them to http://kde.org
+    if (url.protocol().isEmpty()) {
+        const int idx = term.indexOf('/');
+
+        url.clear();
+        url.setHost(term.left(idx));
+        if (idx != -1) {
+            //allow queries
+            const int queryStart = term.indexOf('?', idx);
+            int pathLength = -1;
+            if ((queryStart > -1) && (idx < queryStart)) {
+                pathLength = queryStart - idx;
+                url.setQuery(term.mid(queryStart));
+            }
+
+            url.setPath(term.mid(idx, pathLength));
+        }
+        url.setProtocol("http");
+    }
+
     //kDebug() << "BookmarksRunner::run opening: " << url.url();
     KToolInvocation::invokeBrowser(url.url());
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

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