diff --git a/retroshare-qml-app/src/components/SideBar.qml b/retroshare-qml-app/src/components/SideBar.qml
new file mode 100644
index 000000000..bd19f5e0f
--- /dev/null
+++ b/retroshare-qml-app/src/components/SideBar.qml
@@ -0,0 +1,139 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import "../URI.js" as UriJs
+import "../" //Needed for TokensManager and ClipboardWrapper singleton
+
+Drawer
+{
+ id: drawer
+ height: parent.height
+ width: Math.min(parent.width, parent.height) / 3 * 2
+ dragMargin: 10
+
+ ListView
+ {
+ id: listView
+ currentIndex: -1
+ anchors.fill: parent
+ height: parent.height
+
+ delegate: Item
+ {
+ property var itemHeight: 50
+
+ id: menuItem
+ width: parent.width
+ height: itemHeight
+
+ Connections
+ {
+ target: mainWindow
+ onCoreReadyChanged:
+ {
+ if (model.showOnCoreReady)
+ {
+ setVisible(mainWindow.coreReady)
+ }
+ }
+ }
+
+ Text
+ {
+ text: model.title
+ }
+
+ MouseArea
+ {
+ width: parent.width
+ height: parent.height
+ onClicked:
+ {
+ if (listView.currentIndex != index)
+ {
+ listView.currentIndex = index
+ menuList.actions[model.title]();
+ // titleLabel.text = model.title
+ // stackView.replace(model.source)
+ }
+ drawer.close()
+ }
+ }
+
+ visible: (model.showOnCoreReady)? setVisible(mainWindow.coreReady) : true
+
+ Component.onCompleted:
+ {
+ if (model.showOnOsAndroid && !Q_OS_ANDROID)
+ {
+ menuItem.visible = false
+ menuItem.height = 0
+ }
+ }
+
+ function setVisible(b)
+ {
+ menuItem.visible = b
+ if (!b)
+ {
+ menuItem.height = 0
+ }
+ else
+ {
+ menuItem.height = itemHeight
+ }
+ }
+ }
+
+ model: ListModel
+ {
+ id: menuList
+ property var actions :
+ {
+ "Trusted Nodes": function()
+ {
+ stackView.push("qrc:/TrustedNodesView.qml");
+ },
+ "Search Contacts": function(){
+ stackView.push("qrc:/Contacts.qml",
+ {'searching': true} )
+
+ },
+ "Paste Link": function()
+ {
+ UriJs.URI.withinString(
+ ClipboardWrapper.getFromClipBoard(),
+ handleIntentUri);
+ },
+ "Terminate Core": function()
+ {
+ rsApi.request("/control/shutdown");
+ },
+ }
+
+ ListElement
+ {
+ title: "Trusted Nodes"
+ showOnCoreReady: true
+ }
+ ListElement
+ {
+ title: "Search Contacts"
+ showOnCoreReady: true
+ }
+ ListElement
+ {
+ title: "Paste Link"
+ showOnCoreReady: true
+ }
+ ListElement
+ {
+ title: "Terminate Core"
+ showOnOsAndroid: false
+ }
+
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+}
+
diff --git a/retroshare-qml-app/src/main-app.qml b/retroshare-qml-app/src/main-app.qml
index 4c0fe38de..9c4a7a235 100644
--- a/retroshare-qml-app/src/main-app.qml
+++ b/retroshare-qml-app/src/main-app.qml
@@ -21,6 +21,8 @@ import QtQuick.Controls 2.0
import org.retroshare.qml_components.LibresapiLocalClient 1.0
import "URI.js" as UriJs
import "." //Needed for TokensManager and ClipboardWrapper singleton
+import "components/."
+
ApplicationWindow
{
@@ -114,7 +116,7 @@ ApplicationWindow
anchors.rightMargin: 2
anchors.verticalCenter: parent.verticalCenter
- onClicked: menu.open()
+ onClicked: sideBar.open()
Image
{
@@ -124,41 +126,8 @@ ApplicationWindow
anchors.centerIn: parent
}
- Menu
- {
- id: menu
- y: parent.y + parent.height
-
- MenuItem
- {
- text: qsTr("Trusted Nodes")
- //iconSource: "qrc:/icons/document-share.png"
- onTriggered: stackView.push("qrc:/TrustedNodesView.qml")
- enabled: mainWindow.coreReady
- }
- MenuItem
- {
- text: qsTr("Search Contacts")
- onTriggered:
- stackView.push("qrc:/Contacts.qml",
- {'searching': true} )
- enabled: mainWindow.coreReady
- }
- MenuItem
- {
- text: "Paste Link"
- onTriggered: UriJs.URI.withinString(
- ClipboardWrapper.getFromClipBoard(),
- handleIntentUri)
-
- enabled: mainWindow.coreReady
- }
- MenuItem
- {
- text: "Terminate Core"
- onTriggered: rsApi.request("/control/shutdown")
- visible: !Q_OS_ANDROID
- }
+ SideBar {
+ id: sideBar
}
}
}
diff --git a/retroshare-qml-app/src/qml.qrc b/retroshare-qml-app/src/qml.qrc
index d6a115c96..398056100 100644
--- a/retroshare-qml-app/src/qml.qrc
+++ b/retroshare-qml-app/src/qml.qrc
@@ -39,5 +39,6 @@
components/ColorHash.qml
styles/ChatStyle.qml
components/AvatarOrColorHash.qml
+ components/SideBar.qml