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() } 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 onTextChanged: 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("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: 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 = "" } }