mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-05 18:25:58 +03:00
Add option to hide window on launch
This commit is contained in:
parent
c76ef49265
commit
9814125fcf
1
.gitignore
vendored
1
.gitignore
vendored
@ -17,5 +17,6 @@ qrc_*.cpp
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
yubioath-desktop.app/
|
||||
yubioath-desktop
|
||||
pymodules
|
||||
.vagrant/
|
||||
|
5
main.cpp
5
main.cpp
@ -94,6 +94,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Set icon in the window, doesn't effect desktop icons.
|
||||
qmlWindow->setIcon(QIcon(path_prefix + "/images/windowicon.png"));
|
||||
// Show root window unless explicitly hidden in settings.
|
||||
auto hideOnLaunch = qmlWindow->property("hideOnLaunch");
|
||||
if (!hideOnLaunch.toBool()) {
|
||||
qmlWindow->show();
|
||||
}
|
||||
|
||||
QAction *showAction = new QAction(QObject::tr("&Show credentials"), qmlWindow);
|
||||
// The call to hide doesn't make much sense but makes it work on macOS when hidden from the dock.
|
||||
|
@ -15,6 +15,7 @@ DefaultDialog {
|
||||
property alias slot1digits: slot1digits.currentIndex
|
||||
property alias slot2digits: slot2digits.currentIndex
|
||||
property alias closeToTray: closeToTray.checked
|
||||
property alias hideOnLaunch: hideOnLaunch.checked
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@ -97,6 +98,23 @@ DefaultDialog {
|
||||
CheckBox {
|
||||
id: closeToTray
|
||||
checked: settings.closeToTray
|
||||
onCheckedChanged: {
|
||||
if (!checked) {
|
||||
hideOnLaunch.checked = false
|
||||
}
|
||||
}
|
||||
KeyNavigation.tab: saveSettingsBtn
|
||||
Keys.onEscapePressed: close()
|
||||
}
|
||||
Label {
|
||||
text: qsTr("Hide on launch")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
Layout.fillWidth: false
|
||||
}
|
||||
CheckBox {
|
||||
id: hideOnLaunch
|
||||
enabled: closeToTray.checked
|
||||
checked: settings.hideOnLaunch
|
||||
KeyNavigation.tab: saveSettingsBtn
|
||||
Keys.onEscapePressed: close()
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ ApplicationWindow {
|
||||
height: 400
|
||||
minimumHeight: 400
|
||||
minimumWidth: 300
|
||||
visible: true
|
||||
title: getTitle()
|
||||
property var device: yk
|
||||
property var credentials: device.credentials
|
||||
@ -31,6 +30,8 @@ ApplicationWindow {
|
||||
// See http://doc.qt.io/qt-5/qwindow.html#Visibility-enum
|
||||
property bool shouldRefresh: visibility != 3 && visibility != 0
|
||||
|
||||
property bool hideOnLaunch: settings.hideOnLaunch
|
||||
|
||||
signal copy
|
||||
signal generate(bool copyAfterGenerate)
|
||||
signal deleteCredential
|
||||
@ -88,6 +89,7 @@ ApplicationWindow {
|
||||
property var slot2digits
|
||||
property string savedPasswords
|
||||
property bool closeToTray
|
||||
property bool hideOnLaunch
|
||||
|
||||
// Keep track of window and desktop dimensions.
|
||||
property alias width: appWindow.width
|
||||
@ -598,6 +600,7 @@ ApplicationWindow {
|
||||
settings.slot1digits = settingsDialog.slot1digits
|
||||
settings.slot2digits = settingsDialog.slot2digits
|
||||
settings.closeToTray = settingsDialog.closeToTray
|
||||
settings.hideOnLaunch = settingsDialog.hideOnLaunch
|
||||
}
|
||||
|
||||
function trySetPassword() {
|
||||
|
Loading…
Reference in New Issue
Block a user