on xenial help sign in
Added reply/activate enabled.
commitf9d592ed847dc51b87e53835e3e02ea55b8c64a3 authorNick Dedekind <nicholas.dedekind@gmail.com> dateFri 30 Aug 2013, 19:21 (13 years ago) parent8d0601f
5 files changed+17−3
plugins/Unity/Indicators/Messaging/qml/ActionTextField.qml+2−1 plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+5−1 plugins/Unity/Indicators/Messaging/qml/QuickReply.qml+2 plugins/Unity/Indicators/Messaging/qml/SnapDecision.qml+6−1 plugins/Unity/Indicators/Messaging/qml/TextMessage.qml+2
plugins/Unity/Indicators/Messaging/qml/ActionTextField.qml+2−1
@@ -25,6 +25,7 @@ Item {
2525 id: textField
2626 property alias text: replyField.text
2727 property alias buttonText: sendButton.text
28+ property bool activateEnabled: false
2829
2930 signal activate(var value)
3031
@@ -58,7 +59,7 @@ Item {
5859 right: parent.right
5960 }
6061 width: units.gu(9)
61− enabled: replyField.text !== ""
62+ enabled: replyField.text !== "" && textField.activateEnabled
6263 color: enabled ? "#c94212" : "#bababa"
6364
6465 onClicked: {
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+5−1
@@ -91,11 +91,12 @@ Indicators.BaseMenuItem {
9191 title: menu && menu.label ? menu.label : ""
9292 time: menu ? Utils.formatDate(menu.ext.xCanonicalTime) : ""
9393 message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
94+ replyButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Send"
9495 // icons
9596 avatar: menu && menu.ext.xCanonicalIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) : "qrc:/indicators/artwork/messaging/default_contact.png"
9697 appIcon: menu && menu.ext.xCanonicalAppIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalAppIcon) : ""
9798 // actions
98− replyButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Send"
99+ replyEnabled: replyAction.valid && replyAction.enabled
99100
100101 onActivateApp: {
101102 menuItem.model.activate(modelIndex, true);
@@ -130,6 +131,9 @@ Indicators.BaseMenuItem {
130131 // icons
131132 avatar: menu && menu.ext.xCanonicalIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) : "qrc:/indicators/artwork/messaging/default_contact.png"
132133 appIcon: menu && menu.ext.xCanonicalAppIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalAppIcon) : ""
134+ // actions
135+ activateEnabled: activateAction.valid && activateAction.enabled
136+ replyEnabled: replyAction.valid && replyAction.enabled
133137
134138 onActivateApp: {
135139 menuItem.model.activate(modelIndex, true);
plugins/Unity/Indicators/Messaging/qml/QuickReply.qml+2
@@ -27,6 +27,7 @@ Item {
2727 property alias buttonText: actionTextField.buttonText
2828 property real expandedHeight: childrenRect.height
2929 property alias messages : messagelistRepeater.model
30+ property alias replyEnabled: actionTextField.activateEnabled
3031
3132 signal reply(var value)
3233
@@ -150,6 +151,7 @@ Item {
150151
151152 anchors.fill: parent
152153 anchors.margins: units.gu(1)
154+ activateEnabled: replyEnabled
153155
154156 onActivate: {
155157 quickReply.reply(value)
plugins/Unity/Indicators/Messaging/qml/SnapDecision.qml+6−1
@@ -30,7 +30,10 @@ HeroMessage {
3030 property string time: ""
3131 property string message: ""
3232
33+ property bool activateEnabled: true
3334 property alias actionButtonText: actionButton.text
35+
36+ property bool replyEnabled: true
3437 property alias replyMessages: quickreply.messages
3538 property alias replyButtonText: quickreply.buttonText
3639
@@ -76,11 +79,12 @@ HeroMessage {
7679 Button {
7780 id: actionButton
7881 text: "Call back"
79− color: "#c94212"
82+ color: enabled ? "#c94212" : "#bababa"
8083 anchors.right: parent.right
8184 anchors.top: parent.top
8285 anchors.bottom: parent.bottom
8386 width: (parent.width - units.gu(1)) / 2
87+ enabled: snapDecision.activateEnabled
8488
8589 onClicked: {
8690 snapDecision.activate();
@@ -123,6 +127,7 @@ HeroMessage {
123127 height: 0
124128 opacity: 0.0
125129 enabled: false
130+ replyEnabled: snapDecision.replyEnabled
126131
127132 states: State {
128133 name: "expanded"
plugins/Unity/Indicators/Messaging/qml/TextMessage.qml+2
@@ -25,6 +25,7 @@ import Unity.Indicators 0.1 as Indicators
2525SimpleTextMessage {
2626 id: simpleMessage
2727
28+ property bool replyEnabled: false
2829 property string replyButtonText: "Send"
2930
3031 signal reply(string value)
@@ -32,6 +33,7 @@ SimpleTextMessage {
3233 footer: ActionTextField {
3334 anchors.fill: parent
3435
36+ activateEnabled: simpleMessage.replyEnabled
3537 buttonText: simpleMessage.replyButtonText
3638
3739 onActivate: {