forked from lubuwest/Friendiqa
updatenews error bugfix
This commit is contained in:
parent
d43c18bb76
commit
59fe1ea0df
16 changed files with 117 additions and 105 deletions
|
@ -43,11 +43,9 @@ Dialog {
|
|||
standardButtons: Dialog.Yes | Dialog.No
|
||||
modal: true
|
||||
onAccepted: {
|
||||
// username.visible=true;
|
||||
// password.visible=true;
|
||||
username.visible=true;
|
||||
ruleButton.visible=false;
|
||||
// confirmation.visible=true
|
||||
accountPage.state="oauth"
|
||||
confirmationOAuth.visible=true
|
||||
}
|
||||
onRejected: {close()}
|
||||
ScrollView{
|
||||
|
|
|
@ -67,10 +67,13 @@ Page{
|
|||
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+"/"+username.text+"/")
|
||||
{filesystem.makePath(filesystem.homePath+"/"+username.text);}
|
||||
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");
|
||||
|
@ -373,7 +376,7 @@ Page{
|
|||
rulestext=rulestext+rulesarray[rule].text+"\n"
|
||||
}
|
||||
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
|
||||
var rulesdialog = component.createObject(root,{"rules": rulestext});
|
||||
var rulesdialog = component.createObject(accountPage,{"rules": rulestext});
|
||||
rulesdialog.open();
|
||||
}
|
||||
else if(api=="/api/statusnet/config"){
|
||||
|
@ -385,7 +388,7 @@ Page{
|
|||
catch(e){print(e)}
|
||||
}
|
||||
|
||||
else if (api=="/api/v1/apps"){
|
||||
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);
|
||||
|
@ -537,23 +540,23 @@ Page{
|
|||
states: [
|
||||
State {
|
||||
name: "new_oauth"
|
||||
PropertyChanges { target: username; visible: false }
|
||||
PropertyChanges { target: password; visible: false}
|
||||
PropertyChanges { target: ruleButton; visible: true}
|
||||
PropertyChanges {target: username; visible: false }
|
||||
PropertyChanges {target: password; visible: false}
|
||||
PropertyChanges {target: ruleButton; visible: true}
|
||||
},
|
||||
State {
|
||||
name:"oauth"
|
||||
PropertyChanges {target: username; visible: true}
|
||||
PropertyChanges { target: password; visible: false}
|
||||
PropertyChanges {target: password; visible: false}
|
||||
PropertyChanges {target: confirmationOAuth; visible: true}
|
||||
PropertyChanges {target: setDefault; visible: true}
|
||||
PropertyChanges { target: confirmation; visible: false}
|
||||
PropertyChanges {target: confirmation; visible: false}
|
||||
},
|
||||
State{
|
||||
name:"password"
|
||||
PropertyChanges { target: username; visible: true }
|
||||
PropertyChanges { target: password; visible: true}
|
||||
PropertyChanges { target: confirmation; visible: true}
|
||||
PropertyChanges {target: username; visible: true }
|
||||
PropertyChanges {target: password; visible: true}
|
||||
PropertyChanges {target: confirmation; visible: true}
|
||||
PropertyChanges {target: confirmationOAuth; visible: false}
|
||||
}
|
||||
]
|
||||
|
@ -565,18 +568,24 @@ Page{
|
|||
})
|
||||
accountPage.users=storedUsers;
|
||||
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"}
|
||||
else {accountPage.state="new_oauth"}
|
||||
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)
|
||||
})}
|
||||
catch (e){//print("onCompleted" +users.count +e)
|
||||
|
|
|
@ -80,7 +80,7 @@ ApplicationWindow{
|
|||
color: Material.backgroundColor
|
||||
|
||||
function onLoginChanged(login){
|
||||
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
|
||||
if(login=="" || login==null){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
|
||||
else{
|
||||
// if (login.newsViewType!="" || login.newsViewType!=null){
|
||||
// newstab.newstabstatus=login.newsViewType;}
|
||||
|
|
|
@ -39,7 +39,6 @@ Item {
|
|||
width: parent.width
|
||||
|
||||
Label{
|
||||
|
||||
y:0.5*root.fontFactor*osSettings.bigFontSize
|
||||
width:parent.width
|
||||
height: 1.5*osSettings.bigFontSize*root.fontFactor
|
||||
|
@ -47,11 +46,6 @@ Item {
|
|||
font.pointSize: osSettings.bigFontSize
|
||||
text: account.username
|
||||
}
|
||||
// Label{
|
||||
// text:login.hasOwnProperty("server")?"@"+login.server:""
|
||||
// font.pixelSize: 5*mm
|
||||
// width: parent.width
|
||||
// }
|
||||
|
||||
Label{
|
||||
y:2*root.fontFactor*osSettings.bigFontSize
|
||||
|
@ -64,6 +58,7 @@ Item {
|
|||
login=account;
|
||||
if(!wideScreen){leftDrawerAndroid.close()}
|
||||
// newstypeSignal("refresh")
|
||||
newsBusy.running=true;
|
||||
updatenews.setDatabase();
|
||||
updatenews.login();
|
||||
updatenews.startsync();
|
||||
|
|
|
@ -124,7 +124,7 @@ Rectangle{
|
|||
messageSend.reply_to_user=newsitemobject.user.screen_name;
|
||||
messageSend.parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state="";
|
||||
messageSend.state=null;
|
||||
messageSend.reply_to_user="";
|
||||
messageSend.parentId="";
|
||||
bodyField.text="";
|
||||
|
|
|
@ -38,7 +38,6 @@ import "qrc:/js/service.js" as Service
|
|||
|
||||
Rectangle{
|
||||
id: newsStack
|
||||
//anchors.fill: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: Material.backgroundColor
|
||||
|
@ -47,17 +46,6 @@ Rectangle{
|
|||
property int lastnewsid:0
|
||||
property string newstabstatus: ""
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
z:2
|
||||
running: false
|
||||
}
|
||||
|
||||
function newstypeHandling(newstype){
|
||||
try{newsBusy.running=true}catch(e){print(e)};
|
||||
root.replySignal("");
|
||||
|
@ -215,14 +203,37 @@ Rectangle{
|
|||
xhr.get()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loadDBNews(){
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else{
|
||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target:xhr
|
||||
function onError(data,url,api,code){
|
||||
//if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
||||
newsBusy.running=false;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
const newsApiArray=["/api/statuses/friends_timeline",
|
||||
"/api/direct_messages/all",
|
||||
"/api/direct_messages/conversation",
|
||||
|
@ -244,6 +255,16 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target:updatenews
|
||||
function onError(api,data){print("updatnews error "+api);
|
||||
newsBusy.running=false;
|
||||
}
|
||||
function onSuccess(api){
|
||||
loadDBNews();
|
||||
newsBusy.running=false;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {
|
||||
|
@ -440,30 +461,8 @@ Rectangle{
|
|||
root.searchSignal.connect(search);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
swipeIndicator.visible=true;
|
||||
//newsSwipeview.height=rootstack.height
|
||||
//newsSwipeview.y=5*mm;
|
||||
//rootStackItem.state=""
|
||||
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
|
||||
newstabstatus=newstab.newstabstatus;
|
||||
var messagetype=0;
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
case "Notifications":messagetype=2;break;
|
||||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
|
||||
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews);
|
||||
})
|
||||
}
|
||||
else{
|
||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||
lastnewsid=lastid;
|
||||
showNews(dbnews)
|
||||
})}
|
||||
loadDBNews()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,6 +192,7 @@ Rectangle{
|
|||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
id: swipeIndicator
|
||||
z:5
|
||||
|
@ -203,5 +204,16 @@ Rectangle{
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
BusyIndicator{
|
||||
id: newsBusy
|
||||
anchors.horizontalCenter: newsSwipeview.horizontalCenter
|
||||
anchors.top:parent.top
|
||||
anchors.topMargin: mm
|
||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||
z:2
|
||||
running: false
|
||||
}
|
||||
|
||||
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue