Skip to content

Commit

Permalink
sailfish: Move Accounts settings to the Accounts page completely
Browse files Browse the repository at this point in the history
The account settings are now easier accessible  and consistent since
half of the account management is already on this page.

Also convert copyright information to SPDX.

Signed-off-by: Björn Bidar <bjorn.bidar@thaodan.de>
  • Loading branch information
Thaodan committed Dec 26, 2022
1 parent 5c793ad commit b97f9a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 69 deletions.
15 changes: 15 additions & 0 deletions sailfish/qml/AccountsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ AbstractPage {

property bool _completed: false


PullDownMenu {
MenuItem {
text: quickdditManager.isSignedIn ? qsTr("Sign out") : qsTr("Sign in to Reddit")
onClicked: {
if (quickdditManager.isSignedIn) {
quickdditManager.signOut();
infoBanner.alert(qsTr("You have signed out from Reddit"));
} else {
pageStack.push(Qt.resolvedUrl("SignInPage.qml"));
}
}
}
}

Component.onCompleted: _completed = true
Binding {
// late-bind model as SilicaListView stubbornly positions view at first item otherwise.
Expand Down
82 changes: 13 additions & 69 deletions sailfish/qml/Settings.qml
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
/*
Quickddit - Reddit client for mobile phones
Copyright (C) 2014 Dickson Leong
Copyright (C) 2015-2018 Sander van Grieken
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see [http://www.gnu.org/licenses/].
Quickddit - Reddit client for mobile phones
SPDX-FileCopyrightText: Copyright (C) 2014 Dickson Leong
SPDX-FileCopyrightText: Copyright (C) 2015-2018 Sander van Grieken
SPDX-License-Identifier: GPL-3.0-or-later
*/

import QtQuick 2.0
Expand All @@ -29,6 +19,13 @@ AbstractPage {
id: settingFlickable
anchors.fill: parent

PullDownMenu {
MenuItem {
text: qsTr("Accounts")
onClicked: pageStack.push(Qt.resolvedUrl("AccountsPage.qml"));
}
}

header: Column {
id: settingColumn
width: parent.width
Expand Down Expand Up @@ -188,59 +185,6 @@ AbstractPage {
appSettings.useTor = checked;
}
}

SectionHeader { text: qsTr("Account") }

Text {
anchors { left: parent.left; right: parent.right }
font.pixelSize: constant.fontSizeMedium
color: constant.colorLight
horizontalAlignment: Text.AlignHCenter
text: quickdditManager.isSignedIn ? qsTr("Signed in to Reddit as") : qsTr("Not signed in")
}

Text {
anchors { left: parent.left; right: parent.right }
font.pixelSize: constant.fontSizeLarge
color: Theme.secondaryHighlightColor
visible: quickdditManager.isSignedIn
horizontalAlignment: Text.AlignHCenter
text: appSettings.redditUsername
}

Rectangle {
color: "transparent"
height: 20
width: 1
}

Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: constant.paddingMedium

Button {
text: quickdditManager.isSignedIn ? qsTr("Sign out") : qsTr("Sign in to Reddit")
onClicked: {
if (quickdditManager.isSignedIn) {
quickdditManager.signOut();
infoBanner.alert(qsTr("You have signed out from Reddit"));
} else {
pageStack.push(Qt.resolvedUrl("SignInPage.qml"));
}
}
}

Button {
text: qsTr("Accounts")
onClicked: pageStack.push(Qt.resolvedUrl("AccountsPage.qml"));
}
}

Rectangle {
color: "transparent"
height: constant.paddingLarge
width: 1
}
}
}
}

0 comments on commit b97f9a1

Please sign in to comment.