diff --git a/assets/LoginSheet.qml b/assets/LoginSheet.qml index 7aba311..17479b5 100644 --- a/assets/LoginSheet.qml +++ b/assets/LoginSheet.qml @@ -1,7 +1,7 @@ import bb.cascades 1.4 Sheet { - peekEnabled: false +// peekEnabled: false signal login Page { diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 1f0a37f..ce6c434 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -28,6 +28,10 @@ NavigationPane { property string endpoint property int unread: -1 property bool refreshpull: false + property bool active + + signal openLogin() + signal closeLogin() Page { Container { @@ -52,10 +56,15 @@ NavigationPane { var page = threadPage.createObject(); pnut.threadReceived.connect(page.loadThread); pnut.getThread(postModel.data(indexPath).thread_id); + page.follow.connect(pnut.followUser) + page.unfollow.connect(pnut.unfollowUser) + page.block.connect(pnut.blockUser) + page.unblock.connect(pnut.unblockUser) + page.mute.connect(pnut.muteUser) + page.unmute.connect(pnut.unmuteUser) nav.push(page); } function viewProfile(userobj) { - console.log("narf: " + JSON.stringify(userobj)) var page = profilePage.createObject(); page.user = userobj page.follow.connect(pnut.followUser) @@ -174,14 +183,8 @@ NavigationPane { NewPostSheet { id: newPostSheet onSendPost: { - console.log("send: " + text); - pnut.sendPost(text); - } - }, - LoginSheet { - id: loginSheet - onLogin: { - pnut.authorize(); + console.log("send: " + text) + pnut.sendPost(text) } }, QTimer { @@ -217,14 +220,17 @@ NavigationPane { } onAuthorizationRequired: { - loginSheet.open(); + console.log("__Got a auth required thingy") + openLogin() timer.stop(); } onAuthorizationReceived: { - loginSheet.close(); + console.log("-- THIS --") + closeLogin() pnut.getStream(endpoint, Pnut.STREAM_OLDER); timer.start(); + console.log("__Should be closed now") } onFollowSuccess: update_user_page(user) @@ -263,7 +269,7 @@ NavigationPane { onCreationCompleted: { switch (stream_type) { case "Home": - endpoint = "/posts/streams/unified"; + endpoint = "/posts/streams/unified" break; case "Global": default: @@ -271,15 +277,20 @@ NavigationPane { break; } if (_app.setting("access_token") && _app.setting("access_token").length > 0) { - pnut.getUserInfo(); - pnut.getStream(endpoint, Pnut.STREAM_OLDER); + console.log("__I think I'm authenticated") + pnut.getUserInfo() + pnut.getStream(endpoint, Pnut.STREAM_OLDER) timer.start(); } else { - loginSheet.open(); - timer.stop(); + console.log("__I am not authenticated yet") + openLogin() + timer.stop() } } + function login() { + pnut.authorize() + } function logout() { - pnut.logout(); + pnut.logout() } } diff --git a/assets/ThreadPage.qml b/assets/ThreadPage.qml index aeeb25a..eefa8bd 100644 --- a/assets/ThreadPage.qml +++ b/assets/ThreadPage.qml @@ -1,6 +1,14 @@ import bb.cascades 1.4 -Page { +Page { + + signal follow(string uid) + signal unfollow(string uid) + signal block(string uid) + signal unblock(string uid) + signal mute(string uid) + signal unmute(string uid) + Container { ListView { id: threadView @@ -19,6 +27,17 @@ Page { function getUserName() { return _app.setting("username") } + function viewProfile(userobj) { + var page = profilePage.createObject(); + page.user = userobj + page.follow.connect(follow) + page.unfollow.connect(unfollow) + page.block.connect(block) + page.unblock.connect(unblock) + page.mute.connect(mute) + page.unmute.connect(unmute) + nav.push(page); + } } } diff --git a/assets/main.qml b/assets/main.qml index cde67cc..f3ff552 100644 --- a/assets/main.qml +++ b/assets/main.qml @@ -47,6 +47,12 @@ TabbedPane { delegate: Delegate { StreamTab { stream_type: "Home" + onOpenLogin: { + loginSheet.open() + } + onCloseLogin: { + loginSheet.close() + } } } imageSource: "asset:///icons/home.png" @@ -62,6 +68,12 @@ TabbedPane { StreamTab { id: globalTab stream_type: "Global" + onOpenLogin: { + loginSheet.open() + } + onCloseLogin: { + loginSheet.close() + } } } imageSource: "asset:///icons/globe.png" @@ -70,4 +82,13 @@ TabbedPane { } } + attachedObjects: [ + LoginSheet { + id: loginSheet + onLogin: { + activePane.login() + } + } + ] + } diff --git a/buildnum b/buildnum index eafdfb0..a3090d2 100644 --- a/buildnum +++ b/buildnum @@ -1 +1 @@ -138 \ No newline at end of file +168 \ No newline at end of file diff --git a/src/Pnut.cpp b/src/Pnut.cpp index ac9bcf9..eeae90a 100644 --- a/src/Pnut.cpp +++ b/src/Pnut.cpp @@ -145,8 +145,13 @@ void Pnut::deleteRequest(QUrl url, KQOAuthParameters parameters, int id) void Pnut::onAuthorizationReceived(QString token, QString verifier) { + qDebug() << "--check check--"; + qDebug() << oauthManager->lastError(); + qDebug() << "token: " << token; + qDebug() << "verif: " << verifier; switch (oauthManager->lastError()) { + case KQOAuthManager::RequestValidationError: case KQOAuthManager::NoError: qDebug() << "- authorization received -"; m_appSettings->setValue("access_token", token); diff --git a/translations/Goober.ts b/translations/Goober.ts index 719cf46..95485ec 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -129,22 +129,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload @@ -162,7 +162,7 @@ - + Global