@@ -35,6 +35,7 @@
3535#include <UnityCore/Variant.h>
3636
3737#include <libintl.h>
38+#include <glib.h>
3839
3940Scope::Scope(QObject *parent) :
4041 QObject(parent)
@@ -208,18 +209,11 @@ void Scope::onPreviewReady(unity::dash::LocalResult const& /* result */, unity::
208209
209210void Scope::fallbackActivate(const QString& uri)
210211{
211− /* FIXME: stripping all content before the first column because for some
212− reason the scopes give uri with junk content at their beginning.
213− */
214− QString tweakedUri = uri;
215− int firstColumnAt = tweakedUri.indexOf(":");
216− tweakedUri.remove(0, firstColumnAt+1);
217−
218212 /* Tries various methods to trigger a sensible action for the given 'uri'.
219213 If it has no understanding of the given scheme it falls back on asking
220214 Qt to open the uri.
221215 */
222− QUrl url(tweakedUri);
216+ QUrl url(uri);
223217 if (url.scheme() == "file") {
224218 /* Override the files place's default URI handler: we want the file
225219 manager to handle opening folders, not the dash.
@@ -230,7 +224,24 @@ void Scope::fallbackActivate(const QString& uri)
230224 return;
231225 }
232226 if (url.scheme() == "application") {
233− // TODO: implement application handling
227+ // get the full path to the desktop file
228+ QString path(url.authority());
229+ if (path.startsWith("/")) {
230+ Q_EMIT activateApplication(path);
231+ } else {
232+ gchar* full_path = nullptr;
233+ GKeyFile* key_file = g_key_file_new();
234+ QString apps_path = "applications/" + path;
235+ if (g_key_file_load_from_data_dirs(key_file, apps_path.toLocal8Bit().constData(), &full_path,
236+ G_KEY_FILE_NONE, nullptr)) {
237+ path = full_path;
238+ Q_EMIT activateApplication(path);
239+ } else {
240+ qWarning() << "Unable to activate " << path;
241+ }
242+ g_key_file_free(key_file);
243+ g_free(full_path);
244+ }
234245 return;
235246 }
236247