~ubuntu-branches/ubuntu/vivid/youker-assistant/vivid

« back to all changes in this revision

Viewing changes to qml/func/BrowserCookies.qml

  • Committer: Package Import Robot
  • Author(s): Kobe Lee (kylinkobe)
  • Date: 2013-09-18 16:22:14 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130918162214-6nqyjyf3cd3ynqky
Tags: 0.2.1-0ubuntu1
* Modify the mouse events of MonitorBall.
* Add reset button for clear pages.
* Add policykit for apt clear in sudodbus.
* Fixed the bug about software status and add masklayer.
* Rewrite the code of system information.
* Add some signals and slots.
* Fixed the bug about Software signals(LP: #1226389).
* Modify KThread and add base.py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    width: parent.width
27
27
    height: 435//420//340
28
28
    property string btn_text: "开始扫描"
29
 
//    property string title: "清理浏览器Cookies"
30
 
//    property string description: "清理浏览器Cookies可以保障系统安全"
31
29
    property string title: "清理浏览器登录信息,保护个人隐私"
32
30
    property string description: "清理上网时留下的登录信息,目前仅支持Firefox浏览器"
33
31
    property string btn_flag: "cookies_scan"
39
37
    property int sub_num:coo_sub_num
40
38
    property bool check_flag: true
41
39
    property bool null_flag: false
 
40
    property int deleget_arrow :0
42
41
 
43
42
    signal cookies_signal(string cookies_msg);
44
43
    onCookies_signal: {
46
45
            //get data of cookies
47
46
//            var cookies_data = systemdispatcher.scan_cookies_records_qt();
48
47
            var cookies_data = sessiondispatcher.scan_cookies_records_qt();
49
 
            if (cookies_data == "")
 
48
            if (cookies_data == "") {
50
49
                root.null_flag = true;
51
 
            else
 
50
                if(statusImage.visible == true)
 
51
                    statusImage.visible = false;
 
52
            }
 
53
            else {
52
54
                root.null_flag = false;
 
55
                statusImage.visible = true;
 
56
            }
53
57
            root.coo_sub_num = cookies_data.length;
54
58
            systemdispatcher.clear_cookies_args();
55
59
            subModel.clear();
117
121
        //             }
118
122
 
119
123
//         }
 
124
        onFinishCleanWorkError: {
 
125
            if (btn_flag == "cookies_work") {
 
126
                if (msg == "cookies") {
 
127
                    root.work_result = msg;
 
128
                    root.state = "CookiesWorkError";
 
129
                    toolkits.alertMSG("清理出现异常!", mainwindow.pos.x, mainwindow.pos.y);
 
130
                }
 
131
            }
 
132
         }
120
133
        onFinishCleanWork: {
121
134
            if (btn_flag == "cookies_work") {
122
 
                if (msg == "cookies") {
 
135
                if (msg == "") {
 
136
                    resetBtn.visible = true;
 
137
                }
 
138
                else if (msg == "cookies") {
123
139
                    root.work_result = msg;
124
140
                    root.state = "CookiesWorkFinish";
 
141
                    toolkits.alertMSG("清理完毕!", mainwindow.pos.x, mainwindow.pos.y);
 
142
                    cookies_signal("CookiesWork");
125
143
                }
126
144
            }
127
145
        }
140
158
        spacing: 20
141
159
        width: parent.width
142
160
//        height: 50
143
 
        anchors { top: parent.top; topMargin: 20; left: parent.left; leftMargin: 20 }
 
161
        anchors { top: parent.top; topMargin: 20; left: parent.left; leftMargin: 27 }
144
162
        Image {
145
163
            id: refreshArrow
146
164
            source: "../img/toolWidget/trace.png"
175
193
//        }
176
194
        Common.StatusImage {
177
195
            id: statusImage
 
196
            visible: false
178
197
            iconName: "yellow.png"
179
198
            text: "未完成"
180
199
            anchors.verticalCenter: parent.verticalCenter
181
200
        }
182
201
 
183
 
        Common.Label {
184
 
            id: label
185
 
            visible: false
186
 
            text: ""
187
 
            anchors.verticalCenter: parent.verticalCenter
188
 
        }
189
 
 
190
202
        Common.Button {
191
203
            id: bitButton
192
204
            width: 120
194
206
            text: root.btn_text
195
207
            hoverimage: "green1.png"
196
208
            anchors.verticalCenter: parent.verticalCenter
 
209
            fontsize: 15
197
210
            onClicked: {
 
211
                resetBtn.visible = false;
198
212
                if(root.check_flag)
199
213
                {
200
214
                //broswer cookies
202
216
                     cookies_signal("CookiesWork");
203
217
                     if(root.null_flag == true) {
204
218
                        root.state = "CookiesWorkEmpty";
205
 
                         sessiondispatcher.send_warningdialog_msg("友情提示:","扫描内容为空,不再执行清理!");
 
219
                         deleget_arrow=0;
 
220
                         sessiondispatcher.showWarningDialog("友情提示:","扫描内容为空,不再执行清理!", mainwindow.pos.x, mainwindow.pos.y);
206
221
                     }
207
222
                     else if(root.null_flag == false)
 
223
                     {
208
224
                        root.state = "CookiesWork";
 
225
                         deleget_arrow=1;
 
226
                         toolkits.alertMSG("扫描完成!", mainwindow.pos.x, mainwindow.pos.y);
 
227
                     }
209
228
                 }
210
229
                 else if (btn_flag == "cookies_work") {
211
230
                     systemdispatcher.set_user_homedir_qt();
212
231
                     systemdispatcher.clean_cookies_records_qt(systemdispatcher.get_cookies_args());
213
 
//                     sessiondispatcher.clean_cookies_records_qt(systemdispatcher.get_cookies_args());
 
232
                     deleget_arrow=1;
214
233
                 }
215
234
                }
216
235
                else
217
 
                    sessiondispatcher.send_warningdialog_msg("友情提示:","对不起,您没有选择需要清理的项,请确认!");
218
 
            }
219
 
        }
220
 
//        Common.Button {
221
 
//            id: bitButton
222
 
//            width: 120
223
 
//            height: 39
224
 
////            hoverimage: "scan-start.png"
225
 
//            text:"开始扫描"
226
 
//            bold:true
227
 
//            textsize: 12
228
 
//            anchors.verticalCenter: parent.verticalCenter
229
 
//            onClicked: {
230
 
//                if(root.check_flag)
231
 
//                {
232
 
//                //broswer cookies
233
 
//                 if (btn_flag == "cookies_scan") {
234
 
//                     cookies_signal("CookiesWork");
235
 
//                     if(root.null_flag == true) {
236
 
//                        root.state = "CookiesWorkEmpty";
237
 
//                         sessiondispatcher.send_warningdialog_msg("友情提示:","扫描内容为空,不再执行清理!");
238
 
//                     }
239
 
//                     else if(root.null_flag == false)
240
 
//                        root.state = "CookiesWork";
241
 
//                 }
242
 
//                 else if (btn_flag == "cookies_work") {
243
 
//                     systemdispatcher.set_user_homedir_qt();
244
 
//                     systemdispatcher.clean_cookies_records_qt(systemdispatcher.get_cookies_args());
245
 
////                     sessiondispatcher.clean_cookies_records_qt(systemdispatcher.get_cookies_args());
246
 
//                 }
247
 
//                }
248
 
//                else
249
 
//                    sessiondispatcher.send_warningdialog_msg("友情提示:","对不起,您没有选择需要清理的项,请确认!");
250
 
//                console.log(root.sub_num)
251
 
//            }
252
 
//        }
 
236
                    sessiondispatcher.showWarningDialog("友情提示:","对不起,您没有选择需要清理的项,请确认!", mainwindow.pos.x, mainwindow.pos.y);
 
237
            }
 
238
        }
 
239
        SetBtn {
 
240
            id: resetBtn
 
241
            width: 12
 
242
            height: 15
 
243
            iconName: "revoke.png"
 
244
            visible: false
 
245
            anchors.verticalCenter: parent.verticalCenter
 
246
            onClicked: {
 
247
                resetBtn.visible = false;
 
248
                subModel.clear();
 
249
                root.state = "CookiesWorkAGAIN";
 
250
            }
 
251
        }
253
252
    }
254
253
    //分割条
255
254
    Rectangle {
262
261
        }
263
262
        width: parent.width - 4
264
263
        height: 1
265
 
        color: "#b9c5cc"
 
264
        color: "#d8e0e6"
266
265
    }
267
266
 
268
 
//    Component {
269
 
//        id: listViewDelegate
270
 
//        Item {
271
 
//            id: delegate
272
 
//            property alias expandedItemCount: subItemRepeater.count
273
 
//            x: 5; y: 2
274
 
//            width: root.width
275
 
//            height: headerItemRect.height + subItemsRect.height
276
 
 
277
 
//            //母项
278
 
//            //checkbox, picture and words
279
 
//            Row {
280
 
//                id: headerItemRect
281
 
//                x: 5; y: 2
282
 
//                width: root.width
283
 
//                height: root.itemHeight
284
 
//                spacing: 180
285
 
//                Row{
286
 
//                    spacing: 15
287
 
//                    Image {
288
 
//                        id: clearImage
289
 
//                        fillMode: "PreserveAspectFit"
290
 
//                        height: parent.height*0.9
291
 
//                        source: picture
292
 
//                        smooth: true
293
 
//                    }
294
 
 
295
 
//                    Column {
296
 
//                        id: status_update_content
297
 
//                        spacing: 5
298
 
//                        anchors.verticalCenter: parent.verticalCenter
299
 
//                        Text {
300
 
//                            text: itemTitle
301
 
//                            font.pointSize: 11
302
 
//                            color: "black"
303
 
//                        }
304
 
//                        Text {
305
 
//                            text: detailstr
306
 
//                            font.pointSize: 9
307
 
//                            color: "gray"
308
 
//                        }
309
 
//                    }
310
 
//                }
311
 
//            }//母项Row
312
 
//            Image {
313
 
//                id: arrow
314
 
//                fillMode: "PreserveAspectFit"
315
 
////                    height: parent.height*0.3
316
 
//                height: 28
317
 
//                width: 26
318
 
//                x:740
319
 
//                y:15
320
 
//                source: root.arrow
321
 
//                //当鼠标点击后,箭头图片旋转90度
322
 
////                    rotation: expanded ? 90 : 0
323
 
//                rotation: expanded ? 0 : -180
324
 
//                smooth: true
325
 
//                MouseArea {
326
 
//                    id: mouseRegion
327
 
//                    anchors.fill: parent
328
 
//                    onPressed: {
329
 
////                        console.log(root.width)
330
 
//                        expanded = !expanded
331
 
//                    }
332
 
//                }
333
 
//            }
334
 
//            //子项
335
 
//            Item {
336
 
//                id: subItemsRect
337
 
//                property int itemHeight: root.itemHeight
338
 
//                y: headerItemRect.height
339
 
//                width: root.width
340
 
//                //当高度需要扩展时,根据expandedItemCount数目和itemHeight高度去扩展
341
 
//                height: expanded ? delegate.expandedItemCount * itemHeight : 0
342
 
//                clip: true
343
 
//                opacity: 1
344
 
//                Behavior on height {
345
 
//                    SequentialAnimation {
346
 
//                        NumberAnimation { duration: 100; easing.type: Easing.InOutQuad }
347
 
//                    }
348
 
//                }
349
 
 
350
 
//                Column {
351
 
//                    width: root.width
352
 
//                    Repeater {
353
 
//                        id: subItemRepeater
354
 
////                        model: attributes
355
 
//                        model: subModel
356
 
////                        model: mysubmodel
357
 
//                        width: subItemsRect.width
358
 
//                        ListItem {
359
 
//                            id: subListItem
360
 
//                            width: root.width
361
 
//                            height: subItemsRect.itemHeight
362
 
////                            text: subItemTitle
363
 
//                            text: itemTitle
364
 
//                            descript: desc
365
 
//                            size_num: number
366
 
//                            checkbox_status: root.check_flag
367
 
////                            bgImage: "../../img/icons/list_subitem.png"
368
 
//                            bgImage: ""
369
 
//                            fontName: root.subItemFontName
370
 
//                            fontSize: root.subItemFontSize
371
 
//                            fontColor: root.subItemFontColor
372
 
//                            textIndent: 20
373
 
 
374
 
//                            btn_flag: root.btn_flag
375
 
 
376
 
//                            onClicked: {/*console.log(number)*/}
377
 
//                        }
378
 
 
379
 
//                    }//Repeater
380
 
//                }//Column
381
 
//            }//子项Item
382
 
//        }
383
 
//    }//Component
384
 
 
385
 
 
386
267
    Common.ScrollArea {
387
268
        frame:false
388
269
        anchors.top: titlebar.bottom
389
 
        anchors.topMargin: 30
390
 
        height: root.height -titlebar.height - 50
391
 
        width: parent.width
 
270
        anchors.topMargin: 20//30
 
271
        anchors.left:parent.left
 
272
        anchors.leftMargin: 27
 
273
        height: root.height -titlebar.height - 37//50
 
274
        width: parent.width -27 -2
392
275
        Item {
393
276
            width: parent.width
394
277
            height: (root.sub_num + 1) * 40 //450 + //this height must be higher than root.height, then the slidebar can display
398
281
                height: parent.height
399
282
                model: mainModel
400
283
                delegate: Cleardelegate{
401
 
                    sub_num:root.coo_sub_num;sub_model:subModel;btn_flag:root.btn_flag;
 
284
                    sub_num:root.coo_sub_num;sub_model:subModel;btn_flag:root.btn_flag;arrow_display:deleget_arrow;
402
285
                    delegate_flag: false
403
286
                    onSubpressed: {root.sub_num=hMark}
404
287
                    onCheckchanged: {root.check_flag=checkchange}
419
302
    states: [
420
303
        State {
421
304
            name: "CookiesWork"
422
 
             PropertyChanges { target: label; visible: true; text: "cookies扫描完成"}
423
 
             PropertyChanges { target: bitButton; /*hoverimage: "clear-start.png"*/ text:"开始清理"}
 
305
             PropertyChanges { target: bitButton; text:"开始清理"}
424
306
            PropertyChanges { target: root; btn_flag: "cookies_work" }
 
307
            PropertyChanges { target: statusImage; visible: true; iconName: "yellow.png"; text: "未完成"}
 
308
        },
 
309
        State {
 
310
            name: "CookiesWorkAGAIN"
 
311
            PropertyChanges { target: bitButton; text:"开始扫描" }
 
312
            PropertyChanges { target: root; btn_flag: "cookies_scan" }
 
313
            PropertyChanges { target: statusImage; visible: false }
 
314
        },
 
315
        State {
 
316
            name: "CookiesWorkError"
 
317
            PropertyChanges { target: bitButton; text:"开始扫描" }
 
318
            PropertyChanges { target: root; btn_flag: "cookies_scan" }
 
319
            PropertyChanges { target: statusImage; visible: true; iconName: "red.png"; text: "出现异常"}
425
320
        },
426
321
        State {
427
322
            name: "CookiesWorkFinish"
428
 
            PropertyChanges { target: label; visible: true; text: root.work_result + "清理完毕!" }
429
 
            PropertyChanges { target: bitButton; /*hoverimage: "scan-start.png"*/ text:"开始扫描"}
 
323
            PropertyChanges { target: bitButton; text:"开始扫描"}
430
324
            PropertyChanges { target: root; btn_flag: "cookies_scan" }
431
 
            PropertyChanges { target: statusImage; iconName: "green.png"; text: "已完成"}
 
325
            PropertyChanges { target: statusImage; visible: true; iconName: "green.png"; text: "已完成"}
432
326
        },
433
327
        State {
434
328
            name: "CookiesWorkEmpty"
435
 
            PropertyChanges { target: label; visible: true; text: "扫描内容为空,不再执行清理!" }
436
 
            PropertyChanges { target: bitButton; /*hoverimage: "scan-start.png"*/ text:"开始扫描"}
 
329
            PropertyChanges { target: bitButton; text:"开始扫描"}
437
330
            PropertyChanges { target: root; btn_flag: "cookies_scan" }
438
 
            PropertyChanges { target: statusImage; iconName: "green.png"; text: "已完成"}
 
331
            PropertyChanges { target: statusImage; visible: false}
439
332
        }
440
333
    ]
441
334
}