mirror of
https://github.com/HenkKalkwater/harbour-sailfin.git
synced 2024-11-22 09:15:18 +00:00
Fixed few bugs related to login/logout
* Pressing the logout button now brings the setup page up again * Removing a server and readding one of which the hash of the address has a higher value than the previous one does no longer cause the application to request a login each time you open it. * The method for deciding if the user is in setup has been changed. It now checks if a page in the pageStack has the property _isSetupPage, which works better than manually keeping track of state.
This commit is contained in:
parent
0357227134
commit
a358caf13e
|
@ -32,5 +32,8 @@ function itemModelImageUrl(baseUrl, itemId, tag, type, options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return baseUrl + "/Items/" + itemId + "/Images/" + type + "?tag=" + tag + extraQuery
|
return baseUrl + "/Items/" + itemId + "/Images/" + type + "?tag=" + tag + extraQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
function usePortraitCover(itemType) {
|
||||||
|
return ["Series", "Movie"].indexOf(itemType) >= 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import "pages"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: appWindow
|
id: appWindow
|
||||||
property bool isInSetup: false
|
|
||||||
property bool _hasInitialized: false
|
property bool _hasInitialized: false
|
||||||
// The global mediaPlayer instance
|
// The global mediaPlayer instance
|
||||||
readonly property MediaPlayer mediaPlayer: _mediaPlayer
|
readonly property MediaPlayer mediaPlayer: _mediaPlayer
|
||||||
|
@ -29,7 +28,14 @@ ApplicationWindow {
|
||||||
target: ApiClient
|
target: ApiClient
|
||||||
onNetworkError: errorNotification.show("Network error: " + error)
|
onNetworkError: errorNotification.show("Network error: " + error)
|
||||||
onConnectionFailed: errorNotification.show("Connect error: " + error)
|
onConnectionFailed: errorNotification.show("Connect error: " + error)
|
||||||
//onConnectionSuccess: errorNotification.show("Success: " + loginMessage)
|
//onConnectionSuccess: errorNotification.show("Success: " + loginMessage)
|
||||||
|
onSetupRequired: {
|
||||||
|
var isInSetup = pageStack.find(function (page) { return typeof page._isSetupPage !== "undefined" }) !== null
|
||||||
|
console.log("Is in setup: " + isInSetup)
|
||||||
|
if (!isInSetup) {
|
||||||
|
pageStack.replace(Qt.resolvedUrl("pages/setup/AddServerPage.qml"), {"backNavigation": false});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPlayer {
|
MediaPlayer {
|
||||||
|
@ -42,12 +48,7 @@ ApplicationWindow {
|
||||||
Connections {
|
Connections {
|
||||||
target: ApiClient
|
target: ApiClient
|
||||||
// Replace the MainPage if no server was set up.
|
// Replace the MainPage if no server was set up.
|
||||||
onSetupRequired: {
|
|
||||||
if (!isInSetup) {
|
|
||||||
isInSetup = true;
|
|
||||||
pageStack.replace(Qt.resolvedUrl("pages/setup/AddServerPage.qml"), {"backNavigation": false});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status == PageStatus.Active && !_hasInitialized) {
|
if (status == PageStatus.Active && !_hasInitialized) {
|
||||||
|
|
|
@ -73,7 +73,6 @@ Page {
|
||||||
clip: true
|
clip: true
|
||||||
height: {
|
height: {
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
console.log(collectionType)
|
|
||||||
if (["tvshows", "movies"].indexOf(collectionType) == -1) {
|
if (["tvshows", "movies"].indexOf(collectionType) == -1) {
|
||||||
Constants.libraryDelegateHeight
|
Constants.libraryDelegateHeight
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,7 +98,7 @@ Page {
|
||||||
/*model.imageTags["Primary"] ? ApiClient.baseUrl + "/Items/" + model.id
|
/*model.imageTags["Primary"] ? ApiClient.baseUrl + "/Items/" + model.id
|
||||||
+ "/Images/Primary?maxHeight=" + height + "&tag=" + model.imageTags["Primary"]
|
+ "/Images/Primary?maxHeight=" + height + "&tag=" + model.imageTags["Primary"]
|
||||||
: ""*/
|
: ""*/
|
||||||
landscape: ["Series", "Movie"].indexOf(model.type) == -1
|
landscape: !Utils.usePortraitCover(model.type)
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pageStack.push(Qt.resolvedUrl("DetailPage.qml"), {"itemId": model.id})
|
pageStack.push(Qt.resolvedUrl("DetailPage.qml"), {"itemId": model.id})
|
||||||
|
|
|
@ -14,6 +14,7 @@ Dialog {
|
||||||
readonly property string address: serverSelect.currentItem._address
|
readonly property string address: serverSelect.currentItem._address
|
||||||
readonly property bool addressCorrect: serverSelect.currentIndex > 0 || manualAddress.acceptableInput
|
readonly property bool addressCorrect: serverSelect.currentIndex > 0 || manualAddress.acceptableInput
|
||||||
readonly property string serverName: serverSelect.currentItem._name
|
readonly property string serverName: serverSelect.currentItem._name
|
||||||
|
readonly property bool _isSetupPage: true
|
||||||
|
|
||||||
|
|
||||||
acceptDestination: AddServerConnectingPage {
|
acceptDestination: AddServerConnectingPage {
|
||||||
|
|
|
@ -35,7 +35,7 @@ Dialog {
|
||||||
onAuthenticatedChanged: {
|
onAuthenticatedChanged: {
|
||||||
if (ApiClient.authenticated) {
|
if (ApiClient.authenticated) {
|
||||||
console.log("authenticated!")
|
console.log("authenticated!")
|
||||||
pageStack.replaceAbove(pageStack.previousPage(firstPage), Qt.resolvedUrl("../MainPage.qml"))
|
pageStack.replaceAbove(null, Qt.resolvedUrl("../MainPage.qml"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onAuthenticationError: {
|
onAuthenticationError: {
|
||||||
|
|
|
@ -34,6 +34,14 @@ void FallbackCredentialsManager::get(const QString &server, const QString &user)
|
||||||
|
|
||||||
void FallbackCredentialsManager::remove(const QString &server, const QString &user) {
|
void FallbackCredentialsManager::remove(const QString &server, const QString &user) {
|
||||||
m_settings.remove(urlToGroupName(server) + "/users/" + user);
|
m_settings.remove(urlToGroupName(server) + "/users/" + user);
|
||||||
|
|
||||||
|
// Check if only the /address key is left. In this case, the server section should be removed.
|
||||||
|
m_settings.beginGroup(urlToGroupName(server));
|
||||||
|
int childGroupsCount = m_settings.childGroups().count();
|
||||||
|
m_settings.endGroup();
|
||||||
|
if (childGroupsCount == 0) {
|
||||||
|
m_settings.remove(urlToGroupName(server));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FallbackCredentialsManager::listServers() const {
|
void FallbackCredentialsManager::listServers() const {
|
||||||
|
|
|
@ -109,26 +109,31 @@
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Login</source>
|
<source>Login</source>
|
||||||
|
<extracomment>Dialog action</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Credentials</source>
|
<source>Credentials</source>
|
||||||
|
<extracomment>Section header for entering username and password</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Username</source>
|
<source>Username</source>
|
||||||
|
<extracomment>Label placeholder for username field</extracomment>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Password</source>
|
<source>Password</source>
|
||||||
<translation type="unfinished"></translation>
|
<extracomment>Label placeholder for password field</extracomment>
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>password</source>
|
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Login message</source>
|
<source>Login message</source>
|
||||||
|
<extracomment>Message shown on login, configured by the server owner. Some form of a MOTD</extracomment>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Invalid username or password</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
@ -207,6 +212,10 @@
|
||||||
<source>Log out</source>
|
<source>Log out</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Logging out</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>UnsupportedDetails</name>
|
<name>UnsupportedDetails</name>
|
||||||
|
|
Loading…
Reference in a new issue