From 6f2159745d6ac958c2faf3f586fdd0a4915a8de2 Mon Sep 17 00:00:00 2001 From: Stefan Brand Date: Mon, 25 Dec 2017 13:30:43 +0100 Subject: [PATCH] Added Global Settings Storage and First Example Setting --- i18n/de.ts | 43 +++++++++++++++++++++------- i18n/en.ts | 43 +++++++++++++++++++++------- i18n/fi.ts | 46 +++++++++++++++++++++++------- i18n/fr.ts | 46 +++++++++++++++++++++++------- i18n/ru.ts | 46 +++++++++++++++++++++++------- i18n/sv.ts | 46 +++++++++++++++++++++++------- qml/harbour-sailotp.qml | 10 +++++++ qml/pages/MainView.qml | 4 +++ qml/pages/Settings.qml | 63 +++++++++++++++++++++++++++++++++++++++++ 9 files changed, 287 insertions(+), 60 deletions(-) create mode 100644 qml/pages/Settings.qml diff --git a/i18n/de.ts b/i18n/de.ts index 6e5f095..2a10e0d 100644 --- a/i18n/de.ts +++ b/i18n/de.ts @@ -272,56 +272,61 @@ Lizenz: BSD (3-Klausel) + Settings + Einstellungen + + + Export / Import Export / Import - + Add Token Token hinzufügen - + Nothing here Hier ist nichts - + Pull down to add a OTP Nach unten ziehen zum hinzufügen - + Deleting Lösche - + Token for Token für - + copied to clipboard kopiert - + Move up Nach oben - + Move down Nach unten - + Edit Bearbeiten - + Delete Löschen @@ -371,4 +376,22 @@ Lizenz: BSD (3-Klausel) Vorschau antippen um den Scan zu starten. Nach unten ziehen um manuell hinzu zu fügen. + + Settings + + + Settings + Einstellungen + + + + Behaviour + Verhalten + + + + Show Token as QRCode on Tap + Token bei antippen als QR-Code zeigen + + diff --git a/i18n/en.ts b/i18n/en.ts index 773c286..b68568e 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -254,56 +254,61 @@ License: BSD (3-clause) - Export / Import + Settings + Export / Import + + + + Add Token - + Nothing here - + Pull down to add a OTP - + Deleting - + Token for - + copied to clipboard - + Move up Move up - + Move down Move down - + Edit - + Delete @@ -349,4 +354,22 @@ License: BSD (3-clause) + + Settings + + + Settings + + + + + Behaviour + + + + + Show Token as QRCode on Tap + + + diff --git a/i18n/fi.ts b/i18n/fi.ts index b52e2ad..a601bb6 100644 --- a/i18n/fi.ts +++ b/i18n/fi.ts @@ -257,56 +257,62 @@ Lisenssi: BSD (3-clause) + Settings + Translated using Google Translate + Asetukset + + + Export / Import Eksportoi / Importoi - + Add Token Lisää tunnus - + Nothing here Tyhjä - + Pull down to add a OTP Vedä alaspäin lisääksesi OTP:n - + Deleting Poistaa - + Token for Tunnus - + copied to clipboard kopioitu leikepöydälle - + Move up Siirrä ylös - + Move down Siirrä alas - + Edit Muokkaa - + Delete Poista @@ -352,4 +358,24 @@ Lisenssi: BSD (3-clause) Käynnistä / lopeta skannaus painamalla kuvaa. Vedä alaspäin lisääksesi tunnuksen käsin. + + Settings + + + Settings + Asetukset + + + + Behaviour + Translated using Google Translate + Käytös + + + + Show Token as QRCode on Tap + Translated using Google Translate + Kosketa tokenä QR-koodina + + diff --git a/i18n/fr.ts b/i18n/fr.ts index b6dfe4d..aba2e52 100644 --- a/i18n/fr.ts +++ b/i18n/fr.ts @@ -256,56 +256,62 @@ Licence : BSD (3 clauses) + Settings + Translated using Google Translate + Paramètres + + + Export / Import Exporter / Importer - + Add Token Ajouter un OTP - + Nothing here Aucun mot de passe - + Pull down to add a OTP Glissez vers le bas pour ajouter un OTP - + Deleting Suppression - + Token for OTP pour - + copied to clipboard copié dans le presse-papier - + Move up Déplacer vers le haut - + Move down Déplacer vers le bas - + Edit Modifier - + Delete Supprimer @@ -351,4 +357,24 @@ Licence : BSD (3 clauses) Appuyez sur l'image pour démarrer / arréter le balayage. Glissez vers le bas pour entrer les paramètres manuellement. + + Settings + + + Settings + Paramètres + + + + Behaviour + Translated using Google Translate + Comportement + + + + Show Token as QRCode on Tap + Translated using Google Translate + Touchez le jeton comme un code QR + + diff --git a/i18n/ru.ts b/i18n/ru.ts index 9378c20..18d2088 100644 --- a/i18n/ru.ts +++ b/i18n/ru.ts @@ -257,56 +257,62 @@ License: BSD (3-clause) + Settings + Translated using Google Translate + настройки + + + Export / Import Экспорт / импорт - + Add Token Добавить токен - + Nothing here Ничего нету - + Pull down to add a OTP Потяните вниз чтобы добавить OTP - + Deleting Удаление - + Token for Токен для - + copied to clipboard скопирован в буфер обмена - + Move up Передвинуть вверх - + Move down Передвинуть вниз - + Edit Редактировать - + Delete Удалить @@ -352,4 +358,24 @@ License: BSD (3-clause) Нажмите на изображение чтобы начать / остановить сканирование. Потяните вниз чтобы добавить токен вручную. + + Settings + + + Settings + настройки + + + + Behaviour + Translated using Google Translate + поведение + + + + Show Token as QRCode on Tap + Translated using Google Translate + Сенсорный токен как QR-код + + diff --git a/i18n/sv.ts b/i18n/sv.ts index b2be2f0..1b28481 100644 --- a/i18n/sv.ts +++ b/i18n/sv.ts @@ -257,56 +257,62 @@ Licens: BSD (3-clause) + Settings + Translated using Google Translate + Inställningar + + + Export / Import Export / Import - + Add Token Lägg till Token - + Nothing here Inget här - + Pull down to add a OTP Dra neråt för att lägga till en OTP - + Deleting Tar bort - + Token for Token för - + copied to clipboard kopierad till urklipp - + Move up Flytta upp - + Move down Flytta ner - + Edit Redigera - + Delete Ta bort @@ -352,4 +358,24 @@ Licens: BSD (3-clause) Tryck på bilden för att starta / stoppa skanning. Dra neråt för att lägga till Token manuellt. + + Settings + + + Settings + Inställningar + + + + Behaviour + Translated using Google Translate + Beteende + + + + Show Token as QRCode on Tap + Translated using Google Translate + Peka token som en QR-kod + + diff --git a/qml/harbour-sailotp.qml b/qml/harbour-sailotp.qml index 1d08574..eac8785 100644 --- a/qml/harbour-sailotp.qml +++ b/qml/harbour-sailotp.qml @@ -29,6 +29,7 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 +import org.nemomobile.configuration 1.0 import "pages" import "components" @@ -52,6 +53,15 @@ ApplicationWindow // Global Component for showing notification banners NotifyBanner { id: notify } + // Global Settings Storage + ConfigurationGroup + { + id: settings + path: "/apps/harbour-sailotp" + + property bool showQrDefaultAction: false + } + // Add an entry to the list function appendOTP(title, secret, type, counter, fav, len, diff) { listModel.append({"secret": secret, "title": title, "fav": fav, "type": type, "counter": counter, "len": len, "diff": diff, "otp": "------"}); diff --git a/qml/pages/MainView.qml b/qml/pages/MainView.qml index 948b5b9..0eaf176 100644 --- a/qml/pages/MainView.qml +++ b/qml/pages/MainView.qml @@ -96,6 +96,10 @@ Page { text: qsTr("About") onClicked: pageStack.push(Qt.resolvedUrl("About.qml")) } + MenuItem { + text: qsTr("Settings") + onClicked: pageStack.push(Qt.resolvedUrl("Settings.qml")) + } MenuItem { text: qsTr("Export / Import") onClicked: pageStack.push(Qt.resolvedUrl("ExportPage.qml"), {parentPage: mainPage, mode: "export"}) diff --git a/qml/pages/Settings.qml b/qml/pages/Settings.qml new file mode 100644 index 0000000..52daeec --- /dev/null +++ b/qml/pages/Settings.qml @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2014, Stefan Brand + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * 3. The names of the contributors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +import QtQuick 2.0 +import Sailfish.Silica 1.0 + + +Page { + id: settingsPage + allowedOrientations: Orientation.All + + SilicaFlickable { + id: flickable + anchors.fill: parent + width: parent.width + contentHeight: column.height + + Column { + id: column + width: parent.width + spacing: Theme.paddingSmall + + PageHeader { title: qsTr("Settings") } + + SectionHeader { text: qsTr("Behaviour") } + TextSwitch { + id: showQrDefault + checked: settings.showQrDefaultAction + text: qsTr("Show Token as QRCode on Tap") + onClicked: settings.showQrDefaultAction = !settings.showQrDefaultAction + } + + } + VerticalScrollDecorator { } + } +}