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

« back to all changes in this revision

Viewing changes to qml/func/cleaner/CookiesModel.qml

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2014-03-24 15:52:37 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140324155237-3kod0m3wr2a2ag39
Tags: 1.0.1-0ubuntu1
* New upstream release (LP: #1294936).
* Modify display mode of weather forecast and system settings.
* Add file manager and font style settings.
* Improve system settings and restoring default settings.
* Cache user account (not password).
* Change the position of window control buttons.
* Add configuration for Kingsoft KuaiPan cloud client.
* Add the instruction of Youker Assistant.
* Open related folders when scanning items got double-clicked.
* Notify users when operating the Kingsoft disk cloud configuration.
* Modify Dbus starting method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
    property bool chromium_reset: false//chromium重置按钮默认隐藏
48
48
    property string firefox_btn_flag: "cookies_scan"//扫描或者清理的标记
49
49
    property string chromium_btn_flag: "cookies_scanc"//扫描或者清理的标记
 
50
    property int item_height: 30
50
51
 
51
52
    Connections
52
53
    {
54
55
        onAppendCookiesContentToModel: {
55
56
            //QString flag, QString domain, QString num
56
57
            if(flag == "firefox") {
57
 
                firefoxsubModel.append({"itemTitle": domain, "desc": "", "number": num});
 
58
                firefoxsubModel.append({"itemTitle": domain, "desc": "", "number": num, "index": root.firefoxNum});
58
59
                root.firefoxNum += 1;
59
60
            }
60
61
            else if(flag == "chromium") {
61
 
                chromiumsubModel.append({"itemTitle": domain, "desc": "", "number": num});
 
62
                chromiumsubModel.append({"itemTitle": domain, "desc": "", "number": num, "index": root.chromiumNum});
62
63
                root.chromiumNum += 1;
63
64
            }
64
65
        }
100
101
                        root.firefox_btn_text = qsTr("Start scanning")//开始扫描//1206
101
102
                        root.firefox_reset = false;//1206
102
103
                        if(root.chromium_expanded) {
103
 
                            scrollItem.height = 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
104
                            scrollItem.height = root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
104
105
                        }
105
106
                        else {
106
 
                            scrollItem.height = 2 * 40 + root.spaceValue*2;
 
107
                            scrollItem.height = 2 * root.item_height + root.spaceValue*4;
107
108
                        }
108
109
                    }
109
110
                    else if(root.firefoxResultFlag == true) {
122
123
                        root.firefox_btn_text = qsTr("All cleanup");//全部清理//1206
123
124
                        root.firefox_reset = true;//1206
124
125
                        if(root.chromium_expanded) {
125
 
                            scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
126
                            scrollItem.height = (root.firefoxNum + 1) * root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
126
127
                        }
127
128
                        else {
128
 
                            scrollItem.height = (root.firefoxNum + 1) * 40 + 40 + root.spaceValue*2;
 
129
                            scrollItem.height = (root.firefoxNum + 1) * root.item_height + root.item_height + root.spaceValue*4;
129
130
                        }
130
131
                    }
131
132
                }
159
160
                        root.chromium_btn_text = qsTr("Start scanning")//开始扫描
160
161
                        root.chromium_reset = false;//1206
161
162
                        if(root.firefox_expanded) {
162
 
                            scrollItem.height = 40 + (root.firefoxNum + 1) * 40 + root.spaceValue*2;
 
163
                            scrollItem.height = root.item_height + (root.firefoxNum + 1) * root.item_height + root.spaceValue*4;
163
164
                        }
164
165
                        else {
165
 
                            scrollItem.height = 2 * 40 + root.spaceValue*2;
 
166
                            scrollItem.height = 2 * root.item_height + root.spaceValue*4;
166
167
                        }
167
168
                    }
168
169
                    else if(root.chromiumResultFlag == true) {
181
182
                        root.chromium_btn_text = qsTr("All cleanup");//全部清理
182
183
                        root.chromium_reset = true;//1206
183
184
                        if(root.firefox_expanded) {
184
 
                            scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
185
                            scrollItem.height = (root.firefoxNum + 1) * root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
185
186
                        }
186
187
                        else {
187
 
                            scrollItem.height = (root.chromiumNum + 1) * 40 + 40 + root.spaceValue*2;
 
188
                            scrollItem.height = (root.chromiumNum + 1) * root.item_height + root.item_height + root.spaceValue*4;
188
189
                        }
189
190
                    }
190
191
                }
193
194
    }
194
195
 
195
196
 
196
 
 
197
197
    Component.onCompleted: {
198
198
        //清理 Firefox 保存的 Cookies                清理 Firefox 浏览器自动保存的登录信息 (Cookies)
199
199
        firefoxmainModel.append({
207
207
//                         "detailstr": qsTr("Clean up automatically saved logon information by Chromium browser(Cookies)")})
208
208
    }
209
209
 
210
 
//    //获取firefox的cookies
211
 
//    function getDataOfFirefox() {
212
 
//        var cookies_data = sessiondispatcher.cookies_scan_function_qt("firefox");
213
 
//        if(cookies_data == "None") {//没有安装Firefox
214
 
//            //友情提示
215
 
//            sessiondispatcher.showWarningDialog(qsTr("Tips:"), qsTr("No Firefox browser installed!"), mainwindow.pos.x, mainwindow.pos.y);
216
 
//        }
217
 
//        else {
218
 
//            if (cookies_data.length == 0) {
219
 
//                root.firefoxResultFlag = false;//扫描内容不存在
220
 
//            }
221
 
//            else {
222
 
//                root.firefoxNum = cookies_data.length;//001
223
 
////                systemdispatcher.clear_cookies_args();
224
 
//                firefoxsubModel.clear();
225
 
//                var num = 0;
226
 
//                for (var i=0; i< cookies_data.length; i++) {
227
 
//                //sina.com.cn<2_2>10
228
 
//                    var splitlist = cookies_data[i].split("<2_2>");
229
 
//                    if (splitlist[0] == "") {
230
 
//                        num++;
231
 
//                    }
232
 
//                    else {
233
 
//                        firefoxsubModel.append({"itemTitle": splitlist[0], "desc": "","number": splitlist[1]});
234
 
////                        systemdispatcher.set_cookies_args(splitlist[0]);
235
 
//                    }
236
 
//                }
237
 
//                root.firefoxNum -= num;//001
238
 
//                console.log("firefoxNum:");
239
 
//                console.log(root.firefoxNum);
240
 
//                if(root.firefoxNum != 0) {
241
 
//                    root.firefoxResultFlag = true;//扫描的实际有效内容存在
242
 
//                    firefoxmainModel.clear();
243
 
//                    firefoxmainModel.append({
244
 
//                                     "itemTitle": qsTr("Clean Firefox's Cookies"),
245
 
//                                     "picture": "../../img/toolWidget/firefox.png",
246
 
//                                     "detailstr": qsTr("Clean up automatically saved logon information by Firefox browser(Cookies)")})
247
 
//                }
248
 
//                else {
249
 
//                    root.firefoxResultFlag = false;//扫描的实际有效内容不存在
250
 
//                }
251
 
//            }
252
 
//            if(root.firefoxResultFlag == false) {
253
 
//                root.firefox_expanded = false;//伸缩箭头不扩展
254
 
//                root.firefox_arrow_show = 0;//伸缩箭头不显示
255
 
//                root.firefox_showNum = false;
256
 
//                if(root.flag == false) {//点击扫描时的获取数据,此时显示该对话框
257
 
//                    //友情提示:      扫描内容为空,不再执行清理!
258
 
//                    sessiondispatcher.showWarningDialog(qsTr("Tips:"), qsTr("Scanning content is empty, no longer to perform cleanup!"), mainwindow.pos.x, mainwindow.pos.y);
259
 
//                }
260
 
//                else {//清理apt后的重新获取数据,此时不需要显示对话框
261
 
//                    root.flag = false;
262
 
//                }
263
 
//                root.firefox_btn_flag = "cookies_scan";//1206
264
 
//                root.firefox_btn_text = qsTr("Start scanning")//开始扫描//1206
265
 
//                root.firefox_reset = false;//1206
266
 
//                if(root.chromium_expanded) {
267
 
//                    scrollItem.height = 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
268
 
//                }
269
 
//                else {
270
 
//                    scrollItem.height = 2 * 40 + root.spaceValue*2;
271
 
//                }
272
 
//            }
273
 
//            else if(root.firefoxResultFlag == true) {
274
 
//                root.firefox_expanded = true;//伸缩箭头扩展
275
 
//                root.firefox_arrow_show = 1;//伸缩箭头显示
276
 
//                root.firefox_showNum = true;
277
 
//                if(root.flag == false) {//点击扫描时的获取数据,此时显示该对话框
278
 
//                    toolkits.alertMSG(qsTr("Scan completed!"), mainwindow.pos.x, mainwindow.pos.y);//扫描完成!
279
 
//                }
280
 
//                else {//清理software后的重新获取数据,此时不需要显示对话框
281
 
//                    root.flag = false;
282
 
//                }
283
 
 
284
 
//                //当真正扫描到内容时:按钮状态改变、显示文字改变、重置按钮显示
285
 
//                root.firefox_btn_flag = "cookies_work";//1206
286
 
//                root.firefox_btn_text = qsTr("All clean");//全部清理//1206
287
 
//                root.firefox_reset = true;//1206
288
 
//                if(root.chromium_expanded) {
289
 
//                    scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
290
 
//                }
291
 
//                else {
292
 
//                    scrollItem.height = (root.firefoxNum + 1) * 40 + 40 + root.spaceValue*2;
293
 
//                }
294
 
//            }
295
 
//        }
296
 
//    }
297
 
 
298
 
//    //获取chromium的cookies
299
 
//    function getDataOfChromium() {
300
 
//        var cookies_data = sessiondispatcher.cookies_scan_function_qt("chromium");
301
 
//        if(cookies_data == "None") {//没有安装Chromium
302
 
//            //友情提示
303
 
//            sessiondispatcher.showWarningDialog(qsTr("Tips:"), qsTr("No Chromium browser installed!"), mainwindow.pos.x, mainwindow.pos.y);
304
 
//        }
305
 
//        else {
306
 
//            root.chromiumNum = cookies_data.length;//001
307
 
////            systemdispatcher.clear_chromium_cookies_args();
308
 
//            chromiumsubModel.clear();
309
 
//            var num = 0;
310
 
//            for (var i=0; i< cookies_data.length; i++) {
311
 
//            //  /home/kobe/.cache/software-center/piston-helper<2_2>3026257
312
 
//                var splitlist = cookies_data[i].split("<2_2>");
313
 
//                if (splitlist[0] == "") {
314
 
//                    num++;
315
 
//                }
316
 
//                else {
317
 
//                    chromiumsubModel.append({"itemTitle": splitlist[0], "desc": "","number": splitlist[1]});
318
 
////                    systemdispatcher.set_chromium_cookies_args(splitlist[0]);
319
 
//                }
320
 
//            }
321
 
//            root.chromiumNum -= num;//001
322
 
//            console.log("chromiumNum:");
323
 
//            console.log(root.chromiumNum);
324
 
//            if(root.chromiumNum != 0) {
325
 
//                root.chromiumResultFlag = true;//扫描的实际有效内容存在
326
 
//                chromiummainModel.clear();
327
 
//                chromiummainModel.append({
328
 
//                                 "itemTitle": qsTr("Clean Chromium's Cookies"),
329
 
//                                 "picture": "../../img/toolWidget/chromium.png",
330
 
//                                 "detailstr": qsTr("Clean up automatically saved logon information by Chromium browser(Cookies)")})
331
 
//                }
332
 
//            else {
333
 
//                root.chromiumResultFlag = false;//扫描的实际有效内容不存在
334
 
//            }
335
 
//        }
336
 
//        if(root.chromiumResultFlag == false) {
337
 
//            root.chromium_expanded = false;//伸缩箭头不扩展
338
 
//            root.chromium_arrow_show = 0;//伸缩箭头不显示
339
 
//            root.chromium_showNum = false;
340
 
 
341
 
//            if(root.flag == false) {//点击扫描时的获取数据,此时显示该对话框
342
 
//                //友情提示:      扫描内容为空,不再执行清理!
343
 
//                sessiondispatcher.showWarningDialog(qsTr("Tips:"), qsTr("Scanning content is empty, no longer to perform cleanup!"), mainwindow.pos.x, mainwindow.pos.y);
344
 
//            }
345
 
//            else {//清理apt后的重新获取数据,此时不需要显示对话框
346
 
//                root.flag = false;
347
 
//            }
348
 
 
349
 
//            root.chromium_btn_flag = "cookies_scanc";//1206
350
 
//            root.chromium_btn_text = qsTr("Start scanning")//开始扫描//1206
351
 
//            root.chromium_reset = false;//1206
352
 
//            if(root.firefox_expanded) {
353
 
//                scrollItem.height = 40 + (root.firefoxNum + 1) * 40 + root.spaceValue*2;
354
 
//            }
355
 
//            else {
356
 
//                scrollItem.height = 2 * 40 + root.spaceValue*2;
357
 
//            }
358
 
//        }
359
 
//        else if(root.chromiumResultFlag == true) {
360
 
//            root.chromium_expanded = true;//伸缩箭头扩展
361
 
//            root.chromium_arrow_show = 1;//伸缩箭头显示
362
 
//            root.chromium_showNum = true;
363
 
 
364
 
//            if(root.flag == false) {//点击扫描时的获取数据,此时显示该对话框
365
 
//                toolkits.alertMSG(qsTr("Scan completed!"), mainwindow.pos.x, mainwindow.pos.y);//扫描完成!
366
 
//            }
367
 
//            else {//清理software后的重新获取数据,此时不需要显示对话框
368
 
//                root.flag = false;
369
 
//            }
370
 
 
371
 
//            //当真正扫描到内容时:按钮状态改变、显示文字改变、重置按钮显示
372
 
//            root.chromium_btn_flag = "cookies_workc";//1206
373
 
//            root.chromium_btn_text = qsTr("All clean");//全部清理//1206
374
 
//            root.chromium_reset = true;//1206
375
 
//            if(root.firefox_expanded) {
376
 
//                scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
377
 
//            }
378
 
//            else {
379
 
//                scrollItem.height = (root.chromiumNum + 1) * 40 + 40 + root.spaceValue*2;
380
 
//            }
381
 
//        }
382
 
//    }
383
 
 
384
210
    //信号绑定,绑定qt的信号finishCleanWork,该信号emit时触发onFinishCleanWork
385
211
    Connections
386
212
    {
426
252
                    root.firefox_reset = false;//1206
427
253
                    root.firefoxNum = 0;//隐藏滑动条
428
254
                    if(root.chromium_expanded) {
429
 
                        scrollItem.height = 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
255
                        scrollItem.height = root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
430
256
                    }
431
257
                    else {
432
 
                        scrollItem.height = 2 * 40 + root.spaceValue*2;
 
258
                        scrollItem.height = 2 * root.item_height + root.spaceValue*4;
433
259
                    }
434
260
                    toolkits.alertMSG(qsTr("Cleared"), mainwindow.pos.x, mainwindow.pos.y);//清理完毕!
435
261
                }
436
262
            }
437
263
            else if (msg == "chromium") {
438
264
                if (root.chromium_btn_flag == "cookies_workc") {
439
 
//                    systemdispatcher.clear_chromium_cookies_args();
440
265
                    chromiumsubModel.clear();//内容清空
441
266
                    chromiummainModel.clear();
442
267
                    //清理 Chromium 保存的 Cookies             清理 Chromium 浏览器自动保存的登录信息 (Cookies)
452
277
                    root.chromium_reset = false;//1206
453
278
                    root.chromiumNum = 0;//隐藏滑动条
454
279
                    if(root.firefox_expanded) {
455
 
                        scrollItem.height = 40 + (root.firefoxNum + 1) * 40 + root.spaceValue*2;
 
280
                        scrollItem.height = root.item_height + (root.firefoxNum + 1) * root.item_height + root.spaceValue*4;
456
281
                    }
457
282
                    else {
458
 
                        scrollItem.height = 2 * 40 + root.spaceValue*2;
 
283
                        scrollItem.height = 2 * root.item_height + root.spaceValue*4;
459
284
                    }
460
285
                    toolkits.alertMSG(qsTr("Cleared"), mainwindow.pos.x, mainwindow.pos.y);//清理完毕!
461
286
                }
518
343
        anchors.top: titlebar.bottom
519
344
        anchors.topMargin: 30
520
345
        anchors.left:parent.left
521
 
        anchors.leftMargin: 27
 
346
//        anchors.leftMargin: 27
522
347
        height: root.height -titlebar.height - 47
523
 
        width: parent.width - 27 -2
 
348
        width: parent.width -2//parent.width - 27 -2
524
349
        Item {
525
350
            id: scrollItem
526
351
            width: parent.width
527
 
            height: 40*2 + root.spaceValue*2
 
352
            height: root.item_height*2 + root.spaceValue*2*2
528
353
            Column {
529
 
                spacing: root.spaceValue
 
354
                spacing: root.spaceValue*2
530
355
                //垃圾清理显示内容
531
356
                ListView {
532
357
                    id: aptListView
533
358
                    width: parent.width
534
 
                    height: root.firefox_expanded ? (root.firefoxNum + 1) * 40 : 40
 
359
                    height: root.firefox_expanded ? (root.firefoxNum + 1) * root.item_height : root.item_height
535
360
                    model: firefoxmainModel
536
361
                    delegate: CookiesDelegate{
537
362
                        sub_num: root.firefoxNum
558
383
                                    root.firefox_arrow_show = 0;//2、然后传递给CookiesDelegate.qml去隐藏伸展按钮
559
384
                                    root.firefox_showNum = false;//隐藏扫描的数目
560
385
                                    if(root.chromium_expanded) {
561
 
                                        scrollItem.height = 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
386
                                        scrollItem.height = root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
562
387
                                    }
563
388
                                    else {
564
 
                                        scrollItem.height = 2 * 40 + root.spaceValue*2;
 
389
                                        scrollItem.height = 2 * root.item_height + root.spaceValue*4;
565
390
                                    }
566
391
                                }
567
392
                                else if(status == "rescan") {//点击重新扫描按钮
624
449
                                if(expand_flag == true) {
625
450
                                    root.firefox_expanded = true;
626
451
                                    if(root.chromium_expanded == true) {
627
 
                                        scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
452
                                        scrollItem.height = (root.firefoxNum + 1) * root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
628
453
                                    }
629
454
                                    else {
630
 
                                        scrollItem.height = (root.firefoxNum + 2) * 40 + root.spaceValue*2;
 
455
                                        scrollItem.height = (root.firefoxNum + 2) * root.item_height + root.spaceValue*4;
631
456
                                    }
632
457
                                }
633
458
                                else {
634
459
                                    root.firefox_expanded = false;
635
460
                                    if(root.chromium_expanded == true) {
636
 
                                        scrollItem.height = (root.chromiumNum + 2) * 40 + root.spaceValue*2;
 
461
                                        scrollItem.height = (root.chromiumNum + 2) * root.item_height + root.spaceValue*4;
637
462
                                    }
638
463
                                    else {
639
 
                                        scrollItem.height = 2* 40 + root.spaceValue*2;
 
464
                                        scrollItem.height = 2* root.item_height + root.spaceValue*4;
640
465
                                    }
641
466
                                }
642
467
                            }
644
469
                    }
645
470
                    cacheBuffer: 1000
646
471
                    opacity: 1
647
 
                    spacing: 10
 
472
//                    spacing: 10
648
473
                    snapMode: ListView.NoSnap
649
474
                    boundsBehavior: Flickable.DragOverBounds
650
475
                    currentIndex: 0
656
481
                ListView {
657
482
                    id: softListView
658
483
                    width: parent.width
659
 
                    height: root.chromium_expanded ? (root.chromiumNum + 1) * 40 : 40
 
484
                    height: root.chromium_expanded ? (root.chromiumNum + 1) * root.item_height : root.item_height
660
485
                    model: chromiummainModel
661
486
                    delegate: CookiesDelegate{
662
487
                        sub_num: root.chromiumNum
683
508
                                    root.chromium_arrow_show = 0;//2、然后传递给CookiesDelegate.qml去隐藏伸展按钮
684
509
                                    root.chromium_showNum = false;//隐藏扫描的数目
685
510
                                    if(root.firefox_expanded) {
686
 
                                        scrollItem.height = 40 + (root.firefoxNum + 1) * 40 + root.spaceValue*2;
 
511
                                        scrollItem.height = root.item_height + (root.firefoxNum + 1) * root.item_height + root.spaceValue*4;
687
512
                                    }
688
513
                                    else {
689
 
                                        scrollItem.height = 2 * 40 + root.spaceValue*2;
 
514
                                        scrollItem.height = 2 * root.item_height + root.spaceValue*4;
690
515
                                    }
691
516
                                }
692
517
                                else if(status == "rescan") {
749
574
                                if(expand_flag == true) {
750
575
                                    root.chromium_expanded = true;
751
576
                                    if(root.firefox_expanded == true) {
752
 
                                        scrollItem.height = (root.firefoxNum + 1) * 40 + (root.chromiumNum + 1) * 40 + root.spaceValue*2;
 
577
                                        scrollItem.height = (root.firefoxNum + 1) * root.item_height + (root.chromiumNum + 1) * root.item_height + root.spaceValue*4;
753
578
                                    }
754
579
                                    else {
755
 
                                        scrollItem.height = (root.chromiumNum + 2) * 40 + root.spaceValue*2;
 
580
                                        scrollItem.height = (root.chromiumNum + 2) * root.item_height + root.spaceValue*4;
756
581
                                    }
757
582
                                }
758
583
                                else {
759
584
                                    root.chromium_expanded = false;
760
585
                                    if(root.firefox_expanded == true) {
761
 
                                        scrollItem.height = (root.firefoxNum + 2) * 40 + root.spaceValue*2;
 
586
                                        scrollItem.height = (root.firefoxNum + 2) * root.item_height + root.spaceValue*4;
762
587
                                    }
763
588
                                    else {
764
 
                                        scrollItem.height = 2* 40 + root.spaceValue*2;
 
589
                                        scrollItem.height = 2* root.item_height + root.spaceValue*4;
765
590
                                    }
766
591
                                }
767
592
                            }
769
594
                    }
770
595
                    cacheBuffer: 1000
771
596
                    opacity: 1
772
 
                    spacing: 10
 
597
//                    spacing: 10
773
598
                    snapMode: ListView.NoSnap
774
599
                    boundsBehavior: Flickable.DragOverBounds
775
600
                    currentIndex: 0