Skip to content

Commit

Permalink
Merge branch 'dropsw' into 'master'
Browse files Browse the repository at this point in the history
[tracker] Remove support for tracker-indexed apps, as those aren't indexed in Sailfish. Contributes JB#38022

See merge request !2
  • Loading branch information
Andrew Branson committed Mar 31, 2017
2 parents 2180fe9 + 981b24b commit a80dd2d
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 218 deletions.
4 changes: 0 additions & 4 deletions data/data.pro
Expand Up @@ -15,10 +15,6 @@ testdata.files = \
hl-examples.xml
INSTALLS += testdata

applications.path = /usr/share/applications
applications.files = mimeapps.list
INSTALLS += applications

XML_FILES = highlight1.xml.in

genreg.input = XML_FILES
Expand Down
48 changes: 0 additions & 48 deletions data/gen-regexps
Expand Up @@ -232,52 +232,4 @@ rx_test ("xxx ~http://maps.ovi.com/#|50.060185|19.9328789|11|0|0|normal.day~ and
# Foreign letters are not part of a URL.
rx_test ("xxx |www.10010.com|四川专区特惠活动进行中 xxx")

# OVI Music URL

ovimusicurl = rx_seq (rx_opt (rx_ci ("https?://")),
"music\\.",
rx_or (rx_seq (rx_ci ("ovi\\."),
rx_or (rx_ci ("mobi"), rx_ci ("com")),
rx_opt (rx_ci ("\\.cn"))),
rx_seq (rx_opt (rx_ci ("mobi\\.")), rx_ci ("ovi\\.com\\.cn"))),
rx_opt ("/"),
rx_opt (hu_suffix))

rx_output (ovimusicurl, "OVIMUSICURL")

rx_test_setup (ovimusicurl, "ovimusic")

rx_test ("xxx |http://music.ovi.com| xxx")
rx_test ("xxx |http://music.ovi.mobi| xxx")
rx_test ("xxx |http://music.ovi.com.cn| xxx")
rx_test ("xxx |http://music.ovi.com/cn/zh/pc| xxx")
rx_test ("xxx |http://music.ovi.mobi/fi/fi/pc| xxx")

rx_test ("xxx (see also: |http://music.ovi.com|) ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/|) ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/file|) ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/file/|) ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com|). note, dot should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/|). ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/file|). ending ) should not be included")
rx_test ("xxx (see also: |http://music.ovi.com/file/|). xxx")

rx_test ("xxx see also: |http://music.ovi.com|. dot should not be included")
rx_test ("xxx see also: |http://music.ovi.com/|. dot should not be included")
rx_test ("xxx see also: |http://music.ovi.com/file|. dot should not be included")
rx_test ("xxx see also: |http://music.ovi.com/file/|. dot should not be included")

rx_test ("xxx see also: |http://music.ovi.com|, comma should not be included")
rx_test ("xxx see also: |http://music.ovi.com/|, comma should not be included")
rx_test ("xxx see also: |http://music.ovi.com/file|, comma should not be included")
rx_test ("xxx see also: |http://music.ovi.com/file/|, comma should not be included")

rx_test ("xxxx See also: |http://music.ovi.com/something_(one_%26_two)| parenss included in the address...")
rx_test ("xxxx See also: |http://music.ovi.com/something_(three_%26_four)|. ... but dot is not")
rx_test ("xxxx See also: |http://music.ovi.com/something_(three_%26_four)|, ... but comma is not")

rx_test ("xxxx (See also: |http://music.ovi.com/something_(five_%26_six)|) this might be tricky")
rx_test ("testing also |music.ovi.com/(bar)baz(bar)bar|.")
rx_test ("testing also |music.ovi.com/(bar)baz(bar)bar|, period.")

rx_run ()
1 change: 0 additions & 1 deletion data/highlight1.xml.in
Expand Up @@ -2,7 +2,6 @@
<actions>
<highlight regexp="([mM][aA][iI][lL][tT][oO]:)?[a-zA-Z0-9_!#$%&amp;'*+/=?^`{|}~-]+(\.[a-zA-Z0-9_!#$%&amp;'*+/=?^`{|}~-]+)*@([a-zA-Z0-9_-]+\.)+[a-zA-Z0-9_-]+" name="email-address"/>
<highlight regexp="@PHONENUMBER@" name="phone-number"/>
<highlight regexp="@OVIMUSICURL@" name="ovi-music-url" specialCaseOf="http-url"/>
<highlight regexp="@HTTPURL@" name="http-url"/>
<highlight regexp="[fF][tT][pP]://([a-zA-Z0-9_]+((:[a-zA-Z0-9_]+)?)@)?([a-zA-Z0-9_\-]+\.)+[a-zA-Z0-9_\-]+(:\d+)?(/([a-zA-Z0-9_/?%:;@&amp;=+$,\-.!~*'#]*[a-zA-Z0-9_/?%:;@&amp;=+$,\-!~*'#]|\([a-zA-Z0-9_/?%:;@&amp;=+$,\-.!~*'#]*\))*)?" name="ftp-url"/>
<highlight regexp="[fF][eE][eE][dD]:(//)?([a-zA-Z0-9_]+((:[a-zA-Z0-9_]+)?)@)?([a-zA-Z0-9_\-]+\.)+[a-zA-Z0-9_\-]+(:\d+)?(/([a-zA-Z0-9_/?%:;@&amp;=+$,\-.!~*'#]*[a-zA-Z0-9_/?%:;@&amp;=+$,\-!~*'#]|\([a-zA-Z0-9_/?%:;@&amp;=+$,\-.!~*'#]*\))*)?" name="feed-url"/>
Expand Down
110 changes: 0 additions & 110 deletions data/mimeapps.list

This file was deleted.

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
1 change: 0 additions & 1 deletion rpm/libcontentaction-qt5.spec
Expand Up @@ -79,7 +79,6 @@ rm -rf %{buildroot}
%{_datadir}/contentaction/highlight1.xml
%{_datadir}/contentaction/tracker1.xml
%{_libdir}/libcontentaction5.so.*
%exclude %{_datadir}/applications/mimeapps.list

%files devel
%defattr(-,root,root,-)
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
3 changes: 1 addition & 2 deletions tests/applications/applications.pro
Expand Up @@ -23,8 +23,7 @@ desktop_tests.files = \
gallerywithfilename.desktop \
browser.desktop \
special-browser.desktop \
regexpmatcher.desktop \
ovi-music.desktop
regexpmatcher.desktop
INSTALLS += desktop_tests

unix{
Expand Down
1 change: 0 additions & 1 deletion tests/applications/mimeinfo.cache
Expand Up @@ -11,7 +11,6 @@ x-maemo-nepomuk/music-piece=complexmusic.desktop
x-maemo-urischeme/mailto=emailer.desktop
x-maemo-highlight/email-address=emailer.desktop;
x-maemo-highlight/http-url=browser.desktop;
x-maemo-highlight/ovi-music-url=ovi-music.desktop;
x-maemo-highlight/ftp-url=browser.desktop;
x-maemo-highlight/feed-url=browser.desktop;
x-maemo-highlight/phone-number=caller.desktop;
Expand Down
9 changes: 0 additions & 9 deletions tests/applications/ovi-music.desktop

This file was deleted.

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
7 changes: 0 additions & 7 deletions tests/test-highlight.sh
Expand Up @@ -129,12 +129,5 @@ strstr "$res" ".*'http://maps.ovi.com/#|50.060185|19.9328789|11|0|0|normal.day'
# A URL immediately followed by non-ascii letters.
strstr "$res" ".*'www.10010.com' browser" || exit 10

# music suite URLs
strstr "$res" ".*'http://music.ovi.com' ovi-music browser" || exit 11
strstr "$res" ".*'http://music.ovi.mobi' ovi-music browser" || exit 11
strstr "$res" ".*'http://music.ovi.com.cn' ovi-music browser" || exit 11
strstr "$res" ".*'http://music.ovi.com/cn/zh/pc' ovi-music browser" || exit 11
strstr "$res" ".*'http://music.ovi.mobi/fi/fi/pc' ovi-music browser" || exit 11

strstr "$res" ".*'"
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 a80dd2d

Please sign in to comment.