~paolorotolo/ubuntu-clock-app/fix-for-1222942

« back to all changes in this revision

Viewing changes to clock/WorldClock.qml

  • Committer: Tarmac
  • Author(s): Paolo Rotolo
  • Date: 2013-09-05 17:06:41 UTC
  • mfrom: (179.2.4 fix-for-1200410)
  • Revision ID: tarmac-20130905170641-mqo94ch5gisp70k0
Added a small pause before searching cities online (LP: #1200410). Fixes: https://bugs.launchpad.net/bugs/1200410.

Approved by Ubuntu Phone Apps Jenkins Bot, Nekhelesh Ramananthan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        height: childrenRect.height;
73
73
 
74
74
        TextField {
75
 
            id: searchLabel
76
 
 
77
 
            hasClearButton: true
78
 
            placeholderText: i18n.tr("Search");
79
 
            primaryItem: Image {
80
 
                height: parent.height/1.4
81
 
                width: parent.height/1.45
82
 
                source: Qt.resolvedUrl("../images/search_icon.png")
83
 
            }
84
 
 
85
 
            onTextChanged: {
86
 
                if (searchLabel.text != "") {
87
 
                    search_string = searchLabel.text;
88
 
                    searchCityModel.source = searchCityUrl(search_string);
89
 
                } else {
90
 
                    searchCityModel.source = localCityUrl()
 
75
                    id: searchLabel
 
76
 
 
77
                    hasClearButton: true
 
78
                    placeholderText: i18n.tr("Search");
 
79
                    primaryItem: Image {
 
80
                        height: parent.height/1.4
 
81
                        width: parent.height/1.45
 
82
                        source: Qt.resolvedUrl("../images/search_icon.png")
 
83
                    }
 
84
 
 
85
                    // Provide a small pause before going online to search
 
86
                    Timer {
 
87
                        id: search_timer
 
88
 
 
89
                        interval: 1100
 
90
                        repeat: false
 
91
                        onTriggered: {
 
92
                            if (searchLabel.text != "") {
 
93
                                search_string = searchLabel.text;
 
94
                                searchCityModel.source = searchCityUrl(search_string);
 
95
                            } else {
 
96
                                searchCityModel.source = localCityUrl()
 
97
                            }
 
98
                        }
 
99
                    }
 
100
 
 
101
                    onTextChanged: {
 
102
                        search_timer.restart()
 
103
                    }
91
104
                }
92
 
            }
93
 
        }
94
105
 
95
106
        Button {
96
107
            id: searchButton;