summaryrefstree
path: root/usr/bin/qml/Carlink/Carlink_Contacts_New_Msg.qml
blob: 1535ea6f8869d702b987c8e2e9b72a587013a752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
import QtQuick 2.0
import "../eventsList.js" as EventsList
import "../com/neusoft/auto/widgets"
import "../layoutList.js" as Layout
import "../windowsList.js" as WindowsList
import Label 2.0
HMIWindow
{
   // y:128
    property int curMsgIndex: 0
    Component.onCompleted:
    {
        windowID = WindowsList.CARLINK_CONTACTS_NEW_MSG
        systemCtrl.setTextInputHandle(newMsgInput)
    }
    onVisibleChanged:
    {
        bFullWindow = true
        if(visible && newMsgInput.cursorVisible == true)
        {
            systemCtrl.setTextInputHandle(newMsgInput)
        }
    }

    HMILabel
    {
        x:20
        y:150-128
        width:610
        height:62
        text:"Interact"
        color: "white"
        font.pixelSize: 26
        horizontalAlignment: Text.horizontalAlignment
        verticalAlignment: Text.verticalAlignment
    }
    HMIButton
    {
        id:icon_return
        x:650
        y:10
        width: 90
        height: 21

        btnImg:icon_return.pressed?("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK_P"+bgImageStyle)
                                  :("qrc:MATERIAL/MATERIAL_M8X_ICON_BACK"+bgImageStyle)
        onClicked:
        {
            ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_ALL_LIST)
        }
    }
    HMILabel
    {
        x: 24
        y: 200-128
        width: 600//380
        height: 43
        horizontalAlignment: Label.AlignLeft
        text:("SMS to:")+carlinkCtrl.currentPhoneNum+("  ")+carlinkCtrl.currentPhoneName//carlinkCtrl.getCurrentPhoneNum+carlinkCtrl.getCurrentPhoneName
    }



    HMIListView{
        id:msgContactList
        x:24+110
        y:200-128
        width: 500
        height: 43
        model: carlinkCtrl.carlinkMsgContactListModel
        orientation: ListView.Horizontal
        delegate: del
        onCountChanged: {
            if(count == 0)
            {
                listviewCover.visible = true
            }
            else{
                listviewCover.visible = false
            }
        }
        HMIMouseArea
        {
            anchors.fill: parent
            visible: handInputNum.visible
            onPressed:
            {
                handInputNum.visible=false
                newMsgInput.cursorVisible = false
            }
        }
    }
    HMIMouseArea
    {
        id:listviewCover
        x:24+110
        y:200-128
        width: 500
        height: 43
        visible: true
        onClicked:
        {
            systemCtrl.setTextInputHandle(handInputNum)
            handInputNum.visible=true
            newMsgInput.cursorVisible = false
        }
    }

    /*TextInput
    {
        id: handInputNum
        visible: false
        x:msgContactList.count > 0?24+110+100:24+110
        y:200-128
        width: 500
        height: 43
        font.pixelSize: 26
        readOnly: false
        enabled: true
        horizontalAlignment: Text.AlignLeft
        clip: true
        color:"white"
        cursorVisible:true
        onVisibleChanged: {
            text = ""
            if(visible)
            {
                msgContactList.width=msgContactList.count > 0?100:500
                msgContactList.positionViewAtEnd()
            }
            else{
                msgContactList.width=500
            }
        }
    }*/

    Component{
        id:del
        Item{
            width: contactText.width
            height: 43
            HMILabel{
                anchors.fill: parent
                text:col0 + " " + col1 + ";"
                HMIMouseArea{
                    anchors.fill: parent
                    onClicked: {
                        newMsgInput.cursorVisible = false
                        systemCtrl.setTextInputHandle(handInputNum)
                    }
                }
            }
            Text{
                font.pixelSize: 30
                visible: false
                id:contactText
                text:col0 + " " + col1 + ";"
            }
            Item{
                width:40
                height: 43
                x:contactText.width - 40
                Image{
                    anchors.right: parent.right
                    width: 10
                    height: 10
                    source: close_img.pressed?"qrc:MATERIAL/MATERIAL_M8X_ICON_AIR-CONDITION_CLOSE_P"+bgImageStyle
                                             :"qrc:MATERIAL/MATERIAL_M8X_ICON_AIR-CONDITION_CLOSE"+bgImageStyle
                }
                HMIMouseArea{
                    id:close_img
                    anchors.fill: parent
                    onClicked: {
                        console.debug("delBtMsgContact"+index)
                        carlinkCtrl.delCarlinkMsgContact(index,col0)
                        newMsgInput.cursorVisible = false
                        systemCtrl.setTextInputHandle(handInputNum)
                    }
                }
            }
        }
    }

    HMIButton
    {
       id:search_Cont
        x:650
       y:75
       width: 90
       height: 21
       labelText: "..."
       btnImg: search_Cont.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_56_P"+bgImageStyle)
                                  :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_56"+bgImageStyle)
        onClicked:
        {
                //carlinkCtrl.sLPphoneBookListModelClear();
                ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_SELECT_CONT)

        }
    }

    Item
    {
        id:input_bar
        x:24
        y:60+60
        width: 700
        height: 310
        HMIButton
        {
            x:0
            y:0
            btnImg: "qrc:MATERIAL/MATERIAL_M8X_SMS_BK_310"+bgImageStyle
        }
        Flickable {
             id: flick
             x:5
             y:0
             width: 698
             height: 310
             flickableDirection:Flickable.VerticalFlick
             contentWidth: newMsgInput.paintedWidth
             contentHeight: newMsgInput.paintedHeight
             clip: true

             function ensureVisible(r)
             {
                 if (contentX >= r.x)
                     contentX = r.x;
                 else if (contentX+width <= r.x+r.width)
                     contentX = r.x+r.width-width;
                 if (contentY >= r.y)
                     contentY = r.y;
                 else if (contentY+height <= r.y+r.height)
                     contentY = r.y+r.height-height;
             }
             TextEdit {
                 id: newMsgInput
                 width: 698
                 height: newMsgInput.contentHeight
                 focus: true
                 color:"white"
                 cursorVisible:true
                 font.pixelSize: 24
                 wrapMode: TextEdit.Wrap
                 onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
                 onLengthChanged:
                 {

                     if(length > 80)
                     {
                         console.debug("lengthlengthlengthlengthlengthlengthlengthlength")
                         remove(80, 82)
                     }
                 }

                 onCursorPositionChanged:
                 {
                     if(newMsgInput.text.length == 80)
                     {
                         console.debug("lengthlengthlengthlengthlengthlengthlengthlength")
                         keyBoard.maximumState=true
                     }
                     else if(newMsgInput.text.length <80)
                     {
                         keyBoard.maximumState=false
                     }
                 }
         }





        HMIMouseArea
        {
            id: text_cursor
            visible: !newMsgInput.cursorVisible
            anchors.fill: parent
            onClicked:{
                handInputNum.visible = false
                newMsgInput.cursorVisible = true
                systemCtrl.setTextInputHandle(newMsgInput)
            }
        }
        }
    }


    /*---------------------------------------------Key Board Start----------------------------------------*/
       Rectangle
        {
            id:newmsg_area

            x:0
            y:380+60
            width: 750
            height: 320-62
            color:"#202020"
            HMIKeyBoard
            {
                id:keyBoard
                iSerach: false
                x:0
                y:0
                onClickspell:
                {
                    if(!keyBoard.isPinyin)
                    {
                        systemCtrl.setKeyPress(spell)
                        if(false == newMsgInput.cursorVisible && false == handInputNum.visible)
                        {
                            systemCtrl.setTextInputHandle(handInputNum)
                            handInputNum.visible=true
                        }
                    }
                }

            }
        }

    /*---------------------------------------------Key Board Over----------------------------------------*/


        HMIButton
        {
            id:icon_Send
            x:60
            y:822-128
            width: 100
            height: 66
            labelText: "Send"
            btnImg:icon_Send.pressed?("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_3_P"+bgImageStyle)
                                   :("qrc:MATERIAL/MATERIAL_M8X_FUNCTION_BUTTON_3"+bgImageStyle)
            onClicked:
            {
                if(carlinkCtrl.currentPhoneNum !="")
                {

                    carlinkCtrl.carLinkContactsMsgSend(newMsgInput.text)
                    newMsgInput.text = ""
                    ScreenManager.changeForm(Layout.FM_OPEN,WindowsList.CARLINK_CONTACTS_ALL_LIST)
                }


            }
        }


}