Merge lp:~phablet-team/ubuntu-system-settings/path-fixes into lp:ubuntu-system-settings

Proposed by Jonas G. Drange on 2016-09-19
Status: Merged
Approved by: Ken VanDine on 2016-09-30
Approved revision: 1727
Merged at revision: 1727
Proposed branch: lp:~phablet-team/ubuntu-system-settings/path-fixes
Merge into: lp:ubuntu-system-settings
Diff against target: 574 lines (+141/-48)
17 files modified
CMakeLists.txt (+17/-4)
plugins/about/storageabout.cpp (+13/-3)
plugins/background/background.cpp (+6/-6)
plugins/background/background.h (+1/-1)
plugins/language/language-plugin.cpp (+17/-9)
plugins/language/onscreenkeyboard-plugin.cpp (+10/-2)
plugins/security-privacy/securityprivacy.cpp (+3/-1)
plugins/security-privacy/trust-store-model.cpp (+5/-1)
plugins/sound/PageComponent.qml (+2/-2)
plugins/sound/SoundsList.qml (+3/-2)
plugins/sound/sound.cpp (+10/-0)
src/CMakeLists.txt (+2/-0)
src/main.cpp (+7/-3)
src/plugin-manager.cpp (+14/-3)
src/plugin.cpp (+13/-4)
src/utils.cpp (+12/-5)
tests/CMakeLists.txt (+6/-2)
To merge this branch: bzr merge lp:~phablet-team/ubuntu-system-settings/path-fixes
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Approve on 2016-09-30
Ken VanDine 2016-09-19 Approve on 2016-09-30
Lukáš Tinkl (community) Approve on 2016-09-23
Alberto Mardegan Approve on 2016-09-23
Review via email: mp+306115@code.launchpad.net

Commit Message

uses XDG_DATA_DIRS where applicable to enable USS to find files and folders on snappy-based systems

Description of the Change

Rewrites code that reference hard coded paths (e.g. /usr/share/foo) to use QStandardPaths. Some paths, e.g. to /etc, are still hard coded, but I've prepended $SNAP, which should be empty ("") on traditional non-snappy systems.

Packaging changes are deps that were missing.

Note: I have left the background panel mostly alone, due to [1]. I've also left the Updates panel alone—it will never be expected to work as it is now, on snappy.

[1] https://code.launchpad.net/~mterry/ubuntu-system-settings/default-wallpaper/+merge/297632

To post a comment you must log in.

FAILED: Continuous integration, rev:1721
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/155/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1552/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1552
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1400/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1400/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1400/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1400/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1400/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1400/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1400/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1400
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1400/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1400/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/155/rebuild

review: Needs Fixing (continuous-integration)

PASSED: Continuous integration, rev:1721
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/156/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1573
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/369
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1573
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1421/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1421
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1421/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/156/rebuild

review: Approve (continuous-integration)
Ken VanDine (ken-vandine) wrote :

I'm happy with this now, thanks!

review: Approve
Lukáš Tinkl (lukas-kde) wrote :

Left a few inline comments, sorry :)

review: Needs Fixing
1724. By Jonas G. Drange on 2016-09-23

address comments from ltinkl

Alberto Mardegan (mardy) wrote :

I didn't try it, but the code looks good!

review: Approve
1725. By Jonas G. Drange on 2016-09-23

do sub in one go

Lukáš Tinkl (lukas-kde) wrote :

Yup yup, looks great now to me

review: Approve

FAILED: Continuous integration, rev:1723
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/159/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1601/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1601
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1449/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1449/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1449/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1449/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1449/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1449/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1449
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1449/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1449/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1449/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/159/rebuild

review: Needs Fixing (continuous-integration)
review: Needs Fixing (continuous-integration)
Ken VanDine (ken-vandine) wrote :

Looks good

review: Approve

FAILED: Continuous integration, rev:1725
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/160/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1602/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1602
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1451/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1451/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1451/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1451/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1451/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1451
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1451/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/160/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1725
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/162/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1611/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1611
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1459
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1459/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1459
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1459/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1459
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1459/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1459/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1459/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1459
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1459/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1459/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1459/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1459/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/162/rebuild

review: Needs Fixing (continuous-integration)
1726. By Jonas G. Drange on 2016-09-26

merge Bileto Bot 2016-09-16 Releasing 0.4+16.10.20160916-0ubuntu1

PASSED: Continuous integration, rev:1726
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/181/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1686
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/402
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1686
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1532/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1532
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1532/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/181/rebuild

review: Approve (continuous-integration)
Ken VanDine (ken-vandine) wrote :

I left an inline comment.

Also I noticed defaultBackgroundFile doesn't account for $SNAP

review: Needs Fixing
1727. By Jonas G. Drange on 2016-09-30

prepend SNAP to default wallpaper, and drop unused declarations

Ken VanDine (ken-vandine) wrote :

Looks great, thanks!

review: Approve

PASSED: Continuous integration, rev:1727
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/184/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1697
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/406
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1697
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1542/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1542
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1542/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-ubuntu-system-settings-ci/184/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-06-01 04:08:58 +0000
3+++ CMakeLists.txt 2016-09-30 13:43:32 +0000
4@@ -53,14 +53,27 @@
5 find_program(INTLTOOL_MERGE intltool-merge)
6 find_program(INTLTOOL_EXTRACT intltool-extract)
7
8-set(PLUGIN_MANIFEST_DIR_BASE share/ubuntu/settings/system)
9-set(PLUGIN_MODULE_DIR_BASE ubuntu-system-settings)
10-set(PLUGIN_PRIVATE_MODULE_DIR_BASE "${PLUGIN_MODULE_DIR_BASE}/private")
11-set(PLUGIN_QML_DIR_BASE share/ubuntu/settings/system/qml-plugins)
12+set(DATA_DIR share)
13+set(MODULE_DIR ubuntu-system-settings)
14+set(MANIFEST_DIR "ubuntu/settings/system")
15+set(QML_DIR qml-plugins)
16+set(PRIVATE_DIR private)
17
18+# share/ubuntu/settings/system
19+set(PLUGIN_MANIFEST_DIR_BASE ${DATA_DIR}/${MANIFEST_DIR})
20+# ubuntu-system-settings
21+set(PLUGIN_MODULE_DIR_BASE ${MODULE_DIR})
22+# ubuntu-system-settings/private
23+set(PLUGIN_PRIVATE_MODULE_DIR_BASE "${PLUGIN_MODULE_DIR_BASE}/${PRIVATE_DIR}")
24+# share/ubuntu/settings/system/qml-plugins
25+set(PLUGIN_QML_DIR_BASE ${DATA_DIR}/${MANIFEST_DIR}/${QML_DIR})
26+# E.g. /usr/share/ubuntu/settings/system
27 set(PLUGIN_MANIFEST_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}")
28+# E.g. /usr/lib/ubuntu-system-settings
29 set(PLUGIN_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${PLUGIN_MODULE_DIR_BASE}")
30+# E.g. /usr/share/ubuntu/settings/system/qml-plugins
31 set(PLUGIN_QML_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_QML_DIR_BASE}")
32+# E.g. /usr/lib/ubuntu-system-settings/private
33 set(PLUGIN_PRIVATE_MODULE_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR}/${PLUGIN_PRIVATE_MODULE_DIR_BASE}")
34 set(SETTINGS_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_MANIFEST_DIR_BASE}")
35 set(PUSH_HELPER_DIR "lib/ubuntu-push-client/legacy-helpers")
36
37=== modified file 'plugins/about/storageabout.cpp'
38--- plugins/about/storageabout.cpp 2016-09-21 14:02:39 +0000
39+++ plugins/about/storageabout.cpp 2016-09-30 13:43:32 +0000
40@@ -37,8 +37,10 @@
41 #include <QJsonArray>
42 #include <QJsonDocument>
43 #include <QJsonObject>
44+#include <QStandardPaths>
45 #include <QtCore/QStorageInfo>
46 #include <QtCore/QSharedPointer>
47+#include <QtGlobal>
48 #include <QProcess>
49 #include <QVariant>
50 #include <hybris/properties/properties.h>
51@@ -195,7 +197,7 @@
52 {
53 if (m_ubuntuBuildID.isEmpty() || m_ubuntuBuildID.isNull())
54 {
55- QFile file("/etc/media-info");
56+ QFile file(qgetenv("SNAP").append("/etc/media-info"));
57 if (!file.exists())
58 return "";
59 file.open(QIODevice::ReadOnly | QIODevice::Text);
60@@ -235,10 +237,18 @@
61 QString StorageAbout::licenseInfo(const QString &subdir) const
62 {
63
64- QString copyright = "/usr/share/doc/" + subdir + "/copyright";
65+ QString copyright = "doc/" + subdir + "/copyright";
66 QString copyrightText;
67
68- QFile file(copyright);
69+ QString copyrightFile = QStandardPaths::locate(
70+ QStandardPaths::GenericDataLocation, copyright,
71+ QStandardPaths::LocateFile
72+ );
73+ if (copyrightFile.isEmpty()) {
74+ return QString();
75+ }
76+
77+ QFile file(copyrightFile);
78 if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
79 return QString();
80 copyrightText = QString(file.readAll());
81
82=== modified file 'plugins/background/background.cpp'
83--- plugins/background/background.cpp 2016-07-05 12:48:05 +0000
84+++ plugins/background/background.cpp 2016-09-30 13:43:32 +0000
85@@ -53,7 +53,7 @@
86 return filename;
87 }
88
89-void Background::setBackgroundFile(QUrl backgroundFile)
90+void Background::setBackgroundFile(const QUrl &backgroundFile)
91 {
92 if (!backgroundFile.isLocalFile())
93 return;
94@@ -72,7 +72,7 @@
95 // delete our copy. We don't need it anymore.
96 if (oldBackgroundFile.contains(getCopiedSystemBackgroundFolder().path())) {
97 QString fileName = QUrl(oldBackgroundFile).fileName();
98- if (QFile::exists(SYSTEM_BACKGROUND_DIR "/" + fileName)) {
99+ if (QFile::exists(qgetenv("SNAP") + SYSTEM_BACKGROUND_DIR "/" + fileName)) {
100 rmFile(oldBackgroundFile);
101 }
102 }
103@@ -116,7 +116,7 @@
104 // with it.
105 // So scan the copied backgrounds.
106 QFileInfoList copyList = getCopiedSystemBackgroundFolder().entryInfoList(QDir::Files | QDir::NoSymLinks);
107- QDir systemDir = QDir(SYSTEM_BACKGROUND_DIR);
108+ QDir systemDir = QDir(qgetenv("SNAP") + SYSTEM_BACKGROUND_DIR);
109 foreach (QFileInfo f, copyList) {
110 if (!systemDir.exists(f.fileName()))
111 tmpList << f;
112@@ -213,7 +213,7 @@
113 dir = QDir(envDir);
114 copiedBackgroundDir = dir;
115 } else {
116- dir = QDir(SYSTEM_BACKGROUND_DIR);
117+ dir = QDir(qgetenv("SNAP") + SYSTEM_BACKGROUND_DIR);
118 copiedBackgroundDir = getCopiedSystemBackgroundFolder();
119 }
120
121@@ -229,7 +229,7 @@
122 // Prefer copied versions.
123 if (copiedBackgroundDir.exists(f.fileName()))
124 absPath = copiedBackgroundDir.absoluteFilePath(f.fileName());
125-
126+
127 m_ubuntuArt.append(QUrl::fromLocalFile(absPath).toString());
128 }
129
130@@ -271,7 +271,7 @@
131 QString Background::defaultBackgroundFile() const
132 {
133 /* TODO: For now hardcoded path, later we'll use GSettings */
134- return SYSTEM_BACKGROUND_DIR "/warty-final-ubuntu.png";
135+ return qgetenv("SNAP") + SYSTEM_BACKGROUND_DIR "/warty-final-ubuntu.png";
136 }
137
138 Background::~Background() {
139
140=== modified file 'plugins/background/background.h'
141--- plugins/background/background.h 2016-06-17 19:22:34 +0000
142+++ plugins/background/background.h 2016-09-30 13:43:32 +0000
143@@ -53,7 +53,7 @@
144 explicit Background(QObject *parent = 0);
145 ~Background();
146 QString backgroundFile();
147- void setBackgroundFile(QUrl backgroundFile);
148+ void setBackgroundFile(const QUrl &backgroundFile);
149 Q_INVOKABLE QUrl prepareBackgroundFile(const QUrl &url, bool shareWithGreeter);
150 Q_INVOKABLE bool fileExists(const QString &file);
151 Q_INVOKABLE void rmFile(const QString &file);
152
153=== modified file 'plugins/language/language-plugin.cpp'
154--- plugins/language/language-plugin.cpp 2015-12-22 13:49:39 +0000
155+++ plugins/language/language-plugin.cpp 2016-09-30 13:43:32 +0000
156@@ -17,6 +17,7 @@
157 * You should have received a copy of the GNU General Public License along
158 * with this program. If not, see <http://www.gnu.org/licenses/>.
159 */
160+#include <QStandardPaths>
161 #include <QtDebug>
162 #include "language-plugin.h"
163 #include "keyboard-layout.h"
164@@ -24,7 +25,7 @@
165 #include <act/act.h>
166 #include <unicode/locid.h>
167
168-#define LANGUAGE2LOCALE "/usr/share/language-tools/language2locale"
169+#define LANGUAGE2LOCALE "language-tools/language2locale"
170
171 static const char * const LOCALE_BLACKLIST[] = {
172 "C",
173@@ -208,14 +209,21 @@
174 QString language(languageLocale.locale.getLanguage());
175
176 if (!likelyLocaleForLanguage.contains(language)) {
177- QProcess likelyProcess;
178- likelyProcess.start(LANGUAGE2LOCALE,
179- QStringList(language),
180- QIODevice::ReadOnly);
181- likelyProcess.waitForFinished();
182- QString likelyLocale(likelyProcess.readAllStandardOutput());
183- likelyLocale = likelyLocale.left(likelyLocale.indexOf('.'));
184- likelyLocaleForLanguage.insert(language, likelyLocale.trimmed());
185+ QString l2lPath = QStandardPaths::locate(
186+ QStandardPaths::GenericDataLocation, LANGUAGE2LOCALE
187+ );
188+ if (l2lPath.isEmpty()) {
189+ qWarning() << "Could not find language2locale file.";
190+ } else {
191+ QProcess likelyProcess;
192+ likelyProcess.start(l2lPath, QStringList(language),
193+ QIODevice::ReadOnly);
194+ likelyProcess.waitForFinished();
195+ QString likelyLocale(likelyProcess.readAllStandardOutput());
196+ likelyLocale = likelyLocale.left(likelyLocale.indexOf('.'));
197+ likelyLocaleForLanguage.insert(language,
198+ likelyLocale.trimmed());
199+ }
200 }
201
202 languageLocale.likely = likelyLocaleForLanguage[language] ==
203
204=== modified file 'plugins/language/onscreenkeyboard-plugin.cpp'
205--- plugins/language/onscreenkeyboard-plugin.cpp 2015-12-22 13:49:39 +0000
206+++ plugins/language/onscreenkeyboard-plugin.cpp 2016-09-30 13:43:32 +0000
207@@ -19,6 +19,7 @@
208 * with this program. If not, see <http://www.gnu.org/licenses/>.
209 */
210
211+#include <QStandardPaths>
212 #include <QtDebug>
213 #include "onscreenkeyboard-plugin.h"
214
215@@ -28,7 +29,7 @@
216 #define KEY_CURRENT_LAYOUT "active-language"
217 #define KEY_PLUGIN_PATHS "plugin-paths"
218
219-#define LAYOUTS_DIR "/usr/share/maliit/plugins/com/ubuntu/lib"
220+#define LAYOUTS_DIR "maliit/plugins/com/ubuntu/lib"
221
222 OnScreenKeyboardPlugin::OnScreenKeyboardPlugin(QObject *parent) :
223 QObject(parent),
224@@ -37,7 +38,14 @@
225 GVariantIter *iter;
226 const gchar *path;
227
228- m_layoutPaths.append(LAYOUTS_DIR);
229+ QString layoutPath = QStandardPaths::locate(
230+ QStandardPaths::GenericDataLocation, LAYOUTS_DIR,
231+ QStandardPaths::LocateDirectory
232+ );
233+ if (!layoutPath.isEmpty()) {
234+ m_layoutPaths.append(layoutPath);
235+ }
236+
237 g_settings_get(m_maliitSettings, KEY_PLUGIN_PATHS, "as", &iter);
238 for (int i(0); g_variant_iter_next(iter, "&s", &path); i++) {
239 m_layoutPaths.append(path);
240
241=== modified file 'plugins/security-privacy/securityprivacy.cpp'
242--- plugins/security-privacy/securityprivacy.cpp 2016-05-26 12:20:47 +0000
243+++ plugins/security-privacy/securityprivacy.cpp 2016-09-30 13:43:32 +0000
244@@ -22,6 +22,7 @@
245 #include <QtCore/QDateTime>
246 #include <QtCore/QDebug>
247 #include <QtCore/QProcess>
248+#include <QtGlobal>
249 #include <QtDBus/QDBusConnection>
250 #include <QtDBus/QDBusConnectionInterface>
251 #include <QtDBus/QDBusInterface>
252@@ -336,7 +337,8 @@
253 passwdData += value.toUtf8() + '\n' + value.toUtf8() + '\n';
254
255 QProcess pamHelper;
256- pamHelper.setProgram("/usr/bin/passwd");
257+ // TODO: Decide if this approach is sufficient in a snap world. lp:1616486
258+ pamHelper.setProgram(qgetenv("SNAP") + "/usr/bin/passwd");
259 pamHelper.start();
260 pamHelper.write(passwdData);
261 pamHelper.closeWriteChannel();
262
263=== modified file 'plugins/security-privacy/trust-store-model.cpp'
264--- plugins/security-privacy/trust-store-model.cpp 2015-09-29 11:39:39 +0000
265+++ plugins/security-privacy/trust-store-model.cpp 2016-09-30 13:43:32 +0000
266@@ -24,6 +24,7 @@
267 #include <QIcon>
268 #include <QList>
269 #include <QMap>
270+#include <QtGlobal>
271 #include <QSet>
272 #include <QStandardPaths>
273
274@@ -104,7 +105,10 @@
275
276 /* try system location as well, that's at least needed for unity8-dash
277 * which is not a click (yet) and doesn't have a .local entry */
278- QString usrDesktopFilename(QString("/usr/share/applications/%1.desktop").arg(id));
279+ QString usrDesktopFilename(
280+ qgetenv("SNAP") +
281+ QString("/usr/share/applications/%1.desktop").arg(id)
282+ );
283 if (QFile(usrDesktopFilename).exists())
284 return usrDesktopFilename;
285
286
287=== modified file 'plugins/sound/PageComponent.qml'
288--- plugins/sound/PageComponent.qml 2016-08-23 13:34:14 +0000
289+++ plugins/sound/PageComponent.qml 2016-09-30 13:43:32 +0000
290@@ -154,7 +154,7 @@
291 title: i18n.tr("Ringtone"),
292 showStopButton: true,
293 soundType: 0,
294- soundsDir: "/usr/share/sounds/ubuntu/ringtones/"
295+ soundsDir: "sounds/ubuntu/ringtones/"
296 }
297 )
298 }
299@@ -212,7 +212,7 @@
300 { title: i18n.tr("Message received"),
301 soundType: 1,
302 soundsDir:
303- "/usr/share/sounds/ubuntu/notifications/" })
304+ "sounds/ubuntu/notifications/" })
305 }
306
307 SettingsListItems.Standard {
308
309=== modified file 'plugins/sound/SoundsList.qml'
310--- plugins/sound/SoundsList.qml 2016-03-21 18:36:31 +0000
311+++ plugins/sound/SoundsList.qml 2016-09-30 13:43:32 +0000
312@@ -28,9 +28,10 @@
313 flickable: scrollWidget
314
315 function refreshSoundFileNames() {
316+ var customDir = mountPoint + "/custom/usr/share/" + soundsDir;
317 if (soundType === 0)
318- return backendInfo.listSounds([soundsDir, "/custom" + soundsDir, backendInfo.customRingtonePath])
319- return backendInfo.listSounds([soundsDir, "/custom" + soundsDir])
320+ return backendInfo.listSounds([soundsDir, customDir, backendInfo.customRingtonePath])
321+ return backendInfo.listSounds([soundsDir, customDir])
322 }
323
324 UbuntuSoundPanel {
325
326=== modified file 'plugins/sound/sound.cpp'
327--- plugins/sound/sound.cpp 2016-08-22 13:29:22 +0000
328+++ plugins/sound/sound.cpp 2016-09-30 13:43:32 +0000
329@@ -245,6 +245,16 @@
330 QStringList soundsListFromDir(const QString &dirString)
331 {
332 QDir soundsDir(dirString);
333+ if (soundsDir.isRelative()) {
334+ QString path = QStandardPaths::locate(
335+ QStandardPaths::GenericDataLocation, dirString,
336+ QStandardPaths::LocateDirectory
337+ );
338+ if (path.isEmpty()) {
339+ return QStringList();
340+ }
341+ soundsDir = QDir(path);
342+ }
343
344 if (soundsDir.exists())
345 {
346
347=== modified file 'src/CMakeLists.txt'
348--- src/CMakeLists.txt 2016-08-16 11:46:12 +0000
349+++ src/CMakeLists.txt 2016-09-30 13:43:32 +0000
350@@ -3,7 +3,9 @@
351 add_definitions(-DI18N_DIRECTORY="${CMAKE_INSTALL_PREFIX}/share/locale")
352 add_definitions(-DI18N_DOMAIN="ubuntu-system-settings")
353 add_definitions(-DPLUGIN_PRIVATE_MODULE_DIR="${PLUGIN_PRIVATE_MODULE_DIR}")
354+add_definitions(-DMANIFEST_DIR="${MANIFEST_DIR}")
355 add_definitions(-DPLUGIN_MANIFEST_DIR="${PLUGIN_MANIFEST_DIR}")
356+add_definitions(-DQML_DIR="${QML_DIR}")
357 add_definitions(-DPLUGIN_QML_DIR="${PLUGIN_QML_DIR}")
358 add_definitions(-DPLUGIN_MODULE_DIR="${PLUGIN_MODULE_DIR}")
359
360
361=== modified file 'src/main.cpp'
362--- src/main.cpp 2016-07-31 22:11:50 +0000
363+++ src/main.cpp 2016-09-30 13:43:32 +0000
364@@ -23,11 +23,13 @@
365 #include "plugin-manager.h"
366 #include "utils.h"
367
368+#include <QByteArray>
369 #include <QGuiApplication>
370 #include <QProcessEnvironment>
371 #include <QQmlContext>
372 #include <QUrl>
373 #include <QQuickView>
374+#include <QtGlobal>
375 #include <QtQml>
376 #include <QtQml/QQmlDebuggingEnabler>
377 static QQmlDebuggingEnabler debuggingEnabler(false);
378@@ -37,6 +39,7 @@
379 int main(int argc, char **argv)
380 {
381 QGuiApplication app(argc, argv);
382+ QByteArray mountPoint = qEnvironmentVariableIsSet("SNAP") ? qgetenv("SNAP") : "";
383
384 /* The testability driver is only loaded by QApplication but not by
385 * QGuiApplication. However, QApplication depends on QWidget which would
386@@ -88,10 +91,11 @@
387 qmlRegisterType<SystemSettings::PluginManager>("SystemSettings", 1, 0, "PluginManager");
388 view.engine()->rootContext()->setContextProperty("Utilities", &utils);
389 view.setResizeMode(QQuickView::SizeRootObjectToView);
390- view.engine()->addImportPath(PLUGIN_PRIVATE_MODULE_DIR);
391- view.engine()->addImportPath(PLUGIN_QML_DIR);
392+ view.engine()->addImportPath(mountPoint + PLUGIN_PRIVATE_MODULE_DIR);
393+ view.engine()->addImportPath(mountPoint + PLUGIN_QML_DIR);
394 view.rootContext()->setContextProperty("defaultPlugin", defaultPlugin);
395- view.rootContext()->setContextProperty("i18nDirectory", I18N_DIRECTORY);
396+ view.rootContext()->setContextProperty("mountPoint", mountPoint);
397+ view.rootContext()->setContextProperty("i18nDirectory", mountPoint + I18N_DIRECTORY);
398 view.rootContext()->setContextProperty("pluginOptions", pluginOptions);
399 view.rootContext()->setContextProperty("view", &view);
400 view.setSource(QUrl("qrc:/qml/MainWindow.qml"));
401
402=== modified file 'src/plugin-manager.cpp'
403--- src/plugin-manager.cpp 2014-08-28 07:22:28 +0000
404+++ src/plugin-manager.cpp 2016-09-30 13:43:32 +0000
405@@ -28,11 +28,12 @@
406 #include <QProcessEnvironment>
407 #include <QQmlContext>
408 #include <QQmlEngine>
409+#include <QStandardPaths>
410 #include <QStringList>
411
412 using namespace SystemSettings;
413
414-static const QLatin1String baseDir{PLUGIN_MANIFEST_DIR};
415+static const QLatin1String baseDir{MANIFEST_DIR};
416
417 namespace SystemSettings {
418
419@@ -80,7 +81,17 @@
420 {
421 Q_Q(PluginManager);
422 clear();
423- QDir path(baseDir, "*.settings");
424+
425+ /* Create a list of search paths (e.g. /usr/share, /usr/local/share) and
426+ * append the baseDir. The reason for not using locateAll is that locateAll
427+ * does not seem to work with a dir and file pattern, which means it will
428+ * look for all .settings files, not just those in well-known locations. */
429+ QStandardPaths::StandardLocation loc = QStandardPaths::GenericDataLocation;
430+ QFileInfoList searchPaths;
431+ Q_FOREACH(const QString &path, QStandardPaths::standardLocations(loc)) {
432+ QDir dir(QStringLiteral("%1/%2").arg(path, baseDir), "*.settings");
433+ searchPaths.append(dir.entryInfoList());
434+ }
435
436 /* Use an environment variable USS_SHOW_ALL_UI to show unfinished / beta /
437 * deferred components or panels */
438@@ -95,7 +106,7 @@
439 if (ctx)
440 ctx->engine()->rootContext()->setContextProperty("showAllUI", showAll);
441
442- Q_FOREACH(QFileInfo fileInfo, path.entryInfoList()) {
443+ Q_FOREACH(const QFileInfo &fileInfo, searchPaths) {
444 Plugin *plugin = new Plugin(fileInfo);
445 QQmlEngine::setContextForObject(plugin, ctx);
446 QMap<QString, Plugin*> &pluginList = m_plugins[plugin->category()];
447
448=== modified file 'src/plugin.cpp'
449--- src/plugin.cpp 2015-08-13 20:31:53 +0000
450+++ src/plugin.cpp 2016-09-30 13:43:32 +0000
451@@ -29,6 +29,7 @@
452 #include <QPluginLoader>
453 #include <QQmlContext>
454 #include <QQmlEngine>
455+#include <QStandardPaths>
456 #include <QStringList>
457 #include <QVariantMap>
458
459@@ -38,7 +39,7 @@
460 using namespace SystemSettings;
461
462 static const QLatin1String pluginModuleDir{PLUGIN_MODULE_DIR};
463-static const QLatin1String pluginQmlDir{PLUGIN_QML_DIR};
464+static const QLatin1String pluginQmlDir{QML_DIR};
465
466 namespace SystemSettings {
467
468@@ -60,6 +61,7 @@
469 mutable PluginInterface2 *m_plugin2;
470 QString m_baseName;
471 QVariantMap m_data;
472+ QString m_dataPath;
473 };
474
475 } // namespace
476@@ -86,6 +88,7 @@
477 }
478
479 m_data = json.toVariant().toMap();
480+ m_dataPath = manifest.absolutePath();
481 }
482
483 bool PluginPrivate::ensureLoaded() const
484@@ -102,7 +105,13 @@
485 if (plugin.isEmpty())
486 return false;
487
488- QString name = QString("%1/lib%2.so").arg(pluginModuleDir).arg(plugin);
489+ auto ctx = QQmlEngine::contextForObject(q);
490+ const QString mountPoint = ctx ?
491+ ctx->contextProperty("mountPoint").value<QByteArray>() :
492+ "";
493+
494+ QString name = QString("%1%2/lib%3.so")
495+ .arg(mountPoint).arg(pluginModuleDir).arg(plugin);
496
497 m_loader.setFileName(name);
498 if (Q_UNLIKELY(!m_loader.load())) {
499@@ -143,8 +152,8 @@
500 QUrl componentUrl = m_data.value(key).toString();
501 if (!componentUrl.isEmpty()) {
502 if (componentUrl.isRelative()) {
503- QDir dir(pluginQmlDir);
504- if (dir.cd(m_baseName)) {
505+ QDir dir(m_dataPath);
506+ if (dir.cd(pluginQmlDir) && dir.cd(m_baseName)) {
507 componentUrl =
508 QUrl::fromLocalFile(dir.filePath(componentUrl.path()));
509 }
510
511=== modified file 'src/utils.cpp'
512--- src/utils.cpp 2016-02-16 15:20:07 +0000
513+++ src/utils.cpp 2016-09-30 13:43:32 +0000
514@@ -22,7 +22,8 @@
515 #include "debug.h"
516
517 #include <glib.h>
518-#include <QUrl>
519+#include <QStandardPaths>
520+#include <QUrlQuery>
521 #include <QUrlQuery>
522
523
524@@ -94,13 +95,19 @@
525 */
526 QString Utilities::getDestinationUrl(const QString &source)
527 {
528+ QString mapFile = QStandardPaths::locate(
529+ QStandardPaths::GenericDataLocation,
530+ QString("%1/%2").arg(PLUGIN_MANIFEST_DIR).arg("url-map.ini")
531+ );
532+ if (Q_UNLIKELY(mapFile.isEmpty())) {
533+ qWarning() << "could not locate map file";
534+ return source;
535+ }
536+
537 // This method will be called from multiple threads, and QSettings
538 // is reentrant, meaning each call to this function require its own
539 // settings instance.
540- QSettings map(
541- QString("%1/%2").arg(PLUGIN_MANIFEST_DIR).arg("url-map.ini"),
542- QSettings::IniFormat
543- );
544+ QSettings map(mapFile, QSettings::IniFormat);
545 map.sync();
546
547 // If reading the map failed, return the source unchanged.
548
549=== modified file 'tests/CMakeLists.txt'
550--- tests/CMakeLists.txt 2016-08-19 12:30:40 +0000
551+++ tests/CMakeLists.txt 2016-09-30 13:43:32 +0000
552@@ -10,8 +10,10 @@
553
554 add_definitions(-DI18N_DOMAIN="ubuntu-system-settings")
555 add_definitions(-DPLUGIN_PRIVATE_MODULE_DIR="${PLUGIN_PRIVATE_MODULE_DIR}")
556+add_definitions(-DPLUGIN_MODULE_DIR="${CMAKE_CURRENT_BINARY_DIR}")
557+add_definitions(-DMANIFEST_DIR="data")
558 add_definitions(-DPLUGIN_MANIFEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")
559-add_definitions(-DPLUGIN_MODULE_DIR="${CMAKE_CURRENT_BINARY_DIR}")
560+add_definitions(-DQML_DIR="${CMAKE_CURRENT_BINARY_DIR}")
561 add_definitions(-DPLUGIN_QML_DIR="${CMAKE_CURRENT_BINARY_DIR}")
562 add_definitions(-DSYSTEM_IMAGE_DBUS_TEMPLATE="${CMAKE_SOURCE_DIR}/tests/autopilot/ubuntu_system_settings/tests/systemimage.py")
563
564@@ -49,7 +51,9 @@
565 qt5_use_modules(tst-plugins Core Qml Test)
566 target_link_libraries(tst-plugins SystemSettings ${GLIB_LDFLAGS})
567 add_test(tst-plugins tst-plugins)
568-set_tests_properties(tst-plugins PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
569+set_tests_properties(tst-plugins PROPERTIES ENVIRONMENT
570+ "QT_QPA_PLATFORM=minimal;XDG_DATA_DIRS=${CMAKE_CURRENT_SOURCE_DIR}"
571+)
572
573 qt5_use_modules(tst-arguments Core Test)
574 target_link_libraries(tst-arguments ${GLIB_LDFLAGS})

Subscribers

People subscribed via source and target branches