Commit d4dbb0d3 authored by Dan Chapman's avatar Dan Chapman
Browse files

Add NavPluginToolbar and fix stage loading

parent def086ce
import QtQuick 2.4
import PlugMan 1.0
import Ubuntu.Components 1.3
import Dekko.Mail.API 1.0
Item {
property alias plugins: navRegistry.actions
ItemRegistry {
id: registry
}
// Mail stage is special here as it's the only one kept on the stack
// all other stage plugins are destroyed on stage push's
// If you want your stage to maintain state then you should make
// use of the store/worker pattern and use MazDB or MazDBSettings for data persistence
ActionRegistry {
id: navRegistry
location: "Dekko::Stage::Action"
defaultActions: [
Action {
iconName: "mail-unread"
onTriggered: ViewActions.rewindStageStack()
},
Action {
iconName: "address-book-app-symbolic"
onTriggered: ViewActions.pushStage(registry.findFirstEnabled("Dekko::Stage::Contacts"), {})
},
Action {
iconName: "calendar"
onTriggered: ViewActions.pushStage(registry.findFirstEnabled("Dekko::Stage::Calendar"), {})
},
Action {
iconName: "stock_note"
onTriggered: ViewActions.pushStage(registry.findFirstEnabled("Dekko::Stage::Notes"), {})
},
Action {
iconName: "attachment"
onTriggered: ViewActions.pushStage("./AttachmentsStage.qml", {})
}
]
}
}
......@@ -2,45 +2,16 @@ import QtQuick 2.4
import Ubuntu.Components 1.3
import Dekko.Mail.API 1.0
import Dekko.Components 1.0
import PlugMan 1.0
import MazDB 1.0
import Dekko.Ubuntu.Components 1.0
import Dekko.Mail.Stores.Views 1.0
Rectangle {
id: bar
color: UbuntuColors.inkstone
property int currentIndex: 0
// Mail stage is special here as it's the only one kept on the stack
// all other stage plugins are destroyed on stage push's
// If you want your stage to maintain state then you should make
// use of the store/worker pattern and use MazDB or MazDBSettings for data persistence
ActionRegistry {
id: navRegistry
location: "Dekko::Stage::Action"
defaultActions: [
Action {
iconName: "mail-unread"
onTriggered: ViewActions.rewindStageStack()
},
Action {
iconName: "address-book-app-symbolic"
onTriggered: ViewActions.pushStage("./AddressBookStage.qml", {})
},
Action {
iconName: "calendar"
onTriggered: ViewActions.pushStage("./CalendarStage.qml", {})
},
Action {
iconName: "stock_note"
onTriggered: ViewActions.pushStage("./NotesStage.qml", {})
},
Action {
iconName: "attachment"
onTriggered: ViewActions.pushStage("./AttachmentsStage.qml", {})
}
]
NavPluginModel {
id: navPlugins
}
Line {
......@@ -105,12 +76,12 @@ Rectangle {
}
Repeater {
model: navRegistry.actions
model: navPlugins.plugins
delegate: AbstractButton {
id: btn
readonly property bool isSelected: bar.currentIndex === index
readonly property bool isSelected: ViewStore.selectedNavIndex === index
action: modelData
height: units.gu(7)
......@@ -118,7 +89,7 @@ Rectangle {
implicitHeight: height
visible: action.visible
onClicked: bar.currentIndex = index
onClicked: ViewStore.selectedNavIndex = index
Rectangle {
anchors.fill: parent
......
import QtQuick 2.4
import Ubuntu.Components 1.3
import Dekko.Mail.Stores.Views 1.0
Panel {
id: panel
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: units.gu(6)
InverseMouseArea {
visible: panel.opened
anchors.fill: parent
onClicked: {
if (panel.opened) {
panel.close()
}
}
}
NavPluginModel {
id: navModel
}
Rectangle {
color: UbuntuColors.inkstone
anchors.fill: parent
// two properties used by the toolbar delegate:
property bool opened: panel.opened
property bool animating: panel.animating
Line {
id: line
anchors {
left: parent.left
top: parent.top
right: parent.right
}
}
Row {
anchors.fill: parent
Repeater {
model: navModel.plugins
delegate: AbstractButton {
id: btn
readonly property bool isSelected: ViewStore.selectedNavIndex === index
action: modelData
height: panel.height
width: panel.width / 4
implicitHeight: height
visible: action.visible
onClicked: ViewStore.selectedNavIndex = index
Rectangle {
anchors.fill: parent
visible: btn.pressed
color: UbuntuColors.slate
}
Rectangle {
color: UbuntuColors.blue
width: units.dp(2)
anchors {
left: parent.left
top: parent.top
right: parent.right
}
visible: btn.isSelected
}
Icon {
name: action.iconName
color: btn.isSelected ? UbuntuColors.blue : UbuntuColors.silk
height: units.gu(3.4)
width: height
anchors.centerIn: parent
}
}
}
}
}
QtObject {
id: internal
function peek() {
panel.open()
closeTimer.start()
}
property Timer closeTimer: Timer {
repeat: false
interval: 1000
onTriggered: panel.close()
}
}
Component.onCompleted: internal.peek()
}
......@@ -29,3 +29,4 @@ TitledHeaderButton 1.0 TitledHeaderButton.qml
TitledTextField 1.0 TitledTextField.qml
UbuntuShapeGravatar 1.0 UbuntuShapeGravatar.qml
NavPluginSideBar 1.0 NavPluginSideBar.qml
NavPluginToolbar 1.0 NavPluginToolbar.qml
......@@ -17,13 +17,14 @@
*/
import QtQuick 2.4
import PlugMan 1.0
import Dekko.Ubuntu.Stage 1.0
BaseStage {
id: calendarStage
ItemRegistry {
target: calendarStage
location: "Dekko::Stage::Notes"
location: "Dekko::Stage::Calendar::UI"
loadMode: ItemRegistry.LoadFirstEnabled
asynchronous: true
defaultItems: [
......
{
"id": "ubuntu-calendar-stage",
"register" : "Dekko::Stage::Calendar",
"component" : "CalendarStage.qml"
}
import qbs
Project {
name: "Calendar"
}
......@@ -17,13 +17,14 @@
*/
import QtQuick 2.4
import PlugMan 1.0
import Dekko.Ubuntu.Stage 1.0
BaseStage {
id: contactsStage
ItemRegistry {
target: contactsStage
location: "Dekko::Stage::Notes"
location: "Dekko::Stage::Contacts::UI"
loadMode: ItemRegistry.LoadFirstEnabled
asynchronous: true
defaultItems: [
......
{
"id": "ubuntu-contacts-stage",
"register" : "Dekko::Stage::Contacts",
"component" : "AddressBookStage.qml"
}
......@@ -44,6 +44,129 @@ Project {
}
}
Product {
name: "Contacts"
condition: project.enabled
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Group {
name: "QML components"
files: [
"contacts/*.qml",
"contacts/**/*.qml"
]
fileTags: ["contacts-ui-plugin"]
}
Group {
name: "JavaScript modules"
files: [
"contacts/**/*.js"
]
fileTags: ["contacts-ui-plugin"]
}
Group {
name: "Plugin specs"
files: [
"contacts/**/*.dekko-plugin"
]
fileTags: ["contacts-ui-plugin"]
}
Group {
condition: project.ui === "ubuntu"
fileTagsFilter: "contacts-ui-plugin"
qbs.install: project.ui === "ubuntu"
qbs.installDir: project.binDir + "/plugins/ubuntu/contacts"
qbs.installSourceBase: "contacts"
}
}
Product {
name: "Calendar"
condition: project.enabled
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Group {
name: "QML components"
files: [
"calendar/*.qml",
"calendar/**/*.qml"
]
fileTags: ["calendar-ui-plugin"]
}
Group {
name: "JavaScript modules"
files: [
"calendar/**/*.js"
]
fileTags: ["calendar-ui-plugin"]
}
Group {
name: "Plugin specs"
files: [
"calendar/**/*.dekko-plugin"
]
fileTags: ["calendar-ui-plugin"]
}
Group {
condition: project.ui === "ubuntu"
fileTagsFilter: "calendar-ui-plugin"
qbs.install: project.ui === "ubuntu"
qbs.installDir: project.binDir + "/plugins/ubuntu/calendar"
qbs.installSourceBase: "calendar"
}
}
Product {
name: "Notes"
condition: project.enabled
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Group {
name: "QML components"
files: [
"notes/*.qml",
"notes/**/*.qml"
]
fileTags: ["notes-ui-plugin"]
}
Group {
name: "JavaScript modules"
files: [
"notes/**/*.js"
]
fileTags: ["notes-ui-plugin"]
}
Group {
name: "Plugin specs"
files: [
"notes/**/*.dekko-plugin"
]
fileTags: ["notes-ui-plugin"]
}
Group {
condition: project.ui === "ubuntu"
fileTagsFilter: "notes-ui-plugin"
qbs.install: project.ui === "ubuntu"
qbs.installDir: project.binDir + "/plugins/ubuntu/notes"
qbs.installSourceBase: "notes"
}
}
Product {
name: "Settings"
condition: project.enabled
......
......@@ -126,7 +126,7 @@ SettingsGroupPage {
Item {
height: units.gu(5)
width: parent.width
visible: false
visible: true
Label {
anchors {
left: parent.left
......
......@@ -17,13 +17,14 @@
*/
import QtQuick 2.4
import PlugMan 1.0
import Dekko.Ubuntu.Stage 1.0
BaseStage {
id: notesStage
ItemRegistry {
target: notesStage
location: "Dekko::Stage::Notes"
location: "Dekko::Stage::Notes::UI"
loadMode: ItemRegistry.LoadFirstEnabled
asynchronous: true
defaultItems: [
......
{
"id": "ubuntu-notes-stage",
"register" : "Dekko::Stage::Notes",
"component" : "NotesStage.qml"
}
import qbs
Project {
name: "Notes"
}
......@@ -46,5 +46,15 @@ BaseStage {
}
}
}
NavPluginToolbar {
id: toolbar
visible: dekko.isSmallFF
anchors {
left: parent.left
bottom: parent.bottom
right: parent.right
}
}
}
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