1
0
Fork 0
mirror of https://github.com/seiichiro0185/sailotp.git synced 2024-11-21 15:29:42 +00:00

Added Global Settings Storage and First Example Setting

This commit is contained in:
seiichiro 2017-12-25 13:30:43 +01:00
parent a833d36280
commit 6f2159745d
9 changed files with 287 additions and 60 deletions

View file

@ -272,56 +272,61 @@ Lizenz: BSD (3-Klausel)</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation>Export / Import</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation>Token hinzufügen</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation>Hier ist nichts</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation>Nach unten ziehen zum hinzufügen</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation>Lösche</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation>Token für </translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation> kopiert</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Nach oben</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Nach unten</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation>Bearbeiten</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation>Löschen</translation>
</message>
@ -371,4 +376,22 @@ Lizenz: BSD (3-Klausel)</translation>
<translation type="vanished">Vorschau antippen um den Scan zu starten. Nach unten ziehen um manuell hinzu zu fügen.</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation>Einstellungen</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translation>Verhalten</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translation>Token bei antippen als QR-Code zeigen</translation>
</message>
</context>
</TS>

View file

@ -254,56 +254,61 @@ License: BSD (3-clause)</source>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Export / Import</source>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Move up</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Move down</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation></translation>
</message>
@ -349,4 +354,22 @@ License: BSD (3-clause)</source>
<translation></translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translation></translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translation></translation>
</message>
</context>
</TS>

View file

@ -257,56 +257,62 @@ Lisenssi: BSD (3-clause)</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Settings</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Asetukset</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation>Eksportoi / Importoi</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation>Lisää tunnus</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation>Tyhjä</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation>Vedä alaspäin lisääksesi OTP:n</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation>Poistaa</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation>Tunnus </translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation> kopioitu leikepöydälle</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Siirrä ylös</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Siirrä alas</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation>Muokkaa</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation>Poista</translation>
</message>
@ -352,4 +358,24 @@ Lisenssi: BSD (3-clause)</translation>
<translation>Käynnistä / lopeta skannaus painamalla kuvaa. Vedä alaspäin lisääksesi tunnuksen käsin.</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation>Asetukset</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Käytös</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Kosketa tokenä QR-koodina</translation>
</message>
</context>
</TS>

View file

@ -256,56 +256,62 @@ Licence : BSD (3 clauses)</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Settings</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Paramètres</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation>Exporter / Importer</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation>Ajouter un OTP</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation>Aucun mot de passe</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation>Glissez vers le bas pour ajouter un OTP</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation>Suppression</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation>OTP pour </translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation> copié dans le presse-papier</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Déplacer vers le haut</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Déplacer vers le bas</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation>Modifier</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation>Supprimer</translation>
</message>
@ -351,4 +357,24 @@ Licence : BSD (3 clauses)</translation>
<translation>Appuyez sur l&apos;image pour démarrer / arréter le balayage. Glissez vers le bas pour entrer les paramètres manuellement.</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Comportement</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Touchez le jeton comme un code QR</translation>
</message>
</context>
</TS>

View file

@ -257,56 +257,62 @@ License: BSD (3-clause)</source>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Settings</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>настройки</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation>Экспорт / импорт</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation>Добавить токен</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation>Ничего нету</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation>Потяните вниз чтобы добавить OTP</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation>Удаление</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation>Токен для </translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation> скопирован в буфер обмена</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Передвинуть вверх</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Передвинуть вниз</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation>Редактировать</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
@ -352,4 +358,24 @@ License: BSD (3-clause)</source>
<translation>Нажмите на изображение чтобы начать / остановить сканирование. Потяните вниз чтобы добавить токен вручную.</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation>настройки</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>поведение</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Сенсорный токен как QR-код</translation>
</message>
</context>
</TS>

View file

@ -257,56 +257,62 @@ Licens: BSD (3-clause)</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="100"/>
<source>Settings</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Inställningar</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<source>Export / Import</source>
<translation>Export / Import</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="104"/>
<location filename="../qml/pages/MainView.qml" line="108"/>
<source>Add Token</source>
<translation>Lägg till Token</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="134"/>
<location filename="../qml/pages/MainView.qml" line="138"/>
<source>Nothing here</source>
<translation>Inget här</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="135"/>
<location filename="../qml/pages/MainView.qml" line="139"/>
<source>Pull down to add a OTP</source>
<translation>Dra neråt för att lägga till en OTP</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="146"/>
<location filename="../qml/pages/MainView.qml" line="150"/>
<source>Deleting</source>
<translation>Tar bort</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source>Token for </source>
<translation>Token för </translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="162"/>
<location filename="../qml/pages/MainView.qml" line="166"/>
<source> copied to clipboard</source>
<translation>kopierad till urklipp</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="230"/>
<location filename="../qml/pages/MainView.qml" line="234"/>
<source>Move up</source>
<translation>Flytta upp</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="235"/>
<location filename="../qml/pages/MainView.qml" line="239"/>
<source>Move down</source>
<translation>Flytta ner</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="240"/>
<location filename="../qml/pages/MainView.qml" line="244"/>
<source>Edit</source>
<translation>Redigera</translation>
</message>
<message>
<location filename="../qml/pages/MainView.qml" line="246"/>
<location filename="../qml/pages/MainView.qml" line="250"/>
<source>Delete</source>
<translation>Ta bort</translation>
</message>
@ -352,4 +358,24 @@ Licens: BSD (3-clause)</translation>
<translation>Tryck bilden för att starta / stoppa skanning. Dra neråt för att lägga till Token manuellt.</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="../qml/pages/Settings.qml" line="50"/>
<source>Settings</source>
<translation>Inställningar</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="52"/>
<source>Behaviour</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Beteende</translation>
</message>
<message>
<location filename="../qml/pages/Settings.qml" line="56"/>
<source>Show Token as QRCode on Tap</source>
<translatorcomment>Translated using Google Translate</translatorcomment>
<translation>Peka token som en QR-kod</translation>
</message>
</context>
</TS>

View file

@ -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": "------"});

View file

@ -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"})

63
qml/pages/Settings.qml Normal file
View file

@ -0,0 +1,63 @@
/*
* Copyright (c) 2014, Stefan Brand <seiichiro@seiichiro0185.org>
* 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 { }
}
}