Allow executing code in main menu links configuration
This commit is contained in:
parent
0adf1ab02b
commit
fda3a43473
@ -18,36 +18,36 @@ ConfigurationBase {
|
||||
pluginSettingsEnabled: true
|
||||
|
||||
|
||||
mainMenuLinks: ListModel {
|
||||
ListElement {
|
||||
text: qsTr("Help")
|
||||
iconName: "../images/help.svg"
|
||||
mainMenuLinks: [
|
||||
{
|
||||
text: qsTr("Help"),
|
||||
iconName: "../images/help.svg",
|
||||
url: "https://nymea.io/documentation/users/usage/first-steps"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Forum")
|
||||
iconName: "../images/discourse.svg"
|
||||
},
|
||||
{
|
||||
text: qsTr("Forum"),
|
||||
iconName: "../images/discourse.svg",
|
||||
url: "https://forum.nymea.io"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Telegram")
|
||||
iconName: "../images/telegram.svg"
|
||||
},
|
||||
{
|
||||
text: qsTr("Telegram"),
|
||||
iconName: "../images/telegram.svg",
|
||||
url: "https://t.me/nymeacommunity"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Discord")
|
||||
iconName: "../images/discord.svg"
|
||||
},
|
||||
{
|
||||
text: qsTr("Discord"),
|
||||
iconName: "../images/discord.svg",
|
||||
url: "https://discord.gg/tX9YCpD"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Twitter")
|
||||
iconName: "../images/twitter.svg"
|
||||
},
|
||||
{
|
||||
text: qsTr("Twitter"),
|
||||
iconName: "../images/twitter.svg",
|
||||
url: "https://twitter.com/nymea_io"
|
||||
}
|
||||
ListElement {
|
||||
text: qsTr("Facebook")
|
||||
iconName: "../images/facebook.svg"
|
||||
},
|
||||
{
|
||||
text: qsTr("Facebook"),
|
||||
iconName: "../images/facebook.svg",
|
||||
url: "https://m.facebook.com/groups/nymea"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -19,5 +19,5 @@ Item {
|
||||
|
||||
property string defaultMainView: "things"
|
||||
|
||||
property ListModel mainMenuLinks: null
|
||||
property var mainMenuLinks: null
|
||||
}
|
||||
|
||||
@ -209,13 +209,21 @@ Drawer {
|
||||
Repeater {
|
||||
model: Configuration.mainMenuLinks
|
||||
delegate: NymeaItemDelegate {
|
||||
property var entry: Configuration.mainMenuLinks[index]
|
||||
Layout.fillWidth: true
|
||||
text: model.text
|
||||
iconName: model.iconName
|
||||
text: entry.text
|
||||
iconName: entry.iconName
|
||||
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