2 import org.kde.people 1.0
3 import org.kde.plasma.components 2.0
4 import org.kde.plasma.core 2.0 as Core
5 import org.kde.plasma.extras 2.0
6 import org.kde.kquickcontrolsaddons 2.0
13 Core.SortFilterModel {
16 sortCaseSensitivity: Qt.CaseInsensitive
17 sourceModel: PersonsModel {
20 filterRegExp: searchField.text
30 onCheckedChanged: toMergeItems.clear()
37 left: areWeMerging.right
38 right: mergeLabel.left
51 function uriIndex(uri) {
53 for(var i=0; i<count && ret<0; ++i) {
60 function addUri(uri, name) {
62 toMergeItems.append({ "uri": uri, "name": name })
67 for(var i=0; i<count; ++i) {
70 return people.indexesForUris(ret)
73 function removeUri(uri) {
83 top: searchField.bottom
86 right: contactItem.left
94 height: view.cellHeight
95 width: view.cellWidth-5
103 height: parent.height
105 wrapMode: Text.WrapAnywhere
106 visible: avatar.status!=Image.Ready
110 contactItem.contactData = model
111 personActions.personUri = model.personUri
112 if(areWeMerging.checked)
113 toMergeItems.addUri(model.personUri, model.display)
123 bottom: parent.bottom
125 width: parent.width/2
126 property variant contactData
132 visible: toMergeItems.count>0
133 Label { text: "To Merge:" }
136 delegate: Label { text: name + " - " + uri }
141 people.createPersonFromIndexes(toMergeItems.indexes())
150 text: dataToString(contactItem.contactData)
152 function dataToString(data) {
156 else for(var a in data) {
174 model: PersonActions {
179 iconSource: model.decoration
180 onClicked: personActions.triggerAction(model.index)
185 Rectangle { color: "green"; width: parent.width; height: 5 }
188 model: contactItem.contactData ? contactItem.contactData.photo : null
194 Rectangle { color: "blue"; width: parent.width; height: 5}
197 visible: contactItem.contactData!=null && contactItem.contactData.contactsCount>1
199 dialogLoader.sourceComponent = unmergeDialogComponent
200 dialogLoader.item.open()
210 id: unmergeDialogComponent
213 property string name: contactItem.contactData.name
214 property int index: filteredPeople.mapRowToSource(contactItem.contactData.index)
215 property url uri: contactItem.contactData.uri
217 buttonTexts: ["Unmerge", "Cancel"]
218 titleText: i18n("Unmerging %1", unmergeDialog.name)
224 model: ColumnProxyModel {
225 rootIndex: indexFromModel(people, unmergeDialog.index)
228 property alias checked: willUnmerge.checked
229 property string contactUri: uri
231 onClicked: willUnmerge.checked=!willUnmerge.checked
234 CheckBox { id: willUnmerge }
235 Label { text: display+" - "+contactUri }
240 onButtonClicked: if(index==0) {
241 for(var i=0; i<unmergesView.count; ++i) {
242 var item = unmergesView.itemAt(i)
244 people.unmerge(item.contactUri, uri)