Files
harbour-grumpydove/qml/pages/SettingsPage.qml
T
Carlo Baratto dc401dc29c Selezione multipla e firma (0.20.0)
Selezione: modo che si accende dal menu, tap per scegliere, sposta in una
cartella qualsiasi, cestina, letti/non letti. spostaMolti legge tutti gli id
prima di muovere: dopo il primo spostamento le righe non sono piu' quelle.
Firma in Account, aggiunta solo ai messaggi nuovi.
2026-11-17 12:36:21 +01:00

284 lines
11 KiB
QML

import QtQuick 2.0
import Sailfish.Silica 1.0
// Configurazione dell'account. Nel client originale queste voci stavano in
// Tools > Personalities: qui sono i campi di un server IMAP e di uno SMTP,
// salvati in ~/.config/harbour/grumpydove/grumpydove.conf.
Page {
id: page
SilicaFlickable {
anchors.fill: parent
contentHeight: colonna.height + Theme.paddingLarge
PageHeader {
id: intestazione
title: qsTr("Account")
description: qsTr("Server di posta in arrivo e in partenza")
}
Column {
id: colonna
anchors.top: intestazione.bottom
width: parent.width
spacing: Theme.paddingMedium
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Nome dell'account")
placeholderText: qsTr("per esempio: casa")
text: account.persona
onTextChanged: account.persona = text
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Indirizzo del mittente")
placeholderText: qsTr("nome@example.org")
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
text: account.mittente
onTextChanged: account.mittente = text.trim()
}
// Firma: testo semplice, aggiunto in fondo ai messaggi nuovi.
TextArea {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Firma")
placeholderText: qsTr("facoltativa: due righe al massimo si leggono meglio")
text: account.firma
height: Math.max(Theme.itemSizeLarge * 2,
implicitHeight + Theme.paddingLarge)
onTextChanged: account.firma = text
}
SectionHeader { text: qsTr("Posta in arrivo (IMAP)") }
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Server")
placeholderText: qsTr("imap.example.org")
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
text: account.imapHost
onTextChanged: account.imapHost = text.trim()
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Porta")
inputMethodHints: Qt.ImhDigitsOnly
text: account.imapPort
onTextChanged: {
var n = parseInt(text);
if (n > 0) account.imapPort = n;
}
}
ComboBox {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Sicurezza")
currentIndex: account.imapSecurity
menu: ContextMenu {
MenuItem { text: qsTr("Nessuna") }
MenuItem { text: qsTr("STARTTLS") }
MenuItem { text: qsTr("TLS") }
}
onCurrentIndexChanged: account.imapSecurity = currentIndex
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Utente")
inputMethodHints: Qt.ImhEmailCharactersOnly | Qt.ImhNoAutoUppercase
text: account.user
onTextChanged: account.user = text
}
PasswordField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Password")
text: account.password
showEchoModeToggle: true
// Una password vuota nel campo non deve cancellare quella
// salvata: al salvataggio il valore resterebbe vuoto e il
// client smetterebbe di autenticare senza dire niente.
onTextChanged: if (text.length > 0) account.password = text
}
SectionHeader { text: qsTr("Posta in partenza (SMTP)") }
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Server")
placeholderText: qsTr("smtp.example.org")
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
text: account.smtpHost
onTextChanged: account.smtpHost = text.trim()
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Porta")
inputMethodHints: Qt.ImhDigitsOnly
text: account.smtpPort
onTextChanged: {
var n = parseInt(text);
if (n > 0) account.smtpPort = n;
}
}
ComboBox {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Sicurezza")
currentIndex: account.smtpSecurity
menu: ContextMenu {
MenuItem { text: qsTr("Nessuna") }
MenuItem { text: qsTr("STARTTLS") }
MenuItem { text: qsTr("TLS") }
}
onCurrentIndexChanged: account.smtpSecurity = currentIndex
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Messaggi da tenere per cartella")
description: qsTr("0 = tutti")
inputMethodHints: Qt.ImhDigitsOnly
text: account.keep
onTextChanged: {
var n = parseInt(text);
if (!isNaN(n)) account.keep = n;
}
}
SectionHeader { text: qsTr("Controllo automatico") }
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Ogni quanti minuti")
description: qsTr("0 = solo quando lo chiedi tu")
inputMethodHints: Qt.ImhDigitsOnly
text: engine.minutiControllo()
onTextChanged: {
var n = parseInt(text);
if (!isNaN(n)) engine.setMinutiControllo(n);
}
}
SectionHeader { text: qsTr("Notifiche push") }
Label {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.Wrap
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
text: pushService.endpoint.length > 0
? qsTr("Registrato. Questo è l'indirizzo da mettere nel watcher del server:")
: qsTr("Non registrato: serve il distributore UnifiedPush (FogHorn). Senza push la posta si controlla ogni N minuti.")
}
Label {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
wrapMode: Text.WrapAnywhere
visible: pushService.endpoint.length > 0
text: pushService.endpoint
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.primaryColor
}
SectionHeader { text: qsTr("Rubrica (CardDAV)") }
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Indirizzo del libro")
placeholderText: qsTr("https://…/addressbooks/user/contacts/")
inputMethodHints: Qt.ImhUrlCharactersOnly | Qt.ImhNoAutoUppercase
text: account.bookUrl
onTextChanged: account.bookUrl = text.trim()
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Utente del libro")
placeholderText: qsTr("vuoto = utente della posta")
text: account.bookUser
onTextChanged: account.bookUser = text.trim()
}
TextField {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
label: qsTr("Password del libro")
placeholderText: qsTr("vuota = password della posta")
echoMode: TextInput.Password
text: account.bookPassword
onTextChanged: if (text.length > 0) account.bookPassword = text
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Salva")
preferredWidth: Theme.buttonWidthSmall
onClicked: page.salva()
}
Label {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: account.configPath()
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
wrapMode: Text.Wrap
}
Label {
width: parent.width - 2 * Theme.horizontalPageMargin
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr("GrumpyDove Mobile %1").arg(appVersion)
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
}
}
VerticalScrollDecorator { }
}
function salva() {
account.save();
avviso.text = qsTr("Account salvato");
avvisoTimer.restart();
}
Label {
id: avviso
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingLarge
font.pixelSize: Theme.fontSizeSmall
color: Theme.highlightColor
}
Timer {
id: avvisoTimer
interval: 1500
onTriggered: avviso.text = ""
}
}