@@ -24,6 +24,7 @@ import QMenuModel 0.1
2424import Utils 0.1 as Utils
2525import Ubuntu.Components.ListItems 0.1 as ListItems
2626import Ubuntu.Components 1.1
27+import "../../Greeter"
2728
2829Item {
2930 id: menuFactory
@@ -63,6 +64,14 @@ Item {
6364 },
6465 "indicator-messages" : {
6566 "com.canonical.indicator.button" : messagesButtonMenu
67+ },
68+ "indicator-datetime" : {
69+ "com.canonical.indicator.calendar": calendarMenu,
70+ "com.canonical.indicator.location": timezoneMenu
71+ },
72+ "indicator-session" : {
73+ "indicator.user-menu-item": userMenuItem,
74+ "indicator.guest-menu-item": userMenuItem
6675 }
6776 }
6877
@@ -73,6 +82,8 @@ Item {
7382 return defaultValue;
7483 }
7584
85+ LightDM {id: lightDM} // Provide backend access
86+
7687 Component {
7788 id: separatorMenu;
7889
@@ -422,6 +433,78 @@ Item {
422433 }
423434 }
424435
436+ Component {
437+ id: userMenuItem
438+
439+ Menus.UserSessionMenu {
440+ objectName: "userSessionMenu"
441+ highlightWhenPressed: false
442+
443+ property QtObject menuData: null
444+ property var menuModel: menuFactory.menuModel
445+ property int menuIndex: -1
446+ //property var extendedData: menuData && menuData.ext || undefined
447+
448+ name: menuData && menuData.label || ""
449+ iconSource: menuData && menuData.icon || ""
450+ // active: true // TODO hook up with lightdm
451+
452+ onTriggered: {
453+ menuModel.activate(menuIndex);
454+ }
455+ }
456+ }
457+
458+ Component {
459+ id: calendarMenu
460+
461+ Menus.CalendarMenu {
462+ objectName: "calendarMenu"
463+ highlightWhenPressed: false
464+ }
465+ }
466+
467+ Component {
468+ id: timezoneMenu
469+
470+ Menus.TimeZoneMenu {
471+ id: tzMenuItem
472+ objectName: "timezoneMenu"
473+
474+ property QtObject menuData: null
475+ property var menuModel: menuFactory.menuModel
476+ property int menuIndex: -1
477+ property var extendedData: menuData && menuData.ext || undefined
478+ readonly property var tz: getExtendedProperty(extendedData, "xCanonicalTimezone", "UTC")
479+ property var tzFormatter: Utils.TimeFormatter {}
480+ property var updateTimer: Timer {
481+ repeat: true
482+ running: true
483+ onTriggered: tzMenuItem.time = tzMenuItem.tzFormatter.currentTimeInTimezone(tzMenuItem.tz)
484+ }
485+
486+ city: menuData && menuData.label || ""
487+ time: tzFormatter.currentTimeInTimezone(tz)
488+ enabled: menuData && menuData.sensitive || false
489+ highlightWhenPressed: false
490+
491+ onMenuModelChanged: {
492+ loadAttributes();
493+ }
494+ onMenuIndexChanged: {
495+ loadAttributes();
496+ }
497+ onTriggered: {
498+ menuModel.activate(menuIndex);
499+ }
500+
501+ function loadAttributes() {
502+ if (!menuModel || menuIndex == -1) return;
503+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-timezone': 'string'});
504+ }
505+ }
506+ }
507+
425508 Component {
426509 id: wifiSection;
427510