baseUrl esposto a QML come Q_INVOKABLE: fix TypeError su MainPage/SearchPage/BookDetailPage

This commit is contained in:
2026-08-12 11:05:06 +02:00
parent 5f97cb45bf
commit 0c6c28aa4e
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ Page {
function resolveUrl(u) { function resolveUrl(u) {
if (u.indexOf("http://") === 0 || u.indexOf("https://") === 0) if (u.indexOf("http://") === 0 || u.indexOf("https://") === 0)
return u return u
var base = appSettings.baseUrl var base = appSettings.baseUrl()
return base + (u.charAt(0) === "/" ? u : "/" + u) return base + (u.charAt(0) === "/" ? u : "/" + u)
} }
+1 -1
View File
@@ -72,7 +72,7 @@ Page {
} }
function loadIndex() { function loadIndex() {
var base = appSettings.baseUrl var base = appSettings.baseUrl()
if (base.length === 0) { if (base.length === 0) {
page.errorMessage = "Server non configurato" page.errorMessage = "Server non configurato"
return return
+1 -1
View File
@@ -41,7 +41,7 @@ Page {
} }
function search() { function search() {
var base = appSettings.baseUrl var base = appSettings.baseUrl()
var query = searchField.text.trim() var query = searchField.text.trim()
if (base.length === 0 || query.length === 0) if (base.length === 0 || query.length === 0)
return return
+2 -2
View File
@@ -34,8 +34,8 @@ public:
// Header "Authorization: Basic ..." pronto da usare, vuoto se utente non impostato // Header "Authorization: Basic ..." pronto da usare, vuoto se utente non impostato
QString authHeader() const; QString authHeader() const;
// URL del server senza slash finale // URL del server senza slash finale (usabile da QML come appSettings.baseUrl())
QString baseUrl() const; Q_INVOKABLE QString baseUrl() const;
signals: signals:
void serverUrlChanged(); void serverUrlChanged();