diff --git a/qml/EntriesPage.qml b/qml/EntriesPage.qml
index bff0b04..4abc7e5 100644
--- a/qml/EntriesPage.qml
+++ b/qml/EntriesPage.qml
@@ -39,12 +39,6 @@ Kirigami.ScrollablePage {
onTriggered: insertEntry("Node")
}
}
- onBackRequested: {
- if (fieldsSheet.sheetOpen) {
- event.accepted = true
- fieldsSheet.close()
- }
- }
background: Rectangle {
color: Kirigami.Theme.backgroundColor
}
@@ -118,108 +112,6 @@ Kirigami.ScrollablePage {
}
}
- // component representing a field
- Component {
- id: fieldsListDelegateComponent
-
- RowLayout {
- id: fieldsListItem
- width: fieldsSheet.width
-
- Kirigami.ListItemDragHandle {
- listItem: fieldsListItem
- listView: fieldsListView
- onMoveRequested: fieldsListView.model.moveRows(
- fieldsListView.model.index(-1, 0),
- oldIndex, 1,
- fieldsListView.model.index(-1,
- 0), newIndex)
- }
- Controls.TextField {
- text: model.key ? model.key : ""
- onEditingFinished: fieldsListView.model.setData(
- fieldsListView.model.index(index, 0),
- text)
- Layout.fillWidth: true
- }
- Controls.TextField {
- text: model.actualValue ? model.actualValue : ""
- echoMode: model.isPassword
- && (!activeFocus
- || !main.showPasswordsOnFocus) ? TextInput.PasswordEchoOnEdit : TextInput.Normal
- onEditingFinished: fieldsListView.model.setData(
- fieldsListView.model.index(index, 1),
- text)
- Layout.fillWidth: true
- }
- Controls.Button {
- id: fieldsListItemToolButton
- text: qsTr("⋮")
- flat: true
- onClicked: fieldsListItemMenu.open()
- Layout.maximumWidth: Kirigami.Units.iconSizes.medium
- Layout.maximumHeight: Kirigami.Units.iconSizes.large
-
- Controls.Menu {
- id: fieldsListItemMenu
- y: fieldsListItemToolButton.height
-
- Controls.MenuItem {
- icon.name: model.isPassword ? "password-show-off" : "password-show-on"
- text: model.isPassword ? qsTr("Mark as normal field") : qsTr(
- "Mark as password field")
- onClicked: fieldsListView.model.setData(
- fieldsListView.model.index(index, 0),
- model.isPassword ? 0 : 1, 0x0100 + 1)
- }
- Controls.MenuItem {
- icon.name: "edit-copy"
- text: qsTr("Copy password")
- onClicked: showPassiveNotification(
- nativeInterface.copyToClipboard(
- model.actualValue) ? qsTr("Copied") : qsTr(
- "Unable to access clipboard"))
- }
- Controls.MenuItem {
- icon.name: "edit-delete"
- text: qsTr("Delete field")
- onClicked: fieldsListView.model.removeRows(index, 1)
- }
- Controls.MenuItem {
- icon.name: "list-add"
- text: qsTr("Insert empty field after this")
- onClicked: fieldsListView.model.insertRows(index + 1, 1)
- }
- }
- }
- }
- }
-
- // "sheet" to display field model
- Kirigami.OverlaySheet {
- id: fieldsSheet
- parent: applicationWindow().overlay
- header: Kirigami.Heading {
- text: qsTr("Edit account ") + nativeInterface.currentAccountName
- }
-
- ListView {
- id: fieldsListView
- implicitWidth: Kirigami.Units.gridUnit * 30
- model: nativeInterface.fieldModel
- moveDisplaced: Transition {
- YAnimator {
- duration: Kirigami.Units.longDuration
- easing.type: Easing.InOutQuad
- }
- }
- delegate: Kirigami.DelegateRecycler {
- width: parent ? parent.width : implicitWidth
- sourceComponent: fieldsListDelegateComponent
- }
- }
- }
-
// component representing an entry
Component {
id: listDelegateComponent
@@ -250,9 +142,6 @@ Kirigami.ScrollablePage {
Controls.Label {
Layout.fillWidth: true
Layout.fillHeight: true
- height: Math.max(
- implicitHeight,
- Kirigami.Units.iconSizes.smallMedium)
text: model.name
}
}
@@ -349,7 +238,7 @@ Kirigami.ScrollablePage {
root.pushStackEntry(entryModel, modelIndex)
} else {
nativeInterface.currentAccountIndex = modelIndex
- fieldsSheet.open()
+ root.pushAccountEdit()
}
}
}
diff --git a/qml/FieldsPage.qml b/qml/FieldsPage.qml
new file mode 100644
index 0000000..2d14845
--- /dev/null
+++ b/qml/FieldsPage.qml
@@ -0,0 +1,111 @@
+import QtQuick 2.4
+import QtQuick.Layouts 1.2
+import QtQml.Models 2.2
+import QtQuick.Controls 2.4 as Controls
+import org.kde.kirigami 2.5 as Kirigami
+
+Kirigami.ScrollablePage {
+ id: page
+ property var main: undefined
+
+ Layout.fillWidth: true
+ title: nativeInterface.currentAccountName
+ background: Rectangle {
+ color: Kirigami.Theme.backgroundColor
+ }
+
+ // component representing a field
+ Component {
+ id: fieldsListDelegateComponent
+
+ Kirigami.BasicListItem {
+ id: fieldsListItem
+ contentItem: RowLayout {
+ Kirigami.ListItemDragHandle {
+ listItem: fieldsListItem
+ listView: fieldsListView
+ onMoveRequested: fieldsListView.model.moveRows(
+ fieldsListView.model.index(-1, 0),
+ oldIndex, 1,
+ fieldsListView.model.index(-1, 0),
+ newIndex)
+ }
+ Controls.TextField {
+ Layout.fillWidth: true
+ text: model.key ? model.key : ""
+ onEditingFinished: fieldsListView.model.setData(
+ fieldsListView.model.index(index,
+ 0), text)
+ }
+ Controls.TextField {
+ Layout.fillWidth: true
+ text: model.actualValue ? model.actualValue : ""
+ echoMode: model.isPassword
+ && (!activeFocus
+ || !main.showPasswordsOnFocus) ? TextInput.PasswordEchoOnEdit : TextInput.Normal
+ onEditingFinished: fieldsListView.model.setData(
+ fieldsListView.model.index(index,
+ 1), text)
+ }
+ Kirigami.Icon {
+ source: "handle-right"
+ width: Kirigami.Units.iconSizes.smallMedium
+ height: Kirigami.Units.iconSizes.smallMedium
+ Layout.fillHeight: true
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: fieldContextMenu.popup()
+ onPressAndHold: fieldContextMenu.popup()
+ }
+ }
+ Controls.Menu {
+ id: fieldContextMenu
+ Controls.MenuItem {
+ icon.name: model.isPassword ? "password-show-off" : "password-show-on"
+ text: model.isPassword ? qsTr("Mark as normal field") : qsTr(
+ "Mark as password field")
+ onClicked: fieldsListView.model.setData(
+ fieldsListView.model.index(index, 0),
+ model.isPassword ? 0 : 1, 0x0100 + 1)
+ }
+ Controls.MenuItem {
+ icon.name: "edit-copy"
+ text: qsTr("Copy password")
+ onClicked: showPassiveNotification(
+ nativeInterface.copyToClipboard(
+ model.actualValue) ? qsTr("Copied") : qsTr(
+ "Unable to access clipboard"))
+ }
+ Controls.MenuItem {
+ icon.name: "edit-delete"
+ text: qsTr("Delete field")
+ onClicked: fieldsListView.model.removeRows(index, 1)
+ }
+ Controls.MenuItem {
+ icon.name: "list-add"
+ text: qsTr("Insert empty field after this")
+ onClicked: fieldsListView.model.insertRows(index + 1, 1)
+ }
+ }
+ }
+ }
+ }
+
+ // list view to edit the currently selected account
+ ListView {
+ id: fieldsListView
+ implicitWidth: Kirigami.Units.gridUnit * 30
+ model: nativeInterface.fieldModel
+ moveDisplaced: Transition {
+ YAnimator {
+ duration: Kirigami.Units.longDuration
+ easing.type: Easing.InOutQuad
+ }
+ }
+ delegate: Kirigami.DelegateRecycler {
+ width: parent ? parent.width : implicitWidth
+ sourceComponent: fieldsListDelegateComponent
+ }
+ }
+}
diff --git a/qml/main.qml b/qml/main.qml
index fae8018..de572b0 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -201,6 +201,13 @@ Kirigami.ApplicationWindow {
}
}
+ Component {
+ id: fieldsComponent
+ FieldsPage {
+ main: root
+ }
+ }
+
function clearStack() {
pageStack.pop(root.pageStack.initialPage, Controls.StackView.Immediate)
}
@@ -214,6 +221,10 @@ Kirigami.ApplicationWindow {
}))
}
+ function pushAccountEdit() {
+ pageStack.push(fieldsComponent.createObject(root))
+ }
+
function createFileActions(files) {
return files.map(function (filePath) {
return this.createObject(root, {
diff --git a/resources/qml.qrc b/resources/qml.qrc
index 44ea8fe..7e094d2 100644
--- a/resources/qml.qrc
+++ b/resources/qml.qrc
@@ -7,5 +7,6 @@
../qml/BasicDialog.qml
../qml/PasswordDialog.qml
../qml/EntriesPage.qml
+ ../qml/FieldsPage.qml