[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-foilauth.git</param>
<param name="branch">master</param>
- <param name="revision">280e9dd</param>
+ <param name="revision">1a98202</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/foil-ui/FoilUiEnterPasswordView.qml
^
|
@@ -12,21 +12,25 @@
property bool wrongPassword
property Component iconComponent
- readonly property var settings: foilUi.settings
- readonly property int screenHeight: page.isLandscape ? Screen.width : Screen.height
- readonly property bool landscapeLayout: page.isLandscape && Screen.sizeCategory < Screen.Large
- readonly property bool unlocking: !foilUi.isLockedState(foilModel.foilState)
- readonly property bool canEnterPassword: inputField.text.length > 0 && !unlocking &&
+ readonly property var _settings: foilUi.settings
+ readonly property int _screenHeight: page.isLandscape ? Screen.width : Screen.height
+ readonly property bool _landscapeLayout: page.isLandscape && Screen.sizeCategory < Screen.Large
+ readonly property bool _unlocking: !foilUi.isLockedState(foilModel.foilState)
+ readonly property bool _canEnterPassword: inputField.text.length > 0 && !_unlocking &&
!wrongPasswordAnimation.running && !wrongPassword
function enterPassword() {
if (!foilModel.unlock(inputField.text)) {
wrongPassword = true
wrongPasswordAnimation.start()
- inputField.requestFocus()
+ requestFocus()
}
}
+ function requestFocus() {
+ inputField.requestFocus()
+ }
+
PullDownMenu {
id: pullDownMenu
@@ -64,8 +68,8 @@
id: panel
width: parent.width
- height: childrenRect.height + (landscapeLayout ? 0 : Theme.paddingLarge)
- y: Math.min(Math.floor((screenHeight - height)/2), parent.height - height)
+ height: childrenRect.height + (_landscapeLayout ? 0 : Theme.paddingLarge)
+ y: Math.min(Math.floor((_screenHeight - height)/2), parent.height - height)
readonly property bool showLongPrompt: y >= Theme.paddingMedium
@@ -90,19 +94,19 @@
top: longPrompt.bottom
topMargin: Theme.paddingLarge
}
- enabled: !unlocking
+ enabled: !_unlocking
onTextChanged: view.wrongPassword = false
EnterKey.onClicked: view.enterPassword()
- EnterKey.enabled: view.canEnterPassword
+ EnterKey.enabled: view._canEnterPassword
}
Button {
id: button
- text: unlocking ?
+ text: _unlocking ?
foilUi.qsTrEnterPasswordViewButtonUnlocking() :
foilUi.qsTrEnterPasswordViewButtonUnlock()
- enabled: view.canEnterPassword
+ enabled: view._canEnterPassword
onClicked: view.enterPassword()
}
}
@@ -116,19 +120,19 @@
Loader {
anchors {
top: parent.top
- topMargin: screenHeight - height - Theme.paddingLarge
+ topMargin: _screenHeight - height - Theme.paddingLarge
left: parent.left
leftMargin: Theme.horizontalPageMargin
right: parent.right
rightMargin: Theme.horizontalPageMargin
}
- readonly property bool display: settings.sharedKeyWarning && foilUi.otherFoilAppsInstalled
+ readonly property bool display: _settings.sharedKeyWarning && foilUi.otherFoilAppsInstalled
opacity: display ? 1 : 0
active: opacity > 0
sourceComponent: Component {
FoilUiAppsWarning {
foilUi: view.foilUi
- onClicked: settings.sharedKeyWarning = false
+ onClicked: _settings.sharedKeyWarning = false
}
}
Behavior on opacity { FadeAnimation {} }
@@ -137,7 +141,7 @@
states: [
State {
name: "portrait"
- when: !landscapeLayout
+ when: !_landscapeLayout
changes: [
AnchorChanges {
target: inputField
@@ -165,7 +169,7 @@
},
State {
name: "landscape"
- when: landscapeLayout
+ when: _landscapeLayout
changes: [
AnchorChanges {
target: inputField
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/qml/MainPage.qml
^
|
@@ -253,6 +253,11 @@
}
}
}
+ onItemChanged: {
+ if (item) {
+ item.requestFocus()
+ }
+ }
Behavior on opacity { FadeAnimation { } }
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/qml/QRCodePage.qml
^
|
@@ -4,24 +4,31 @@
Page {
property alias uri: generator.text
+ property alias label: header.title
+ property alias issuer: header.description
forwardNavigation: false
- backNavigation: false
- HarbourQrCodeGenerator {
- id: generator
+ PageHeader { id: header }
- ecLevel: FoilAuthSettings.qrCodeEcLevel
+ Item {
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: header.bottom
+ bottom: parent.bottom
+ }
+
+ QRCodeImage {
+ qrcode: generator.qrcode
+ anchors.centerIn: parent
+ maximumSize: Math.min(parent.width - 2 * Theme.horizontalPageMargin, parent.height - 2 * Theme.paddingLarge)
+ }
}
- QRCodeImage {
- qrcode: generator.qrcode
- anchors.centerIn: parent
- }
+ HarbourQrCodeGenerator {
+ id: generator
- MouseArea {
- anchors.fill: parent
- onClicked: pageStack.pop()
- onPressAndHold: /* ignore */;
+ ecLevel: FoilAuthSettings.qrCodeEcLevel
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/qml/ScanPage.qml
^
|
@@ -1,6 +1,8 @@
import QtQuick 2.0
import QtMultimedia 5.4
import Sailfish.Silica 1.0
+import Sailfish.Media 1.0
+import org.nemomobile.policy 1.0
import org.nemomobile.notifications 1.0
import harbour.foilauth 1.0
@@ -9,10 +11,12 @@
Page {
id: thisPage
- property Item viewFinder
- property Item hint
+ property Item _viewFinder
+ property Item _hint
- readonly property bool canScan: viewFinder && viewFinder.source.cameraState === Camera.ActiveState
+ readonly property bool _canUseVolumeKeys: FoilAuthSettings.volumeZoom && Qt.application.active &&
+ (status === PageStatus.Active)
+ readonly property bool canScan: _viewFinder && _viewFinder.source.cameraState === Camera.ActiveState
readonly property bool canShowViewFinder: Qt.application.active &&
(status === PageStatus.Active || status === PageStatus.Deactivating)
@@ -28,22 +32,22 @@
onCanShowViewFinderChanged: {
if (canShowViewFinder) {
- viewFinder = viewFinderComponent.createObject(viewFinderContainer, {
+ _viewFinder = viewFinderComponent.createObject(viewFinderContainer, {
viewfinderResolution: viewFinderContainer.viewfinderResolution,
digitalZoom: FoilAuthSettings.scanZoom,
orientation: orientationAngle()
})
- if (viewFinder.source.availability === Camera.Available) {
+ if (_viewFinder.source.availability === Camera.Available) {
console.log("created viewfinder")
- viewFinder.source.start()
+ _viewFinder.source.start()
} else {
console.log("oops, couldn't create viewfinder...")
}
} else {
- viewFinder.source.stop()
- viewFinder.destroy()
- viewFinder = null
+ _viewFinder.source.stop()
+ _viewFinder.destroy()
+ _viewFinder = null
}
}
@@ -65,8 +69,8 @@
}
onOrientationChanged: {
- if (viewFinder) {
- viewFinder.orientation = orientationAngle()
+ if (_viewFinder) {
+ _viewFinder.orientation = orientationAngle()
}
}
@@ -76,16 +80,16 @@
}
function showHint(text) {
- if (!hint) {
- hint = hintComponent.createObject(thisPage)
+ if (!_hint) {
+ _hint = hintComponent.createObject(thisPage)
}
- hint.text = text
- hint.opacity = 1.0
+ _hint.text = text
+ _hint.opacity = 1.0
}
function hideHint() {
- if (hint) {
- hint.opacity = 0.0
+ if (_hint) {
+ _hint.opacity = 0.0
}
}
@@ -200,15 +204,16 @@
Rectangle {
id: viewFinderContainer
- readonly property real ratio_4_3: 4./3.
- readonly property real ratio_16_9: 16./9.
- readonly property bool canSwitchResolutions: typeof ViewfinderResolution_4_3 !== "undefined" &&
- typeof ViewfinderResolution_16_9 !== "undefined"
+ readonly property bool canSwitchResolutions:
+ FoilAuthSettings.wideCameraResolution.width > 0 && FoilAuthSettings.wideCameraResolution.height > 0 &&
+ FoilAuthSettings.narrowCameraResolution.width > 0 && FoilAuthSettings.narrowCameraResolution.height > 0
readonly property size viewfinderResolution: canSwitchResolutions ?
- (FoilAuthSettings.scanWideMode ? ViewfinderResolution_4_3 : ViewfinderResolution_16_9) :
+ (FoilAuthSettings.scanWideMode ? FoilAuthSettings.wideCameraResolution : FoilAuthSettings.narrowCameraResolution) :
Qt.size(0,0)
- readonly property real ratio: canSwitchResolutions ? (FoilAuthSettings.scanWideMode ? ratio_4_3 : ratio_16_9) :
- typeof ViewfinderResolution_4_3 !== "undefined" ? ratio_4_3 : ratio_16_9
+ readonly property real ratio: canSwitchResolutions ?
+ (FoilAuthSettings.scanWideMode ? FoilAuthSettings.wideCameraRatio : FoilAuthSettings.narrowCameraRatio) :
+ (FoilAuthSettings.wideCameraResolution.width > 0 && FoilAuthSettings.wideCameraResolution.height > 0) ?
+ FoilAuthSettings.wideCameraRatio : FoilAuthSettings.narrowCameraRatio
readonly property int portraitWidth: Math.floor((parent.height/parent.width > ratio) ? parent.width : parent.height/ratio)
readonly property int portraitHeight: Math.floor((parent.height/parent.width > ratio) ? (parent.width * ratio) : parent.height)
@@ -226,13 +231,31 @@
onYChanged: updateViewFinderPosition()
onViewfinderResolutionChanged: {
- if (viewFinder && viewfinderResolution && canSwitchResolutions) {
- viewFinder.viewfinderResolution = viewfinderResolution
+ if (_viewFinder && viewfinderResolution && canSwitchResolutions) {
+ _viewFinder.viewfinderResolution = viewfinderResolution
}
}
function updateViewFinderPosition() {
- scanner.viewFinderRect = Qt.rect(x + parent.x, y + parent.y, viewFinder ? viewFinder.width : width, viewFinder ? viewFinder.height : height)
+ scanner.viewFinderRect = Qt.rect(x + parent.x, y + parent.y, _viewFinder ? _viewFinder.width : width, _viewFinder ? _viewFinder.height : height)
+ }
+
+ function updateSupportedResolution_4_3(res) {
+ if (res.width > FoilAuthSettings.wideCameraResolution.width) {
+ FoilAuthSettings.wideCameraResolution = res
+ }
+ }
+
+ function updateSupportedResolution_16_9(res) {
+ if (res.width > FoilAuthSettings.narrowCameraResolution.width) {
+ FoilAuthSettings.narrowCameraResolution = res
+ }
+ }
+
+ Connections {
+ target: _viewFinder
+ onSupportedWideResolutionChanged: viewFinderContainer.updateSupportedResolution_4_3(_viewFinder.supportedWideResolution)
+ onSupportedNarrowResolutionChanged: viewFinderContainer.updateSupportedResolution_16_9(_viewFinder.supportedNarrowResolution)
}
}
}
@@ -258,13 +281,13 @@
}
visible: TorchSupported
- icon.source: (viewFinder && viewFinder.flashOn) ? "images/flash-on.svg" : "images/flash-off.svg"
+ icon.source: (_viewFinder && _viewFinder.flashOn) ? "images/flash-on.svg" : "images/flash-off.svg"
//: Hint label
//% "Toggle flashlight"
hint: qsTrId("foilauth-scan-hint_toggle_flash")
- onShowHint: thisPage.showHint(hint)
+ onShowHint: thisPage.showHint(_hint)
onHideHint: thisPage.hideHint()
- onClicked: if (viewFinder) viewFinder.toggleFlash()
+ onClicked: if (_viewFinder) _viewFinder.toggleFlash()
}
Slider {
@@ -286,16 +309,40 @@
maximumValue: FoilAuthSettings.maxZoom
value: 1.0
stepSize: (maximumValue - minimumValue)/100
+
onValueChanged: {
FoilAuthSettings.scanZoom = value
- if (viewFinder) {
- viewFinder.digitalZoom = value
+ if (_viewFinder) {
+ _viewFinder.digitalZoom = value
}
}
+
Component.onCompleted: {
value = FoilAuthSettings.scanZoom
- if (viewFinder) {
- viewFinder.digitalZoom = value
+ if (_viewFinder) {
+ _viewFinder.digitalZoom = value
+ }
+ }
+
+ function zoomIn() {
+ if (value < maximumValue) {
+ var newValue = value + stepSize
+ if (newValue < maximumValue) {
+ value = newValue
+ } else {
+ value = maximumValue
+ }
+ }
+ }
+
+ function zoomOut() {
+ if (value > minimumValue) {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/qml/TokenListView.qml
^
|
@@ -276,6 +276,8 @@
onClicked: {
pageStack.push(Qt.resolvedUrl("QRCodePage.qml"), {
allowedOrientations: mainPage.allowedOrientations,
+ label: model.label,
+ issuer: model.issuer,
uri: FoilAuth.toUri(model.type, model.secret, model.label, model.issuer,
model.digits, model.counter, model.timeshift, model.algorithm)
})
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/qml/ViewFinder.qml
^
|
@@ -12,11 +12,11 @@
property alias beepSource: beep.source
property bool playingBeep: false
property size viewfinderResolution
- property bool completed
property real digitalZoom: 1.0
+ property size supportedWideResolution: Qt.size(0,0) // 4:3
+ property size supportedNarrowResolution: Qt.size(0,0) // 16:9
readonly property bool cameraActive: camera.cameraState === Camera.ActiveState
- readonly property bool tapFocusActive: focusTimer.running
readonly property bool flashOn: camera.flash.mode !== Camera.FlashOff
// Not sure why not just camera.orientation but this makes the camera
// behave similar to what it does for Jolla Camera
@@ -26,6 +26,12 @@
// Camera.ActiveStatus and doesn't emit maximumDigitalZoomChanged signal
signal maximumDigitalZoom(var value)
+ // Internal properties
+ readonly property bool _tapFocusActive: focusTimer.running
+ readonly property real _ratio_4_3: 4./3.
+ readonly property real _ratio_16_9: 16./9.
+ property bool _completed
+
onOrientationChanged: {
if (camera.cameraState !== Camera.UnloadedState) {
reloadTimer.restart()
@@ -52,7 +58,7 @@
if (viewfinderResolution) {
camera.viewfinder.resolution = viewfinderResolution
}
- completed = true
+ _completed = true
}
function turnFlashOn() {
@@ -140,15 +146,15 @@
imageProcessing.whiteBalanceMode: flashOn ?
CameraImageProcessing.WhiteBalanceFlash :
CameraImageProcessing.WhiteBalanceTungsten
- cameraState: (completed && !reloadTimer.running) ?
+ cameraState: (_completed && !reloadTimer.running) ?
Camera.ActiveState : Camera.UnloadedState
exposure {
exposureCompensation: 1.0
exposureMode: Camera.ExposureAuto
}
focus {
- focusMode: tapFocusActive ? Camera.FocusAuto : Camera.FocusContinuous
- focusPointMode: tapFocusActive ? Camera.FocusPointCustom : Camera.FocusPointAuto
+ focusMode: _tapFocusActive ? Camera.FocusAuto : Camera.FocusContinuous
+ focusPointMode: _tapFocusActive ? Camera.FocusPointCustom : Camera.FocusPointAuto
}
onCameraStatusChanged: {
if (cameraStatus === Camera.ActiveStatus) {
@@ -156,6 +162,7 @@
viewFinder.maximumDigitalZoom(maximumDigitalZoom)
digitalZoom = viewFinder.digitalZoom
}
+ updateSupportedResolutions()
}
onCameraStateChanged: {
if (cameraState === Camera.ActiveState) {
@@ -167,6 +174,32 @@
}
}
}
+ function updateSupportedResolutions() {
+ var list = camera.supportedViewfinderResolutions()
+ var max_4_3 = Qt.size(0,0)
+ var max_16_9 = Qt.size(0,0)
+ for (var i = 0; i < list.length; i++) {
+ var size = list[i]
+ var ratio = size.width / size.height
+ if (ratio === _ratio_4_3) {
+ if (size.width > max_4_3.width) {
+ max_4_3 = size
+ }
+ } else if (ratio === _ratio_16_9) {
+ if (size.width > max_16_9.width) {
+ max_16_9 = size
+ }
+ }
+ }
+ if (supportedWideResolution.width !== max_4_3.width &&
+ supportedWideResolution.height !== max_4_3.height) {
+ supportedWideResolution = Qt.size(max_4_3.width, max_4_3.height)
+ }
+ if (supportedNarrowResolution.width !== max_16_9.width &&
+ supportedNarrowResolution.height !== max_16_9.height) {
+ supportedNarrowResolution = Qt.size(max_16_9.width, max_16_9.height)
+ }
+ }
}
Timer {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/settings/settings.qml
^
|
@@ -26,7 +26,7 @@
description: applicationName ?
//: Settings page header description (app version)
//% "Version %1"
- qsTrId("foilauth-settings_page-header-version").arg("1.1.5") : ""
+ qsTrId("foilauth-settings_page-header-version").arg("1.1.6") : ""
Image {
id: appIcon
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/src/FoilAuthModel.cpp
^
|
@@ -543,6 +543,9 @@
foilmsg_encrypt(out, &data, NULL, &headers, aPrivate, aPublic,
Util::encryptionOptions(&opt), NULL);
foil_output_unref(out);
+ if (chmod(fname, ENCRYPT_FILE_MODE) < 0) {
+ HWARN("Failed to chmod" << fname << strerror(errno));
+ }
} else {
HWARN("Failed to open" << fname);
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/src/FoilAuthSettings.cpp
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2019-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2019-2022 Jolla Ltd.
- * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -40,9 +40,12 @@
#include <MGConfItem>
#define DCONF_KEY(x) FOILAUTH_DCONF_ROOT x
+#define KEY_RESOLUTION_4_3 DCONF_KEY("resolution_4_3") // Width is stored
+#define KEY_RESOLUTION_16_9 DCONF_KEY("resolution_16_9") // Width is stored
#define KEY_QRCODE_ECLEVEL DCONF_KEY("qrCodeEcLevel")
#define KEY_MAX_ZOOM DCONF_KEY("maxZoom")
#define KEY_SCAN_ZOOM DCONF_KEY("scanZoom")
+#define KEY_VOLUME_ZOOM DCONF_KEY("volumeZoom")
#define KEY_SCAN_WIDE_MODE DCONF_KEY("scanWideMode")
#define KEY_SHARED_KEY_WARNING DCONF_KEY("sharedKeyWarning")
#define KEY_SHARED_KEY_WARNING2 DCONF_KEY("sharedKeyWarning2")
@@ -54,25 +57,43 @@
#define DEFAULT_QRCODE_ECLEVEL ((int)HarbourQrCodeGenerator::ECLevelLowest)
#define DEFAULT_MAX_ZOOM 10.f
#define DEFAULT_SCAN_ZOOM 3.f
+#define DEFAULT_VOLUME_ZOOM true
#define DEFAULT_SCAN_WIDE_MODE false
#define DEFAULT_SHARED_KEY_WARNING true
#define DEFAULT_AUTO_LOCK true
#define DEFAULT_AUTO_LOCK_TIME 15000
+// Camera configuration (got removed at some point)
+#define CAMERA_DCONF_PATH_(x) "/apps/jolla-camera/primary/image/" x
+#define CAMERA_DCONF_RESOLUTION_4_3 CAMERA_DCONF_PATH_("viewfinderResolution_4_3")
+#define CAMERA_DCONF_RESOLUTION_16_9 CAMERA_DCONF_PATH_("viewfinderResolution_16_9")
+
// ==========================================================================
// FoilAuthSettings::Private
// ==========================================================================
-class FoilAuthSettings::Private {
+class FoilAuthSettings::Private
+{
public:
- Private(FoilAuthSettings* aParent);
+ Private(FoilAuthSettings*);
+
+ static int validateQrCodeEcLevel(int);
+ static QSize toSize(const QVariant);
+ static QSize size_4_3(int);
+ static QSize size_16_9(int);
- static int validateQrCodeEcLevel(int aValue);
+ QSize resolution_4_3();
+ QSize resolution_16_9();
public:
+ const int iDefaultResolution_4_3;
+ const int iDefaultResolution_16_9;
+ MGConfItem* iResolution_4_3;
+ MGConfItem* iResolution_16_9;
MGConfItem* iQrCodeEcLevel;
MGConfItem* iMaxZoom;
MGConfItem* iScanZoom;
+ MGConfItem* iVolumeZoom;
MGConfItem* iScanWideMode;
MGConfItem* iSharedKeyWarning;
MGConfItem* iSharedKeyWarning2;
@@ -82,10 +103,16 @@
MGConfItem* iSailotpImportedTokens;
};
-FoilAuthSettings::Private::Private(FoilAuthSettings* aParent) :
+FoilAuthSettings::Private::Private(
+ FoilAuthSettings* aParent) :
+ iDefaultResolution_4_3(toSize(MGConfItem(CAMERA_DCONF_RESOLUTION_4_3).value()).width()),
+ iDefaultResolution_16_9(toSize(MGConfItem(CAMERA_DCONF_RESOLUTION_16_9).value()).width()),
+ iResolution_4_3(new MGConfItem(KEY_RESOLUTION_4_3, aParent)),
+ iResolution_16_9(new MGConfItem(KEY_RESOLUTION_16_9, aParent)),
iQrCodeEcLevel(new MGConfItem(KEY_QRCODE_ECLEVEL, aParent)),
iMaxZoom(new MGConfItem(KEY_MAX_ZOOM, aParent)),
iScanZoom(new MGConfItem(KEY_SCAN_ZOOM, aParent)),
+ iVolumeZoom(new MGConfItem(KEY_VOLUME_ZOOM, aParent)),
iScanWideMode(new MGConfItem(KEY_SCAN_WIDE_MODE, aParent)),
iSharedKeyWarning(new MGConfItem(KEY_SHARED_KEY_WARNING, aParent)),
iSharedKeyWarning2(new MGConfItem(KEY_SHARED_KEY_WARNING2, aParent)),
@@ -94,26 +121,21 @@
iSailotpImportDone(new MGConfItem(KEY_SAILOTP_IMPORT_DONE, aParent)),
iSailotpImportedTokens(new MGConfItem(KEY_SAILOTP_IMPORTED_TOKENS, aParent))
{
- QObject::connect(iQrCodeEcLevel, SIGNAL(valueChanged()),
- aParent, SIGNAL(qrCodeEcLevelChanged()));
- QObject::connect(iMaxZoom, SIGNAL(valueChanged()),
- aParent, SIGNAL(maxZoomChanged()));
- QObject::connect(iScanZoom, SIGNAL(valueChanged()),
- aParent, SIGNAL(scanZoomChanged()));
- QObject::connect(iScanWideMode, SIGNAL(valueChanged()),
- aParent, SIGNAL(scanWideModeChanged()));
- QObject::connect(iSharedKeyWarning, SIGNAL(valueChanged()),
- aParent, SIGNAL(sharedKeyWarningChanged()));
- QObject::connect(iSharedKeyWarning2, SIGNAL(valueChanged()),
- aParent, SIGNAL(sharedKeyWarning2Changed()));
- QObject::connect(iAutoLock, SIGNAL(valueChanged()),
- aParent, SIGNAL(autoLockChanged()));
- QObject::connect(iAutoLockTime, SIGNAL(valueChanged()),
- aParent, SIGNAL(autoLockTimeChanged()));
- QObject::connect(iSailotpImportDone, SIGNAL(valueChanged()),
- aParent, SIGNAL(sailotpImportDoneChanged()));
- QObject::connect(iSailotpImportedTokens, SIGNAL(valueChanged()),
- aParent, SIGNAL(sailotpImportedTokensChanged()));
+ connect(iResolution_4_3, SIGNAL(valueChanged()), aParent, SIGNAL(wideCameraResolutionChanged()));
+ connect(iResolution_16_9, SIGNAL(valueChanged()), aParent, SIGNAL(narrowCameraResolutionChanged()));
+ connect(iQrCodeEcLevel, SIGNAL(valueChanged()), aParent, SIGNAL(qrCodeEcLevelChanged()));
+ connect(iMaxZoom, SIGNAL(valueChanged()), aParent, SIGNAL(maxZoomChanged()));
+ connect(iScanZoom, SIGNAL(valueChanged()), aParent, SIGNAL(scanZoomChanged()));
+ connect(iVolumeZoom, SIGNAL(valueChanged()), aParent, SIGNAL(volumeZoomChanged()));
+ connect(iScanWideMode, SIGNAL(valueChanged()), aParent, SIGNAL(scanWideModeChanged()));
+ connect(iSharedKeyWarning, SIGNAL(valueChanged()), aParent, SIGNAL(sharedKeyWarningChanged()));
+ connect(iSharedKeyWarning2, SIGNAL(valueChanged()), aParent, SIGNAL(sharedKeyWarning2Changed()));
+ connect(iAutoLock, SIGNAL(valueChanged()), aParent, SIGNAL(autoLockChanged()));
+ connect(iAutoLockTime, SIGNAL(valueChanged()), aParent, SIGNAL(autoLockTimeChanged()));
+ connect(iSailotpImportDone, SIGNAL(valueChanged()), aParent, SIGNAL(sailotpImportDoneChanged()));
+ connect(iSailotpImportedTokens, SIGNAL(valueChanged()), aParent, SIGNAL(sailotpImportedTokensChanged()));
+ HDEBUG("Default 4:3 resolution" << size_4_3(iDefaultResolution_4_3));
+ HDEBUG("Default 16:9 resolution" << size_16_9(iDefaultResolution_16_9));
}
inline int
@@ -125,11 +147,59 @@
aValue : DEFAULT_QRCODE_ECLEVEL;
}
+QSize
+FoilAuthSettings::Private::toSize(
+ const QVariant aVariant)
+{
+ // e.g. "1920x1080"
+ if (aVariant.isValid()) {
+ const QStringList values(aVariant.toString().split('x'));
+ if (values.count() == 2) {
+ bool ok = false;
+ int width = values.at(0).toInt(&ok);
+ if (ok && width > 0) {
+ int height = values.at(1).toInt(&ok);
+ if (ok && height > 0) {
+ return QSize(width, height);
+ }
+ }
+ }
+ }
+ return QSize(0, 0);
+}
+
+QSize
+FoilAuthSettings::Private::size_4_3(
+ int aWidth)
+{
+ return QSize(aWidth, aWidth * 3 / 4);
+}
+
+QSize
+FoilAuthSettings::Private::size_16_9(
+ int aWidth)
+{
+ return QSize(aWidth, aWidth * 9 / 16);
+}
+
+QSize
+FoilAuthSettings::Private::resolution_4_3()
+{
+ return size_4_3(qMax(iResolution_4_3->value(iDefaultResolution_4_3).toInt(), 0));
+}
+
+QSize
+FoilAuthSettings::Private::resolution_16_9()
+{
+ return size_16_9(qMax(iResolution_16_9->value(iDefaultResolution_16_9).toInt(), 0));
+}
+
// ==========================================================================
// FoilAuthSettings
// ==========================================================================
-FoilAuthSettings::FoilAuthSettings(QObject* aParent) :
+FoilAuthSettings::FoilAuthSettings(
+ QObject* aParent) :
QObject(aParent),
iPrivate(new Private(this))
{
@@ -143,8 +213,8 @@
// Callback for qmlRegisterSingletonType<FoilAuthSettings>
QObject*
FoilAuthSettings::createSingleton(
- QQmlEngine* aEngine,
- QJSEngine* aScript)
+ QQmlEngine*,
+ QJSEngine*)
{
return new FoilAuthSettings;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/src/FoilAuthSettings.h
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2019-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2019-2022 Jolla Ltd.
- * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -34,18 +34,30 @@
#ifndef FOILAUTH_SETTINGS_H
#define FOILAUTH_SETTINGS_H
-#include <QtQml>
+#include <QObject>
+#include <QSize>
+#include <QStringList>
+
+class QQmlEngine;
+class QJSEngine;
// Note that sailotpImportedTokens stores SHA1 hash of the secrets
// imported from SailOTP, not the actual secrets. In other words,
// it's not much of a security flaw.
-class FoilAuthSettings : public QObject {
+class FoilAuthSettings :
+ public QObject
+{
Q_OBJECT
Q_PROPERTY(int qrCodeEcLevel READ qrCodeEcLevel WRITE setQrCodeEcLevel NOTIFY qrCodeEcLevelChanged)
- Q_PROPERTY(qreal scanZoom READ scanZoom WRITE setScanZoom NOTIFY scanZoomChanged)
Q_PROPERTY(qreal maxZoom READ maxZoom WRITE setMaxZoom NOTIFY maxZoomChanged)
+ Q_PROPERTY(qreal scanZoom READ scanZoom WRITE setScanZoom NOTIFY scanZoomChanged)
+ Q_PROPERTY(bool volumeZoom READ volumeZoom WRITE setVolumeZoom NOTIFY volumeZoomChanged)
Q_PROPERTY(bool scanWideMode READ scanWideMode WRITE setScanWideMode NOTIFY scanWideModeChanged)
+ Q_PROPERTY(qreal wideCameraRatio READ wideCameraRatio CONSTANT)
+ Q_PROPERTY(qreal narrowCameraRatio READ narrowCameraRatio CONSTANT)
+ Q_PROPERTY(QSize wideCameraResolution READ wideCameraResolution WRITE setWideCameraResolution NOTIFY wideCameraResolutionChanged)
+ Q_PROPERTY(QSize narrowCameraResolution READ narrowCameraResolution WRITE setNarrowCameraResolution NOTIFY narrowCameraResolutionChanged)
Q_PROPERTY(bool sharedKeyWarning READ sharedKeyWarning WRITE setSharedKeyWarning NOTIFY sharedKeyWarningChanged)
Q_PROPERTY(bool sharedKeyWarning2 READ sharedKeyWarning2 WRITE setSharedKeyWarning2 NOTIFY sharedKeyWarning2Changed)
Q_PROPERTY(bool autoLock READ autoLock WRITE setAutoLock NOTIFY autoLockChanged)
@@ -58,42 +70,57 @@
explicit FoilAuthSettings(QObject* aParent = Q_NULLPTR);
~FoilAuthSettings();
- static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+ // Callback for qmlRegisterSingletonType<FoilAuthSettings>
+ static QObject* createSingleton(QQmlEngine*, QJSEngine*);
int qrCodeEcLevel() const;
- void setQrCodeEcLevel(int aValue);
+ void setQrCodeEcLevel(int);
+
+ qreal maxZoom() const;
+ void setMaxZoom(qreal);
qreal scanZoom() const;
- void setScanZoom(qreal aValue);
+ void setScanZoom(qreal);
- qreal maxZoom() const;
- void setMaxZoom(qreal aValue);
+ bool volumeZoom() const;
+ void setVolumeZoom(bool);
bool scanWideMode() const;
- void setScanWideMode(bool aValue);
+ void setScanWideMode(bool);
+
+ qreal wideCameraRatio() const;
+ QSize wideCameraResolution() const;
+ void setWideCameraResolution(QSize);
+
+ qreal narrowCameraRatio() const;
+ QSize narrowCameraResolution() const;
+ void setNarrowCameraResolution(QSize);
bool sharedKeyWarning() const;
bool sharedKeyWarning2() const;
- void setSharedKeyWarning(bool aValue);
- void setSharedKeyWarning2(bool aValue);
+ void setSharedKeyWarning(bool);
+ void setSharedKeyWarning2(bool);
bool autoLock() const;
- void setAutoLock(bool aValue);
+ void setAutoLock(bool);
int autoLockTime() const;
- void setAutoLockTime(int aValue);
+ void setAutoLockTime(int);
bool sailotpImportDone() const;
- void setSailotpImportDone(bool aValue);
+ void setSailotpImportDone(bool);
QStringList sailotpImportedTokens() const;
- void setSailotpImportedTokens(QStringList aValue);
+ void setSailotpImportedTokens(QStringList);
Q_SIGNALS:
void qrCodeEcLevelChanged();
void maxZoomChanged();
void scanZoomChanged();
+ void volumeZoomChanged();
void scanWideModeChanged();
+ void wideCameraResolutionChanged();
+ void narrowCameraResolutionChanged();
void sharedKeyWarningChanged();
void sharedKeyWarning2Changed();
void autoLockChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/src/FoilAuthToken.cpp
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2019-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2019-2022 Jolla Ltd.
- * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -244,15 +244,15 @@
public:
QAtomicInt iRef;
- AuthType iType;
- DigestAlgorithm iAlgorithm;
- QByteArray iSecret;
- QString iSecretBase32;
- QString iLabel;
- QString iIssuer;
- quint64 iCounter;
- int iDigits;
- int iTimeshift; // Seconds
+ const AuthType iType;
+ const DigestAlgorithm iAlgorithm;
+ const QByteArray iSecret;
+ const QString iSecretBase32;
+ const QString iLabel;
+ const QString iIssuer;
+ const quint64 iCounter;
+ const int iDigits;
+ const int iTimeshift; // Seconds
};
FoilAuthToken::Private::Private(
@@ -759,7 +759,6 @@
return out;
}
-
QList<FoilAuthToken>
FoilAuthToken::fromProtoBuf(
const QByteArray& aData)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/src/FoilAuthToken.h
^
|
@@ -1,6 +1,6 @@
/*
+ * Copyright (C) 2019-2023 Slava Monich <slava@monich.com>
* Copyright (C) 2019-2022 Jolla Ltd.
- * Copyright (C) 2019-2022 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -82,7 +82,7 @@
static const QString TYPE_HOTP;
FoilAuthToken();
- FoilAuthToken(const FoilAuthToken& aToken);
+ FoilAuthToken(const FoilAuthToken&);
FoilAuthToken(FoilAuthTypes::AuthType, QByteArray, QString, QString,
int aDigits = FoilAuthTypes::DEFAULT_DIGITS,
quint64 aCounter = FoilAuthTypes::DEFAULT_COUNTER,
@@ -100,9 +100,9 @@
Q_REQUIRED_RESULT FoilAuthToken withDigits(int) const;
Q_REQUIRED_RESULT FoilAuthToken withTimeshift(int) const;
- FoilAuthToken& operator=(const FoilAuthToken& aToken);
- bool operator==(const FoilAuthToken& aToken) const;
- bool operator!=(const FoilAuthToken& aToken) const;
+ FoilAuthToken& operator=(const FoilAuthToken&);
+ bool operator==(const FoilAuthToken&) const;
+ bool operator!=(const FoilAuthToken&) const;
bool equals(const FoilAuthToken&) const;
bool isValid() const;
@@ -116,6 +116,7 @@
int digits() const;
int timeshift() const;
uint password(quint64 aTime) const;
+
Q_REQUIRED_RESULT QString passwordString(quint64) const;
Q_REQUIRED_RESULT QString toUri() const;
Q_REQUIRED_RESULT QVariantMap toVariantMap() const;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-foilauth-1.1.6.tar.gz/translations/harbour-foilauth-sv.ts
^
|
@@ -114,12 +114,12 @@
<message id="foilauth-token-digest_algorithm-label">
<source>Digest algorithm</source>
<extracomment>Combo box label</extracomment>
- <translation type="unfinished">Sammandrag algoritm</translation>
+ <translation>Sammandragsalgoritm</translation>
</message>
<message id="foilauth-token-digest_algorithm-default">
<source>%1 (default)</source>
<extracomment>Menu item for the default digest algorithm</extracomment>
- <translation type="unfinished">%1 (standard)</translation>
+ <translation>%1 (standard)</translation>
</message>
<message id="foilauth-token-digits-text">
<source>Digits</source>
@@ -145,22 +145,22 @@
<source>Counter value</source>
<oldsource>Сounter value</oldsource>
<extracomment>Text field label (HOTP counter value)</extracomment>
- <translation type="unfinished">Räknarvärde</translation>
+ <translation>Räknarvärde</translation>
</message>
<message id="foilauth-token-type-label">
<source>Type</source>
<extracomment>Combo box label</extracomment>
- <translation type="unfinished">Typ</translation>
+ <translation>Typ</translation>
</message>
<message id="foilauth-token-type-totp">
<source>Time-based (TOTP)</source>
<extracomment>Menu item for time based token</extracomment>
- <translation type="unfinished">Tidsbaserad (TOTP)</translation>
+ <translation>Tidsbaserad (TOTP)</translation>
</message>
<message id="foilauth-token-type-hotp">
<source>Counter-based (HOTP)</source>
<extracomment>Menu item for counter based token</extracomment>
- <translation type="unfinished">Räknarbaserad (HOTP)</translation>
+ <translation>Räknarbaserad (HOTP)</translation>
</message>
<message id="foilauth-token-scan-button">
<source>Scan QR code</source>
@@ -175,7 +175,7 @@
<message id="foilauth-scan-title">
<source>Scan QR code</source>
<extracomment>Page title (suggestion to scan QR code)</extracomment>
- <translation type="unfinished">Skanna QR-kod</translation>
+ <translation>Skanna QR-kod</translation>
</message>
<message id="foilauth-scan-zoom_label">
<source>Zoom</source>
@@ -195,7 +195,7 @@
<message id="foilauth-scan-skip_button">
<source>Skip</source>
<extracomment>Button label (skip scanning)</extracomment>
- <translation type="unfinished">Hoppa över</translation>
+ <translation>Hoppa över</translation>
</message>
<message id="foilauth-foil_apps_warning">
<source>Note that all Foil apps use the same encryption key and password.</source>
@@ -215,26 +215,26 @@
<message id="foilauth-import-first_one">
<source>FoilAuth has found 1 unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
<extracomment>Text for SailOTP import page (first import, one token)</extracomment>
- <translation type="unfinished">FoilAuth har hittat en okrypterad SailOTP-token på din enhet. Vill du importera och kryptera det?</translation>
+ <translation>FoilAuth har hittat en okrypterad SailOTP-token på din enhet. Vill du importera och kryptera den?</translation>
</message>
<message id="foilauth-import-first_many" numerus="yes">
<source>FoilAuth has found %0 unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
<extracomment>Text for SailOTP import page (first import, multiple tokens)</extracomment>
- <translation type="unfinished">
- <numerusform>FoilAuth har hittat %0 okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
+ <translation>
+ <numerusform>FoilAuth har hittat %0 okrypterad SailOTP-token på din enhet. Vill du importera och kryptera den?</numerusform>
<numerusform>FoilAuth har hittat %0 okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
</translation>
</message>
<message id="foilauth-import-new_one">
<source>FoilAuth has found 1 new unencrypted SailOTP token on your device. Would you like to import and encrypt it?</source>
<extracomment>Text for SailOTP import page (one new token is found)</extracomment>
- <translation type="unfinished">FoilAuth har hittat en ny okrypterad SailOTP-token på din enhet. Vill du importera och kryptera det?</translation>
+ <translation>FoilAuth har hittat en ny okrypterad SailOTP-token på din enhet. Vill du importera och kryptera den?</translation>
</message>
<message id="foilauth-import-new_many" numerus="yes">
<source>FoilAuth has found %0 new unencrypted SailOTP token(s) on your device. Would you like to import and encrypt them?</source>
<extracomment>Text for SailOTP import page (multiple new tokens were found)</extracomment>
- <translation type="unfinished">
- <numerusform>FoilAuth har hittat %0 nya okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
+ <translation>
+ <numerusform>FoilAuth har hittat %0 ny okrypterad SailOTP-tokens på din enhet. Vill du importera och kryptera den?</numerusform>
<numerusform>FoilAuth har hittat %0 nya okrypterade SailOTP-tokens på din enhet. Vill du importera och kryptera dem?</numerusform>
</translation>
</message>
@@ -261,7 +261,7 @@
<message id="foilauth-menu-copy_password">
<source>Copy password</source>
<extracomment>Context menu item (copy password to clipboard)</extracomment>
- <translation type="unfinished">Kopiera lösenord</translation>
+ <translation>Kopiera lösenord</translation>
</message>
<message id="foilauth-menu-show_qr_code">
<source>Show QR code</source>
@@ -326,7 +326,7 @@
<message id="foilauth-confirm_password-description">
<source>Make sure you don't forget your password. It's impossible to either recover it or to access the encrypted tokens without knowing it. Better take it seriously.</source>
<extracomment>Password confirmation description</extracomment>
- <translation type="unfinished">Tillse att du inte glömmer ditt lösenord. Det går inte att återställa lösenordet, eller att få tillgång till de krypterade tokens utan det. Seriöst alltså.</translation>
+ <translation>Tillse att du inte glömmer ditt lösenord. Det går inte att återställa lösenordet, eller att få tillgång till de krypterade tokens utan det. Seriöst alltså.</translation>
</message>
<message id="foilauth-confirm_password-placeholder-new_password">
<source>New password again</source>
@@ -346,12 +346,12 @@
<message id="foilauth-add_token-title">
<source>Add token</source>
<extracomment>Dialog title</extracomment>
- <translation type="unfinished">Lägg till token</translation>
+ <translation>Lägg till token</translation>
</message>
<message id="foilauth-edit_token-title">
<source>Edit token</source>
<extracomment>Dialog title</extracomment>
- <translation type="unfinished">Redigera token</translation>
+ <translation>Redigera token</translation>
</message>
<message id="foilauth-edit_token-save">
<source>Save</source>
@@ -361,97 +361,97 @@
<message id="foilauth-menu-select_tokens">
<source>Select</source>
<extracomment>Pulley menu item, opens selection page</extracomment>
- <translation type="unfinished">Markera</translation>
+ <translation>Välj</translation>
</message>
<message id="foilauth-select_page-header">
<source>Select tokens</source>
<extracomment>Page title</extracomment>
- <translation type="unfinished">Välj tokens</translation>
+ <translation>Välj tokens</translation>
</message>
<message id="foilauth-menu-select_none">
<source>Deselect all</source>
<extracomment>Pulley menu item</extracomment>
- <translation type="unfinished">Välj ingen</translation>
+ <translation>Välj ingen</translation>
</message>
<message id="foilauth-menu-select_all">
<source>Select all</source>
<extracomment>Pulley menu item, selects all tokens</extracomment>
- <translation type="unfinished">Välj alla</translation>
+ <translation>Välj alla</translation>
</message>
<message id="foilauth-remorse-deleting_selected_tokens">
<source>Deleting selected tokens</source>
<extracomment>Remorse popup text (multiple tokens selected)</extracomment>
- <translation type="unfinished">Tar bort valda tokens</translation>
+ <translation>Tar bort valda tokens</translation>
</message>
<message id="foilauth-remorse-deleting_selected_token">
<source>Deleting selected token</source>
<extracomment>Remorse popup text (single token selected)</extracomment>
- <translation type="unfinished">Tar bort valda token</translation>
+ <translation>Tar bort vald token</translation>
</message>
<message id="foilauth-select_page-hint_delete_selected">
<source>Delete selected tokens</source>
<extracomment>Hint text</extracomment>
- <translation type="unfinished">Ta bort valda tokens</translation>
+ <translation>Ta bort valda tokens</translation>
</message>
<message id="foilauth-select_page-hint_export_selected">
<source>Export selected tokens via QR code</source>
<extracomment>Hint text</extracomment>
- <translation type="unfinished">Exportera utvalda tokens via QR -kod</translation>
+ <translation>Exportera valda tokens via QR -kod</translation>
</message>
<message id="foilauth-export_page-title">
<source>Code %1 of %2</source>
<extracomment>Page header</extracomment>
- <translation type="unfinished">Kod %1/%2</translation>
+ <translation>Kod %1 av %2</translation>
</message>
<message id="foilauth-select_tokens-title-add_tokens">
<source>Select tokens to add</source>
<extracomment>Dialog title</extracomment>
- <translation type="unfinished">Välj tokens att lägga till</translation>
+ <translation>Välj tokens att lägga till</translation>
</message>
<message id="foilauth-organize-groups-title">
<source>Manage groups</source>
<extracomment>Page header title</extracomment>
- <translation type="unfinished">Hantera grupper</translation>
+ <translation>Hantera grupper</translation>
</message>
<message id="foilauth-organize-groups-description">
<source>Create, delete and rename groups</source>
<extracomment>Page header descriptions</extracomment>
- <translation type="unfinished">Skapa, ta bort och byt namn på grupper</translation>
+ <translation>Skapa, ta bort och byt namn på grupper</translation>
</message>
<message id="foilauth-organize-groups-menu-rename">
|