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

@ -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