v0.6.4 contact search
This commit is contained in:
parent
66e5c33b00
commit
5032c78de1
57 changed files with 2218 additions and 2252 deletions
|
@ -31,11 +31,12 @@
|
|||
|
||||
import QtQuick 2.11
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Layouts 1.11
|
||||
import QtQuick.LocalStorage 2.0
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
//import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/qml/contactqml"
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
@ -44,14 +45,16 @@ Item{
|
|||
Layout.fillWidth:true
|
||||
Layout.fillHeight: true
|
||||
function showContacts(contact){
|
||||
try {contactsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
try {contactsModel.clear()} catch(e){};
|
||||
Newsjs.listFriends(login,db,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
contactsobject[j].name=Qt.atob(contactsobject[j].name);
|
||||
if(Helperjs.getCount(db,login,"contacts","screen_name",contactsobject[j].screen_name)>1){
|
||||
contactsobject[j].screen_name=contactsobject[j].screen_name+"+"+contactsobject[j].cid
|
||||
}
|
||||
contactsModel.append({"contact":contactsobject[j]});
|
||||
}
|
||||
},"isFriend",0,"screen_name ASC");
|
||||
},searchText.text,-1);
|
||||
}
|
||||
MButton {
|
||||
id: cleanButton
|
||||
|
@ -61,17 +64,40 @@ Item{
|
|||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
Service.cleanContacts(root.login,root.db,function(){
|
||||
try {contactsModel.clear()} catch(e){print(e)};
|
||||
Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
for (var j=0;j<contactsobject.length;j++){
|
||||
contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
contactsobject[j].name=Qt.atob(contactsobject[j].name);
|
||||
contactsModel.append({"contact":contactsobject[j]});
|
||||
}
|
||||
},"isFriend",0,"screen_name ASC");
|
||||
showContacts()
|
||||
// try {contactsModel.clear()} catch(e){print(e)};
|
||||
// Helperjs.readData(db, "contacts",root.login.username,function(contactsobject){
|
||||
// for (var j=0;j<contactsobject.length;j++){
|
||||
// contactsobject[j].description=Qt.atob(contactsobject[j].description);
|
||||
// contactsobject[j].name=Qt.atob(contactsobject[j].name);
|
||||
// contactsModel.append({"contact":contactsobject[j]});
|
||||
// }
|
||||
// },"isFriend",0,"screen_name ASC");
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id:searchComponent
|
||||
x: mm; y:mm
|
||||
color: Material.backgroundColor
|
||||
radius:0.5*mm
|
||||
width: 10*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
TextField {
|
||||
id: searchText
|
||||
color: Material.primaryTextColor
|
||||
focus: true
|
||||
font.pointSize: osSettings.systemFontSize
|
||||
wrapMode: Text.Wrap
|
||||
anchors.fill:parent
|
||||
selectByMouse: true
|
||||
cursorVisible: false
|
||||
placeholderText: "\uf0b0"
|
||||
onTextChanged: {showContacts(root.login.username)}
|
||||
}
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: contactsView
|
||||
x:mm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue