diff --git a/plugin/utiltools.cpp b/plugin/utiltools.cpp index 1a6857d..72ffda7 100644 --- a/plugin/utiltools.cpp +++ b/plugin/utiltools.cpp @@ -35,6 +35,11 @@ void UtilTools::restartLipstick(QJSValue successCallback, QJSValue errorCallback execute(SystemTool, QStringList("restart_lipstick"), successCallback, errorCallback); } +void UtilTools::restartFingerprint(QJSValue successCallback, QJSValue errorCallback) +{ + execute(SystemTool, QStringList("restart_fingerprint"), successCallback, errorCallback); +} + void UtilTools::handleProcessExit(int exitCode, QProcess::ExitStatus status) { QProcess *process = qobject_cast(sender()); diff --git a/plugin/utiltools.h b/plugin/utiltools.h index f2342a3..306c09f 100644 --- a/plugin/utiltools.h +++ b/plugin/utiltools.h @@ -24,6 +24,9 @@ class UtilTools: public QObject Q_INVOKABLE void restartLipstick(QJSValue successCallback = QJSValue::UndefinedValue, QJSValue errorCallback = QJSValue::UndefinedValue); + Q_INVOKABLE void restartFingerprint(QJSValue successCallback = QJSValue::UndefinedValue, + QJSValue errorCallback = QJSValue::UndefinedValue); + private slots: void handleProcessExit(int exitCode, QProcess::ExitStatus status); diff --git a/qml/ActionList.qml b/qml/ActionList.qml index bbf5b3b..d05f359 100644 --- a/qml/ActionList.qml +++ b/qml/ActionList.qml @@ -29,7 +29,8 @@ Column { plugins.append(info) } var names = [ "RestartNetwork", "RestartUI", - "CleanPackageCache", "CleanTracker" ] + "CleanPackageCache", "CleanTracker", + "RestartFingerprint"] for (var i = 0; i < names.length; ++i) justLoad(names[i]) } diff --git a/qml/plugins/RestartFingerprint.qml b/qml/plugins/RestartFingerprint.qml new file mode 100644 index 0000000..de1fa1a --- /dev/null +++ b/qml/plugins/RestartFingerprint.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import Sailfish.Utilities 1.0 + +ActionItem { + //% "Fingerprint" + title: qsTrId("sailfish-tools-he-fingerprint") + //% "Restart" + actionName: qsTrId("sailfish-tools-bt-fingerprint_restart") + deviceLockRequired: false + //% "Restart fingerprint service. In some circumstancces this can " + //% "resolve issues where valid fingerprints are no longer being " + //% "recognised." + description: qsTrId("sailfish-utilities-restart-fingerprint_desc") + + function action(on_reply, on_error) { + UtilTools.restartFingerprint(on_reply, on_error) + } +} diff --git a/sailfish-utilities.pro b/sailfish-utilities.pro index d9cae34..32ae6dd 100644 --- a/sailfish-utilities.pro +++ b/sailfish-utilities.pro @@ -1,11 +1,18 @@ TEMPLATE = aux -PROJECTS = qml plugin qml/plugins +PROJECTS = qml plugin qml/plugins tools message($${PROJECTS}) -OTHER_FILES += *.qml *.js +OTHER_FILES += *.qml *.js *.txt qmldir +HEADERS += *.h +SOURCES += *.cpp for (PROJECT, PROJECTS) { OTHER_FILES += $${PROJECT}/*.qml \ - $${PROJECT}/*.js + $${PROJECT}/*.js \ + $${PROJECT}/*.txt \ + $${PROJECT}/qmldir \ + $${PROJECT}/*.sh \ + $${PROJECT}/*.in + HEADERS += $${PROJECT}/*.h + SOURCES += $${PROJECT}/*.cpp } -j diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f94c39b..56b545a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -22,5 +22,6 @@ install(PROGRAMS restart_network.sh restart_lipstick.sh tracker_reindex.sh + restart_fingerprint.sh DESTINATION share/sailfish-utilities ) diff --git a/tools/restart_fingerprint.sh b/tools/restart_fingerprint.sh new file mode 100755 index 0000000..ef6c13c --- /dev/null +++ b/tools/restart_fingerprint.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +warning() { + printf "%s: Warning: %s\n" "$(basename $0)" "${@}" 1>&2; +} + +service_do() { + if systemctl "$1" "$2"; then + return 0; + else + warning "Status $? on" "${@}" + return 1; + fi +} + +service_do restart sailfish-fpd +sleep 3 +service_do restart sailfish-fpd diff --git a/tools/sailfish_tools_system_action.cpp b/tools/sailfish_tools_system_action.cpp index 0592a26..915763e 100644 --- a/tools/sailfish_tools_system_action.cpp +++ b/tools/sailfish_tools_system_action.cpp @@ -66,11 +66,14 @@ std::map actions = { }}, { "tracker_reindex", [](action_ctx const *) { return execute_own_utility("tracker_reindex.sh"); + }}, + { "restart_fingerprint", [](action_ctx const *) { + return execute_own_utility("restart_fingerprint.sh"); }} }; std::set root_actions = { - "repair_rpm_db", "restart_network" + "repair_rpm_db", "restart_network", "restart_fingerprint" }; class BecomeRoot