Don't refresh codes when minimized

This commit is contained in:
Dag Heyman 2017-03-01 13:17:47 +01:00
parent b8ce346012
commit 22807d740d
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338

View File

@ -25,6 +25,10 @@ ApplicationWindow {
property var hotpCoolDowns: []
property var totpCoolDowns: []
// Don't refresh credentials when window is minimized or hidden
// See http://doc.qt.io/qt-5/qwindow.html#Visibility-enum
property bool shouldRefresh: visibility != 3 && visibility != 0
SystemPalette {
id: palette
}
@ -173,7 +177,6 @@ ApplicationWindow {
function rememberPassword() {
var deviceId = device.oathId
settings.savedPasswords += deviceId + ':' + device.passwordKey + ';'
console.log(settings.savedPasswords)
}
onCredentialsChanged: {
@ -493,7 +496,7 @@ ApplicationWindow {
}
function refreshDependingOnMode(force) {
if (hasDevice) {
if (hasDevice && shouldRefresh) {
if (settings.slotMode && device.hasOTP) {
device.refreshSlotCredentials([settings.slot1, settings.slot2],
getSlotDigitsSettings(), force)