forked from lubuwest/Friendiqa
v0.6.4 contact search
This commit is contained in:
parent
66e5c33b00
commit
5032c78de1
57 changed files with 2218 additions and 2252 deletions
|
@ -34,7 +34,6 @@
|
|||
import QtQuick 2.4
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
//import QtQuick.Dialogs 1.2
|
||||
import "qrc:/js/helper.js" as Helperjs
|
||||
import "qrc:/js/smiley.js" as Smileyjs
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
|
@ -42,19 +41,17 @@ import "qrc:/qml/genericqml"
|
|||
|
||||
|
||||
Rectangle{
|
||||
color:Material.dialogColor//"#EEEEEE"
|
||||
color:Material.dialogColor
|
||||
width:parent.width
|
||||
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+mm:0
|
||||
height: conversation || (newsSwipeview.stacktype!="Notifications")?messageColumn.height+2*mm:0
|
||||
id:messageSend
|
||||
visible:conversation || (newsSwipeview.stacktype!="Notifications")||(newstab.newstabstatus!="Search")?true:false
|
||||
property string parentId: ""
|
||||
property bool textfocus: false
|
||||
//property var parentObject:({})
|
||||
property bool conversation: false
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
property var attachImageURLs: [];
|
||||
//property int directmessage: 0;
|
||||
property var contacts: []
|
||||
property var groups: []
|
||||
property var contact_allow:login.hasOwnProperty("permissions")?login.permissions[0]:[]
|
||||
|
@ -130,13 +127,12 @@ Rectangle{
|
|||
}
|
||||
|
||||
function setParent(newsitemobject){
|
||||
//print("Newsobject "+newsitemobject.id+ " "+JSON.stringify(newsitemobject.user));
|
||||
if (newsitemobject!=""){
|
||||
messageSend.state="conversation"
|
||||
messageSend.reply_to_user=newsitemobject.user.screen_name;
|
||||
messageSend.parentId=newsitemobject.id
|
||||
} else {
|
||||
//messageSend.state=null;
|
||||
messageSend.state=null;
|
||||
messageSend.reply_to_user="";
|
||||
messageSend.parentId="";
|
||||
bodyField.text="";
|
||||
|
@ -145,7 +141,7 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
|
||||
function contactmenu(letter){//print("letter "+letter)
|
||||
function contactmenu(letter){
|
||||
Newsjs.listFriends(login,db,function(contacts){
|
||||
contactModel.clear();
|
||||
for (var i=0;i<contacts.length;i++){
|
||||
|
@ -158,7 +154,7 @@ Rectangle{
|
|||
},letter);
|
||||
}
|
||||
|
||||
function hashtagmenu(){//print("letter "+letter)
|
||||
function hashtagmenu(){
|
||||
Newsjs.listHashtags(login,db,function(tags){
|
||||
tagModel.clear();
|
||||
for (var i=0;i<tags.length;i++){
|
||||
|
@ -191,7 +187,7 @@ Rectangle{
|
|||
id:messageColumn
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
height: 11*mm+stackTypeDescription.height//implicitHeight
|
||||
height: 2.6*root.fontFactor*osSettings.bigFontSize+stackTypeDescription.height
|
||||
Label{id:stackTypeDescription
|
||||
width: parent.width
|
||||
horizontalAlignment:Text.AlignHCenter
|
||||
|
@ -200,7 +196,7 @@ Rectangle{
|
|||
}
|
||||
TextArea{
|
||||
id:receiverLabel
|
||||
width: messageColumn.width//-8*mm
|
||||
width: messageColumn.width
|
||||
font.pointSize: osSettings.bigFontSize
|
||||
placeholderText:qsTr("to:")
|
||||
text: ""
|
||||
|
@ -222,11 +218,12 @@ Rectangle{
|
|||
}
|
||||
|
||||
Rectangle{
|
||||
color: Material.backgroundColor//"white"
|
||||
color: Material.backgroundColor
|
||||
radius: 0.5*mm
|
||||
visible:(newsSwipeview.stacktype!="Notifications")
|
||||
x:mm
|
||||
width: parent.width-2*mm
|
||||
height:Math.max(bodyField.contentHeight+4*mm,10*mm)
|
||||
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
|
||||
|
||||
TextArea {
|
||||
id: bodyField
|
||||
|
@ -238,14 +235,27 @@ Rectangle{
|
|||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
|
||||
textFormat: TextEdit.RichText //TextEdit.PlainText
|
||||
onLineCountChanged: (conversation==true)?conversationView.contentY=conversationView.contentY+3*mm:newsView.contentY=newsView.contentY+3*mm
|
||||
textFormat: TextEdit.RichText
|
||||
onLineCountChanged: {
|
||||
if (messageSend.ListView.view==null){
|
||||
if (newsitem.ListView.view==null){}
|
||||
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize}
|
||||
}
|
||||
if(conversation==true){
|
||||
conversationView.contentY=conversationView.contentY+root.fontFactor*osSettings.systemFontSize
|
||||
}
|
||||
else{
|
||||
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+root.fontFactor*osSettings.systemFontSize
|
||||
}
|
||||
}
|
||||
onLinkActivated:{Qt.openUrlExternally(link)}
|
||||
onActiveFocusChanged:{//print(placeholder)
|
||||
onActiveFocusChanged:{
|
||||
if (activeFocus==true){
|
||||
print("contenty "+messageSend.ListView.view.contentY)
|
||||
if (messageSend.ListView.view.contentY==null){messageSend.parent.ListView.view.y=0}else{messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm};
|
||||
if (conversation==true){
|
||||
if (messageSend.ListView.view==null){
|
||||
if (newsitem.ListView.view==null){}
|
||||
else {newsitem.ListView.view.contentY=newsitem.ListView.view.contentY+newsitem.height/2}
|
||||
}
|
||||
else if (conversation==true){
|
||||
if(parentId==""){setParent(conversationModel.get(0).newsitemobject);}
|
||||
messageSend.state="conversation";
|
||||
try{conversationView.contentY=conversationView.contentY+20*mm}catch(e){}
|
||||
|
@ -253,15 +263,15 @@ Rectangle{
|
|||
messageSend.state="active";
|
||||
newsView.positionViewAtBeginning();
|
||||
}
|
||||
else{
|
||||
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
|
||||
};
|
||||
}
|
||||
}
|
||||
onTextChanged:{
|
||||
if (text!=""){
|
||||
var plaintext=getText(0,cursorPosition)
|
||||
//print(plaintext+plaintext.lastIndexOf("@",cursorPosition)+getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition) +" preedit: "+ preeditText+cursorPosition);
|
||||
var regex1 = /@[a-z]+/;var regex2 = /![a-z]+/;var regex3 = /\s/;
|
||||
//print(text.substring(cursorPosition-2,cursorPosition));
|
||||
//if (regex.test(getText(bodyField.cursorPosition-2,bodyField.cursorPosition)) || regex.test(preeditText) || regex.test(text)){
|
||||
var regex1 = /@[a-z]+/;var regex2 = /\![a-z]+/;var regex3 = /\s/;
|
||||
if (regex1.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText) && !regex3.test(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)+preeditText)){
|
||||
var letter=(getText(plaintext.lastIndexOf('@',cursorPosition),cursorPosition)).match(/[a-z]+/);
|
||||
contactprefix="@";
|
||||
|
@ -280,8 +290,8 @@ Rectangle{
|
|||
id:contactSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:8*mm
|
||||
width: parent.width-9*mm
|
||||
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
|
||||
height: messageSend.height/2
|
||||
model:contactModel
|
||||
function processContactSelection(contact){
|
||||
|
@ -307,8 +317,8 @@ Rectangle{
|
|||
id: tagSelector
|
||||
visible: false
|
||||
z:3
|
||||
x:8*mm
|
||||
width: parent.width-9*mm
|
||||
x:2*root.fontFactor*osSettings.bigFontSize//8*mm
|
||||
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize//9*mm
|
||||
height: messageSend.height/2
|
||||
model:tagModel
|
||||
clip: true
|
||||
|
@ -367,15 +377,15 @@ Rectangle{
|
|||
id:buttonRow
|
||||
visible:false //(bodyField.length>1)||(attachImageURLs.length>0)
|
||||
spacing: mm
|
||||
height: 12*mm
|
||||
height: 2.5*root.fontFactor*osSettings.bigFontSize//12*mm
|
||||
x: 0.5*mm
|
||||
MButton{id:permButton
|
||||
visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
|
||||
}
|
||||
// MButton{id:permButton //Permissions not working in Friendica 02/2022
|
||||
// visible: !conversation && (newsSwipeview.stacktype!=="DirectMessages")
|
||||
// height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
// width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
// text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
// onClicked: { if (permissionDialog.visible==false){permissionDialog.visible=true} else{permissionDialog.visible=false}}
|
||||
// }
|
||||
MButton {
|
||||
id: attachButton
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
|
@ -440,8 +450,8 @@ Rectangle{
|
|||
var body=bodyField.getFormattedText(0,bodyField.length);
|
||||
var dmbody=bodyField.getText(0,bodyField.length);
|
||||
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
|
||||
statusUpdate(title,body,parentId,attachImageURLs)}
|
||||
else {
|
||||
statusUpdate(title,body,parentId,attachImageURLs)
|
||||
}else {
|
||||
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
|
||||
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue