Skip to content

Commit

Permalink
[tracker] Remove support for tracker-indexed apps, as those aren't in…
Browse files Browse the repository at this point in the history
…dexed in Sailfish. Contributes JB#38022
  • Loading branch information
Andrew Branson committed Mar 16, 2017
1 parent 2180fe9 commit 2d4dccd
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 35 deletions.
4 changes: 0 additions & 4 deletions data/tracker1.xml
Expand Up @@ -10,10 +10,6 @@
{ ?uri a nfo:Image . }
</tracker-condition>

<tracker-condition name="software-application">
{ ?uri a nfo:Software . }
</tracker-condition>

<tracker-condition name="calendar-event">
{ ?uri a ncal:Event . }
</tracker-condition>
Expand Down
22 changes: 0 additions & 22 deletions src/tracker.cpp
Expand Up @@ -43,7 +43,6 @@ namespace ContentAction {
using namespace ContentAction::Internal;

const QString OntologyMimeClass("x-maemo-nepomuk/");
static const QString SoftwareApplicationMimeType("x-maemo-nepomuk/software-application");
static const QString SparqlQuery("SparqlQuery");

// Returns true if the \a uri is a valid IRI, warns otherwise.
Expand Down Expand Up @@ -148,8 +147,6 @@ QStringList Internal::mimeForTrackerObject(const QString& uri)
// Don't consider mime types for which nobody defines an action,
// except if it is `software-application' which is special case.
QString pseudoMimeType(OntologyMimeClass + mimeType);
if (pseudoMimeType != SoftwareApplicationMimeType &&
appsForContentType(pseudoMimeType).isEmpty()) continue;

if (checkTrackerCondition(conditions[mimeType], uri))
mimeTypes << pseudoMimeType;
Expand All @@ -170,21 +167,6 @@ static QList<QStringList> mimeTypesForUris(const QStringList& uris)
return allMimeTypes;
}

// Given a nfo:SoftwareApplication \a uri, constructs an Action, which
// launches the corresponding application when triggered.
static Action createSoftwareAction(const QString& uri)
{
QString query("SELECT nie:url(<%1>) {}");
QDBusReply<QVector<QStringList> > reply = tracker()->call(SparqlQuery, query.arg(uri));
if (!reply.isValid())
return Action();
QString fileUri(reply.value()[0][0]);
if (fileUri.isEmpty())
return Action();
QUrl desktopFileUri(fileUri);
return createAction(desktopFileUri.toLocalFile(), QStringList());
}

/// Returns the default action for the given \a uri representing an object
/// stored in Tracker. A default action is determined by checking the \ref
/// tracker_conditions "conditions" that apply to the \a uri, and taking the
Expand All @@ -201,8 +183,6 @@ Action Action::defaultAction(const QString& uri)
QStringList mimeTypes = mimeForTrackerObject(uri);
LCA_DEBUG << "pseudo-mimes" << mimeTypes;
Q_FOREACH (const QString& mimeType, mimeTypes) {
if (mimeType == SoftwareApplicationMimeType)
return createSoftwareAction(uri);
QString def = findDesktopFile(defaultAppForContentType(mimeType));
if (!def.isEmpty())
return createAction(def,
Expand Down Expand Up @@ -330,8 +310,6 @@ QList<Action> Action::actions(const QString& uri)
QSet<QString> blackList; // for adding each action only once
Q_FOREACH (const QString& mimeType, mimeTypes) {
QStringList apps = appsForContentType(mimeType);
if (mimeType == SoftwareApplicationMimeType)
result << createSoftwareAction(uri);
Q_FOREACH (const QString& appid, apps) {
QString app = findDesktopFile(appid);
if (!app.isEmpty()) {
Expand Down
7 changes: 0 additions & 7 deletions tests/test-actions.sh
Expand Up @@ -26,11 +26,4 @@ uri="file:///tmp/test.html"
a=$(lca-tool --file --print $uri)
strstr "$a" '.*fixedparams' || exit 1

appuri="file://$(abspath $srcdir)/applications/emailer.desktop"
tracker-sparql -u -q "INSERT { <a.softwareapp> nie:url \"$appuri\" . }"
a=$(lca-tool --tracker --print a.softwareapp)
strstr "$a" '.*emailer' || exit 1
a=$(lca-tool --tracker --printdefault a.softwareapp)
test "$a" = "emailer" || exit 1

exit 0
2 changes: 0 additions & 2 deletions tests/testdata.ttl
Expand Up @@ -31,8 +31,6 @@
nie:url "file:///tmp/bbb.wav" ;
nie:mimeType "audio/wav" .

<a.softwareapp> a nfo:SoftwareApplication, nie:DataObject .

<a.contact> a nco:PersonContact .
<b.phonenumber> a nco:PhoneNumber ;
nco:phoneNumber "555-334112" .
Expand Down

0 comments on commit 2d4dccd

Please sign in to comment.