Allow executing code in main menu links configuration
This commit is contained in:
parent
0adf1ab02b
commit
fda3a43473
@ -18,36 +18,36 @@ ConfigurationBase {
|
|||||||
pluginSettingsEnabled: true
|
pluginSettingsEnabled: true
|
||||||
|
|
||||||
|
|
||||||
mainMenuLinks: ListModel {
|
mainMenuLinks: [
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Help")
|
text: qsTr("Help"),
|
||||||
iconName: "../images/help.svg"
|
iconName: "../images/help.svg",
|
||||||
url: "https://nymea.io/documentation/users/usage/first-steps"
|
url: "https://nymea.io/documentation/users/usage/first-steps"
|
||||||
}
|
},
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Forum")
|
text: qsTr("Forum"),
|
||||||
iconName: "../images/discourse.svg"
|
iconName: "../images/discourse.svg",
|
||||||
url: "https://forum.nymea.io"
|
url: "https://forum.nymea.io"
|
||||||
}
|
},
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Telegram")
|
text: qsTr("Telegram"),
|
||||||
iconName: "../images/telegram.svg"
|
iconName: "../images/telegram.svg",
|
||||||
url: "https://t.me/nymeacommunity"
|
url: "https://t.me/nymeacommunity"
|
||||||
}
|
},
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Discord")
|
text: qsTr("Discord"),
|
||||||
iconName: "../images/discord.svg"
|
iconName: "../images/discord.svg",
|
||||||
url: "https://discord.gg/tX9YCpD"
|
url: "https://discord.gg/tX9YCpD"
|
||||||
}
|
},
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Twitter")
|
text: qsTr("Twitter"),
|
||||||
iconName: "../images/twitter.svg"
|
iconName: "../images/twitter.svg",
|
||||||
url: "https://twitter.com/nymea_io"
|
url: "https://twitter.com/nymea_io"
|
||||||
}
|
},
|
||||||
ListElement {
|
{
|
||||||
text: qsTr("Facebook")
|
text: qsTr("Facebook"),
|
||||||
iconName: "../images/facebook.svg"
|
iconName: "../images/facebook.svg",
|
||||||
url: "https://m.facebook.com/groups/nymea"
|
url: "https://m.facebook.com/groups/nymea"
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,5 +19,5 @@ Item {
|
|||||||
|
|
||||||
property string defaultMainView: "things"
|
property string defaultMainView: "things"
|
||||||
|
|
||||||
property ListModel mainMenuLinks: null
|
property var mainMenuLinks: null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,13 +209,21 @@ Drawer {
|
|||||||
Repeater {
|
Repeater {
|
||||||
model: Configuration.mainMenuLinks
|
model: Configuration.mainMenuLinks
|
||||||
delegate: NymeaItemDelegate {
|
delegate: NymeaItemDelegate {
|
||||||
|
property var entry: Configuration.mainMenuLinks[index]
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: model.text
|
text: entry.text
|
||||||
iconName: model.iconName
|
iconName: entry.iconName
|
||||||
progressive: false
|
progressive: false
|
||||||
onClicked: Qt.openUrlExternally(model.url)
|
onClicked: {
|
||||||
|
if (entry.func !== undefined) {
|
||||||
|
entry.func(app, root.currentEngine)
|
||||||
|
}
|
||||||
|
if (entry.url !== undefined) {
|
||||||
|
Qt.openUrlExternally(entry.url)
|
||||||
|
}
|
||||||
|
root.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user