Fix crash Close book (pop(null) differito con Timer); config condivisa nemo/defaultuser con permessi aperti a ogni scrittura
This commit is contained in:
@@ -57,10 +57,9 @@ Page {
|
|||||||
text: qsTr("Close book")
|
text: qsTr("Close book")
|
||||||
onClicked: {
|
onClicked: {
|
||||||
page.maybeSave(true)
|
page.maybeSave(true)
|
||||||
// torna alla prima pagina dello stack (MainPage):
|
// differito: pop() subito dall'handler della pagina che viene
|
||||||
// popTo(null) non è affidabile su questa Silica
|
// distrutta crasha; pop(null) = torna alla prima pagina
|
||||||
while (pageStack.depth > 1)
|
closeBookTimer.start()
|
||||||
pageStack.pop()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,6 +179,13 @@ Page {
|
|||||||
onTriggered: openChapter()
|
onTriggered: openChapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// chiusura libro differita (pop dalla MainPage, non dall'handler del ReaderPage)
|
||||||
|
Timer {
|
||||||
|
id: closeBookTimer
|
||||||
|
interval: 50
|
||||||
|
onTriggered: pageStack.pop(null)
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: page.errorMessage
|
text: page.errorMessage
|
||||||
|
|||||||
@@ -25,13 +25,17 @@ in locale.
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Aug 19 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.2.0-1
|
* Wed Aug 19 2026 Carlo Baratto <carlo@carlobaratto.it> - 0.2.0-1
|
||||||
|
- Fix crash 'Close book': pop(null) differito con Timer (distruggere la pagina
|
||||||
|
dall'handler del suo MenuItem crashava)
|
||||||
|
- Config condivisa nemo/defaultuser: permessi aperti su /home/nemo/.config/harbour
|
||||||
|
e sul file a ogni scrittura (il launcher gira come nemo, il debug SSH come
|
||||||
|
defaultuser: prima le impostazioni salvate da un lato sparivano dall'altro)
|
||||||
- Selettore lingua nelle impostazioni (System/English/Italiano, applicata al
|
- Selettore lingua nelle impostazioni (System/English/Italiano, applicata al
|
||||||
riavvio; QTranslator in main.cpp, pattern quill). Catalogo .qm nel data dir
|
riavvio; QTranslator in main.cpp, pattern quill). Catalogo .qm nel data dir
|
||||||
dell'app (/usr/share/harbour-calibreweb/translations, il validatore RPM
|
dell'app (/usr/share/harbour-calibreweb/translations, il validatore RPM
|
||||||
rifiuta /usr/share/translations)
|
rifiuta /usr/share/translations)
|
||||||
- Fix 'Close book': pop fino alla prima pagina (popTo(null) non affidabile)
|
|
||||||
- Localizzazione: lingua di default inglese (qsTr ovunque), catalogo
|
- Localizzazione: lingua di default inglese (qsTr ovunque), catalogo
|
||||||
italiano harbour-calibreweb_it.ts/.qm installato in /usr/share/translations
|
italiano harbour-calibreweb_it.ts/.qm nel data dir dell'app
|
||||||
- Fix configurazione persa: file di configurazione unico e fisso
|
- Fix configurazione persa: file di configurazione unico e fisso
|
||||||
(/home/nemo/.config/harbour/calibreweb.conf) indipendente dall'utente
|
(/home/nemo/.config/harbour/calibreweb.conf) indipendente dall'utente
|
||||||
che avvia l'app (launcher nemo / debug SSH defaultuser), con migrazione
|
che avvia l'app (launcher nemo / debug SSH defaultuser), con migrazione
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
QString Settings::configPath()
|
QString Settings::configPath()
|
||||||
@@ -16,6 +18,7 @@ Settings::Settings(QObject *parent)
|
|||||||
, m_settings(configPath(), QSettings::IniFormat)
|
, m_settings(configPath(), QSettings::IniFormat)
|
||||||
{
|
{
|
||||||
migrateIfNeeded();
|
migrateIfNeeded();
|
||||||
|
openPermissions();
|
||||||
// diagnostica: path reale del file di configurazione e valori letti all'avvio
|
// diagnostica: path reale del file di configurazione e valori letti all'avvio
|
||||||
qDebug() << "Settings file:" << m_settings.fileName();
|
qDebug() << "Settings file:" << m_settings.fileName();
|
||||||
if (m_settings.status() != QSettings::NoError)
|
if (m_settings.status() != QSettings::NoError)
|
||||||
@@ -62,11 +65,39 @@ void Settings::migrateIfNeeded()
|
|||||||
}
|
}
|
||||||
src.endGroup();
|
src.endGroup();
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
qDebug() << "Settings: importati i valori da" << cand;
|
qDebug() << "Settings: importati i valori da" << cand;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::openPermissions()
|
||||||
|
{
|
||||||
|
// Apre la catena di directory e il file di configurazione: la home di
|
||||||
|
// nemo e' 700 di default e defaultuser (debug SSH) non puo' entrarci.
|
||||||
|
// Al primo avvio dal launcher (nemo) questi permessi restano aperti, e
|
||||||
|
// da quel momento entrambi gli utenti condividono lo stesso file.
|
||||||
|
QDir home(QStringLiteral("/home/nemo"));
|
||||||
|
QFile::setPermissions(home.absolutePath(),
|
||||||
|
QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner
|
||||||
|
| QFile::ReadGroup | QFile::ExeGroup
|
||||||
|
| QFile::ReadOther | QFile::ExeOther);
|
||||||
|
QDir config(QStringLiteral("/home/nemo/.config"));
|
||||||
|
QFile::setPermissions(config.absolutePath(),
|
||||||
|
QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner
|
||||||
|
| QFile::ReadGroup | QFile::ExeGroup
|
||||||
|
| QFile::ReadOther | QFile::ExeOther);
|
||||||
|
QDir dir(QFileInfo(m_settings.fileName()).absolutePath());
|
||||||
|
QFile::setPermissions(dir.absolutePath(),
|
||||||
|
QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner
|
||||||
|
| QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup
|
||||||
|
| QFile::ReadOther | QFile::WriteOther | QFile::ExeOther);
|
||||||
|
QFile::setPermissions(m_settings.fileName(),
|
||||||
|
QFile::ReadOwner | QFile::WriteOwner
|
||||||
|
| QFile::ReadGroup | QFile::WriteGroup
|
||||||
|
| QFile::ReadOther | QFile::WriteOther);
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::serverUrl() const
|
QString Settings::serverUrl() const
|
||||||
{
|
{
|
||||||
return m_settings.value(QStringLiteral("serverUrl")).toString();
|
return m_settings.value(QStringLiteral("serverUrl")).toString();
|
||||||
@@ -78,6 +109,7 @@ void Settings::setServerUrl(const QString &value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("serverUrl"), value);
|
m_settings.setValue(QStringLiteral("serverUrl"), value);
|
||||||
m_settings.sync(); // scrivi subito su disco: l'app può crashare alla chiusura (WebView)
|
m_settings.sync(); // scrivi subito su disco: l'app può crashare alla chiusura (WebView)
|
||||||
|
openPermissions();
|
||||||
emit serverUrlChanged();
|
emit serverUrlChanged();
|
||||||
emit baseUrlChanged();
|
emit baseUrlChanged();
|
||||||
}
|
}
|
||||||
@@ -93,6 +125,7 @@ void Settings::setUsername(const QString &value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("username"), value);
|
m_settings.setValue(QStringLiteral("username"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit usernameChanged();
|
emit usernameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +140,7 @@ void Settings::setPassword(const QString &value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("password"), value);
|
m_settings.setValue(QStringLiteral("password"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit passwordChanged();
|
emit passwordChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +155,7 @@ void Settings::setIgnoreSslErrors(bool value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("ignoreSslErrors"), value);
|
m_settings.setValue(QStringLiteral("ignoreSslErrors"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit ignoreSslErrorsChanged();
|
emit ignoreSslErrorsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,6 +170,7 @@ void Settings::setReaderMargin(int value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("readerMargin"), value);
|
m_settings.setValue(QStringLiteral("readerMargin"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit readerMarginChanged();
|
emit readerMarginChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +185,7 @@ void Settings::setReaderMarginV(int value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("readerMarginV"), value);
|
m_settings.setValue(QStringLiteral("readerMarginV"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit readerMarginVChanged();
|
emit readerMarginVChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +200,7 @@ void Settings::setLanguage(const QString &value)
|
|||||||
return;
|
return;
|
||||||
m_settings.setValue(QStringLiteral("language"), value);
|
m_settings.setValue(QStringLiteral("language"), value);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
emit languageChanged();
|
emit languageChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +240,7 @@ void Settings::setBookmarkKey(int bookId, const QString &format, const QString &
|
|||||||
{
|
{
|
||||||
m_settings.setValue(QStringLiteral("bookmarks/%1/%2").arg(bookId).arg(format), key);
|
m_settings.setValue(QStringLiteral("bookmarks/%1/%2").arg(bookId).arg(format), key);
|
||||||
m_settings.sync();
|
m_settings.sync();
|
||||||
|
openPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::bookFilePath(int bookId, const QString &format) const
|
QString Settings::bookFilePath(int bookId, const QString &format) const
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ private:
|
|||||||
// Importa i valori dalla vecchia config per-utente (~/.config/harbour/...) se
|
// Importa i valori dalla vecchia config per-utente (~/.config/harbour/...) se
|
||||||
// il file condiviso e' vuoto: copre la configurazione fatta prima del fix.
|
// il file condiviso e' vuoto: copre la configurazione fatta prima del fix.
|
||||||
void migrateIfNeeded();
|
void migrateIfNeeded();
|
||||||
|
// Apre i permessi della catena /home/nemo/.config/harbour e del file:
|
||||||
|
// il launcher gira come nemo (home 700), il debug SSH come defaultuser —
|
||||||
|
// entrambi devono poter leggere/scrivere lo stesso file di configurazione.
|
||||||
|
void openPermissions();
|
||||||
|
|
||||||
QSettings m_settings;
|
QSettings m_settings;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user