Quick GUI: Show warning if no password set
This commit is contained in:
parent
b1bd12755c
commit
f86fcefc03
23
qml/main.qml
23
qml/main.qml
|
@ -25,6 +25,9 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
globalDrawer: Kirigami.GlobalDrawer {
|
||||
id: leftMenu
|
||||
property bool showNoPasswordWarning: nativeInterface.fileOpen
|
||||
&& !nativeInterface.passwordSet
|
||||
|
||||
title: qsTr("Password Manager")
|
||||
titleIcon: "qrc://icons/hicolor/scalable/apps/passwordmanager-black.svg"
|
||||
visible: !nativeInterface.fileOpen
|
||||
|
@ -63,6 +66,26 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
visible: leftMenu.showNoPasswordWarning
|
||||
|
||||
Item {
|
||||
Layout.preferredWidth: 2
|
||||
}
|
||||
Kirigami.Icon {
|
||||
source: "emblem-warning"
|
||||
width: Kirigami.Units.iconSizes.small
|
||||
height: Kirigami.Units.iconSizes.small
|
||||
}
|
||||
Controls.Label {
|
||||
text: qsTr("No password set\nFile will be saved unencrypted!")
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
Item {
|
||||
visible: leftMenu.showNoPasswordWarning
|
||||
height: 4
|
||||
}
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
|
|
|
@ -21,6 +21,7 @@ class Controller : public QObject {
|
|||
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
|
||||
Q_PROPERTY(QString windowTitle READ windowTitle NOTIFY windowTitleChanged)
|
||||
Q_PROPERTY(bool fileOpen READ isFileOpen NOTIFY fileOpenChanged)
|
||||
Q_PROPERTY(bool passwordSet READ isPasswordSet NOTIFY passwordChanged)
|
||||
Q_PROPERTY(EntryModel *entryModel READ entryModel NOTIFY entryModelChanged)
|
||||
Q_PROPERTY(EntryFilterModel *entryFilterModel READ entryFilterModel NOTIFY entryFilterModelChanged)
|
||||
Q_PROPERTY(FieldModel *fieldModel READ fieldModel NOTIFY fieldModelChanged)
|
||||
|
@ -42,6 +43,7 @@ public:
|
|||
void setPassword(const QString &password);
|
||||
const QString &windowTitle() const;
|
||||
bool isFileOpen() const;
|
||||
bool isPasswordSet() const;
|
||||
EntryModel *entryModel();
|
||||
EntryFilterModel *entryFilterModel();
|
||||
FieldModel *fieldModel();
|
||||
|
@ -138,6 +140,11 @@ inline bool Controller::isFileOpen() const
|
|||
return m_fileOpen;
|
||||
}
|
||||
|
||||
inline bool Controller::isPasswordSet() const
|
||||
{
|
||||
return !m_password.isEmpty();
|
||||
}
|
||||
|
||||
inline EntryModel *Controller::entryModel()
|
||||
{
|
||||
return &m_entryModel;
|
||||
|
|
Loading…
Reference in New Issue