diff --git a/qml/harbour-tooterb.qml b/qml/harbour-tooterb.qml index b0f9abd..b50b096 100644 --- a/qml/harbour-tooterb.qml +++ b/qml/harbour-tooterb.qml @@ -35,8 +35,8 @@ import "./lib/API.js" as Logic ApplicationWindow { id: appWindow - cover: Qt.resolvedUrl("cover/CoverPage.qml") allowedOrientations: defaultAllowedOrientations + cover: Qt.resolvedUrl("cover/CoverPage.qml") Component.onCompleted: { var obj = {} Logic.mediator.installTo(obj) @@ -44,26 +44,26 @@ ApplicationWindow { console.log('confLoaded'); //console.log(JSON.stringify(Logic.conf)) if (!Logic.conf['notificationLastID']) - Logic.conf['notificationLastID'] = 0 + Logic.conf['notificationLastID'] = 0 if (Logic.conf['instance']) { - Logic.api = Logic.mastodonAPI({ - "instance": Logic.conf['instance'], - "api_user_token": "" - }) + Logic.api = Logic.mastodonAPI({ + "instance": Logic.conf['instance'], + "api_user_token": "" + }) } if (Logic.conf['login']) { - //Logic.conf['notificationLastID'] = 0 - Logic.api.setConfig("api_user_token", Logic.conf['api_user_token']) - //accounts/verify_credentials - Logic.api.get('instance', [], function(data) { - console.log(JSON.stringify(data)) - pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {}) - }) - //pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {}) + //Logic.conf['notificationLastID'] = 0 + Logic.api.setConfig("api_user_token", Logic.conf['api_user_token']) + //accounts/verify_credentials + Logic.api.get('instance', [], function(data) { + console.log(JSON.stringify(data)) + pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {}) + }) + //pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {}) } else { - pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {}) + pageStack.push(Qt.resolvedUrl("./pages/LoginPage.qml"), {}) } }) Logic.init() @@ -73,6 +73,7 @@ ApplicationWindow { //Logic.conf.notificationLastID = 0; Logic.saveData() } + Connections { target: Dbus onViewtoot: { diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml index b35ad7a..3a2cb10 100644 --- a/qml/pages/LoginPage.qml +++ b/qml/pages/LoginPage.qml @@ -39,37 +39,37 @@ Page { EnterKey.onClicked: { Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" }); Logic.api.registerApplication("Tooter", - 'http://localhost/harbour-tooter', // redirect uri, we will need this later on - ["read", "write", "follow"], //scopes - "http://grave-design.com/harbour-tooter", //website on the login screen - function(data) { + 'http://localhost/harbour-tooter', // redirect uri, we will need this later on + ["read", "write", "follow"], //scopes + "http://grave-design.com/harbour-tooter", //website on the login screen + function(data) { - console.log(data) - var conf = JSON.parse(data) - conf.instance = instance.text; - conf.login = false; + console.log(data) + var conf = JSON.parse(data) + conf.instance = instance.text; + conf.login = false; - /*conf['login'] = false; + /*conf['login'] = false; conf['mastodon_client_id'] = data['mastodon_client_id']; conf['mastodon_client_secret'] = data['mastodon_client_secret']; conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri']; delete Logic.conf;*/ - Logic.conf = conf; - console.log(JSON.stringify(conf)) - console.log(JSON.stringify(Logic.conf)) - // we got our application + Logic.conf = conf; + console.log(JSON.stringify(conf)) + console.log(JSON.stringify(Logic.conf)) + // we got our application - // our user to it! - var url = Logic.api.generateAuthLink(Logic.conf["client_id"], - Logic.conf["redirect_uri"], - "code", // oauth method - ["read", "write", "follow"] //scopes - ); - console.log(url) - webView.url = url - webView.visible = true - } - ); + // our user to it! + var url = Logic.api.generateAuthLink(Logic.conf["client_id"], + Logic.conf["redirect_uri"], + "code", // oauth method + ["read", "write", "follow"] //scopes + ); + console.log(url) + webView.url = url + webView.visible = true + } + ); } } Label { @@ -109,7 +109,7 @@ Page { if ( (url+"").substr(0, 37) === 'http://localhost/harbour-tooter?code=' || (url+"").substr(0, 38) === 'https://localhost/harbour-tooter?code=' - ) { + ) { visible = false; var vars = {}; @@ -120,22 +120,22 @@ Page { console.log(authCode) Logic.api.getAccessTokenFromAuthCode( - Logic.conf["client_id"], - Logic.conf["client_secret"], - Logic.conf["redirect_uri"], - authCode, - function(data) { - // AAAND DATA CONTAINS OUR TOKEN! - console.log(data) - data = JSON.parse(data) - console.log(JSON.stringify(data)) - console.log(JSON.stringify(data.access_token)) - Logic.conf["api_user_token"] = data.access_token - Logic.conf["login"] = true; - Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"]) - pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {}) - } - ) + Logic.conf["client_id"], + Logic.conf["client_secret"], + Logic.conf["redirect_uri"], + authCode, + function(data) { + // AAAND DATA CONTAINS OUR TOKEN! + console.log(data) + data = JSON.parse(data) + console.log(JSON.stringify(data)) + console.log(JSON.stringify(data.access_token)) + Logic.conf["api_user_token"] = data.access_token + Logic.conf["login"] = true; + Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"]) + pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {}) + } + ) } diff --git a/qml/pages/components/InfoBanner.qml b/qml/pages/components/InfoBanner.qml index 8d33b9a..06601aa 100644 --- a/qml/pages/components/InfoBanner.qml +++ b/qml/pages/components/InfoBanner.qml @@ -3,7 +3,7 @@ import Sailfish.Silica 1.0 DockedPanel { - id: root + id: root dock: Dock.Top width: parent.width height: content.height @@ -28,7 +28,7 @@ DockedPanel { right: parent.right rightMargin: Theme.horizontalPageMargin verticalCenter: parent.verticalCenter - } + } } MouseArea { diff --git a/qml/pages/components/MediaFullScreen.qml b/qml/pages/components/MediaFullScreen.qml index 324fa76..38ec83a 100644 --- a/qml/pages/components/MediaFullScreen.qml +++ b/qml/pages/components/MediaFullScreen.qml @@ -27,7 +27,7 @@ FullscreenContentPage { } Flickable { - id: videoFlickable + id: videoFlickable visible: false clip: true contentWidth: imageContainer.width diff --git a/qml/pages/components/ProfileHeader.qml b/qml/pages/components/ProfileHeader.qml index b27f024..0c8ab17 100644 --- a/qml/pages/components/ProfileHeader.qml +++ b/qml/pages/components/ProfileHeader.qml @@ -122,7 +122,7 @@ Item { rightMargin: Theme.paddingLarge } - /* Rectangle { + /* Rectangle { id: followingBg visible: (following ? true : false) radius: Theme.paddingSmall diff --git a/qml/pages/components/ProfileImage.qml b/qml/pages/components/ProfileImage.qml index 1e000b0..5c49285 100644 --- a/qml/pages/components/ProfileImage.qml +++ b/qml/pages/components/ProfileImage.qml @@ -4,7 +4,7 @@ import Sailfish.Silica 1.0 FullscreenContentPage { id: profileImage - property string image: "" + property string image: "" allowedOrientations: Orientation.All diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index c58f039..a3578d9 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -23,8 +23,8 @@ BackgroundItem { height: parent.height opacity: 0.3 gradient: Gradient { - GradientStop { position: -1.5; color: "transparent" } - GradientStop { position: 0.6; color: Theme.highlightBackgroundColor } + GradientStop { position: -1.5; color: "transparent" } + GradientStop { position: 0.6; color: Theme.highlightBackgroundColor } } } @@ -37,8 +37,8 @@ BackgroundItem { height: parent.height opacity: 0.5 gradient: Gradient { - GradientStop { position: -0.5; color: "transparent" } - GradientStop { position: 0.4; color: Theme.highlightDimmerColor } + GradientStop { position: -0.5; color: "transparent" } + GradientStop { position: 0.4; color: Theme.highlightDimmerColor } } } @@ -71,8 +71,8 @@ BackgroundItem { onStatusChanged: { if (avatar.status === Image.Error) source = "../../images/icon-m-profile.svg?" + (pressed - ? Theme.highlightColor - : Theme.primaryColor) + ? Theme.highlightColor + : Theme.primaryColor) } MouseArea { @@ -165,8 +165,8 @@ BackgroundItem { textFormat: Text.RichText font.pixelSize: Theme.fontSizeSmall linkColor: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) { - Theme.secondaryHighlightColor - } else Theme.highlightColor + Theme.secondaryHighlightColor + } else Theme.highlightColor wrapMode: Text.Wrap color: if (myList.type === "notifications" && ( model.type === "favourite" || model.type === "reblog" )) { (pressed ? Theme.secondaryHighlightColor : (!highlight ? Theme.secondaryColor : Theme.secondaryHighlightColor)) @@ -305,7 +305,7 @@ BackgroundItem { MenuItem { 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") onClicked: { var status = typeof model.favourited !== "undefined" && model.favourited