Native colors and new message create window

This commit is contained in:
LubuWest 2023-07-27 21:52:16 +02:00
commit 2debd8f2ab
122 changed files with 3525 additions and 3122 deletions

View file

@ -30,7 +30,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls.Material 2.12
//import QtQuick.Controls 2.4
Item {
@ -51,7 +50,7 @@ Item {
id:daytext
anchors.right: parent.right
anchors.margins: 0.5*mm
color:(model.month==monthgrid.month)?Material.primaryTextColor:Material.secondaryTextColor
color:(model.month==monthgrid.month)?osSettings.primaryTextColor:osSettings.secondaryTextColor
wrapMode: Text.WrapAnywhere
text: model.day
font.bold: model.today

View file

@ -29,11 +29,10 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import QtQml 2.2
import Qt.labs.calendar 1.0
import QtQuick 2.15
import QtQuick.Controls 6.3
//import Qt.labs.calendar 1.0
//import QtQuick.Layouts 1.3
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
@ -45,7 +44,7 @@ Rectangle {
// y:1
width:parent.width
height:parent.height
color: Material.backgroundColor
color: osSettings.backgroundColor
property date currentTime: new Date()
property int offsetTime: currentTime.getTimezoneOffset() * 60 * 1000
property var events:[]
@ -128,7 +127,7 @@ Rectangle {
anchors.topMargin: 0.5*mm
anchors.right:calendartabstatusButton.left
anchors.rightMargin:mm
width: 2*root.fontFactor*osSettings.bigFontSize;
//width: 2*root.fontFactor*osSettings.bigFontSize;
text:"\uf021"
onClicked: {
calBusy.running=true;
@ -223,7 +222,7 @@ Rectangle {
orientation: ListView.Horizontal
highlightRangeMode: ListView.StrictlyEnforceRange
model: CalendarModel {id:calendarModel
model: CalendarModel {id:calendarModel
from: new Date()
to: new Date(new Date().valueOf()+93312000000)
}
@ -236,7 +235,7 @@ Rectangle {
//Layout.fillWidth: true
width: parent.width-root.fontFactor*osSettings.bigFontSize
horizontalAlignment:Text.AlignHCenter
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text: model.year
font.pointSize: osSettings.systemFontSize
}
@ -244,7 +243,7 @@ Rectangle {
width: parent.width-osSettings.bigFontSize
text: Qt.locale().standaloneMonthName(model.month)
//Layout.fillWidth: true
color: Material.primaryTextColor
color: osSettings.primaryTextColor
horizontalAlignment:Text.AlignHCenter
font.pointSize: osSettings.systemFontSize
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls 1.4 as Oldcontrols
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
@ -56,7 +55,7 @@ Flickable{
id: eventRect
width: root.width
height: textColumn.height + 6*root.fontFactor*osSettings.bigFontSize
color: Material.backgroundColor
color: osSettings.backgroundColor
MButton{
id:closeButton
anchors.top: parent.top
@ -74,7 +73,7 @@ Flickable{
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
//verticalAlignment: TextInput.AlignBottom
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:qsTr("Start")
}
@ -139,7 +138,7 @@ Flickable{
width: 3*root.fontFactor*osSettings.bigFontSize
height: root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:qsTr("End")
}
TextField {
@ -293,7 +292,7 @@ Flickable{
}
Rectangle{
color: Material.backgroundColor
color: osSettings.backgroundColor
radius: 0.5*mm
width: parent.width-root.fontFactor*osSettings.bigFontSize
height:Math.max(bodyField.contentHeight+root.fontFactor*osSettings.bigFontSize,2.5*root.fontFactor*osSettings.bigFontSize)
@ -391,7 +390,7 @@ Flickable{
Label {
text: formatText(Tumbler.tumbler.count, modelData)
opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
color:Material.primaryTextColor
color: osSettings.primaryTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pointSize: osSettings.systemFontSize

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -39,7 +38,7 @@ import "qrc:/qml/calendarqml"
Rectangle{
id:eventList
color: Material.backgroundColor
color: osSettings.backgroundColor
property var daylist:[]
property int dayint: 0
property var events:[]
@ -50,6 +49,7 @@ Rectangle{
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "\uf057"
onClicked:{rootstackView.pop()}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -43,8 +42,8 @@ Rectangle{
property var currEvent: event
width:parent.width
height:Math.max(eventNameText.height+eventDetailsText.height,profileImage.height)+mm
border.color: Material.backgroundDimColor
color: Material.backgroundColor
//border.color: osSettings.backgroundDimColor
color: osSettings.backgroundColor
border.width: 1
radius: 0.5*mm
Image {
@ -61,7 +60,7 @@ Rectangle{
x: 8*mm
width:parent.width-8*mm
height:contentHeight
color: Material.primaryTextColor
color: osSettings.primaryTextColor
textFormat: Text.RichText
font.pointSize: osSettings.systemFontSize
text: new Date(event.start).toLocaleString(Qt.locale(),Locale.NarrowFormat)+ " - " +((event.end>0)&&(event.end!=null)?new Date(event.end).toLocaleString(Qt.locale(),Locale.NarrowFormat):"\u221E")+":<br>"+(status=="large"?"<b>"+event.title+"</b>":event.title)
@ -74,7 +73,7 @@ Rectangle{
z:4
width: parent.width-8*mm
height: contentHeight
color: Material.primaryTextColor
color: osSettings.primaryTextColor
textFormat: Text.RichText
text: status!="large"?"":Qt.atob(event.desc) + (event.location==""?"":"<br><br>"+qsTr("Location")+": "+event.location)
anchors.top: eventNameText.bottom

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
Dialog {
id: rulesDialog
@ -57,8 +56,8 @@ Dialog {
x:1; y:1
width: root.width-4*root.fontFactor*osSettings.bigFontSize
wrapMode: TextEdit.Wrap
color: Material.primaryTextColor
linkColor: Material.accentColor
color: osSettings.primaryTextColor
linkColor: osSettings.secondaryTextColor
textFormat: Text.PlainText
font.family: "Noto Sans"
font.pointSize: osSettings.systemFontSize

View file

@ -29,11 +29,12 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.7
import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12
import QtQuick 6.3
import QtCore 6.3
import QtQuick.Dialogs 6.3
import QtQuick.Controls 6.3
import QtQuick.Layouts 1.12
import QtQml.Models 2.15
import QtQml.Models 6.3
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/configqml"
@ -55,495 +56,494 @@ Page{
xhr.clearParams();
xhr.get();
}
}
}
function verify(userconfig){
Helperjs.friendicaRequest(userconfig,"/api/v1/accounts/verify_credentials",root,function(obj){
accountBusy.running=false;
try{var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('error')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
if (userconfig.APIVersion!=""){userconfig.password=""}
if (imagestoredir==""){
imagestoredir=filesystem.homePath+"/"+credentials.username+"/";
userconfig.imagestore=imagestoredir
accountBusy.running=false;
try{var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('error')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)
}
if(userconfig.imagestore == filesystem.homePath+"/"+credentials.username+"/")
else{
if (users.length==0){Service.setDefaultOptions(db);}
if (userconfig.APIVersion!=""){userconfig.password=""}
if (imagestoredir==""){
imagestoredir=filesystem.homePath+"/"+credentials.username+"/";
userconfig.imagestore=imagestoredir
}
if(userconfig.imagestore == filesystem.homePath+"/"+credentials.username+"/")
{filesystem.makePath(filesystem.homePath+"/"+credentials.username);}
print("imagestoredir "+imagestoredir)
filesystem.Directory=imagestoredir;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
userconfig.accountId=credentials.id;
userconfig.username=credentials.username;
Service.storeConfig(db,userconfig);
print("imagestoredir "+imagestoredir)
filesystem.Directory=imagestoredir;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
userconfig.accountId=credentials.id;
userconfig.username=credentials.username;
Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
});
accountPage.users=storedUsers});
//reset values
login=userconfig;
news=[];
contactlist=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.display_name+"\nScreen Name: "+credentials.username,root)
rootstackView.pop()
}
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)};
})
}
BusyIndicator{
id: accountBusy
anchors.centerIn: parent
width: 5*root.fontFactor*osSettings.bigFontSize
height: 5*root.fontFactor*osSettings.bigFontSize
running: false
}
ColumnLayout{
x: root.fontFactor*osSettings.bigFontSize
width: root.width - 2*mm
y: root.fontFactor*osSettings.bigFontSize
spacing: root.fontFactor*osSettings.bigFontSize
Row{
spacing:0.5*mm
height: userButton.height
width: parent.width
MButton{
id:userButton
text:qsTr("User")
font.pointSize: osSettings.bigFontSize
visible: users.length>0
onClicked:{
var useritems="";
for (var i=0;i<accountPage.users.length;i++){
useritems=useritems+"MenuItem{font.pointSize: osSettings.bigFontSize;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
serverModel.insert(0,{text:obj.server})
accountPage.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;
imagestoredir=obj.imagestore;
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
if(obj.password!=''){accountPage.state='password'}
else if (obj.token!=''){accountPage.state='oauth'}
},'username','"+ accountPage.users[i].username+"')}}"
}
var menuString="import QtQuick.Controls 2.15;import 'qrc:/js/service.js' as Service;"+
" Menu {width:8*root.fontFactor*osSettings.bigFontSize;"+useritems+"}";
var userlistObject=Qt.createQmlObject(menuString,accountPage,"usermenuOutput")
userlistObject.popup() }
}
MButton {
visible: users.length>0
text: "-"
font.pointSize: osSettings.bigFontSize
onClicked:{
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
Service.readConfig(db,function(user){
if(userdata.token!=""){xhr.setUrl(servername.text);
xhr.setApi("/oauth/revoke");
xhr.clearParams();
xhr.setParam("client_id",user.client.client_id);
xhr.setParam("client_secret",user.client.client_secret);
xhr.setParam("token",user.token);
xhr.post();
}
},"username",username.text);
Service.deleteConfig(db,userconfig,function(){
filesystem.Directory=imagestore.text+"contacts";
filesystem.rmDir();
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
servername.text="https://";
servericon.visible=false;
servericon.source="";
username.text="";
password.text="";
imagestore.text="";
userButton.text=qsTr("User");
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;})
accountPage.state="new_oauth"
})
}}
MButton {
visible: users.length>0
text: "+"
font.pointSize: osSettings.bigFontSize
onClicked:{
servername.text="https://"
servericon.visible=false;
servericon.source="";
username.text=""
password.text=""
imagestore.text=""
userButton.text=qsTr("User")
accountPage.state="new_oauth"
}
}
MButton {
text: "?"
font.pointSize: osSettings.bigFontSize
onClicked:{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
MButton{
id:closeButton
visible: users.length>0
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}
Row{
spacing:0.5*mm
height: 3*root.fontFactor*osSettings.bigFontSize
width: parent.width
Image{
id:servericon
width:2.5*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
visible: false
source:""
property var serverconfig:({})
MouseArea{
anchors.fill:parent
onClicked:{
let serverConfigString="import QtQuick 2.0; import QtQuick.Dialogs 6.3; MessageDialog{ visible: true; title:'Server';buttons: MessageDialog.Ok;text: 'Name: "+
servericon.serverconfig.site.name+"\nLanguage: "+servericon.serverconfig.site.language+
"\nEmail: "+servericon.serverconfig.site.email+"\nTimezone: "+servericon.serverconfig.site.timezone+"\nClosed: "+servericon.serverconfig.site.closed+
"\nText limit: "+servericon.serverconfig.site.textlimit+"\nShort Url length: "+servericon.serverconfig.site.shorturllength+
"\nFriendica version: "+servericon.serverconfig.site.friendica.FRIENDICA_VERSION+
"\nDB Update version: "+servericon.serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
var serverconfigObject=Qt.createQmlObject(serverConfigString,accountPage,"serverconfigOutput");
}
}
}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
MButton{
id:serverSearchButton
width: 3*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
text:"\uf002"
icon.name: "search"
font.pointSize: osSettings.bigFontSize
visible: servericon.visible?false:true
onClicked:{Qt.openUrlExternally(Qt.resolvedUrl("https://dir.friendica.social/servers"))}
}
// ComboBox{
// id: servername
// x: 4*root.fontFactor*osSettings.bigFontSize
// y: 3.5*root.fontFactor*osSettings.bigFontSize
// width: root.width-5*root.fontFactor*osSettings.bigFontSize
// height: 2.5*root.fontFactor*osSettings.bigFontSize//5*mm;
// font.pointSize: osSettings.systemFontSize
// editable:true
// model: serverModel
// onAccepted: {
// let cleanText =currentText;if(currentText==""){cleanText=editText}
// if((cleanText).substring(0,8) !=="https://"){
// cleanText="https://"+cleanText
// }
// if (find(cleanText) === -1) {
// serverModel.append({text: cleanText})
// currentIndex = find(cleanText)
// displayText=cleanText
// }
// if (cleanText!=""){accountPage.setServericon(cleanText)}
// }
// onFocusChanged: {
// if(focus==false){
// onAccepted()
// }
// }
// }
TextField {
id: servername
width: root.width-5*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
text:"https://"
onFocusChanged:{
if (focus){servermenu.open()}
else{
if((servername.text).substring(0,11) =="https://http"){
servername.text= (servername.text).substring(8)
}
if (servername.text!="https://"){
accountPage.setServericon(servername.text)}
}
}
}
Menu {
id:servermenu
width: 13*root.fontFactor*osSettings.bigFontSize
Instantiator{
model:serverModel
MenuItem{
text: modelData
onTriggered: {servername.text=modelData}
}
onObjectAdded:{servermenu.insertItem(index,object)}
onObjectRemoved:{servermenu.removeItem(object)}
}
}
ListModel{id:serverModel
ListElement{text:"https://anonsys.net"}
ListElement{text:"https://asaps-sm.lafayettegroup.com"}
ListElement{text:"https://f.freinetz.ch"}
ListElement{text:"https://friendica.chilemasto.casa"}
ListElement{text:"https://friendica.eskimo.com"}
ListElement{text:"https://friendica.me"}
ListElement{text:"https://friendica.opensocial.space"}
ListElement{text:"https://friendica.utzer.de"}
ListElement{text:"https://friendica.vrije-mens.org"}
ListElement{text:"https://libranet.de"}
ListElement{text:"https://loma.ml"}
ListElement{text:"https://nerdica.net"}
ListElement{text:"https://nsfw.wnymathguy.com"}
ListElement{text:"https://opensocial.at"}
ListElement{text:"https://poliverso.org"}
ListElement{text:"https://social.isurf.ca"}
ListElement{text:"https://social.trom.tf"}
ListElement{text:"https://squeet.me"}
ListElement{text:"https://venera.social"}
}
}
MButton {
id: ruleButton
width: parent.width
visible: (osSettings.osType=="Android") && (userButton.text== qsTr("User"))
height: 2*root.fontFactor*osSettings.bigFontSize;
text: qsTr("Instance rules")
font.pointSize: osSettings.bigFontSize
onClicked:{
xhr.setUrl(servername.text);
xhr.setApi("/api/v1/instance/rules");
xhr.clearParams();
xhr.get();
}
}
TextField {
id: username
width: root.width-5*root.fontFactor*osSettings.bigFontSize
height: servername.height
Layout.leftMargin: 3*root.fontFactor*osSettings.bigFontSize;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(text!= ""):true
placeholderText: qsTr("Nickname")
selectByMouse: true
onEditingFinished: {
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
}
imagestoredir=filesystem.homePath+"/"+username.text+"/"
}
}
TextField {
id: password
width: root.width-9*mm; height: 2.5*root.fontFactor*osSettings.bigFontSize;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
selectByMouse: true
echoMode: TextInput.Password
placeholderText: qsTr("Password")
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhSensitiveData
}
Row{
spacing:0.5*mm
height: 3*root.fontFactor*osSettings.bigFontSize
width: parent.width
Label {
id: imagedirlabel
visible: imagestore.text!=""
text: qsTr("Image dir.")
font.pointSize: osSettings.systemFontSize
}
TextField {
id: imagestore
width: root.width-17*mm;
height: 2.5*root.fontFactor*osSettings.bigFontSize;
visible:imagestore.text!=""
font.pointSize: osSettings.systemFontSize
selectByMouse: true
text: ""
wrapMode: TextEdit.NoWrap
onTextChanged: imagestoredir=imagestore.text
}
MButton {
visible:imagestore.text!=""
text: "..."
font.pointSize: osSettings.bigFontSize
onClicked:{imagestoreDialog.open()}
}
FolderDialog {
id: imagestoreDialog
title: "Please choose a directory"
currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
//selectFolder: true
onAccepted: {
var imagestoreString=imagestoreDialog.selectedFolder.toString();
imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/"
imagestore.text=imagestoreString
}
}
}
MButton {
id:confirmationOAuth
width: parent.width
text: qsTr("Connect")
font.pointSize: osSettings.bigFontSize
visible: (osSettings.osType=="Android")?userButton.text!= qsTr("User"):true
onClicked:{
if (servername.text==""){Helperjs.showMessage(qsTr("Error"), qsTr("No server given!"),root)}
else{
xhr.setUrl(servername.text);
xhr.setApi("/api/v1/apps");
xhr.clearParams();
if (osSettings.osType=="Android"){
xhr.setParam("client_name","Friendiqa-Android");
} else {
xhr.setParam("client_name","Friendiqa-"+filesystem.hostname);
}
xhr.setParam("redirect_uris","http://127.0.0.1:1337/");
xhr.setParam("scopes","read write follow push");
xhr.setParam("website","https://friendiqa.ma-nic.de");
xhr.post();
}
}
}
Connections{
target: xhr
function onSuccess(text,api){
if(api=="/api/v1/instance/rules"){
let rulestext="";
let rulesarray=JSON.parse(text)
for (let rule in rulesarray){
rulestext=rulestext+rulesarray[rule].text+"\n"
}
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
var rulesdialog = component.createObject(accountPage,{"rules": rulestext});
rulesdialog.open();
}
else if(api=="/api/statusnet/config"){
try{let serverdata = JSON.parse(text);
servericon.visible=true;
servericon.source=serverdata.site.logo;
servericon.serverconfig=serverdata;
}
catch(e){print(e)}
}
else if (api=="/api/v1/apps"){print("/api/v1/apps text "+text)
let app=JSON.parse(text);
accountPage.appdata=app;
oauth2.setClientId(app.client_id);
oauth2.setClientSecret(app.client_secret);
oauth2.setServer(servername.text);
oauth2.grant();
}
}
function onError(text,api){
print(api + " Error "+ text)
}
}
Connections{
target: oauth2
function onSuccess(text){
var userconfig={server: servername.displayText, username:"", password:"", imagestore: imagestoredir,interval:"",token: text,client:Qt.btoa(JSON.stringify(appdata))}
verify(userconfig)
}
function onError(text){
Helperjs.showMessage(qsTr("Error"), qsTr("Couldn't connect to server"),root)
print ("oauth2 onerror "+text)
}
}
MButton {
id:confirmation
width: 10*root.fontFactor*osSettings.bigFontSize;
text: qsTr("Confirm")
font.pointSize: osSettings.bigFontSize
visible: false// (osSettings.osType=="Android")?userButton.text!= qsTr("User"):true
onClicked:{
accountBusy.running=true;
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir,interval:""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
else {errormessage=""}
if (errormessage=="") {verify(userconfig)}
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
}}
MButton {
id: setDefault
width: 10*root.fontFactor*osSettings.bigFontSize;
text: qsTr("Set as default")
font.pointSize: osSettings.bigFontSize
visible: false
onClicked:{
accountBusy.running=true;
let users=updatenews.getAccounts("username",username.text)
Service.storeConfig(db,users[0]);
Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
});
accountPage.users=storedUsers});
//reset values
//reset values
login=userconfig;
news=[];
contactlist=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.display_name+"\nScreen Name: "+credentials.username,root)
Helperjs.showMessage(qsTr("Success"),"Screen Name: "+users[0].username,root)
rootstackView.pop()
}
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)};
})}
MButton{
id:userButton
text:qsTr("User")
font.pointSize: osSettings.bigFontSize
x: root.fontFactor*osSettings.bigFontSize
y: root.fontFactor*osSettings.bigFontSize
width: root.width/2 - 2*mm
height: 2*root.fontFactor*osSettings.bigFontSize
visible: users.length>0
onClicked:{
var useritems="";
for (var i=0;i<accountPage.users.length;i++){
useritems=useritems+"MenuItem{font.pointSize: osSettings.bigFontSize;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
serverModel.insert(0,{text:obj.server})
accountPage.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;
imagestoredir=obj.imagestore;
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
if(obj.password!=''){accountPage.state='password'}
else if (obj.token!=''){accountPage.state='oauth'}
},'username','"+ accountPage.users[i].username+"')}}"
}
var menuString="import QtQuick.Controls 2.12;import 'qrc:/js/service.js' as Service;"+
" Menu {width:8*root.fontFactor*osSettings.bigFontSize;"+useritems+"}";
var userlistObject=Qt.createQmlObject(menuString,accountPage,"usermenuOutput")
userlistObject.popup() }
}
Image{
id:servericon
x:root.fontFactor*osSettings.bigFontSize;y:3*root.fontFactor*osSettings.bigFontSize
width:2.5*root.fontFactor*osSettings.bigFontSize; height: 2.5*root.fontFactor*osSettings.bigFontSize
visible: false
source:""
property var serverconfig:({})
MouseArea{
anchors.fill:parent
onClicked:{
let serverConfigString="import QtQuick 2.0; import QtQuick.Dialogs 1.2; MessageDialog{ visible: true; title:'Server';standardButtons: StandardButton.Ok;text: 'Name: "+
servericon.serverconfig.site.name+"\nLanguage: "+servericon.serverconfig.site.language+
"\nEmail: "+servericon.serverconfig.site.email+"\nTimezone: "+servericon.serverconfig.site.timezone+"\nClosed: "+servericon.serverconfig.site.closed+
"\nText limit: "+servericon.serverconfig.site.textlimit+"\nShort Url length: "+servericon.serverconfig.site.shorturllength+
"\nFriendica version: "+servericon.serverconfig.site.friendica.FRIENDICA_VERSION+
"\nDB Update version: "+servericon.serverconfig.site.friendica.DB_UPDATE_VERSION+"'}";
var serverconfigObject=Qt.createQmlObject(serverConfigString,accountPage,"serverconfigOutput");
}
}
}
FontLoader{id: fontAwesome; source: "qrc:/images/fontawesome-webfont.ttf"}
MButton{
id:serverSearchButton
text:"\uf002"
icon.name: "search"
font.pointSize: osSettings.bigFontSize
x:root.fontFactor*osSettings.bigFontSize
y:3*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize; height:2*root.fontFactor*osSettings.bigFontSize
visible: servericon.visible?false:true
onClicked:{Qt.openUrlExternally(Qt.resolvedUrl("https://dir.friendica.social/servers"))}
}
// ComboBox{
// id: servername
// x: 4*root.fontFactor*osSettings.bigFontSize
// y: 3.5*root.fontFactor*osSettings.bigFontSize
// width: root.width-5*root.fontFactor*osSettings.bigFontSize
// height: 2.5*root.fontFactor*osSettings.bigFontSize//5*mm;
// font.pointSize: osSettings.systemFontSize
// editable:true
// model: serverModel
// onAccepted: {
// let cleanText =currentText;if(currentText==""){cleanText=editText}
// if((cleanText).substring(0,8) !=="https://"){
// cleanText="https://"+cleanText
// }
// if (find(cleanText) === -1) {
// serverModel.append({text: cleanText})
// currentIndex = find(cleanText)
// displayText=cleanText
// }
// if (cleanText!=""){accountPage.setServericon(cleanText)}
// }
// onFocusChanged: {
// if(focus==false){
// onAccepted()
// }
// }
// }
TextField {
id: servername
x: 4*root.fontFactor*osSettings.bigFontSize
y: 3.5*root.fontFactor*osSettings.bigFontSize
width: root.width-5*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
text:"https://"
onFocusChanged:{
if (focus){servermenu.open()}
else{
if((servername.text).substring(0,11) =="https://http"){
servername.text= (servername.text).substring(8)
}
if (servername.text!="https://"){
accountPage.setServericon(servername.text)}
}
}
}
Menu {
id:servermenu
width: 13*root.fontFactor*osSettings.bigFontSize
x: 4*root.fontFactor*osSettings.bigFontSize
y: 5*root.fontFactor*osSettings.bigFontSize
Instantiator{
model:serverModel
MenuItem{
text: modelData
onTriggered: {servername.text=modelData}
}
onObjectAdded: servermenu.insertItem(index,object)
onObjectRemoved: servermenu.removeItem(object)
}
}
ListModel{id:serverModel
ListElement{text:"https://anonsys.net"}
ListElement{text:"https://asaps-sm.lafayettegroup.com"}
ListElement{text:"https://f.freinetz.ch"}
ListElement{text:"https://friendica.chilemasto.casa"}
ListElement{text:"https://friendica.eskimo.com"}
ListElement{text:"https://friendica.me"}
ListElement{text:"https://friendica.opensocial.space"}
ListElement{text:"https://friendica.utzer.de"}
ListElement{text:"https://friendica.vrije-mens.org"}
ListElement{text:"https://libranet.de"}
ListElement{text:"https://loma.ml"}
ListElement{text:"https://nerdica.net"}
ListElement{text:"https://nsfw.wnymathguy.com"}
ListElement{text:"https://opensocial.at"}
ListElement{text:"https://poliverso.org"}
ListElement{text:"https://social.isurf.ca"}
ListElement{text:"https://social.trom.tf"}
ListElement{text:"https://squeet.me"}
ListElement{text:"https://venera.social"}
}
MButton {
id: ruleButton
x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm;
visible: (osSettings.osType=="Android") && (userButton.text== qsTr("User"))
height: 2*root.fontFactor*osSettings.bigFontSize;
text: qsTr("Instance rules")
font.pointSize: osSettings.bigFontSize
onClicked:{
xhr.setUrl(servername.text);
xhr.setApi("/api/v1/instance/rules");
xhr.clearParams();
xhr.get();
}
}
TextField {
id: username
x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
placeholderText: qsTr("Nickname")
selectByMouse: true
onEditingFinished: {
if (username.text.indexOf('@')>-1){
Helperjs.showMessage(qsTr("Error"),qsTr("Nicknames containing @ symbol currently not supported"),accountPage)
}
imagestoredir=filesystem.homePath+"/"+username.text+"/"
//if (imagestore.text==filesystem.homePath+"/.friendiqa/"){imagestore.text=filesystem.homePath+"/.friendiqa/"+username.text+"/"}
}
}
TextField {
id: password
x: root.fontFactor*osSettings.bigFontSize; y: 9*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
selectByMouse: true
echoMode: TextInput.Password
placeholderText: qsTr("Password")
inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhSensitiveData
}
Label {
id: imagedirlabel
visible: imagestore.text!=""
text: qsTr("Image dir.")
font.pointSize: osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y: 12*root.fontFactor*osSettings.bigFontSize
}
TextField {
id: imagestore
x: root.fontFactor*osSettings.bigFontSize; y: 13*root.fontFactor*osSettings.bigFontSize; width: root.width-17*mm; //height: 5*mm;
visible:imagestore.text!=""
font.pointSize: osSettings.systemFontSize
selectByMouse: true
text: "" //filesystem.homePath+"/.friendiqa/"+username.text+"/" //(osSettings.osType=="Android") && (filesystem.fileexist("/storage/emulated/0/Pictures/"))?"/storage/emulated/0/Pictures/":""
wrapMode: TextEdit.NoWrap
onTextChanged: imagestoredir=imagestore.text
}
MButton {
x: root.width-3*root.fontFactor*osSettings.bigFontSize; y: 13*root.fontFactor*osSettings.bigFontSize;
height: 2*root.fontFactor*osSettings.bigFontSize;
visible:imagestore.text!=""
text: "..."
font.pointSize: osSettings.bigFontSize
onClicked:{imagestoreDialog.open()}
}
FileDialog {
id: imagestoreDialog
title: "Please choose a directory"
folder: shortcuts.pictures
selectFolder: true
onAccepted: {
var imagestoreString=imagestoreDialog.folder.toString();
imagestoreString=imagestoreString.replace(/^(file:\/{2})/,"")+"/"
imagestore.text=imagestoreString
}
}
BusyIndicator{
id: accountBusy
anchors.horizontalCenter: parent.horizontalCenter
y: 16*root.fontFactor*osSettings.bigFontSize
width:10*mm
height: 10*mm
running: false
}
MButton {
id:confirmationOAuth
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Connect")
font.pointSize: osSettings.bigFontSize
visible: (osSettings.osType=="Android")?userButton.text!= qsTr("User"):true
onClicked:{
if (servername.text==""){Helperjs.showMessage(qsTr("Error"), qsTr("No server given!"),root)}
else{
xhr.setUrl(servername.text);
xhr.setApi("/api/v1/apps");
xhr.clearParams();
if (osSettings.osType=="Android"){
xhr.setParam("client_name","Friendiqa-Android");
} else {
xhr.setParam("client_name","Friendiqa-"+filesystem.hostname);
}
xhr.setParam("redirect_uris","http://127.0.0.1:1337/");
xhr.setParam("scopes","read write follow push");
xhr.setParam("website","https://friendiqa.ma-nic.de");
xhr.post();
}
}
}
Connections{
target: xhr
function onSuccess(text,api){
if(api=="/api/v1/instance/rules"){
let rulestext="";
let rulesarray=JSON.parse(text)
for (let rule in rulesarray){
rulestext=rulestext+rulesarray[rule].text+"\n"
}
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
var rulesdialog = component.createObject(accountPage,{"rules": rulestext});
rulesdialog.open();
}
else if(api=="/api/statusnet/config"){
try{let serverdata = JSON.parse(text);
servericon.visible=true;
servericon.source=serverdata.site.logo;
servericon.serverconfig=serverdata;
}
catch(e){print(e)}
}
else if (api=="/api/v1/apps"){print("/api/v1/apps text "+text)
let app=JSON.parse(text);
accountPage.appdata=app;
oauth2.setClientId(app.client_id);
oauth2.setClientSecret(app.client_secret);
oauth2.setServer(servername.text);
oauth2.grant();
}
}
function onError(text,api){
print(api + " Error "+ text)
}
}
Connections{
target: oauth2
function onSuccess(text){
var userconfig={server: servername.displayText, username:"", password:"", imagestore: imagestoredir,interval:"",token: text,client:Qt.btoa(JSON.stringify(appdata))}
verify(userconfig)
}
function onError(text){
Helperjs.showMessage(qsTr("Error"), qsTr("Couldn't connect to server"),root)
print ("oauth2 onerror "+text)
}
}
MButton {
id:confirmation
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Confirm")
font.pointSize: osSettings.bigFontSize
visible: false// (osSettings.osType=="Android")?userButton.text!= qsTr("User"):true
onClicked:{
accountBusy.running=true;
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir,interval:""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
else {errormessage=""}
if (errormessage=="") {verify(userconfig)}
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
}}
MButton {
id: setDefault
x: 10*root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Set as default")
font.pointSize: osSettings.bigFontSize
visible: false
onClicked:{
accountBusy.running=true;
let users=updatenews.getAccounts("username",username.text)
Service.storeConfig(db,users[0]);
Service.readConfig(db,function(userconfig){
//reset values
login=userconfig;
news=[];
contactlist=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
Helperjs.showMessage(qsTr("Success"),"Screen Name: "+users[0].username,root)
rootstackView.pop()
}}
Row{
spacing:0.5*mm
anchors.top: parent.top
anchors.topMargin: root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right
anchors.rightMargin: 1*mm
MButton {
width: 5*mm;
visible: users.length>0
text: "-"
font.pointSize: osSettings.bigFontSize
onClicked:{
var userconfig={server: servername.text, username: username.text, password: Qt.btoa(password.text)};
Service.readConfig(db,function(user){
if(userdata.token!=""){xhr.setUrl(servername.text);
xhr.setApi("/oauth/revoke");
xhr.clearParams();
xhr.setParam("client_id",user.client.client_id);
xhr.setParam("client_secret",user.client.client_secret);
xhr.setParam("token",user.token);
xhr.post();
}
},"username",username.text);
Service.deleteConfig(db,userconfig,function(){
filesystem.Directory=imagestore.text+"contacts";
filesystem.rmDir();
filesystem.Directory=imagestore.text+"albums";
filesystem.rmDir();
servername.text="https://";
servericon.visible=false;
servericon.source="";
username.text="";
password.text="";
imagestore.text="";
userButton.text=qsTr("User");
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;})
accountPage.state="new_oauth"
})
}}
MButton {
width: 5*mm;
visible: users.length>0
text: "+"
font.pointSize: osSettings.bigFontSize
onClicked:{
servername.text="https://"
servericon.visible=false;
servericon.source="";
username.text=""
password.text=""
imagestore.text=""
userButton.text=qsTr("User")
accountPage.state="new_oauth"
}
}
MButton {
width: 5*mm;
text: "?"
font.pointSize: osSettings.bigFontSize
onClicked:{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
MButton{
id:closeButton
width: 5*mm;
visible: users.length>0
text: "\uf057"
font.pointSize: osSettings.bigFontSize
onClicked:{rootstackView.pop()}
}
}
states: [
State {
name: "new_oauth"
PropertyChanges {target: username; visible: false }
PropertyChanges {target: password; visible: false}
PropertyChanges {target: ruleButton; visible: true}
},
},
State {
name:"oauth"
PropertyChanges {target: username; visible: true}
@ -561,34 +561,34 @@ Page{
}
]
Component.onCompleted: { //print("filesystem.osType " +filesystem.osType)
try{Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;
Service.readConfig(db,function(obj){
if (obj==null){
accountPage.state="new_oauth"
}
else{
userButton.text=obj.username;
servername.text=obj.server;
serverModel.insert(0,{text:obj.server})
accountPage.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;
imagestoredir=obj.imagestore;
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
if(obj.password!=""){accountPage.state="password"}
else if (obj.token!=""){accountPage.state="oauth"}
else {accountPage.state="new_oauth"}
}
Component.onCompleted: { //print("filesystem.osType " +filesystem.osType)
try{Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
})
accountPage.users=storedUsers;
Service.readConfig(db,function(obj){
if (obj==null){
accountPage.state="new_oauth"
}
else{
userButton.text=obj.username;
servername.text=obj.server;
serverModel.insert(0,{text:obj.server})
accountPage.setServericon(obj.server);
username.text= obj.username;
password.text=Qt.atob(obj.password);
imagestore.text=obj.imagestore;
imagestoredir=obj.imagestore;
if( obj.isActive==0){userButton.font.bold='true'} else {userButton.font.bold='false'}
if(obj.password!=""){accountPage.state="password"}
else if (obj.token!=""){accountPage.state="oauth"}
else {accountPage.state="new_oauth"}
}
},"isActive",0)
},"isActive",0)
})}
catch (e){//print("onCompleted" +users.count +e)
}
}
}
}

View file

@ -30,179 +30,218 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/service.js" as Service
import "qrc:/qml/configqml"
import "qrc:/qml/genericqml"
Page{
//anchors.fill: parent
width:root.width
height:root.height
width: parent.width
height: parent.height
ScrollView{
anchors.fill: parent
contentHeight: 40*root.fontFactor*osSettings.bigFontSize
contentWidth: root.width
clip:true
Label {
text: qsTr("News as")
font.pointSize:osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y: 2*root.fontFactor*osSettings.bigFontSize
}
Rectangle{
x: root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize;
width: newsTypeField.contentWidth+2*mm; height: 2*root.fontFactor*osSettings.bigFontSize
color: Material.dialogColor//"#F3F3F3"
radius: 0.5*mm
Label{
id: newsTypeField
anchors.fill: parent
font.pointSize:osSettings.bigFontSize
text:qsTr("Conversations")
Label {
text: qsTr("News as")
font.pointSize:osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y: 2*root.fontFactor*osSettings.bigFontSize
}
MouseArea{
anchors.fill:parent
onClicked:newstypemenu.popup()
}
}
Menu {
id:newstypemenu
width:12*root.fontFactor*osSettings.bigFontSize
MenuItem {
font.pointSize: osSettings.bigFontSize
text: qsTr("Timeline")
onTriggered: {newsTypeField.text=qsTr("Timeline");
Service.updateglobaloptions(root.db,"newsViewType","Timeline");}
}
MenuItem {
font.pointSize: osSettings.bigFontSize
text: qsTr("Conversations")
onTriggered: {newsTypeField.text=qsTr("Conversations");
Service.updateglobaloptions(root.db,"newsViewType","Conversations");}
}
}
Label {
text: qsTr("Max. News")
font.pointSize: osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y:8*root.fontFactor*osSettings.bigFontSize
}
Slider{ id: maxNews
x:6*root.fontFactor*osSettings.bigFontSize; y: 10*root.fontFactor*osSettings.bigFontSize;
width: root.width/2;height:2*root.fontFactor*osSettings.bigFontSize
from: 0;to:2000; stepSize: 100
value: root.globaloptions.hasOwnProperty("max_news")?root.globaloptions.max_news:1000
}
Rectangle{
color: Material.dialogColor
x: root.fontFactor*osSettings.bigFontSize; y: 10*root.fontFactor*osSettings.bigFontSize;
width: 4*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize;
radius: 0.5*mm
TextEdit{id:maxNewsText;
anchors.fill: parent
font.pointSize: osSettings.bigFontSize
verticalAlignment:TextEdit.AlignRight
color: Material.primaryTextColor
text:maxNews.value
selectByMouse: true
onTextChanged: {
Service.updateglobaloptions(root.db,"max_news",text);
Rectangle{
x: root.fontFactor*osSettings.bigFontSize; y: 4*root.fontFactor*osSettings.bigFontSize;
width: newsTypeField.contentWidth+2*mm; height: 2*root.fontFactor*osSettings.bigFontSize
color: osSettings.backgroundDimColor//"#F3F3F3"
radius: 0.5*mm
Label{
id: newsTypeField
anchors.fill: parent
font.pointSize:osSettings.bigFontSize
text:qsTr("Conversations")
}
MouseArea{
anchors.fill:parent
onClicked:newstypemenu.popup()
}
}
}
CheckBox{
id: nsfwCheckbox
x: root.fontFactor*osSettings.bigFontSize
y: 14*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.bigFontSize
text: qsTr("Hide #nsfw?")
checked:(globaloptions["hide_nsfw"]==1)?true:false
onClicked: {
toggle();
if(nsfwCheckbox.checked==true){
Service.updateglobaloptions(root.db,"hide_nsfw",0);nsfwCheckbox.checked=false;
Menu {
id:newstypemenu
width:12*root.fontFactor*osSettings.bigFontSize
MenuItem {
font.pointSize: osSettings.bigFontSize
text: qsTr("Timeline")
onTriggered: {newsTypeField.text=qsTr("Timeline");
Service.updateglobaloptions(root.db,"newsViewType","Timeline");}
}
else{
Service.updateglobaloptions(root.db,"hide_nsfw",1);nsfwCheckbox.checked=true;
MenuItem {
font.pointSize: osSettings.bigFontSize
text: qsTr("Conversations")
onTriggered: {newsTypeField.text=qsTr("Conversations");
Service.updateglobaloptions(root.db,"newsViewType","Conversations");}
}
}
}
// CheckBox{
// id: darkmodeCheckbox
// tristate:true
// x: root.fontFactor*osSettings.bigFontSize
// y: 24*root.fontFactor*osSettings.bigFontSize
// font.pointSize: osSettings.bigFontSize
// text: qsTr("Dark Mode")
// checked:(globaloptions["view_darkmode"]==1)?true:false
// onClicked: {
// toggle();
// if(darkmodeCheckbox.checked==true){
// Service.updateglobaloptions(root.db,"view_darkmode",0);darkmodeCheckbox.checked=false;
// root.Material.theme=Material.Light
// }
// else{
// Service.updateglobaloptions(root.db,"view_darkmode",1);darkmodeCheckbox.checked=true;
// root.Material.theme=Material.Dark
// }
// }
// }
Column{
x: root.fontFactor*osSettings.bigFontSize
y: 18*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Dark Mode")
font.pointSize: osSettings.systemFontSize}
Label {
text: qsTr("Max. News")
font.pointSize: osSettings.systemFontSize
x: root.fontFactor*osSettings.bigFontSize; y:8*root.fontFactor*osSettings.bigFontSize
}
RadioButton{
text: qsTr("System")
checked: (globaloptions["view_darkmode"]==0 || globaloptions["view_darkmode"]==undefined)?true:false
Slider{ id: maxNews
x:6*root.fontFactor*osSettings.bigFontSize; y: 10*root.fontFactor*osSettings.bigFontSize;
width: root.width/2;height:2*root.fontFactor*osSettings.bigFontSize
from: 0;to:2000; stepSize: 100
value: root.globaloptions.hasOwnProperty("max_news")?root.globaloptions.max_news:1000
}
Rectangle{
color: osSettings.backgroundDimColor
x: root.fontFactor*osSettings.bigFontSize; y: 10*root.fontFactor*osSettings.bigFontSize;
width: 4*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize;
radius: 0.5*mm
TextEdit{id:maxNewsText;
anchors.fill: parent
font.pointSize: osSettings.bigFontSize
verticalAlignment:TextEdit.AlignRight
color: osSettings.primaryTextColor
text:maxNews.value
selectByMouse: true
onTextChanged: {
Service.updateglobaloptions(root.db,"max_news",text);
}
}
}
CheckBox{
id: nsfwCheckbox
x: root.fontFactor*osSettings.bigFontSize
y: 14*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.bigFontSize
text: qsTr("Hide #nsfw?")
checked:(globaloptions["hide_nsfw"]==1)?true:false
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",0);
root.Material.theme=Material.System
}
toggle();
if(nsfwCheckbox.checked==true){
Service.updateglobaloptions(root.db,"hide_nsfw",0);nsfwCheckbox.checked=false;
}
else{
Service.updateglobaloptions(root.db,"hide_nsfw",1);nsfwCheckbox.checked=true;
}
}
}
RadioButton{
text: qsTr("Dark")
checked: (globaloptions["view_darkmode"]==1)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",1);
root.Material.theme=Material.Dark
}
}
}
RadioButton{
text: qsTr("Light")
checked: (globaloptions["view_darkmode"]==2)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",2);
root.Material.theme=Material.Light
}
}
}
}
MButton {
anchors.right: parent.right; //anchors.rightMargin: mm;
anchors.top: parent.top
anchors.topMargin: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize;
text: "?"
font.pointSize: osSettings.bigFontSize
onClicked:{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
// CheckBox{
// id: darkmodeCheckbox
// tristate:true
// x: root.fontFactor*osSettings.bigFontSize
// y: 24*root.fontFactor*osSettings.bigFontSize
// font.pointSize: osSettings.bigFontSize
// text: qsTr("Dark Mode")
// checked:(globaloptions["view_darkmode"]==1)?true:false
// onClicked: {
// toggle();
// if(darkmodeCheckbox.checked==true){
// Service.updateglobaloptions(root.db,"view_darkmode",0);darkmodeCheckbox.checked=false;
// root.Material.theme=Material.Light
// }
// else{
// Service.updateglobaloptions(root.db,"view_darkmode",1);darkmodeCheckbox.checked=true;
// root.Material.theme=Material.Dark
// }
// }
// }
Column{
visible: osSettings.osType=="Android"
x: root.fontFactor*osSettings.bigFontSize
y: 18*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Dark Mode")
font.pointSize: osSettings.systemFontSize}
RadioButton{
text: qsTr("System")
checked: (globaloptions["view_darkmode"]==0 || globaloptions["view_darkmode"]==undefined)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",0);
root.Material.theme=Material.System
}
}
}
RadioButton{
text: qsTr("Dark")
checked: (globaloptions["view_darkmode"]==1)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",1);
root.Material.theme=Material.Dark
}
}
}
RadioButton{
text: qsTr("Light")
checked: (globaloptions["view_darkmode"]==2)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"view_darkmode",2);
root.Material.theme=Material.Light
}
}
}
}
Column{
x: root.fontFactor*osSettings.bigFontSize
y: 28*root.fontFactor*osSettings.bigFontSize
Label{
text: qsTr("Toolbar Postion")
font.pointSize: osSettings.systemFontSize}
RadioButton{
text: qsTr("Top")
checked: (globaloptions["toolbarposition"]==0 || globaloptions["toolbarposition"]==undefined)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"roottoolbarposition",0);
globaloptions.toolbarposition=0;
root.roottoolbar.position=ToolBar.Header
}
}
}
RadioButton{
text: qsTr("Bottom")
checked: (globaloptions["toolbarposition"]==1)?true:false
font.pointSize: osSettings.bigFontSize
onClicked: {
if(checked==true){
Service.updateglobaloptions(root.db,"roottoolbarposition",1);
globaloptions.toolbarposition=1;
root.roottoolbar.position=ToolBar.Footer
}
}
}
}
MButton {
anchors.right: parent.right; anchors.rightMargin: mm;
anchors.top: parent.top
anchors.topMargin: 3*root.fontFactor*osSettings.bigFontSize
//width: 2*root.fontFactor*osSettings.bigFontSize;
text: "?"
font.pointSize: osSettings.bigFontSize
onClicked:{
rootstackView.push("qrc:/qml/configqml/InfoBox.qml");
}
}
}
// MButton{

View file

@ -30,10 +30,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Dialogs 1.2
//import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/service.js" as Service
import "qrc:/qml/configqml"
import "qrc:/qml/genericqml"
@ -119,7 +118,7 @@ Page{
MButton{
id:closeButton
// height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize;
//width: 2*root.fontFactor*osSettings.bigFontSize;
anchors.top: parent.top
anchors.topMargin:2*root.fontFactor*osSettings.bigFontSize
anchors.right: parent.right

View file

@ -31,8 +31,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
Page{
//anchors.fill: parent

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
Page{
@ -41,9 +40,9 @@ Page{
textFormat: Text.RichText
width: root.width-mm
font.pointSize: osSettings.systemFontSize
color:Material.primaryTextColor
color: osSettings.primaryTextColor
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.6.8 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.6.9 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+

View file

@ -51,6 +51,7 @@ ScrollView{
spacing: 0.7*root.fontFactor*osSettings.bigFontSize
Label{
width:implicitWidth
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
text: "\uf085 "+ qsTr("Settings")
MouseArea{
@ -63,6 +64,7 @@ ScrollView{
Label{y: 2*root.fontFactor*osSettings.bigFontSize
width:implicitWidth
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
text: "\uf2bb " + qsTr("Accounts")
MouseArea{
@ -75,6 +77,7 @@ ScrollView{
Label{y: 4*root.fontFactor*osSettings.bigFontSize
width:implicitWidth
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
text: "\uf08b " +qsTr("Quit")
MouseArea{

View file

@ -31,16 +31,40 @@
import QtQuick.Window 2.0
import QtQuick 2.0
import QtQuick.Controls.Material 2.12
QtObject{
property int appWidth: Screen.desktopAvailableWidth
property int appHeight: Screen.desktopAvailableHeight
property int backKey: Qt.Key_Back
//property string attachImageDir:filesystem.cameraPath+"/"
property string osType: "Android"
property int systemFontSize: root.font.pointSize*1.1
property int bigFontSize: systemFontSize*1.3
property string imagePickQml: "ImagePicker"
property string imagePicker:'import QtQuick 2.0; import "qrc:/qml/genericqml";'+
imagePickQml+'{multiple : true;onReady: {attachImageURLs.push(imageUrl);'+
'attachImage(imageUrl)}}'
Material.theme: Material.System
property color backgroundColor: Material.backgroundColor
property color backgroundDimColor:Material.backgroundDimColor
property color primaryTextColor: Material.primaryTextColor
property color secondaryTextColor: Material.secondaryTextColor
property color dialogColor: Material.dialogColor
property color accentColor: Material.accentColor
property color buttonColor: Material.buttonColor
function setTheme(theme){
if (theme=="system"){
Material.theme=Material.System
}
else if (theme=="dark"){
Material.theme=Material.Dark
}
else if (theme=="light"){
Material.theme=Material.Light
}
}
}

View file

@ -30,7 +30,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick.Window 2.0
import QtQuick 2.0
import QtQuick 6.3
import QtQuick.Controls 6.3
QtObject{
property real appWidth: Screen.desktopAvailableWidth/4*3
property real appHeight: Screen.desktopAvailableHeight/4*3
@ -40,4 +42,25 @@ QtObject{
property int bigFontSize: systemFontSize*1.5
//property string attachImageDir:filesystem.homePath+"/Pictures/"
property string imagePickQml: "ImagePickerLinux"
//SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
//property SystemPalette name: value
property color backgroundColor: palette.window
property color backgroundDimColor: palette.button
property color primaryTextColor: palette.windowText
property color secondaryTextColor: palette.buttonText
property color dialogColor: palette.base
property color accentColor: palette.highlightedText
property color buttonColor: palette.button
function setTheme(theme){
if (theme=="system"){
//Material.theme=Material.System
}
else if (theme=="dark"){
//Material.theme=Material.Dark
}
else if (theme=="light"){
//Material.theme=Material.Light
}
}
}

View file

@ -32,12 +32,11 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/configqml"
import "qrc:/js/service.js" as Service
Rectangle{
color: Material.dialogColor
color: osSettings.dialogColor
property string adapter: ""
width: parent.width
height: 4*root.fontFactor*osSettings.bigFontSize

View file

@ -31,7 +31,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/configqml"
import "qrc:/qml/genericqml"
import "qrc:/js/service.js" as Service
@ -59,14 +58,14 @@ Page{
Rectangle{
x: root.fontFactor*osSettings.bigFontSize; y:4*root.fontFactor*osSettings.bigFontSize;
width: 4*root.fontFactor*osSettings.bigFontSize; height: 2*root.fontFactor*osSettings.bigFontSize;
color: Material.dialogColor
color: osSettings.dialogColor
radius: 0.5*mm
TextEdit{
id: messageIntervalField
anchors.fill: parent
font.pointSize: osSettings.bigFontSize
verticalAlignment:TextEdit.AlignRight
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:messageIntervalSlider.value
focus: true
selectByMouse: true

View file

@ -31,7 +31,6 @@
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
@ -115,7 +114,7 @@ Page{
x:1.5*root.fontFactor*osSettings.systemFontSize;
width:root.width-(7*root.fontFactor*osSettings.systemFontSize+mm);
height: 2.5*root.fontFactor*osSettings.systemFontSize;
color:Material.dialogColor
color:osSettings.dialogColor
selfdestroying:false
}
@ -132,10 +131,10 @@ Page{
Rectangle {
width: contactsSearchView.width
height: childrenRect.height
color: Material.backgroundColor
color: osSettings.backgroundColor
required property string section
Text {
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
text: parent.section
font.bold: true
font.pointSize: osSettings.bigFontSize

View file

@ -31,7 +31,6 @@
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
@ -146,14 +145,15 @@ Item{
Rectangle {
id:searchComponent
x: mm; y:mm
color: Material.backgroundColor
color: osSettings.backgroundColor
radius:0.5*mm
width: 10*root.fontFactor*osSettings.bigFontSize
height: 2*root.fontFactor*osSettings.bigFontSize
TextField {
id: searchText
color: Material.primaryTextColor
color: osSettings.primaryTextColor
focus: true
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
wrapMode: Text.Wrap
anchors.fill:parent
@ -193,10 +193,10 @@ Item{
Rectangle {
width: friendsView.width
height: childrenRect.height
color: Material.backgroundColor
color: osSettings.backgroundColor
required property string section
Text {
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
text: parent.section
font.bold: true
font.pointSize: osSettings.bigFontSize
@ -208,11 +208,12 @@ Item{
Component { id:headerComponent
Rectangle{
color: Material.dialogColor
color: osSettings.dialogColor
width:friendsView.width
height:6*mm
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
anchors.centerIn: parent
text:"\uf234"

View file

@ -31,7 +31,6 @@
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
@ -42,7 +41,7 @@ import "qrc:/qml/genericqml"
Rectangle {
y:1
color: Material.backgroundColor//"white"
color: osSettings.backgroundColor
function showContactdetails(contact){
// rootstack.currentIndex=0;

View file

@ -31,7 +31,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/genericqml"
@ -56,7 +55,7 @@ Item {
height: parent.height-mm
radius: 0.5*mm
border.color: "grey"
color:Material.backgroundColor
color:osSettings.backgroundColor
Rectangle{
id:namelabelRect
@ -65,13 +64,13 @@ Item {
width: wrapper.width-2
height: 3*root.fontFactor*osSettings.bigFontSize
//border.color: "light grey"
color:Material.backgroundColor
color: osSettings.backgroundColor
TextInput {
id: namelabel
anchors.fill: parent
readOnly: true
text: group.new?"":group.groupname
color: Material.secondaryTextColor//"#303030"
color: osSettings.secondaryTextColor//"#303030"
font.pointSize: osSettings.bigFontSize
}
}
@ -122,7 +121,7 @@ Item {
Rectangle{
id: detailsrectangle
anchors.top: namelabelRect.bottom
color: Material.backgroundColor
color: osSettings.backgroundColor
//anchors.topMargin: mm
x:mm
width: parent.width-2*mm

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
import "qrc:/js/service.js" as Service
@ -39,7 +38,7 @@ Rectangle {
// width:parent.width-2*mm
// height:parent.height-14*mm
anchors.fill:parent
color: Material.backgroundColor//color:"white"
color: osSettings.backgroundColor
property var profile:({})
property var attachImageURLs:[]
property var createdAtDate: new Date(profile.friendica_owner.created_at)
@ -176,6 +175,7 @@ Rectangle {
Text {
id:phototext
z:4
font.family: fontAwesome.name
text: "\uf040"
width:5*mm
anchors.top: photoImage.top
@ -206,7 +206,7 @@ Rectangle {
anchors.topMargin: 0
anchors.left: photoImage.left
wrapMode: Text.Wrap
color: Material.secondaryTextColor//"#303030"
color: osSettings.secondaryTextColor
font.pointSize: osSettings.bigFontSize
anchors.top: photoImage.bottom
}
@ -217,13 +217,13 @@ Rectangle {
Rectangle{
id:profileRect
width:profileView.width
color: Material.backgroundColor
color: osSettings.backgroundColor
height: 5*mm+profiletextfield.height
Text{
y:mm
font.pointSize: osSettings.systemFontSize
text:"<b>"+qsTr("profile id")+": </b> "+profileid+"<br>"
color:Material.primaryTextColor//"black"
color:osSettings.primaryTextColor
}
Text{
id:profiletextfield
@ -233,7 +233,7 @@ Rectangle {
wrapMode: Text.Wrap
font.pointSize: osSettings.systemFontSize
text:profiletext
color:Material.primaryTextColor
color: osSettings.primaryTextColor
onLinkActivated: Qt.openUrlExternally(link)
}
}
@ -242,7 +242,7 @@ Rectangle {
id:textcomponent
Text{
id:namelabeltext
color:Material.primaryTextColor
color: osSettings.primaryTextColor
width: namelabelflickable.width
height: implicitHeight
font.pointSize: osSettings.bigFontSize

View file

@ -33,7 +33,7 @@ import QtQuick 2.5
import QtQuick.LocalStorage 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.11
import QSystemTrayIcon 1.0
import "qrc:/js/news.js" as Newsjs
@ -45,7 +45,7 @@ ApplicationWindow{
id:root
title: "Friendiqa"
property var globaloptions: Service.readGO(db)
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettingsLinux.qml");return tmp.createObject(root)}
property QtObject osSettings: {var tmp=Qt.createComponent("qrc:/qml/configqml/OSSettings"+filesystem.osType+".qml");return tmp.createObject(root)}
width: globaloptions.hasOwnProperty("appWidth")?globaloptions.appWidth:osSettings.appWidth
height:globaloptions.hasOwnProperty("appHeight")?globaloptions.appHeight:osSettings.appHeight
visible: filesystem.Visibility// true
@ -75,10 +75,6 @@ ApplicationWindow{
property var contactposts:[]
property bool imagePicking: false
Material.theme: Material.System
color: Material.backgroundColor
function onLoginChanged(login){
if(login=="" || login==null){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
else{
@ -187,16 +183,18 @@ ApplicationWindow{
else {rootstack.currentIndex=0;close.accepted=false}
}
Rectangle{
anchors.fill: parent
color: Material.backgroundColor
color: osSettings.backgroundColor
}
header: ToolBar{
footer: ToolBar{
id: roottoolbar
//position: ToolBar.Footer//globaloptions.roottoolbarposition==0 || globaloptions.roottoolbarposition==undefined?ToolBar.Header:ToolBar.Footer
width:root.width
background: Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
RowLayout{
anchors.fill: parent
@ -209,38 +207,42 @@ ApplicationWindow{
try{while(rootstackView.depth>1){rootstackView.pop()}}catch(e){}
}
TabButton {
font.family: fontAwesome.name
text: "\uf03a"
background:Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Posts")
onDoubleClicked: {newstypeSignal("refresh")}
}
TabButton {
font.family: fontAwesome.name
text: "\uf0c0"
background:Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Contacts")
}
TabButton {
font.family: fontAwesome.name
text: "\uf03e"
background:Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Photos")
}
TabButton {
font.family: fontAwesome.name
text: "\uf073"
background:Rectangle{
anchors.fill: parent
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Calendar")
@ -249,11 +251,12 @@ ApplicationWindow{
}
}
StackView{id:rootstackView
width:root.width
height: root.height
initialItem: StackLayout{
StackView{id:rootstackView
//y:roottoolbar.height
//anchors.fill: parent
width:root.width
height: root.height-roottoolbar.contentHeight
initialItem: StackLayout{
id:rootstack
width:rootstackView.width
height: rootstackView.height
@ -283,7 +286,6 @@ StackView{id:rootstackView
}
}
QSystemTrayIcon {
id: systemTray
visible: false
@ -299,7 +301,7 @@ StackView{id:rootstackView
}
}
Component.onCompleted: {
icon = iconTray
icon = root.color<palette.text?iconTrayWhite:iconTrayBlack//iconTray
toolTip = qsTr("Click to open Friendiqa")
//&hide()
}
@ -309,9 +311,9 @@ StackView{id:rootstackView
Component.onCompleted: {
onLoginChanged(login);
globaloptions=Service.readGO(db);
if(globaloptions.view_darkmode==1){Material.theme=Material.Dark}
else if (globaloptions.view_darkmode==2){Material.theme=Material.Light}
else {Material.theme=Material.System}
if(globaloptions.view_darkmode==1){osSettings.setTheme("dark")}
else if (globaloptions.view_darkmode==2){osSettings.setTheme("light")}
else {osSettings.setTheme("system")}
if(!filesystem.Visibility){
systemTray.icon = iconTray;
// systemTray.toolTip = qsTr("Click to open Friendiqa");
@ -324,7 +326,7 @@ StackView{id:rootstackView
var IntentReceiverQml = component.createObject(root);
}
else if (osSettings.osType=="Linux"){
if (login!=""){newstypeSignal("refresh")}
//if (login!=""){newstypeSignal("refresh")}
var component = Qt.createComponent("qrc:/qml/genericqml/LinuxSync.qml");
var LinuxSyncQml = component.createObject(root);
}

View file

@ -30,7 +30,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls.Material 2.12
Rectangle{
id: blueButton
width: Math.max(mainText.width+2*mm,5*mm)
@ -48,7 +47,7 @@ Rectangle{
Text{
id:mainText
color: Material.primaryTextColor//"black"
color: osSettings.primaryTextColor
anchors.centerIn: parent
width: contentWidth
height: contentHeight
@ -67,7 +66,7 @@ Rectangle{
states: [
State { name: "Pressed"
PropertyChanges { target: blueButton; color: Material.buttonColor} }
PropertyChanges { target: blueButton; color: osSettings.buttonColor} }
]
transitions: [
Transition { to:"*"

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
Item {
@ -46,8 +45,8 @@ Item {
width:parent.width
height: parent.height
radius: 0.5*mm
border.color: Material.backgroundDimColor
color: Material.backgroundColor
border.color: osSettings.backgroundDimColor
color: osSettings.backgroundColor
Image {
id: photoImage
x:0.5*mm
@ -70,7 +69,7 @@ Item {
height: 1.1*root.fontFactor*osSettings.bigFontSize
text: contact.name
elide: contentWidth>wrapper.width-4*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
font.pointSize: osSettings.bigFontSize
}
Label {
@ -79,7 +78,7 @@ Item {
height: 1.1*root.fontFactor*osSettings.bigFontSize
text: "(@"+contact.screen_name+")"
elide: contentWidth>wrapper.width-4*root.fontFactor*osSettings.systemFontSize?Text.ElideRight:Text.ElideNone
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
font.pointSize: osSettings.bigFontSize
}
Label {
@ -89,7 +88,7 @@ Item {
maximumLineCount:2
text: Qt.atob(contact.description)!=""?contact.description:""
elide:Text.ElideRight
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
font.pointSize: osSettings.systemFontSize
}
}

View file

@ -29,8 +29,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick 2.15
import QtQuick.Controls 6.3
import "qrc:/qml/genericqml"
Item {
@ -50,6 +50,7 @@ Item {
Label{
y:2*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
text: "\uf021 " + qsTr("Refresh")
MouseArea{
@ -69,6 +70,7 @@ Item {
Label{
y:3.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Timeline"
text: "\uf1da " + qsTr("Timeline")
@ -87,6 +89,7 @@ Item {
Label{
y:5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Conversations"
text: "\uf086 " + qsTr("Conversations")
@ -107,6 +110,7 @@ Item {
Label{
y:6.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Replies"
text: "\uf0ec " + qsTr("Replies")
@ -125,6 +129,7 @@ Item {
Label{
y:8*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="DirectMessages"
text: "\uf0e0 " + qsTr("Direct Messages")
@ -141,6 +146,7 @@ Item {
Label{
y:9.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Favorites"
text: "\uf005 " + qsTr("Favorites")
@ -159,6 +165,7 @@ Item {
Label{
y:11*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Public Timeline"
text: "\uf0ac " + qsTr("Public Timeline")
@ -177,6 +184,7 @@ Item {
Label{
y:12.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Groupnews"
text: "\uf0c0 " + qsTr("Group news")
@ -195,6 +203,7 @@ Item {
Label{
y:14*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Search"
text: "\uf002 " + qsTr("Search")
@ -213,6 +222,7 @@ Item {
Label{
y:15.5*root.fontFactor*osSettings.bigFontSize
width:parent.width
font.family: fontAwesome.name
font.pointSize: osSettings.systemFontSize
font.bold: account.username==login.username && currentnewstabstatus=="Notifications"
text: "\uf0f3 " + qsTr("Notifications")

View file

@ -37,7 +37,8 @@ Item {
Connections {
target: SystemDispatcher
onDispatched: {
//onDispatched: {
function onDispatched(type, message){
if ((type === m_CHOSEN_MESSAGE) && (root.imagePicking==true)) {
var h=[];
for (var n in message.imageUrls){

View file

@ -30,9 +30,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Dialogs 1.2
import QtQuick.Controls 6.3
import QtQuick.Dialogs 6.3
import Qt.labs.folderlistmodel 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
@ -81,11 +80,12 @@ Item{
FileDialog {
id: imageFileDialog
title: "Please choose a file"
folder: shortcuts.pictures
selectFolder: false
selectMultiple: true
currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
fileMode: FileDialog.OpenFiles
//selectMultiple: true
onAccepted: {
imageUrl=imageFileDialog.fileUrls.toString();
//imageUrl=imageFileDialog.fileUrls.toString();
imageUrl=imageFileDialog.selectedFiles.toString();
ready();
}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/configqml"
Rectangle{
@ -40,7 +39,7 @@ Rectangle{
// height: root.height-bar.height
//y: bar.height
signal opened()
color: Material.backgroundColor
color: osSettings.backgroundColor
LeftDrawerScrollview{
width:parent.width-mm
@ -51,7 +50,7 @@ Rectangle{
width: 1
height: leftDrawer.height
anchors.right: leftDrawer.right
color: Material.dialogColor//"#EEEEEE"
color: osSettings.dialogColor
}
//Component.onCompleted: {opened();}
}

View file

@ -28,18 +28,18 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.6
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick 2.9
import QtQuick.Controls 6.3
Button{
id: mButton
property alias color: bg.color
width: Math.max(text.width+2*mm,2*root.fontFactor*osSettings.bigFontSize)
width: Math.max(implicitContentWidth+2*mm,3*root.fontFactor*osSettings.bigFontSize)
//radius: mm
height: 2*root.fontFactor*osSettings.bigFontSize
//color: Material.grey
height: 2.5*root.fontFactor*osSettings.bigFontSize
//color: Material.foreground
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
//highlighted:true
background: Rectangle{id:bg;color: Material.dialogColor//"#F3F3F3";
background: Rectangle{id:bg;color: osSettings.dialogColor;
radius: 0.5*mm}
}

View file

@ -30,14 +30,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls.Material 2.12
import "qrc:/js/service.js" as Service
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle{
id:permissionDialog
color: Material.backgroundColor
color: osSettings.backgroundColor
// x: mm
width: parent.width-5*mm
height:root.height/3
@ -66,7 +65,7 @@ Rectangle{
Text{ //cid not working in Friendica 02/2022
x:0.5*mm
y:0.5*mm
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text: qsTr("Friends")
}
ListView {
@ -86,7 +85,7 @@ Rectangle{
id:contactItem
Rectangle{
id:contactitemRect
color: Material.backgroundColor
color: osSettings.backgroundColor
width:contactView.width
height: 5*mm
radius: 0.5*mm
@ -94,10 +93,10 @@ Rectangle{
onContactstatusChanged:{
if(contactstatus=="positive"){contactitemRect.color="light green"}
else if (contactstatus=="negative"){contactitemRect.color= "red"}
else{contactitemRect.color= Material.backgroundColor}}
border.color:Material.frameColor
else{contactitemRect.color= osSettings.backgroundColor}}
//border.color:Material.frameColor
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:contact.screen_name
}
MouseArea{
@ -126,7 +125,7 @@ Rectangle{
}
}
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
x:contactView.width+2*mm
y:0.5*mm
text: qsTr("Groups")
@ -155,11 +154,11 @@ Rectangle{
onGroupstatusChanged:
{if(groupstatus=="positive"){groupitemRect.color="light green"}
else if (groupstatus=="negative"){groupitemRect.color= "red"}
else{groupitemRect.color= Material.backgroundColor}}
color: Material.backgroundColor
border.color: Material.frameColor
else{groupitemRect.color= osSettings.backgroundColor}}
color: osSettings.backgroundColor
//border.color: Material.frameColor
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:group.groupname
}
MouseArea{

View file

@ -31,12 +31,11 @@
import QtQuick 2.7
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
Rectangle {
id:searchComponent
color: Material.backgroundColor
color: osSettings.backgroundColor
radius:0.5*mm
property bool selfdestroying:false
/* anchors.left: parent.left
@ -48,7 +47,7 @@ Rectangle {
TextInput {
id: searchText
color: Material.primaryTextColor
color: osSettings.primaryTextColor
focus: true
font.pointSize: osSettings.bigFontSize
wrapMode: Text.Wrap

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
Dialog {

View file

@ -32,7 +32,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/service.js" as Service
@ -134,9 +133,9 @@ Page {
Component { id: contactHeader
Rectangle{
border.color: Material.backgroundDimColor
border.color: osSettings.backgroundDimColor
border.width: 1
color: Material.backgroundColor
color: osSettings.backgroundColor
width:contactView.width
height: contactView.width<35*root.fontFactor*osSettings.systemFontSize?(profileImage.height+namelabel.height+detailtext.height+7*mm):Math.max(profileImage.height,(buttonflow.height+namelabel.height+detailtext.height))+7*mm
property var createdAtDate: new Date(contact.created_at)
@ -319,7 +318,7 @@ Page {
height: implicitHeight
text:contact.name+" (@"+contact.screen_name+")"
wrapMode: Text.Wrap
color: Material.primaryTextColor
color: osSettings.primaryTextColor
font.pointSize: 1.2*osSettings.bigFontSize
font.family: "Noto Sans"
anchors.top: contactView.width<35*root.fontFactor*osSettings.systemFontSize?profileImage.bottom:buttonflow.bottom
@ -337,7 +336,7 @@ Page {
font.family: "Noto Sans"
textFormat:Text.RichText
wrapMode: Text.Wrap
color: Material.primaryTextColor
color: osSettings.primaryTextColor
text:"<b>"+qsTr("Description")+": </b> "+(Qt.atob(contact.description)!=""?contact.description:"")+"<br> <b>"+qsTr("Location")+":</b> "+contact.location+"<br> <b>"+qsTr("Posts")+":</b> "+contact.statuses_count+
"<br> <b>"+qsTr("URL")+":</b> <a href='"+ contact.url+"'>"+contact.url+"</a><br>"+
"<b>"+qsTr("Created at")+":</b> "+createdAtDate.toLocaleString(Qt.locale())+"<br>"+

View file

@ -31,15 +31,14 @@
// List of people from Friendica Activities
import QtQuick 2.0
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
Rectangle {
id:activitiesRectangle
property var activitymembers
color: Material.dialogColor
border.color: Material.frameColor
color: osSettings.dialogColor
//border.color: osSettings.frameColor
radius:0.5*mm
width:root.width/2
height:Math.min(root.height/2,(10*mm+6*activitymembers.length*mm))
@ -61,8 +60,8 @@ Rectangle {
Component {
id:activitiesContact
Rectangle{
border.color: Material.frameColor
color: Material.backgroundColor
//border.color: Material.frameColor
color: osSettings.backgroundColor
border.width: 1
radius:0.5*mm
width:parent.width
@ -77,7 +76,7 @@ Rectangle {
onStatusChanged: if (contactImage.status == Image.Error) {source="qrc:/images/defaultcontact.jpg"}
}
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
font.pointSize: osSettings.bigFontSize
anchors.left: contactImage.right
anchors.margins: 1*mm

View file

@ -30,11 +30,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls.Material 2.12
Rectangle {
id:hashtagRectangle
color:Material.dialogColor
color: osSettings.dialogColor
property alias text: hashtagText.text
radius:0.3*mm
width:hashtagText.contentWidth+mm
@ -42,7 +41,7 @@ Rectangle {
Text{
id:hashtagText
font.pointSize: osSettings.systemFontSize
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
anchors.centerIn: parent
anchors.margins: 0.5*mm
}

View file

@ -29,9 +29,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.5
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick 2.12
import QtQuick.Controls 6.3
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -177,7 +176,7 @@ Page{
Rectangle{
width: Math.max(10*root.fontFactor*osSettings.bigFontSize,uploadImage.width)
height:imageUploadView.height-4*root.fontFactor*osSettings.bigFontSize
color: Material.backgroundColor
color: osSettings.backgroundColor
Image{
id: uploadImage
width: parent.width //root.width/2-mm
@ -196,7 +195,7 @@ Page{
anchors.right: uploadImage.right
color: "black"
opacity: 0.5
Text{anchors.centerIn:parent;text: "\uf01e";color: "white"}
Text{anchors.centerIn:parent;font.family: fontAwesome.name;text: "\uf01e";color: "white"}
MouseArea{
anchors.fill:parent;
onClicked:{
@ -215,7 +214,7 @@ Page{
anchors.left: uploadImage.left
color: "black"
opacity: 0.5
Text{anchors.centerIn:parent;text: "\uf00d";color: "white"}
Text{anchors.centerIn:parent;font.family: fontAwesome.name; text: "\uf00d";color: "white"}
MouseArea{
anchors.fill:parent;
onClicked:{
@ -238,7 +237,7 @@ Page{
Rectangle{
id:descriptionRectangle
color: Material.backgroundColor
color: osSettings.backgroundColor
border.color: "grey"
anchors.top: uploadImage.bottom
anchors.topMargin: mm
@ -262,7 +261,7 @@ Page{
BlueButton{
width: 5*root.fontFactor*osSettings.bigFontSize
height:imageUploadView.height-3*root.fontFactor*osSettings.bigFontSize
color: Material.backgroundColor
color: osSettings.backgroundColor
border.color: "transparent"
text:"\u002b"
fontSize: 3*osSettings.bigFontSize

View file

@ -31,25 +31,30 @@
// message.qml
// message with buttons
import QtQuick 2.4
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.0;
import QtQuick.Dialogs 6.4;
//import Qt.labs.platform 6.3 as Platform
import io.qt.examples.texteditor 1.0;
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/js/news.js" as Newsjs
import "qrc:/qml/genericqml"
import "qrc:/qml/newsqml"
Rectangle{
color:Material.dialogColor
width:parent.width
height: messageColumn.height+2*mm
id:messageSend
visible:conversation || (newstab.newstabstatus!="Search")?true:false
Window{
color: osSettings.backgroundColor
width: parent.width
height: parent.height//messageColumn.height+2*mm
id: messageSend
property bool wideScreen : width>height
// visible: conversation || (newstab.newstabstatus!="Search")?true:false
property string parentId: ""
property bool textfocus: false
property bool conversation: false
//property bool textfocus: false
//property bool conversation: false
property string reply_to_user:""
property string windowstate:""
property alias bodyMessage: bodyField.text
property var media_ids:[]
property var contacts: []
@ -59,15 +64,15 @@ Rectangle{
property var group_allow:login.hasOwnProperty("permissions")?login.permissions[2]:[]
property var group_deny:login.hasOwnProperty("permissions")?login.permissions[3]:[]
function directmessagePrepare(friend){
messageSend.state="active";
reply_to_user=friend.screen_name;
receiverLabel.text=friend.screen_name;
}
// function directmessagePrepare(friend){
// messageSend.state="active";
// reply_to_user=friend.screen_name;
// receiverLabel.text=friend.screen_name;
// }
function sendUrls(urls){
attachImage(urls);
messageSend.state="active";
attachImage(urls);
messageSend.state="active";
}
function sendtext(text){
@ -88,24 +93,26 @@ Rectangle{
}
function statusUpdate(title,status,in_reply_to_status_id) {
print("status: "+status);
//xhr.url= login.server + "/api/statuses/update.json";
try{newsBusy.running=true;conversationBusy.running=true}catch(e){}
xhr.setAccount(login);
xhr.setApi("/api/statuses/update");
xhr.setParam("source", "Friendiqa");
xhr.setParam("htmlstatus", status);
if (parentId!="") {xhr.setParam("in_reply_to_status_id", parentId)};
xhr.setParam("status", status);
if (parentId!="") {xhr.setParam("in_reply_to_status_id", in_reply_to_status_id)};
if (title!=="") {xhr.setParam("title", title)};
// if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
// if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
// if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
// if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
// if (group_allow.length>0) {xhr.setParam("group_allow", Helperjs.cleanArray(group_allow))};
// if (group_deny.length>0) {xhr.setParam("group_deny", Helperjs.cleanArray(group_deny))};
// if (contact_allow.length>0) {xhr.setParam("contact_allow", Helperjs.cleanArray(contact_allow))};
// if (contact_deny.length>0) {xhr.setParam("contact_deny", Helperjs.cleanArray(contact_deny))};
if (media_ids.length>0) {
xhr.setParam("media_ids", media_ids.join());
}
xhr.post();
Newsjs.storeHashtags(login,db,status,root);
media_ids=[]
messageSend.close()
}
function dmUpdate(title,text,replyto,screen_name) {
@ -116,20 +123,21 @@ Rectangle{
xhr.setParam("screen_name", screen_name);
if (parentId!="") {xhr.setParam("replyto", replyto)};
xhr.post();
messageSend.close()
}
function setParent(newsitemobject){
if (newsitemobject!=""){
messageSend.state="conversation"
messageSend.reply_to_user=newsitemobject.user.screen_name;
messageSend.parentId=newsitemobject.id
} else {
messageSend.state=null;
messageSend.reply_to_user="";
messageSend.parentId="";
bodyField.text="";
}
}
// function setParent(newsitemobject){
// if (newsitemobject!=""){
// messageSend.state="conversation"
// messageSend.reply_to_user=newsitemobject.user.screen_name;
// messageSend.parentId=newsitemobject.id
// } else {
// messageSend.state=null;
// messageSend.reply_to_user="";
// messageSend.parentId="";
// bodyField.text="";
// }
// }
function contactmenu(letter){
Newsjs.listFriends(login,db,function(contacts){
@ -153,18 +161,51 @@ Rectangle{
tagSelector.visible=true
});
}
// Flickable{
// anchors.fill: parent
// contentHeight: messageColumn.height
// boundsBehavior: Flickable.StopAtBounds
Action {
id: quitAction
shortcut: StandardKey.Quit
onTriggered: messageSend.close()
}
Action {
id: copyAction
shortcut: StandardKey.Copy
onTriggered: bodyField.copy()
}
Action {
id: cutAction
shortcut: StandardKey.Cut
onTriggered: bodyField.cut()
}
Action {
id: pasteAction
shortcut: StandardKey.Paste
onTriggered: bodyField.paste()
}
Action {
id: boldAction
shortcut: StandardKey.Bold
onTriggered: document.bold = !document.bold
}
Action {
id: italicAction
shortcut: StandardKey.Italic
onTriggered: document.italic = !document.italic
}
DropArea{
anchors.fill: parent
onDropped: {
if (messageSend.state==""){messageSend.state="active"}
//if (messageSend.state==""){messageSend.state="active"}
if (drop.keys.includes('text/uri-list')){
var droptext = drop.text.replace(/(\r\n|\n|\r)/gm, ",");
imageUploadDialog.visible=true;
attachImage(droptext)}
attachImage(droptext)}
else if (drop.keys.includes('text/html')){
bodyField.append(drop.html)}
else if (drop.keys.includes('text/plain')){
@ -172,121 +213,71 @@ Rectangle{
}
}
}
Column {
y:0.5*mm
id:messageColumn
spacing: 0.5*mm
width: parent.width
height: 2.6*root.fontFactor*osSettings.bigFontSize+stackTypeDescription.height
Label{id:stackTypeDescription
width: parent.width
horizontalAlignment:Text.AlignHCenter
text: !conversation &&newsSwipeview.stacktype?qsTr(newsSwipeview.stacktype):""
font.pointSize: osSettings.bigFontSize
BlueButton{
width: root.fontFactor*osSettings.bigFontSize
height:stackTypeDescription.height
anchors.left: stackTypeDescription.left
anchors.leftMargin: 2*root.fontFactor*osSettings.bigFontSize
visible: newsSwipeview.currentIndex!=0
text:"\uf053"
fontColor: Material.hintTextColor
border.color: "transparent"
color:"transparent"
radius:0
onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex-1}
ScrollView{
width: messageSend.width-root.fontFactor*osSettings.bigFontSize
height: parent.height
clip:true
Column {
y:0.5*mm
id:messageColumn
spacing: 0.5*mm
width: messageSend.width-2*root.fontFactor*osSettings.bigFontSize
TextArea{
id:receiverLabel
x: mm
width: parent.width-2*mm
font.pointSize: osSettings.bigFontSize
placeholderText:qsTr("to:")
text: ""
visible:false
onTextChanged: {
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
}
BlueButton{
width: root.fontFactor*osSettings.bigFontSize
height:stackTypeDescription.height
anchors.right: stackTypeDescription.right
anchors.rightMargin: 2*root.fontFactor*osSettings.bigFontSize
visible: newsSwipeview.currentIndex!=newsSwipeview.count-1
text:"\uf054"
fontColor: Material.hintTextColor
border.color: "transparent"
color:"transparent"
radius:0
onClicked: {newsSwipeview.currentIndex=newsSwipeview.currentIndex+1}
TextField {
id: titleField
x: mm
width: parent.width
font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Title (optional)")
placeholderTextColor: osSettings.secondaryTextColor
visible: false
background: Rectangle{
color: osSettings.backgroundDimColor
radius: 0.5*mm
}
}
}
TextArea{
id:receiverLabel
width: messageColumn.width
font.pointSize: osSettings.bigFontSize
placeholderText:qsTr("to:")
text: ""
visible:false
onTextChanged: {
if (text!=""){contactmenu(text)} else {var receiver=getText(0,cursorPosition);contactmenu(receiver+preeditText)}}
}
TextField {
id: titleField
x: 0.5*mm
width: parent.width-mm
font.pointSize: osSettings.systemFontSize
placeholderText: qsTr("Title (optional)")
visible: false
onVisibleChanged: if ((visible==true)&&(conversation==true)){
conversationView.contentY=conversationView.contentY+titleField.height
}
}
Rectangle{
color: Material.backgroundColor
radius: 0.5*mm
visible:(conversation || (newsSwipeview.stacktype!="Notifications"))
x:mm
width: parent.width-2*mm
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
// Rectangle{
// color: osSettings.backgroundColor
// radius: 0.5*mm
// x:mm
// width: parent.width-2*mm
// height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
TextArea {
id: bodyField
property string contactprefix:""
property string placeholder: osSettings.osType=="Linux"? qsTr(" Drop your Content here."):""
anchors.fill: parent
//anchors.fill: parent
x:mm
height:Math.max(bodyField.contentHeight+4*mm,2.5*root.fontFactor*osSettings.bigFontSize)
width: parent.width
background: Rectangle{
color: osSettings.backgroundDimColor
radius: 0.5*mm
}
font.pointSize: osSettings.systemFontSize
font.family: "Noto Sans"
wrapMode: Text.Wrap
selectByMouse: true
placeholderText: conversation?"": (qsTr("What's on your mind?")+placeholder)
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
}
}
persistentSelection: true
placeholderText: (qsTr("What's on your mind?")+placeholder)
placeholderTextColor: osSettings.secondaryTextColor
textFormat: TextEdit.MarkdownText
onLinkActivated:{Qt.openUrlExternally(link)}
onActiveFocusChanged:{
if (activeFocus==true){
if (messageSend.ListView.view==null){
if ((typeof newsitem == 'undefined') || (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){}
} else if (textfocus==false){
messageSend.state="active";
messageSend.ListView.view.positionViewAtBeginning();
}
else{
messageSend.ListView.view.contentY=messageSend.ListView.view.contentY+8*mm
};
}
}
onTextChanged:{
if (text!=""){
var plaintext=getText(0,cursorPosition)
@ -302,200 +293,317 @@ Rectangle{
}else {contactSelector.visible=false}
}else{contactSelector.visible=false}
}
}
}
ListView{
id:contactSelector
visible: false
z:3
x:2*root.fontFactor*osSettings.bigFontSize
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
height: messageSend.height/2
model:contactModel
function processContactSelection(contact){
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
contact.screen_name=contact.screen_name+"+"+contacts.cid
MouseArea {
acceptedButtons: Qt.RightButton
anchors.fill: parent
onClicked: contextMenu.open()
}
if (newsSwipeview.stacktype=='DirectMessages'){
receiverLabel.text=contact.screen_name;
reply_to_user=contact.screen_name
} else {
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
}
Menu {
id: contextMenu
MenuItem {
text: qsTr("Copy")
enabled: bodyField.selectedText
action: copyAction
//onTriggered: bodyField.copy()
}
MenuItem {
text: qsTr("Cut")
enabled: bodyField.selectedText
action: cutAction
//onTriggered: bodyField.cut()
}
MenuItem {
text: qsTr("Paste")
enabled: bodyField.canPaste
action: pasteAction
//onTriggered: bodyField.paste()
}
MenuItem {
text: qsTr("Text")
enabled: bodyField.selectedText
onTriggered: print(bodyField.getFormattedText(bodyField.selectionStart,bodyField.selectionEnd))
}
//receiverLabel.text=contact.screen_name;
contactSelector.visible=false
}
delegate: ContactComponent { }
}
ListModel{id:contactModel}
ListView{
id: tagSelector
visible: false
z:3
x:2*root.fontFactor*osSettings.bigFontSize
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
height: messageSend.height/2
model:tagModel
clip: true
spacing: 0
function processTagSelection(hashtag){
bodyField.insert(bodyField.cursorPosition, hashtag+" ");
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
tagSelector.visible=false
}
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
}
ListModel{id:tagModel}
Row{
id:buttonRow
visible:false
spacing: mm
height: 2.5*root.fontFactor*osSettings.bigFontSize
x: 0.5*mm
// 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:smileyButton
text: "\uf118"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
DocumentHandler { id: document
document: bodyField.textDocument
cursorPosition: bodyField.cursorPosition
selectionStart: bodyField.selectionStart
selectionEnd: bodyField.selectionEnd
property alias bold: document.font.bold
property alias italic: document.font.italic
property alias strikeout: document.font.strikeout
//onError: function (message) { errorDialog.text = message errorDialog.open() }
}
MButton{
id:hastagButton
text: "\uf292"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
}
MButton{
id:imagesButton
visible:(newsSwipeview.stacktype!="DirectMessages")
text: "\uf03e"
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
onClicked: {
if (imageUploadDialog.visible==false){
imageUploadDialog.visible=true;
imageUploadDialog.attach()
ListView{
id:contactSelector
visible: false
z:3
x:2*root.fontFactor*osSettings.bigFontSize
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
height: messageSend.height/2
model:contactModel
function processContactSelection(contact){
if(Helperjs.getCount(db,login,"contacts","screen_name",contact.screen_name)>1){
contact.screen_name=contact.screen_name+"+"+contacts.cid
}
else{imageUploadDialog.visible=false}}
if (newsSwipeview.stacktype=='DirectMessages'){
receiverLabel.text=contact.screen_name;
reply_to_user=contact.screen_name
} else {
bodyField.remove(bodyField.getText(0,bodyField.cursorPosition).lastIndexOf(bodyField.contactprefix,bodyField.cursorPosition),bodyField.cursorPosition);
bodyField.insert(bodyField.cursorPosition, bodyField.contactprefix+contact.screen_name+" ");
bodyField.cursorPosition=bodyField.cursorPosition+contact.screen_name.length+1
}
//receiverLabel.text=contact.screen_name;
contactSelector.visible=false
}
delegate: ContactComponent { }
}
ListModel{id:contactModel}
MButton {
id: cancelButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf057"
onClicked: {
if (textfocus==true){messageSend.destroy()}
else{
bodyField.text="";
messageSend.state="";
permissionDialog.visible=false;
smileyDialog.visible=false;
imageUploadDialog.visible=false;
receiverLabel.visible=false;
reply_to_user="";
media_ids=[]
ListView{
id: tagSelector
visible: false
z:3
x:2*root.fontFactor*osSettings.bigFontSize
width: parent.width-2.2*root.fontFactor*osSettings.bigFontSize
height: messageSend.height/2
model:tagModel
clip: true
spacing: 0
function processTagSelection(hashtag){
bodyField.insert(bodyField.cursorPosition, hashtag+" ");
bodyField.cursorPosition=bodyField.cursorPosition+hashtag.length+1
tagSelector.visible=false
}
delegate: MButton {text:tag;onClicked: tagSelector.processTagSelection(tag)}
}
ListModel{id:tagModel}
Row{
id:formatRow
visible: wideScreen
spacing: mm
height: 3.5*root.fontFactor*osSettings.bigFontSize
x: 0.5*mm
MButton {
id: boldButton
text: "\uf032" // icon-bold
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Bold")
focusPolicy: Qt.NoFocus
// Don't want to close the virtual keyboard when this is clicked.
// focusPolicy: Qt.NoFocus
// checkable: true
// checked: document.bold
onClicked: {
document.bold = !document.bold;
bodyField.forceActiveFocus()
}
}
MButton {
id: italicButton
text: "\uf033" // icon-italic
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Italic")
focusPolicy: Qt.NoFocus
// focusPolicy: Qt.NoFocus
// checkable: true
// checked: document.italic
onClicked: {document.italic = !document.italic;bodyField.forceActiveFocus()}
}
MButton {
id: liststyleButton
text: "\uf03a" // icon-align-justify
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Create list")
// focusPolicy: Qt.NoFocus
// checkable: true
// checked: document.alignment == Qt.AlignJustify
onClicked: {document.liststyle = !document.liststyle;bodyField.forceActiveFocus()}
}
MButton {
id: codeblockButton
text: "\uf121" // icon-code
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Format as code")
// focusPolicy: Qt.NoFocus
// checkable: true
// checked: document.alignment == Qt.AlignJustify
onClicked: {document.codeblock = !document.codeblock;bodyField.forceActiveFocus()}
}
MButton {
id: plainButton
text: bodyField.textFormat==TextEdit.PlainText?qsTr("Rendered"):qsTr("MD") // icon-code
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Show Markdown code")
// focusPolicy: Qt.NoFocus
// checkable: true
// checked: document.alignment == Qt.AlignJustify
onClicked: {
if(bodyField.textFormat==TextEdit.PlainText){
bodyField.textFormat=TextEdit.MarkdownText;}
else {bodyField.textFormat=TextEdit.PlainText}
bodyField.forceActiveFocus()
}
}
}
MButton {
id: sendButton
height: 2*root.fontFactor*osSettings.bigFontSize
width: 2*root.fontFactor*osSettings.bigFontSize
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (conversation || newsSwipeview.stacktype!=="DirectMessages"){
if (parentId!=""){
statusUpdate(title,dmbody,parentId)
}else{
statusUpdate(title,body,parentId)}
}else {
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
}
if (conversation==true){
newstab.newstabstatus=root.globaloptions.newsViewType; rootstackView.pop(null)
PermissionDialog{id:permissionDialog;x:mm;visible: false}
SmileyDialog{id:smileyDialog;x:mm;visible: false}
MessageImageUploadDialog{id:imageUploadDialog;visible: false}
Row{
id:buttonRow
visible: true
spacing: mm
height: 3.5*root.fontFactor*osSettings.bigFontSize
x: 0.5*mm
// 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:smileyButton
text: "\uf118"
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert smiley")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
onClicked: {if (smileyDialog.visible==false){smileyDialog.visible=true} else{smileyDialog.visible=false}}
}
MButton{
id:hastagButton
text: "\uf292"
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert previous hashtag")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
onClicked: {if (tagSelector.visible==false){hashtagmenu()} else{tagSelector.visible=false}}
}
MButton{
id:imagesButton
visible:(newsSwipeview.stacktype!="DirectMessages")
text: "\uf03e"
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Insert images")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
onClicked: {
if (imageUploadDialog.visible==false){
imageUploadDialog.visible=true;
imageUploadDialog.attach()
}
else{imageUploadDialog.visible=false}}
}
MButton {
id: cancelButton
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Cancel message")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
text: "\uf057"
onClicked: {messageSend.close()}
}
MButton {
id: formatButton
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Format message")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
text: "\uf031"
onClicked: {formatRow.visible?formatRow.visible=false:formatRow.visible=true}
}
MButton {
id: sendButton
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Send message")
height: 3*root.fontFactor*osSettings.bigFontSize
width: 3*root.fontFactor*osSettings.bigFontSize
text: "\uf1d9"
onClicked: {
var title=titleField.text.replace("\"","\'");
var body=bodyField.getFormattedText(0,bodyField.length);
var dmbody=bodyField.getText(0,bodyField.length);
if (windowstate=="directmessage"){
if (reply_to_user!=""){dmUpdate(title,dmbody,parentId,reply_to_user)}
else{Helperjs.showMessage(qsTr("Error"),qsTr("No receiver supplied!"),root)}
}else {
body=body.replace(/\*\*/g,"__")
statusUpdate(title,body,parentId)
}
}
}
}
}
PermissionDialog{id:permissionDialog;x:mm;visible: false}
SmileyDialog{id:smileyDialog;x:mm;visible: false}
MessageImageUploadDialog{id:imageUploadDialog;visible: false}
}
Component.onCompleted:{
root.replySignal.connect(setParent);
root.directmessageSignal.connect(directmessagePrepare);
if(parentId!="" &&reply_to_user!=""){
receiverLabel.text=reply_to_user;
}
// root.replySignal.connect(setParent);
// root.directmessageSignal.connect(directmessagePrepare);
root.uploadSignal.connect(sendUrls);
root.sendtextSignal.connect(sendtext);
if (textfocus==true){bodyField.forceActiveFocus()}
// if (textfocus==true){bodyField.forceActiveFocus()}
}
states: [
State {
name: "active"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(newsSwipeview.stacktype!="DirectMessages")
}
PropertyChanges {
target: receiverLabel; visible:(newsSwipeview.stacktype=="DirectMessages");
}
},
State {
name: "conversation"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:(!conversation&&newsSwipeview.stacktype!="DirectMessages")
}
},
StateGroup{
state: windowstate
states: [
State {
name: "active"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: titleField; visible: true
}
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
},
State {
name: "directmessage"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: formatRow; visible: false
}
PropertyChanges {
target: titleField; visible: false
}
PropertyChanges {
target: receiverLabel; visible: true;
}
PropertyChanges {
target: imagesButton; visible: false
}
PropertyChanges {
target: formatButton; visible: false
} },
State {
name: "reply"
PropertyChanges {
target: messageColumn; height: implicitHeight
}
PropertyChanges {
target: titleField; visible: false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
}
PropertyChanges {
target: buttonRow; visible:true
}
PropertyChanges {
target: titleField; visible:false
}
PropertyChanges {
target: bodyField; placeholderText:"";focus:true
}
PropertyChanges {
target: stackTypeDescription; visible:false
}
}
]
]
}
}

View file

@ -30,12 +30,12 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls.Material 2.12
Rectangle{
id: moreComments
width: parent.width
height: 5*mm
color:Material.background//"white"
color:osSettings.backgroundColor
property int comments:0
// border.color:"grey"
// border.width:1

View file

@ -32,7 +32,6 @@
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/qml/genericqml"
Page{
@ -66,7 +65,7 @@ Page{
anchors.topMargin: 1*mm
anchors.right: parent.right
anchors.rightMargin: 1*mm
color: Material.dialogColor
color: osSettings.dialogColor
text: "\uf057"
onClicked: {
if (rootstackView.depth>1){

View file

@ -31,7 +31,6 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
@ -40,11 +39,12 @@ Rectangle{
id: newsStack
width: parent.width
height: parent.height
color: Material.backgroundColor
color: osSettings.backgroundColor
property string updateMethodNews: "refresh"
property var allchats: ({})
property int lastnewsid:0
property string newstabstatus: ""
property bool expectScreenUpdate: false
function newstypeHandling(newstype){
try{newsBusy.running=true}catch(e){print(e)};
@ -69,21 +69,25 @@ Rectangle{
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Favorites";
Service.updateView("Favorites");
expectScreenUpdate=true;
break;
case "replies":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Replies";
Service.updateView("Replies");
expectScreenUpdate=true;
break;
case "publictimeline":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Public Timeline";
Service.updateView("Public Timeline");
expectScreenUpdate=true;
break;
case "groupnews":
newsStack.updateMethodNews="refresh";
newstab.newstabstatus="Groupnews";
Service.showGroups();
expectScreenUpdate=true;
break;
case "search":
newsView.anchors.topMargin=7*mm;
@ -109,6 +113,7 @@ Rectangle{
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
expectScreenUpdate=true;
break;
default:
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
@ -126,6 +131,7 @@ Rectangle{
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
}
expectScreenUpdate=true;
}
}
@ -149,7 +155,9 @@ Rectangle{
xhr.setAccount(login);
xhr.setApi("/api/search");
xhr.setParam("q",term)
xhr.get();}
xhr.get();
expectScreenUpdate=true;
}
newsView.anchors.topMargin=mm
}
@ -201,6 +209,7 @@ Rectangle{
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
xhr.get()
expectScreenUpdate=true;
}
}
@ -232,6 +241,7 @@ Rectangle{
target:xhr
function onError(data,url,api,code){
newsBusy.running=false;
expectScreenUpdate=false;
}
function onSuccess(data,api){
const newsApiArray=["/api/statuses/friends_timeline",
@ -249,9 +259,11 @@ Rectangle{
"/api/statuses/update",
"/api/direct_messages/new"
];
if(newsApiArray.includes(api)){
if(newsApiArray.includes(api) && expectScreenUpdate==true){
expectScreenUpdate=false;
Service.processNews(api,data)
root.replySignal("")
expectScreenUpdate=false;
}
}
}
@ -261,8 +273,11 @@ Rectangle{
newsBusy.running=false;
}
function onSuccess(api){
loadDBNews();
newsBusy.running=false;
if(expectScreenUpdate){
loadDBNews();
newsBusy.running=false;
expectScreenUpdate=false;
}
}
}
@ -286,6 +301,7 @@ Rectangle{
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
}
expectScreenUpdate=true;
root.replySignal("")
}
}
@ -294,12 +310,12 @@ Rectangle{
Component { id:footerComponent
Rectangle{
border.color: "#EEEEEE"
color: Material.dialogColor
color: osSettings.dialogColor
border.width: 1
width:newsView.width
height:6*mm
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
font.pointSize: osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")
@ -308,6 +324,7 @@ Rectangle{
anchors.fill:parent
onClicked:{
if (newsModel.count==0){
expectScreenUpdate=true;
if (newsSwipeview.stacktype=="Home"){
Service.updateView(newstab.newstabstatus)
}
@ -334,11 +351,11 @@ Rectangle{
property bool viewdraggedpositive: false
property string viewtype: "news"
width: parent.width
height: parent.height-3*mm
height: parent.height//-3*mm
anchors.margins: 0.5*mm
clip: true
spacing: 0
header:MessageSend{id:messagesend;onHeightChanged: {if(state=="active"){newsView.positionViewAtBeginning()}}}
//header:MessageSend{id:messagesend;onHeightChanged: {if(state=="active"){newsView.positionViewAtBeginning()}}}
footer: footerComponent
model: newsModel
delegate: Newsitem{}
@ -397,18 +414,22 @@ Rectangle{
showNews(news)});
}
} else {
expectScreenUpdate=true;
Service.updateView(currentnewstabstatus,currentlastnews)
}
});
}
else if (newsSwipeview.stacktype=="DirectMessages"){
Service.updateView("Direct Messages")
expectScreenUpdate=true;
}
else if (newsSwipeview.stacktype=="Notifications"){
Service.updateView("Notifications")
expectScreenUpdate=true;
}
else if (newsSwipeview.stacktype=="Replies"){
Service.updateView("Replies")
expectScreenUpdate=true;
}
}

View file

@ -29,18 +29,18 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick 2.15
import QtQuick.Controls 6.3
import "qrc:/qml/newsqml"
import "qrc:/qml/genericqml"
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/service.js" as Service
Rectangle{
Page{
id:newstabitem
width:rootstack.width
height: rootstack.height-8*mm
height: rootstack.height
Timer {id:contacttimer; interval: 50; running: false; repeat: false
onTriggered: {
@ -85,48 +85,66 @@ Rectangle{
function getActivitiesView(newsitemobject){
var likeText="";var dislikeText="";var attendyesText="";var attendnoText="";var attendmaybeText=""; var self={};
try{if (newsitemobject.messagetype==0&&newsitemobject.hasOwnProperty('friendica_activities')){
if (newsitemobject.friendica_activities.like.length>0){
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
}
if (newsitemobject.friendica_activities.dislike.length>0){
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
}
if (newsitemobject.friendica_activities.attendyes.length>0){
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
}
if (newsitemobject.friendica_activities.attendno.length>0){
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
}
if (newsitemobject.friendica_activities.attendmaybe.length>0){
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
if (newsitemobject.friendica_activities.like.length>0){
if (newsitemobject.friendica_activities.like.length==1){likeText= newsitemobject.friendica_activities.like[0].name+" "+ qsTr("likes this.")}
else {likeText= newsitemobject.friendica_activities.like.length+" "+ qsTr("like this.")}
}
if (newsitemobject.friendica_activities.dislike.length>0){
if (newsitemobject.friendica_activities.dislike.length==1){dislikeText= newsitemobject.friendica_activities.dislike[0].name+" "+ qsTr("doesn't like this.")}
else {dislikeText= newsitemobject.friendica_activities.dislike.length+" "+ qsTr("don't like this.")}
}
if (newsitemobject.friendica_activities.attendyes.length>0){
if (newsitemobject.friendica_activities.attendyes.length==1){attendyesText=newsitemobject.friendica_activities.attendyes[0].name+" "+ qsTr("will attend.")}
else {attendyesText= newsitemobject.friendica_activities.attendyes.length+" "+ qsTr("persons will attend.")}
}
if (newsitemobject.friendica_activities.attendno.length>0){
if (newsitemobject.friendica_activities.attendno.length==1){attendnoText= newsitemobject.friendica_activities.attendno[0].name+" "+ qsTr("will not attend.")}
else {attendnoText= newsitemobject.friendica_activities.attendno.length+" "+ qsTr("persons will not attend.")}
}
if (newsitemobject.friendica_activities.attendmaybe.length>0){
if (newsitemobject.friendica_activities.attendmaybe.length==1){attendmaybeText= newsitemobject.friendica_activities.attendmaybe[0].name+" "+ qsTr("may attend.")}
else {attendmaybeText= newsitemobject.friendica_activities.attendmaybe.length+" "+ qsTr("persons may attend.")}
}
//var friendica_activities_self=JSON.parse(newsitemobject.friendica_activities_self);
}} catch(e){print("Activities "+e+ " "+JSON.stringify(newsitemobject.friendica_activities))}
return {likeText:likeText,dislikeText:dislikeText,attendyesText:attendyesText,attendnoText:attendnoText,attendmaybeText:attendmaybeText}
}
function openMessageSend(messageState,newsitemobject){
var parentId=""
var replyUser=""
if(newsitemobject!=""){
parentId=newsitemobject.id
replyUser=newsitemobject.user.screen_name;
}
// var messageString='import QtQuick 2.15; import QtQuick.Window 2.0; import "qrc:/qml/newsqml";'+
// ' Window{id:messageWindow; title:"Message"; width:root.width; height:root.height; '+
// 'MessageSend{state:"'+messageState+'"} Component.onCompleted: {x=Screen.width/2-width/2; y=Screen.height/2-height/2}}';
// var messageObject=Qt.createQmlObject(messageString,root,"messageOutput");
var messageObject = Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var messageWindow=messageObject.createObject(root, { parentId: parentId, reply_to_user: replyUser, windowstate: messageState });
messageWindow.show();
}
// CalendarTab{
// visible: wideScreen&&rootstackView.depth<2
// width: newstabitem.width/3
// x: newsSwipeview.width
// //anchors.left: newsSwipeview.right
// //anchors.fill: null
// }
// Rectangle{
// color: "#F8F8F8"
// height: parent.height
// width: 0.5*mm
// anchors.left: newsSwipeview.right
// }
MessageSend{}
// CalendarTab{
// visible: wideScreen&&rootstackView.depth<2
// width: newstabitem.width/3
// x: newsSwipeview.width
// //anchors.left: newsSwipeview.right
// //anchors.fill: null
// }
// Rectangle{
// color: "#F8F8F8"
// height: parent.height
// width: 0.5*mm
// anchors.left: newsSwipeview.right
// }
BlueButton{
z:2
anchors.right: parent.right
visible: !wideScreen
fontColor: "grey"
border.color: "transparent"
@ -136,6 +154,20 @@ Rectangle{
leftDrawerAndroid.visible?leftDrawerAndroid.close():leftDrawerAndroid.open()}
}
MButton{
z:2
anchors.right: parent.right
anchors.bottom: parent.bottom
// fontColor: "grey"
// border.color: "transparent"
text: "\uf040"
font.pointSize: osSettings.bigFontSize
onClicked:{
if (newsSwipeview.stacktype=="DirectMessages"){openMessageSend("directmessage","")}
else {openMessageSend("active","")}
}
}
LeftDrawerLinux{
id:leftDrawer
property var newstabstatus: newstab.newstabstatus
@ -148,22 +180,87 @@ Rectangle{
id: leftDrawerAndroid
}
TabBar {
id: newstabbar
x: leftDrawer.width
width: newsSwipeview.width
spacing: 1
position: TabBar.Header
onCurrentIndexChanged: {
newsSwipeview.currentIndex=newstabbar.currentIndex;
}
TabButton {
font.family: fontAwesome.name
font.pointSize : osSettings.bigFontSize
width: newstabbar.width/5
text: "\uf015"
background:Rectangle{
anchors.fill: parent
color: osSettings.backgroundDimColor
border.color: newsSwipeview.currentIndex==0?osSettings.accentColor:color
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Home")
onDoubleClicked: {newstypeSignal("refresh")}
}
TabButton {
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
width: newstabbar.width/5
text: "\uf0ec"
background:Rectangle{
anchors.fill: parent
color: osSettings.backgroundDimColor
border.color: newsSwipeview.currentIndex==1?osSettings.accentColor:color
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Replies")
}
TabButton {
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
width: newstabbar.width/5
text: "\uf0e0"
background:Rectangle{
anchors.fill: parent
color: osSettings.backgroundDimColor
border.color: newsSwipeview.currentIndex==2?osSettings.accentColor:color
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Direct Messages")
}
TabButton {
font.family: fontAwesome.name
font.pointSize: osSettings.bigFontSize
width: newstabbar.width/5
text: "\uf0f3"
background:Rectangle{
anchors.fill: parent
color: osSettings.backgroundDimColor
border.color: newsSwipeview.currentIndex==3?osSettings.accentColor:color
}
ToolTip.visible: pressed || hovered
ToolTip.text: qsTr("Notifications")
}
}
SwipeView{
id: newsSwipeview
property string stacktype:"Home"
currentIndex: 0
width: wideScreen&&rootstackView.depth<2?newstabitem.width-leftDrawer.width:newstabitem.width//newstabitem.width/3*2:newstabitem.width
height: newstabitem.height-4*mm
height: newstabitem.height-newstabbar.height
x: leftDrawer.width
y: newstabbar.height
function onDirectMessage(friend){currentIndex=2}
onCurrentIndexChanged: {
switch(currentIndex){
case 0: stacktype="Home";break;
case 1: stacktype="Replies";break;
case 2: stacktype="DirectMessages";break;
case 3: stacktype="Notifications";break;
default: stacktype="Home";
case 0: stacktype="Home";break;
case 1: stacktype="Replies";break;
case 2: stacktype="DirectMessages";break;
case 3: stacktype="Notifications";break;
default: stacktype="Home";
}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/news.js" as Newsjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -59,17 +58,18 @@ Item {
if (model.newsitemobject.hasOwnProperty("currentconversation")){
rootstackView.push("qrc:/qml/newsqml/Conversation.qml",{"news": model.newsitemobject.currentconversation})}
else{rootstackView.push("qrc:/qml/newsqml/Conversation.qml")};
expectScreenUpdate=true;
showConversation(index,newsitemobject)
}
Rectangle{width:newsitem.width; height: 1; anchors.bottom: newsitem.bottom;
color: Material.backgroundDimColor
color: osSettings.backgroundDimColor
}
Rectangle{
width:newsitem.width
height:newsitem.height-1
color: Material.background
color: osSettings.backgroundColor
Column {
id:toprow
@ -112,20 +112,20 @@ Item {
Label {
id:messageTypeLabel
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
text: if (newsitemobject.messagetype==1){ qsTr("Direct Message")} else if(newsitemobject.messagetype==2) {" Notification"} else {qsTr("Source: ")+newsitemobject.source}
font.pointSize: 0.6*osSettings.systemFontSize
}
Label {
id:createdAtLabel
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
font.pointSize: 0.6*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
text: " \u00B7 "+getDateDiffString(newsitemobject.dateDiff) + " " +qsTr("ago")
}
Label {
id:replytoLabel
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
font.pointSize: 0.6*osSettings.systemFontSize
font.family: "Noto Sans"
horizontalAlignment: Label.AlignRight
@ -139,8 +139,8 @@ Item {
height: itemMessage.height
onClicked: {pushConversation()}
Text {
color: Material.primaryTextColor
linkColor: Material.accentColor
color: osSettings.primaryTextColor
linkColor: osSettings.accentColor
id: itemMessage
textFormat: Text.RichText
font.family: "Noto Sans"
@ -189,12 +189,12 @@ Item {
anchors.bottom: toprow.bottom
visible: toprow.implicitHeight>3/4*root.height || newsitemobject.nsfw
text:"\uf078"
fontColor: Material.secondaryTextColor
fontColor: osSettings.secondaryTextColor
border.color: "transparent"
color: Material.backgroundColor
color: osSettings.backgroundColor
// gradient: Gradient {
// GradientStop { position: 0.0; color: "transparent" }
// GradientStop { position: 0.5; color: Material.backgroundDimColor}
// GradientStop { position: 0.5; color: osSettings.backgroundDimColor}
// }
radius:0
onClicked: {
@ -215,7 +215,7 @@ Item {
width:parent.width
spacing:mm
Label{color: Material.secondaryTextColor
Label{color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.likeText
@ -224,7 +224,7 @@ Item {
onClicked: { showActivityContacts(newsitemobject.friendica_activities.like)}
}
}
Label{color: Material.secondaryTextColor
Label{color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.dislikeText
@ -233,7 +233,7 @@ Item {
onClicked: { showActivityContacts(newsitemobject.friendica_activities.dislike)}
}
}
Label{color: Material.secondaryTextColor
Label{color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendyesText
@ -241,7 +241,7 @@ Item {
anchors.fill: parent
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendyes)}
}}
Label{color: Material.secondaryTextColor
Label{color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendnoText
@ -250,7 +250,7 @@ Item {
onClicked: { showActivityContacts(newsitemobject.friendica_activities.attendno)}
}
}
Label{color: Material.secondaryTextColor
Label{color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
text: newsitemobject.hasOwnProperty("isLastComment")?"":friendica_activities_view.attendmaybeText
@ -261,7 +261,7 @@ Item {
}
Label{
id:attendLabel
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
height:3.5*mm
font.pointSize: 0.75*osSettings.systemFontSize
horizontalAlignment: Label.AlignRight
@ -288,7 +288,7 @@ Item {
anchors.centerIn: parent
font.pointSize: osSettings.bigFontSize
font.family:fontAwesome.name
color:likeCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
color:likeCheckbox.checked?osSettings.primaryTextColor: osSettings.secondaryTextColor
text:likeCheckbox.checked?"\uf118"+"!":"\uf118"
}
}
@ -317,7 +317,7 @@ Item {
anchors.centerIn: parent
font.pointSize: osSettings.bigFontSize
font.family:fontAwesome.name
color:dislikeCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
color:dislikeCheckbox.checked?osSettings.primaryTextColor: osSettings.secondaryTextColor
text: dislikeCheckbox.checked?"\uf119"+"!":"\uf119"
}
}
@ -346,7 +346,7 @@ Item {
anchors.centerIn: parent
font.pointSize: osSettings.bigFontSize
font.family:fontAwesome.name
color: favoritedCheckbox.checked?Material.primaryTextColor: Material.secondaryTextColor
color: favoritedCheckbox.checked?osSettings.primaryTextColor: osSettings.secondaryTextColor
text:"\uf005"
}
}
@ -365,7 +365,7 @@ Item {
color:"transparent"
Text{
id:replysymbol
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
anchors.centerIn: parent
font.pointSize: osSettings.bigFontSize
font.family:fontAwesome.name
@ -374,21 +374,24 @@ Item {
MouseArea{
anchors.fill:parent
onClicked: {
var directmessage=0;
if (newsitemobject.messagetype==1){ directmessage=1}
var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
var conversation;
if (newsitem.ListView.view==null){conversation=true}
else if (newsitem.ListView.view.viewtype=="conversation"){
conversation=true
newsitem.ListView.view.currentIndex=itemindex
}
else{
conversation=false;
newsitem.ListView.view.currentIndex=itemindex
};
var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
openMessageSend("reply",newsitemobject)
}
// var directmessage=0;
// if (newsitemobject.messagetype==1){ directmessage=1}
// var replycomp=Qt.createComponent("qrc:/qml/newsqml/MessageSend.qml");
// var conversation;
// if (newsitem.ListView.view==null){conversation=true}
// else if (newsitem.ListView.view.viewtype=="conversation"){
// conversation=true
// newsitem.ListView.view.currentIndex=itemindex
// }
// else{
// conversation=false;
// newsitem.ListView.view.currentIndex=itemindex
// };
// var reply=replycomp.createObject(friendicaActivities,{parentId:newsitemobject.id,reply_to_user:newsitemobject.user.screen_name, state:"reply",conversation:conversation,textfocus:true})
// }
}
}
Rectangle{
@ -398,7 +401,7 @@ Item {
color:"transparent"
Text{
id:newsmenusymbol
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
anchors.centerIn: parent
font.pointSize: osSettings.bigFontSize
font.family:fontAwesome.name
@ -416,7 +419,7 @@ Item {
delegate: MenuItem{
contentItem: Text{
font.pointSize: osSettings.systemFontSize
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
text: parent.text
}
}
@ -483,7 +486,7 @@ Item {
delegate: MenuItem{
contentItem: Text{
font.pointSize: osSettings.systemFontSize
color: Material.secondaryTextColor
color: osSettings.secondaryTextColor
text: parent.text
}
}

View file

@ -31,7 +31,6 @@
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
Dialog {

View file

@ -32,7 +32,6 @@
import QtQuick 2.11
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.11
import QtQuick.Controls.Material 2.12
import "qrc:/js/smiley.js" as Smileyjs
import "qrc:/js/helper.js" as Helperjs
import "qrc:/qml/genericqml"
@ -42,7 +41,7 @@ Rectangle{
x: mm
width: messageColumn.width-5*mm
height:root.height/2
color: Material.backgroundColor
color: osSettings.backgroundColor
MButton{
id:closeButton
@ -64,22 +63,8 @@ Rectangle{
text:qsTr("Unicode")
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Standard")
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Addon")
font.pointSize: osSettings.systemFontSize
}
TabButton {
text: qsTr("Adult")
font.pointSize: osSettings.systemFontSize
}
}
StackLayout{
id:smileyTabView
currentIndex: smileybar.currentIndex
@ -89,7 +74,7 @@ Rectangle{
height: smileyDialog.height-4*root.fontFactor*osSettings.bigFontSize
Rectangle{
id: htmlGridTab
color: Material.backgroundColor
color: osSettings.backgroundColor
GridView {
id:htmlView
anchors.fill: parent
@ -109,97 +94,7 @@ Rectangle{
}
}
}
Rectangle{
id: coreGridTab
color: Material.backgroundColor
GridView {
id: coreSmileyView
anchors.fill: parent
cellWidth: 5*mm
cellHeight: 5*mm
clip: true
model: coreSmileyModel
delegate: smileyItem
}
ListModel{
id: coreSmileyModel
}
Component.onCompleted:{
var smileyarray=Smileyjs.core
for (var icon in smileyarray){
coreSmileyModel.append({"emoji":smileyarray[icon]})
}
}
}
Rectangle{
id: addonGridTab
color: Material.backgroundColor
GridView {
id: addonView
anchors.fill: parent
cellWidth: 5*mm
cellHeight: 5*mm
clip: true
model: addonModel
delegate: smileyItem
}
ListModel{
id: addonModel
}
Component.onCompleted:{
for (var icon in Smileyjs.addon){
addonModel.append({"emoji":Smileyjs.addon[icon]})
}
}
}
Rectangle{
id: adultGridTab
color: Material.backgroundColor
GridView {
id: adultView
anchors.fill: parent
cellWidth: 5*mm
cellHeight: 5*mm
clip: true
model: adultModel
delegate: smileyItem
}
ListModel{
id: adultModel
}
Component.onCompleted:{
for (var icon in Smileyjs.adult){
adultModel.append({"emoji":Smileyjs.adult[icon]})
}
}
}
}
Component{
id:smileyItem
AnimatedImage{id:smileyImage
width:4.5*mm
height: 4.5*mm
fillMode:Image.PreserveAspectFit
source:emoji.url
MouseArea{
anchors.fill: parent
onClicked:{
//bodyField.append(emoji.name+" ")
bodyField.insert(bodyField.cursorPosition,emoji.name+" ");
smileyDialog.visible=false
}
}
}
}
Component{
id:htmlItem

View file

@ -31,7 +31,6 @@
import QtQuick 2.5
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import "qrc:/js/helper.js" as Helperjs
import "qrc:/js/image.js" as Imagejs
import "qrc:/qml/genericqml"
@ -237,7 +236,7 @@ Page{
Rectangle{
width:root.width/2 //Math.max(20*mm,descriptionInput.contentWidth)
height:imageUploadView.height-3*root.fontFactor*osSettings.bigFontSize// 20*mm
color: Material.backgroundColor
color: osSettings.backgroundColor
Image{
id: uploadImage
width: root.width/2-mm //20*mm
@ -256,7 +255,7 @@ Page{
}
Rectangle{
color: Material.backgroundColor
color: osSettings.backgroundColor
border.color: "grey"
anchors.top: uploadImage.bottom
anchors.topMargin: mm
@ -282,7 +281,7 @@ Page{
BlueButton{
width: 5*root.fontFactor*osSettings.bigFontSize
height:imageUploadView.height-3*root.fontFactor*osSettings.bigFontSize
color: Material.backgroundColor
color: osSettings.backgroundColor
text:"\u002b"
fontSize: 3*osSettings.bigFontSize
onClicked:{

View file

@ -31,7 +31,6 @@
import QtQuick 2.5
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQml.Models 2.1
import "qrc:/js/image.js" as Imagejs
import "qrc:/js/helper.js" as Helperjs
@ -44,7 +43,7 @@ StackView{
initialItem:Rectangle {
id:fotorectangle
anchors.fill:parent
color: Material.backgroundColor
color: osSettings.backgroundColor
property var newimages:[]
property int currentimageno: 0
property bool remoteContact: false
@ -174,7 +173,7 @@ StackView{
BlueButton{
z:2
visible: !wideScreen
fontColor: Material.secondaryTextColor//"grey"
fontColor: osSettings.secondaryTextColor//"grey"
border.color: "transparent"
text: "\uf0c9"
font.pointSize: osSettings.bigFontSize
@ -287,13 +286,13 @@ StackView{
clip: true
model: visualphotoModel.parts.album
footer:Rectangle{
border.color: Material.backgroundDimColor
border.color: osSettings.backgroundDimColor
border.width: 1
color: Material.dialogColor
color: osSettings.dialogColor
width:12*mm
height:6*mm
Text{
color: Material.primaryTextColor
color: osSettings.primaryTextColor
font.pointSize: 0.75*osSettings.systemFontSize
anchors.centerIn: parent
text:qsTr("More")