Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[buteo-mtp] Use dconf setting for selecting symlink policy. JB#44457
Using dconf for configuring behavioral changes is preferred over
environment.

Users can change the symlink policy by setting dconf string value
with key /desktop/sailfish/buteo-mtp/symlink_policy.

When needed device specific configuration files can be used to
select default value, and optionally lock down the selection.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Feb 28, 2019
1 parent ee0a28c commit 0a57804
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions rpm/buteo-mtp-qt5.spec
Expand Up @@ -17,6 +17,7 @@ BuildRequires: pkgconfig(buteosyncfw5)
BuildRequires: pkgconfig(Qt5SystemInfo)
BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(mount)
BuildRequires: pkgconfig(mlite5)
# for the thumbnailer unit test
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: ssu-devel >= 0.37.9
Expand Down
17 changes: 17 additions & 0 deletions service/service.cpp
Expand Up @@ -32,6 +32,7 @@
#include <QStringList>
#include <QTimer>
#include <Logger.h>
#include <MGConfItem>
#include "mts.h"

using namespace meegomtp1dot0;
Expand All @@ -47,6 +48,19 @@ void signalHandler(int signum, siginfo_t *info, void *context)
_exit(0);
}

static void setupSymLinkPolicy()
{
MGConfItem confItem("/desktop/sailfish/buteo-mtp/symlink_policy");
QString symLinkPolicy(confItem.value().toString());

/* Note that we override value that might be existing in env,
* i.e. environment is used only as a vehicle for conveying the
* dconf setting data from main binary over to plugin that gets
* loaded at later stage.
*/
qputenv("BUTEO_MTP_SYMLINK_POLICY", symLinkPolicy.toUtf8());
}

int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
Expand All @@ -59,6 +73,9 @@ int main(int argc, char** argv)
parser.process(app);
bool logToHome(parser.isSet(logToHomeOption));

/* Get symlink policy from dconf */
setupSymLinkPolicy();

struct sigaction action;

action.sa_sigaction = signalHandler;
Expand Down
1 change: 1 addition & 0 deletions service/service.pro
Expand Up @@ -12,6 +12,7 @@ QT -= gui
CONFIG += link_pkgconfig
equals(QT_MAJOR_VERSION, 4): PKGCONFIG += buteosyncfw
equals(QT_MAJOR_VERSION, 5): PKGCONFIG += buteosyncfw5
PKGCONFIG += mlite5

SOURCES += service.cpp

Expand Down

0 comments on commit 0a57804

Please sign in to comment.