~feng-kylin/unity8/OpenUrlInIndicator

« back to all changes in this revision

Viewing changes to Panel/MenuContent.qml

  • Committer: Tarmac
  • Author(s): Nick Dedekind, Launchpad Translations on behalf of unity-team
  • Date: 2013-07-11 19:50:27 UTC
  • mfrom: (2.5.114 indicators-client)
  • Revision ID: tarmac-20130711195027-yheu3w2oc42c1h7s
Moved indicators-client code into unity8. Fixes: https://bugs.launchpad.net/bugs/1191132, https://bugs.launchpad.net/bugs/1191822.

Approved by PS Jenkins bot, Michał Sawicz, Nicolas d'Offay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import QtQuick 2.0
18
18
import Ubuntu.Components 0.1
 
19
import Unity.Indicators 0.1 as Indicators
19
20
import "Menus"
20
21
import "../Components"
21
22
 
29
30
    property bool __contentActive: false
30
31
    property alias currentIndex : menus.currentIndex
31
32
    property color backgroundColor: "#221e1c"
32
 
    property int contentReleaseInterval: 5000
 
33
    property int contentReleaseInterval: 20000
33
34
 
34
35
    width: units.gu(40)
35
36
    height: units.gu(42)
94
95
 
95
96
            width: menus.width
96
97
            height: menus.height
97
 
            sourceComponent: component
 
98
            source: pageSource
98
99
            visible: content.__shown
99
100
            onVisibleChanged: {
100
101
                // Reset the indicator states
104
105
            }
105
106
            asynchronous: true
106
107
 
107
 
            onStatusChanged: {
108
 
                if (status == Loader.Ready) {
109
 
                    if (indicatorsModel.widgetsMap && item.hasOwnProperty("widgetsMap")) {
110
 
                        item["widgetsMap"] = indicatorsModel.widgetsMap
111
 
                    }
112
 
                    for(var pName in initialProperties) {
113
 
                        if (item.hasOwnProperty(pName)) {
114
 
                            item[pName] = initialProperties[pName]
115
 
                        }
116
 
                    }
117
 
                    if (contentActive && menus.visible) {
118
 
                        item.start()
119
 
                    }
120
 
                }
121
 
            }
122
 
 
123
 
            // FIXME: QTBUG-30632 - asynchronous loader crashes when changing index quickly.
124
 
            Component.onDestruction: {
125
 
                active = false;
 
108
            onLoaded: {
 
109
                for(var pName in indicatorProperties) {
 
110
                    if (item.hasOwnProperty(pName)) {
 
111
                        item[pName] = indicatorProperties[pName]
 
112
                    }
 
113
                }
 
114
                if (contentActive && menus.visible) {
 
115
                    item.start()
 
116
                }
126
117
            }
127
118
 
128
119
            // Need to use a binding because the handle height changes.
189
180
                left: parent.left
190
181
                right: parent.right
191
182
            }
192
 
            text: content.overviewActive ? i18n.tr("Device") : (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count) ?  indicatorsModel.get(menus.currentIndex).title : ""
 
183
            text: {
 
184
                if (content.overviewActive)
 
185
                    return i18n.tr("Device");
 
186
                if (indicatorsModel && menus.currentIndex >= 0 && menus.currentIndex < indicatorsModel.count)
 
187
                    return indicatorsModel.data(menus.currentIndex, Indicators.IndicatorsModelRole.Title);
 
188
                return "";
 
189
            }
193
190
            opacity: __shown ? 1 : 0
194
191
            Behavior on opacity {NumberAnimation{duration: 100}}
195
192
        }