X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=qml%2FMainPage.qml;h=a14e48db09c9161f201f0aa1dadfeecf2474d1fc;hb=e069deef85dd16cf7070b5f1d7272a867a2a7fb3;hp=8a6c4cc0a2a4ac87ad8f5b14e2b947ac26d8b8b5;hpb=16db513655f93766af3dd18054d04ca5f4248e99;p=pywienerlinien diff --git a/qml/MainPage.qml b/qml/MainPage.qml index 8a6c4cc..a14e48d 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -44,32 +44,6 @@ Page { } SelectionDialog { - id: lineSelector - titleText: 'Select line' - - model: ListModel { - id: lineSelectorModel - - Component.onCompleted: { - var lines = itip.get_lines() - - for (var idx in lines) { - lineSelectorModel.append({'name': lines[idx]}) - } - } - } - - // XXX It would be nice if we could make a delegate with - // icons (i.e. U1, U2, ... in the right colors), but we - // would have to "copy" the default delegate style - - onAccepted: { - console.log('accepted: ' + selectedIndex) - gline.text = lineSelectorModel.get(selectedIndex).name - } - } - - SelectionDialog { id: stationSelector titleText: 'Select nearby station' @@ -102,19 +76,7 @@ Page { } onTextChanged: { - // TODO: Check if text matches an item in lineSelectorModel and - // set selectedIndex in lineSelector to the right item gstation.text = '' - - if (lineSelector.selectedIndex === -1) { - text = text.toUpperCase() - return - } - - // Disable selection in line selector if user changes the text - if (lineSelectorModel.get(lineSelector.selectedIndex).name !== text) { - lineSelector.selectedIndex = -1 - } } MouseArea { @@ -126,10 +88,15 @@ Page { } } - /* LineSheet { id: lineSheet - }*/ + onAccepted: { + gline.text = currentLine + + /* We usually want to select a station after selecting a line */ + stationPickerButton.clicked() + } + } Button { id: lineSearchButton @@ -144,7 +111,10 @@ Page { width: 60 iconSource: 'image://theme/icon-m-common-search' - onClicked: lineSelector.open() + onClicked: { + lineSheet.currentLine = '' + lineSheet.open() + } } TextField {