2 * Copyright (C) 2011 Lukáš Karas <lukas.karas@centrum.cz>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 import org.makneto 0.1 as Makneto
28 property variant _model: ListModel {}
32 console.log("II [ContatListPanel.qml]: "+msg);
35 console.log("EE [ContatListPanel.qml]: "+msg);
38 console.log("WW [ContatListPanel.qml]: "+msg);
40 function onContactsModelChanged(model){
43 function changeTextFilter(text){
44 //log("contact filter: "+text);
45 backGroundText.text = (text.length > 0)?"": backGroundText.defaultText;
46 _model.contactStringFilter = text;
47 // TODO: return filtered contacts as array
51 Component.onCompleted: {
52 //main.addContactsModelListener( contactListPanel );
53 main.contactsModelChanged.connect(onContactsModelChanged);
56 SystemPalette{ id: syspal }
60 anchors{top: parent.top; left: parent.left; right: parent.right}
66 BorderImage { source: "img/lineedit.sci"; anchors.fill: parent; opacity: .5 }
68 anchors.top: parent.top
69 anchors.right: parent.right;
70 anchors.bottom: parent.bottom
71 anchors.left: filterText.right
72 anchors.leftMargin: 20
74 anchors.bottomMargin: 5
81 anchors{ verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter}
82 width: (parent.width * 0.3)
83 height: (parent.height - 10)
84 BorderImage { source: "img/lineedit.sci"; anchors.fill: parent }
90 left: parent.left; right: parent.right; leftMargin: 10; rightMargin: 10
91 verticalCenter: parent.verticalCenter
93 cursorVisible: true; font.bold: true
94 color: main.useSyspal? syspal.windowText :"white"
95 selectionColor: "gray"
98 var items = changeTextFilter(editor.text);
99 if (items.length == 1 && contactsFlickable.interactive && event.key == Qt.Key_Return){
100 log("show enter contact details ");
101 //items[0].component.state = "detail"
107 Keys.forwardTo: [ (editor)]
112 property string defaultText: "Search contact..."
114 color: main.useSyspal? syspal.highlightedText :"white"
115 anchors{verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 10}
119 style: Text.Raised; styleColor: main.useSyspal? syspal.highlightedText :"white"
126 //border{ color: "white"; width: 1 }
127 width: showOfflineCheckBox.width + checkBoxText.width + 10
130 anchors.verticalCenter: filterText.verticalCenter
131 anchors.left: parent.left
132 anchors.leftMargin: 10
135 id: showOfflineCheckBox
136 height: parent.height
139 anchors.left: parent.left
140 onCheckedChanged: (contactListPanel._model.hideOffline !== undefined)? contactListPanel._model.hideOffline = !checked: 0
144 text: "Show offline contacts"
145 anchors.right: parent.right
146 anchors.verticalCenter: parent.verticalCenter
147 color: main.useSyspal? syspal.highlightedText :"white"
151 onClicked: showOfflineCheckBox.checked = !showOfflineCheckBox.checked