Friendiqa v0.2.2
This commit is contained in:
parent
ca6ae19a88
commit
93f08e604f
22 changed files with 345 additions and 91 deletions
|
@ -59,8 +59,9 @@ StackView{
|
|||
|
||||
function setServericon(server){
|
||||
try {Helperjs.friendicaWebRequest(server+"/api/statusnet/config",configBackground, function (obj){
|
||||
var serverdata = JSON.parse(obj);
|
||||
servericon.source=serverdata.site.logo})} catch(e){print(e)}
|
||||
var serverdata = JSON.parse(obj);
|
||||
servericon.visible=true;
|
||||
servericon.source=serverdata.site.logo})} catch(e){print(e)}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
|
@ -127,6 +128,7 @@ StackView{
|
|||
id:servericon
|
||||
x:19*mm;y:10*mm
|
||||
width:5*mm; height: 5*mm
|
||||
visible: false
|
||||
source:""
|
||||
MouseArea{
|
||||
anchors.fill:parent
|
||||
|
@ -137,6 +139,17 @@ StackView{
|
|||
}
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:serverSearchButton
|
||||
text:"\uf002"
|
||||
x:19*mm
|
||||
y:10*mm
|
||||
width: 5*mm; height:5*mm
|
||||
visible: servericon.visible?false:true
|
||||
onClicked:{Qt.openUrlExternally(Qt.resolvedUrl("https://dir.friendica.social/servers"))}
|
||||
}
|
||||
|
||||
|
||||
Rectangle{color: "light grey"; x: 25*mm; y: 10*mm; width: root.width/2; height: 5*mm;}
|
||||
Flickable {
|
||||
id: servernameFlickable
|
||||
|
@ -327,6 +340,7 @@ StackView{
|
|||
filesystem.rmDir();
|
||||
configBackground.registeredUser=true;
|
||||
servername.text="https://...";
|
||||
servericon.visible=false;
|
||||
servericon.source="";
|
||||
username.text="";
|
||||
password.text="";
|
||||
|
@ -349,6 +363,7 @@ StackView{
|
|||
onClicked:{
|
||||
configBackground.registeredUser=true;
|
||||
servername.text="https://..."
|
||||
servericon.visible=false;
|
||||
servericon.source="";
|
||||
username.text=""
|
||||
password.text=""
|
||||
|
|
|
@ -36,11 +36,13 @@ import QtQuick.Controls 1.2
|
|||
import QtQuick.Controls.Styles 1.4
|
||||
import "qrc:/js/news.js" as Newsjs
|
||||
import "qrc:/js/service.js" as Service
|
||||
import "qrc:/qml/genericqml"
|
||||
|
||||
|
||||
TabView{
|
||||
id:root
|
||||
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsAndroid.qml");return tmp.createObject(root)}
|
||||
IntentReceiver{}
|
||||
tabPosition: Qt.BottomEdge
|
||||
width: osSettings.appWidth
|
||||
height:osSettings.appHeight
|
||||
|
@ -58,6 +60,7 @@ TabView{
|
|||
signal contactdetailsSignal(var contact)
|
||||
signal eventSignal(var contact)
|
||||
signal uploadSignal(var urls)
|
||||
signal sendtextSignal(var intenttext)
|
||||
|
||||
property var news:[]
|
||||
property var newContacts:[]
|
||||
|
@ -189,11 +192,11 @@ TabView{
|
|||
id: configtab
|
||||
source: (root.currentIndex==4)?"qrc:/qml/configqml/ConfigTab.qml":""
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
osSettings.imagePickQml+'{multiple : true; onReady: {'+
|
||||
'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
|
||||
' root.currentIndex=2;fotostab.active=true;'+
|
||||
'root.uploadSignal(imageUrls)};}}',root,"imagePicker");
|
||||
}
|
||||
// Component.onCompleted: {
|
||||
// var imagePicker = Qt.createQmlObject('import QtQuick 2.0; import "qrc:/qml/genericqml";'+
|
||||
// osSettings.imagePickQml+'{multiple : true; onReady: {'+
|
||||
// 'if(imageUrls.length==1){root.currentIndex=0;newstab.active=true;root.uploadSignal(imageUrls)} else{'+
|
||||
// ' root.currentIndex=2;fotostab.active=true;'+
|
||||
// 'root.uploadSignal(imageUrls)};}}',root,"imagePicker");
|
||||
// }
|
||||
}
|
||||
|
|
43
source-android/qml/genericqml/IntentReceiver.qml
Normal file
43
source-android/qml/genericqml/IntentReceiver.qml
Normal file
|
@ -0,0 +1,43 @@
|
|||
import QtQuick 2.0
|
||||
import AndroidNative 1.0
|
||||
|
||||
Item {
|
||||
|
||||
/// The URL of the image chosen. If multiple images are picked, it will be equal to the first image.
|
||||
property string imageUrl: ""
|
||||
|
||||
/// A list of images chosen
|
||||
property var imageUrls: []
|
||||
|
||||
property string m_TEXT_MESSAGE: "androidnative.TextIntent.chosen";
|
||||
property string m_IMAGE_MESSAGE: "androidnative.ImagePicker.chosen";
|
||||
|
||||
|
||||
Connections {
|
||||
target: SystemDispatcher
|
||||
onDispatched: {
|
||||
if (type === m_IMAGE_MESSAGE) {
|
||||
var h=[];
|
||||
for (var n in message.imageUrls){
|
||||
h.push("file://"+ decodeURIComponent(message.imageUrls[n]).substring(5))
|
||||
}
|
||||
imageUrls=h;
|
||||
if(imageUrls.length==1){
|
||||
root.currentIndex=0;newstab.active=true;
|
||||
root.uploadSignal(imageUrls)
|
||||
} else{
|
||||
root.currentIndex=2;fotostab.active=true;
|
||||
root.uploadSignal(imageUrls)
|
||||
}
|
||||
} else if (type==m_TEXT_MESSAGE){
|
||||
root.currentIndex=0;newstab.active=true;
|
||||
root.sendtextSignal(message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
SystemDispatcher.setInitialized();
|
||||
}
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ Rectangle{
|
|||
anchors.bottomMargin:1
|
||||
text:"\u2713"
|
||||
onClicked:{updatePerms();
|
||||
permissionDialog.destroy();
|
||||
permissionDialog.visible=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ Flickable{
|
|||
id:messageSend
|
||||
property string parentId: ""
|
||||
property string reply_to_user:""
|
||||
property alias bodyMessage: bodyField.text
|
||||
property var attachImageURLs: [];
|
||||
property int directmessage: 0;
|
||||
property var contacts: []
|
||||
|
@ -58,7 +59,8 @@ Flickable{
|
|||
|
||||
function attachImage(url){
|
||||
var imageAttachmentObject=Qt.createQmlObject('import QtQuick 2.0; Image {id:imageAttachment'+attachImageURLs.length+'; source:"'+
|
||||
url.toString()+'"; width: 15*mm; height: 15*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
url.toString()+'"; x:2*mm; width: 45*mm; height: 45*mm;fillMode: Image.PreserveAspectFit;MouseArea{anchors.fill:parent;onClicked:{attachImageURLs.splice(attachImageURLs.indexOf("'+
|
||||
url+'"),1); imageAttachment'+attachImageURLs.length+'.destroy()}}}',messageColumn,"attachedImage");
|
||||
}
|
||||
|
||||
function statusUpdate(title,status,in_reply_to_status_id,attachImageURL) {
|
||||
|
@ -90,7 +92,7 @@ Flickable{
|
|||
|
||||
Column {
|
||||
id:messageColumn
|
||||
spacing: 2
|
||||
spacing: 0.5*mm
|
||||
width: parent.width
|
||||
TextField {
|
||||
id: titleField
|
||||
|
@ -99,14 +101,23 @@ Flickable{
|
|||
visible: messageSend.parentId === ""
|
||||
}
|
||||
|
||||
TextArea {
|
||||
id: bodyField
|
||||
width: parent.width
|
||||
height: 30*mm
|
||||
wrapMode: TextEdit.Wrap
|
||||
textFormat: TextEdit.PlainText
|
||||
Rectangle{
|
||||
color: "white"
|
||||
radius: 0.5*mm
|
||||
x:mm
|
||||
width: parent.width-2*mm
|
||||
height:Math.max(bodyField.contentHeight+2*mm,10*mm)
|
||||
TextArea {
|
||||
id: bodyField
|
||||
anchors.fill: parent
|
||||
font.pixelSize: 3*mm
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
textFormat: TextEdit.PlainText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row{
|
||||
spacing: 2
|
||||
CheckBox{
|
||||
|
@ -143,10 +154,9 @@ Flickable{
|
|||
text:"\u2713"
|
||||
onClicked: {if(urlTextEdit.text!=""){
|
||||
var start = bodyField.selectionStart;
|
||||
var end = bodyField.selectionEnd;
|
||||
var text = bodyField.getText(start,end);
|
||||
var text=bodyField.selectedText
|
||||
text = "[url="+urlTextEdit.text+"]" + text + "[/url]";
|
||||
bodyField.remove(start,end);
|
||||
bodyField.remove(start,bodyField.selectionEnd);
|
||||
bodyField.insert(start,text);}
|
||||
urlRectangle.visible=false}
|
||||
}
|
||||
|
@ -158,13 +168,11 @@ Flickable{
|
|||
BlueButton{id:permButton
|
||||
visible: (directmessage==1)?false:true
|
||||
text: ((contact_allow.length==0)&&(contact_deny.length==0)&&(group_allow.length==0)&&(group_deny.length==0))?"\uf09c":"\uf023"
|
||||
onClicked: {
|
||||
var component = Qt.createComponent("qrc:/qml/genericqml/PermissionDialog.qml");
|
||||
var permissions = component.createObject(messageColumn);
|
||||
}}
|
||||
onClicked: { permissionDialog.visible=true;}
|
||||
}
|
||||
BlueButton {
|
||||
id: attachButton
|
||||
text: "\uf0c6"
|
||||
text: "\uf03e"
|
||||
visible:(directmessage==0)
|
||||
onClicked: {
|
||||
if (attachImageURLs.length>0){//Server currently accepts only one attachment
|
||||
|
@ -189,27 +197,26 @@ Flickable{
|
|||
if(Helperjs.getCount(db,login,"contacts","screen_name",contacts[i].screen_name)>1){
|
||||
contacts[i].screen_name=contacts[i].screen_name+"+"+contacts[i].cid
|
||||
}
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"';iconSource:'"+contacts[i].profile_image+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
|
||||
contactitems=contactitems+"MenuItem{text:'"+contacts[i].screen_name+"'; onTriggered: bodyField.insert(0,' @"+contacts[i].screen_name+" ')}"
|
||||
}}
|
||||
var menuString="import QtQuick.Controls 1.4; Menu {"+contactitems+"}";
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageSend,"contactmenuOutput")
|
||||
var contactlistObject=Qt.createQmlObject(menuString,messageColumn,"contactmenuOutput")
|
||||
contactlistObject.popup() }
|
||||
}
|
||||
|
||||
BlueButton{
|
||||
id:smileyButton
|
||||
text: "\uf118"
|
||||
onClicked: {
|
||||
var smileyarray=Smileyjs.smileys
|
||||
var component = Qt.createComponent("qrc:/qml/newsqml/SmileyDialog.qml");
|
||||
var smileydialog = component.createObject(messageColumn)
|
||||
}}
|
||||
onClicked: {smileyDialog.visible=true}
|
||||
}
|
||||
|
||||
BlueButton {
|
||||
id: cancelButton
|
||||
text: "\uf057"
|
||||
onClicked: {newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop(null)}
|
||||
onClicked: {
|
||||
newstab.newstabstatus=login.newsViewType;
|
||||
newsStack.pop(null)
|
||||
}
|
||||
}
|
||||
BlueButton {
|
||||
id: sendButton
|
||||
|
@ -224,7 +231,8 @@ Flickable{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
PermissionDialog{id:permissionDialog;x:mm;visible: false}
|
||||
SmileyDialog{id:smileyDialog;x:mm;visible: false}
|
||||
}
|
||||
Component.onCompleted: if(attachImageURLs.length>0){attachImage(attachImageURLs[0])}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,14 @@ Item {
|
|||
|
||||
function sendUrls(urls){
|
||||
if((urls.length==1)&&(newsStack.depth<2)){
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{attachImageURLs:urls}}])
|
||||
}
|
||||
}
|
||||
|
||||
function sendtext(text){
|
||||
if(text&&(newsStack.depth<2)){
|
||||
if (text.subject=="undefined"){text.subject=""}
|
||||
newsStack.push([newslistRectangle,{item:"qrc:/qml/newsqml/MessageSend.qml",properties:{bodyMessage:text.subject+"\n"+text.plaintext}}])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,6 +345,7 @@ Item {
|
|||
root.directmessageSignal.connect(onDirectMessage);
|
||||
root.newsSignal.connect(showNews);
|
||||
root.uploadSignal.connect(sendUrls);
|
||||
root.sendtextSignal.connect(sendtext);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
|
||||
//print("imageUrls "+JSON.stringify(imageUrls)+" newsstack.depth:"+newsStack.depth);
|
||||
|
|
|
@ -49,7 +49,7 @@ Rectangle{
|
|||
anchors.right: parent.right
|
||||
anchors.rightMargin: 1*mm
|
||||
text: "\uf057"
|
||||
onClicked:{smileyDialog.destroy()}
|
||||
onClicked:{smileyDialog.visible=false}
|
||||
}
|
||||
|
||||
TabView{
|
||||
|
@ -164,7 +164,8 @@ Rectangle{
|
|||
MouseArea{
|
||||
anchors.fill: parent
|
||||
onClicked:{
|
||||
bodyField.append(emoji.name+" ")
|
||||
//bodyField.append(emoji.name+" ")
|
||||
bodyField.insert(bodyField.cursorPosition,emoji.name+" ");
|
||||
smileyDialog.destroy()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue