Commit 65972a9f authored by LNJ's avatar LNJ Committed by Jonah Brüchert

RosterPage: Make 'Add contact' the main action

Fixes #155.
parent d7e865f6
......@@ -37,13 +37,6 @@ Kirigami.GlobalDrawer {
}
actions: [
Kirigami.Action {
text: qsTr("Add new contact")
iconName: "contact-new"
onTriggered: {
addContactDialogRequested();
}
},
Kirigami.Action {
text: qsTr("Logout")
iconName: "system-shutdown"
......
......@@ -35,6 +35,15 @@ Kirigami.ScrollablePage {
jid: ""
}
mainAction: Kirigami.Action {
text: qsTr("Add new contact")
iconName: "contact-new"
enabled: !addContactSheet.sheetOpen
onTriggered: {
addContactSheet.open();
}
}
ListView {
verticalLayoutDirection: ListView.TopToBottom
model: kaidan.rosterModel
......@@ -71,18 +80,4 @@ Kirigami.ScrollablePage {
]
}
}
Component.onCompleted: {
function openAddContactSheet() {
addContactSheet.open();
}
function disconnectOpenAddContactSheet() {
addContactDialogRequested.disconnect(openAddContactSheet);
}
// open sheet when requested from drawer over signal
addContactDialogRequested.connect(openAddContactSheet);
// disconnect the open function, when the roster page is closed
kaidan.connectionStateDisconnected.connect(disconnectOpenAddContactSheet);
}
}
......@@ -20,7 +20,6 @@
*/
import QtQuick 2.6
import QtQuick.Controls.Material 2.0
import org.kde.kirigami 2.0 as Kirigami
Kirigami.ApplicationWindow {
......@@ -28,14 +27,16 @@ Kirigami.ApplicationWindow {
width: 960
height: 540
// signals
signal addContactDialogRequested()
// Header / ToolBar
header: Kirigami.ApplicationHeader {
preferredHeight: Kirigami.Units.gridUnit * 2.25
}
// Global and Contextual Drawers
globalDrawer: GlobalDrawer {}
contextDrawer: Kirigami.ContextDrawer {
id: contextDrawer
}
// when the window was closed, disconnect from jabber server
onClosing: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment