@@ -35,6 +35,7 @@
35#include <UnityCore/Variant.h>
35#include <UnityCore/Variant.h>
37#include <libintl.h>
37#include <libintl.h>
39Scope::Scope(QObject *parent) :
40Scope::Scope(QObject *parent) :
40 QObject(parent)
41 QObject(parent)
@@ -208,18 +209,11 @@ void Scope::onPreviewReady(unity::dash::LocalResult const& /* result */, unity::
209void Scope::fallbackActivate(const QString& uri)
210void Scope::fallbackActivate(const QString& uri)
211− /* FIXME: stripping all content before the first column because for some
212− reason the scopes give uri with junk content at their beginning.
214− QString tweakedUri = uri;
215− int firstColumnAt = tweakedUri.indexOf(":");
216− tweakedUri.remove(0, firstColumnAt+1);
218 /* Tries various methods to trigger a sensible action for the given 'uri'.
212 /* Tries various methods to trigger a sensible action for the given 'uri'.
219 If it has no understanding of the given scheme it falls back on asking
213 If it has no understanding of the given scheme it falls back on asking
220 Qt to open the uri.
214 Qt to open the uri.
222− QUrl url(tweakedUri);
216+ QUrl url(uri);
223 if (url.scheme() == "file") {
217 if (url.scheme() == "file") {
224 /* Override the files place's default URI handler: we want the file
218 /* Override the files place's default URI handler: we want the file
225 manager to handle opening folders, not the dash.
219 manager to handle opening folders, not the dash.
@@ -230,7 +224,24 @@ void Scope::fallbackActivate(const QString& uri)
232 if (url.scheme() == "application") {
226 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);
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)) {
238+ Q_EMIT activateApplication(path);
240+ qWarning() << "Unable to activate " << path;
242+ g_key_file_free(key_file);