commit
bbafc24d1d
7 changed files with 71 additions and 70 deletions
|
@ -35,8 +35,8 @@ import "./lib/API.js" as Logic
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: appWindow
|
id: appWindow
|
||||||
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
|
||||||
allowedOrientations: defaultAllowedOrientations
|
allowedOrientations: defaultAllowedOrientations
|
||||||
|
cover: Qt.resolvedUrl("cover/CoverPage.qml")
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var obj = {}
|
var obj = {}
|
||||||
Logic.mediator.installTo(obj)
|
Logic.mediator.installTo(obj)
|
||||||
|
@ -44,26 +44,26 @@ ApplicationWindow {
|
||||||
console.log('confLoaded');
|
console.log('confLoaded');
|
||||||
//console.log(JSON.stringify(Logic.conf))
|
//console.log(JSON.stringify(Logic.conf))
|
||||||
if (!Logic.conf['notificationLastID'])
|
if (!Logic.conf['notificationLastID'])
|
||||||
Logic.conf['notificationLastID'] = 0
|
Logic.conf['notificationLastID'] = 0
|
||||||
|
|
||||||
if (Logic.conf['instance']) {
|
if (Logic.conf['instance']) {
|
||||||
Logic.api = Logic.mastodonAPI({
|
Logic.api = Logic.mastodonAPI({
|
||||||
"instance": Logic.conf['instance'],
|
"instance": Logic.conf['instance'],
|
||||||
"api_user_token": ""
|
"api_user_token": ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Logic.conf['login']) {
|
if (Logic.conf['login']) {
|
||||||
//Logic.conf['notificationLastID'] = 0
|
//Logic.conf['notificationLastID'] = 0
|
||||||
Logic.api.setConfig("api_user_token", Logic.conf['api_user_token'])
|
Logic.api.setConfig("api_user_token", Logic.conf['api_user_token'])
|
||||||
//accounts/verify_credentials
|
//accounts/verify_credentials
|
||||||
Logic.api.get('instance', [], function(data) {
|
Logic.api.get('instance', [], function(data) {
|
||||||
console.log(JSON.stringify(data))
|
console.log(JSON.stringify(data))
|
||||||
pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {})
|
pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {})
|
||||||
})
|
})
|
||||||
//pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {})
|
//pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {})
|
||||||
} else {
|
} else {
|
||||||
pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {})
|
pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Logic.init()
|
Logic.init()
|
||||||
|
@ -73,6 +73,7 @@ ApplicationWindow {
|
||||||
//Logic.conf.notificationLastID = 0;
|
//Logic.conf.notificationLastID = 0;
|
||||||
Logic.saveData()
|
Logic.saveData()
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Dbus
|
target: Dbus
|
||||||
onViewtoot: {
|
onViewtoot: {
|
||||||
|
|
|
@ -39,37 +39,37 @@ Page {
|
||||||
EnterKey.onClicked: {
|
EnterKey.onClicked: {
|
||||||
Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" });
|
Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" });
|
||||||
Logic.api.registerApplication("Tooter",
|
Logic.api.registerApplication("Tooter",
|
||||||
'http://localhost/harbour-tooter', // redirect uri, we will need this later on
|
'http://localhost/harbour-tooter', // redirect uri, we will need this later on
|
||||||
["read", "write", "follow"], //scopes
|
["read", "write", "follow"], //scopes
|
||||||
"http://grave-design.com/harbour-tooter", //website on the login screen
|
"http://grave-design.com/harbour-tooter", //website on the login screen
|
||||||
function(data) {
|
function(data) {
|
||||||
|
|
||||||
console.log(data)
|
console.log(data)
|
||||||
var conf = JSON.parse(data)
|
var conf = JSON.parse(data)
|
||||||
conf.instance = instance.text;
|
conf.instance = instance.text;
|
||||||
conf.login = false;
|
conf.login = false;
|
||||||
|
|
||||||
/*conf['login'] = false;
|
/*conf['login'] = false;
|
||||||
conf['mastodon_client_id'] = data['mastodon_client_id'];
|
conf['mastodon_client_id'] = data['mastodon_client_id'];
|
||||||
conf['mastodon_client_secret'] = data['mastodon_client_secret'];
|
conf['mastodon_client_secret'] = data['mastodon_client_secret'];
|
||||||
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
|
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
|
||||||
delete Logic.conf;*/
|
delete Logic.conf;*/
|
||||||
Logic.conf = conf;
|
Logic.conf = conf;
|
||||||
console.log(JSON.stringify(conf))
|
console.log(JSON.stringify(conf))
|
||||||
console.log(JSON.stringify(Logic.conf))
|
console.log(JSON.stringify(Logic.conf))
|
||||||
// we got our application
|
// we got our application
|
||||||
|
|
||||||
// our user to it!
|
// our user to it!
|
||||||
var url = Logic.api.generateAuthLink(Logic.conf["client_id"],
|
var url = Logic.api.generateAuthLink(Logic.conf["client_id"],
|
||||||
Logic.conf["redirect_uri"],
|
Logic.conf["redirect_uri"],
|
||||||
"code", // oauth method
|
"code", // oauth method
|
||||||
["read", "write", "follow"] //scopes
|
["read", "write", "follow"] //scopes
|
||||||
);
|
);
|
||||||
console.log(url)
|
console.log(url)
|
||||||
webView.url = url
|
webView.url = url
|
||||||
webView.visible = true
|
webView.visible = true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
|
@ -109,7 +109,7 @@ Page {
|
||||||
if (
|
if (
|
||||||
(url+"").substr(0, 37) === 'http://localhost/harbour-tooter?code=' ||
|
(url+"").substr(0, 37) === 'http://localhost/harbour-tooter?code=' ||
|
||||||
(url+"").substr(0, 38) === 'https://localhost/harbour-tooter?code='
|
(url+"").substr(0, 38) === 'https://localhost/harbour-tooter?code='
|
||||||
) {
|
) {
|
||||||
visible = false;
|
visible = false;
|
||||||
|
|
||||||
var vars = {};
|
var vars = {};
|
||||||
|
@ -120,22 +120,22 @@ Page {
|
||||||
console.log(authCode)
|
console.log(authCode)
|
||||||
|
|
||||||
Logic.api.getAccessTokenFromAuthCode(
|
Logic.api.getAccessTokenFromAuthCode(
|
||||||
Logic.conf["client_id"],
|
Logic.conf["client_id"],
|
||||||
Logic.conf["client_secret"],
|
Logic.conf["client_secret"],
|
||||||
Logic.conf["redirect_uri"],
|
Logic.conf["redirect_uri"],
|
||||||
authCode,
|
authCode,
|
||||||
function(data) {
|
function(data) {
|
||||||
// AAAND DATA CONTAINS OUR TOKEN!
|
// AAAND DATA CONTAINS OUR TOKEN!
|
||||||
console.log(data)
|
console.log(data)
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
console.log(JSON.stringify(data))
|
console.log(JSON.stringify(data))
|
||||||
console.log(JSON.stringify(data.access_token))
|
console.log(JSON.stringify(data.access_token))
|
||||||
Logic.conf["api_user_token"] = data.access_token
|
Logic.conf["api_user_token"] = data.access_token
|
||||||
Logic.conf["login"] = true;
|
Logic.conf["login"] = true;
|
||||||
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
|
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
|
||||||
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
|
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ DockedPanel {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: Theme.horizontalPageMargin
|
rightMargin: Theme.horizontalPageMargin
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
@ -122,7 +122,7 @@ Item {
|
||||||
rightMargin: Theme.paddingLarge
|
rightMargin: Theme.paddingLarge
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rectangle {
|
/* Rectangle {
|
||||||
id: followingBg
|
id: followingBg
|
||||||
visible: (following ? true : false)
|
visible: (following ? true : false)
|
||||||
radius: Theme.paddingSmall
|
radius: Theme.paddingSmall
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Sailfish.Silica 1.0
|
||||||
FullscreenContentPage {
|
FullscreenContentPage {
|
||||||
id: profileImage
|
id: profileImage
|
||||||
|
|
||||||
property string image: ""
|
property string image: ""
|
||||||
|
|
||||||
allowedOrientations: Orientation.All
|
allowedOrientations: Orientation.All
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ BackgroundItem {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
opacity: 0.3
|
opacity: 0.3
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { position: -1.5; color: "transparent" }
|
GradientStop { position: -1.5; color: "transparent" }
|
||||||
GradientStop { position: 0.6; color: Theme.highlightBackgroundColor }
|
GradientStop { position: 0.6; color: Theme.highlightBackgroundColor }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ BackgroundItem {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
GradientStop { position: -0.5; color: "transparent" }
|
GradientStop { position: -0.5; color: "transparent" }
|
||||||
GradientStop { position: 0.4; color: Theme.highlightDimmerColor }
|
GradientStop { position: 0.4; color: Theme.highlightDimmerColor }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ BackgroundItem {
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (avatar.status === Image.Error)
|
if (avatar.status === Image.Error)
|
||||||
source = "../../images/icon-m-profile.svg?" + (pressed
|
source = "../../images/icon-m-profile.svg?" + (pressed
|
||||||
? Theme.highlightColor
|
? Theme.highlightColor
|
||||||
: Theme.primaryColor)
|
: Theme.primaryColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
@ -165,8 +165,8 @@ BackgroundItem {
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
linkColor: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
|
linkColor: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
|
||||||
Theme.secondaryHighlightColor
|
Theme.secondaryHighlightColor
|
||||||
} else Theme.highlightColor
|
} else Theme.highlightColor
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
color: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
|
color: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) {
|
||||||
(pressed ? Theme.secondaryHighlightColor : (!highlight ? Theme.secondaryColor : Theme.secondaryHighlightColor))
|
(pressed ? Theme.secondaryHighlightColor : (!highlight ? Theme.secondaryColor : Theme.secondaryHighlightColor))
|
||||||
|
@ -305,7 +305,7 @@ BackgroundItem {
|
||||||
|
|
||||||
MenuItem {
|
MenuItem {
|
||||||
id: mnuFavourite
|
id: mnuFavourite
|
||||||
visible: model.type !== "follow" || model.status_visibility !== "direct"
|
visible: model.type !== "follow"
|
||||||
text: typeof model.favourited !== "undefined" && model.favourited ? qsTr("Unfavorite") : qsTr("Favorite")
|
text: typeof model.favourited !== "undefined" && model.favourited ? qsTr("Unfavorite") : qsTr("Favorite")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var status = typeof model.favourited !== "undefined" && model.favourited
|
var status = typeof model.favourited !== "undefined" && model.favourited
|
||||||
|
|
Loading…
Reference in a new issue