feat: introduce a generic "error page" component
This new component can be used to inject an interstitial page, letting the user know something went wrong and allowing them to decide whether to continue or to quit Keysmith. This is especially useful when Keysmith was launched automatically from some other context (i.e. another app) without the user necessarily being fully aware of it. Issues: #7, #14master
parent
30e66ef978
commit
72cfaee9bf
|
@ -32,6 +32,7 @@ target_link_libraries(keysmith
|
|||
|
||||
if(ANDROID)
|
||||
kirigami_package_breeze_icons(ICONS
|
||||
application-quit
|
||||
answer-correct
|
||||
edit-delete
|
||||
edit-undo
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* SPDX-FileCopyrightText: 2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
|
||||
*/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtQuick.Controls 2.0 as Controls
|
||||
import org.kde.kirigami 2.8 as Kirigami
|
||||
|
||||
Kirigami.Page {
|
||||
id: root
|
||||
signal quit
|
||||
signal dismissed
|
||||
property bool quitEnabled: false
|
||||
property string error
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
Controls.Label {
|
||||
text: root.error
|
||||
color: Kirigami.Theme.negativeTextColor
|
||||
Layout.maximumWidth: root.width - 2 * Kirigami.Units.largeSpacing
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
|
||||
actions.main: Kirigami.Action {
|
||||
text: i18nc("@action:button Button to dismiss the error page", "Continue")
|
||||
iconName: "answer-correct"
|
||||
onTriggered: {
|
||||
root.dismissed();
|
||||
}
|
||||
}
|
||||
actions.right: Kirigami.Action {
|
||||
text: i18nc("@action:button Dismiss the error page and quit Keysmtih", "Quit")
|
||||
iconName: "application-exit"
|
||||
enabled: root.quitEnabled
|
||||
visible: root.quitEnabled
|
||||
onTriggered: {
|
||||
root.quit();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
<file alias="main.qml">contents/ui/main.qml</file>
|
||||
<file alias="AccountsOverview.qml">contents/ui/AccountsOverview.qml</file>
|
||||
<file alias="AddAccount.qml">contents/ui/AddAccount.qml</file>
|
||||
<file alias="ErrorPage.qml">contents/ui/ErrorPage.qml</file>
|
||||
<file alias="AccountNameForm.qml">contents/ui/AccountNameForm.qml</file>
|
||||
<file alias="HOTPDetailsForm.qml">contents/ui/HOTPDetailsForm.qml</file>
|
||||
<file alias="TOTPDetailsForm.qml">contents/ui/TOTPDetailsForm.qml</file>
|
||||
|
|
Loading…
Reference in New Issue