From 80859db2fb6746441668efc851c500695aaf4d58 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 16 Jul 2016 10:02:36 +0200 Subject: Share the settings implementation --- accounts/imap/CMakeLists.txt | 4 +- accounts/imap/imapsettings.cpp | 237 ++------------------------------- accounts/imap/imapsettings.h | 51 +------- accounts/maildir/CMakeLists.txt | 4 +- accounts/maildir/maildirsettings.cpp | 247 ++--------------------------------- accounts/maildir/maildirsettings.h | 51 +------- 6 files changed, 42 insertions(+), 552 deletions(-) (limited to 'accounts') diff --git a/accounts/imap/CMakeLists.txt b/accounts/imap/CMakeLists.txt index 07c53701..42b50899 100644 --- a/accounts/imap/CMakeLists.txt +++ b/accounts/imap/CMakeLists.txt @@ -35,11 +35,11 @@ set(SRCS add_library(imapaccountplugin SHARED ${SRCS}) qt5_use_modules(imapaccountplugin Core Quick Qml) -target_link_libraries(imapaccountplugin sink settingsplugin) +target_link_libraries(imapaccountplugin sink settingsplugin mailplugin) add_library(imapaccount_static STATIC ${SRCS}) qt5_use_modules(imapaccount_static Core Quick Qml) -target_link_libraries(imapaccount_static sink settingsplugin) +target_link_libraries(imapaccount_static sink settingsplugin mailplugin) add_subdirectory(tests) kpackage_install_package(package org.kube.accounts.imap "genericqml") diff --git a/accounts/imap/imapsettings.cpp b/accounts/imap/imapsettings.cpp index fcef8971..1f338e83 100644 --- a/accounts/imap/imapsettings.cpp +++ b/accounts/imap/imapsettings.cpp @@ -18,241 +18,32 @@ */ #include "imapsettings.h" -#include - -#include -#include -#include -#include - ImapSettings::ImapSettings(QObject *parent) - : QObject(parent) -{ -} - - -void ImapSettings::setAccountIdentifier(const QByteArray &id) -{ - if (id.isEmpty()) { - return; - } - mAccountIdentifier = id; - - //Clear - mIcon = QString(); - mName = QString(); - mImapServer = QString(); - mImapUsername = QString(); - mImapPassword = QString(); - mSmtpServer = QString(); - mSmtpUsername = QString(); - mSmtpPassword = QString(); - emit changed(); - emit imapResourceChanged(); - emit smtpResourceChanged(); - - Q_ASSERT(!id.isEmpty()); - Sink::Store::fetchOne(Sink::Query::IdentityFilter(id)) - .then([this](const Sink::ApplicationDomain::SinkAccount &account) { - mIcon = account.getProperty("icon").toString(); - mName = account.getProperty("name").toString(); - emit changed(); - }).exec(); - - Sink::Store::fetchOne(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage)) - .then([this](const Sink::ApplicationDomain::SinkResource &resource) { - mIdentifier = resource.identifier(); - mImapServer = resource.getProperty("server").toString(); - mImapUsername = resource.getProperty("username").toString(); - mImapPassword = resource.getProperty("password").toString(); - emit imapResourceChanged(); - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the imap resource: " << errorMessage; - }).exec(); - - Sink::Store::fetchOne(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport)) - .then([this](const Sink::ApplicationDomain::SinkResource &resource) { - mMailtransportIdentifier = resource.identifier(); - mSmtpServer = resource.getProperty("server").toString(); - mSmtpUsername = resource.getProperty("username").toString(); - mSmtpPassword = resource.getProperty("password").toString(); - emit smtpResourceChanged(); - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the smtp resource: " << errorMessage; - }).exec(); - - //FIXME this assumes that we only ever have one identity per account - Sink::Store::fetchOne(Sink::Query::AccountFilter(id)) - .then([this](const Sink::ApplicationDomain::Identity &identity) { - mIdentityIdentifier = identity.identifier(); - mUsername = identity.getProperty("username").toString(); - mEmailAddress = identity.getProperty("address").toString(); - emit identityChanged(); - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the identity resource: " << errorMessage; - }).exec(); -} - -QByteArray ImapSettings::accountIdentifier() const -{ - return mAccountIdentifier; -} - -QValidator *ImapSettings::imapServerValidator() const + : AccountSettings(parent) { - class ImapServerValidator : public QValidator { - State validate(QString &input, int &pos) const { - Q_UNUSED(pos); - // imaps://mainserver.example.net:475 - const QUrl url(input); - static QSet validProtocols = QSet() << "imap" << "imaps"; - if (url.isValid() && validProtocols.contains(url.scheme().toLower())) { - return Acceptable; - } else { - return Intermediate; - } - } - }; - static ImapServerValidator *validator = new ImapServerValidator; - return validator; } -QValidator *ImapSettings::smtpServerValidator() const +void ImapSettings::load() { - class SmtpServerValidator : public QValidator { - State validate(QString &input, int &pos) const { - Q_UNUSED(pos); - // smtps://mainserver.example.net:475 - const QUrl url(input); - static QSet validProtocols = QSet() << "smtp" << "smtps"; - if (url.isValid() && validProtocols.contains(url.scheme().toLower())) { - return Acceptable; - } else { - return Intermediate; - } - } - }; - static SmtpServerValidator *validator = new SmtpServerValidator; - return validator; + loadAccount(); + loadImapResource(); + loadMailtransportResource(); + loadIdentity(); } void ImapSettings::save() { - qDebug() << "Saving account " << mAccountIdentifier << mIdentifier << mMailtransportIdentifier; - Q_ASSERT(!mAccountIdentifier.isEmpty()); - Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier); - account.setProperty("type", "imap"); - account.setProperty("name", mName); - account.setProperty("icon", mIcon); - Q_ASSERT(!account.identifier().isEmpty()); - Sink::Store::modify(account).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating account: " << errorMessage; - }) - .exec(); - - if (!mIdentifier.isEmpty()) { - Sink::ApplicationDomain::SinkResource resource(mIdentifier); - resource.setProperty("server", mImapServer); - resource.setProperty("username", mImapUsername); - resource.setProperty("password", mImapPassword); - Sink::Store::modify(resource).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying resource: " << errorMessage; - }) - .exec(); - } else { - auto resource = Sink::ApplicationDomain::ImapResource::create(mAccountIdentifier); - mIdentifier = resource.identifier(); - resource.setProperty("server", mImapServer); - resource.setProperty("username", mImapUsername); - resource.setProperty("password", mImapPassword); - Sink::Store::create(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating resource: " << errorMessage; - }) - .exec(); - } - - if (!mMailtransportIdentifier.isEmpty()) { - Sink::ApplicationDomain::SinkResource resource(mMailtransportIdentifier); - resource.setProperty("server", mSmtpServer); - resource.setProperty("username", mSmtpUsername); - resource.setProperty("password", mSmtpPassword); - Sink::Store::modify(resource).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying resource: " << errorMessage; - }) - .exec(); - } else { - auto resource = Sink::ApplicationDomain::MailtransportResource::create(mAccountIdentifier); - mMailtransportIdentifier = resource.identifier(); - resource.setProperty("server", mSmtpServer); - resource.setProperty("username", mSmtpUsername); - resource.setProperty("password", mSmtpPassword); - Sink::Store::create(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating resource: " << errorMessage; - }) - .exec(); - } - - if (!mIdentityIdentifier.isEmpty()) { - Sink::ApplicationDomain::Identity identity(mMailtransportIdentifier); - identity.setProperty("username", mUsername); - identity.setProperty("address", mEmailAddress); - Sink::Store::modify(identity).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying identity: " << errorMessage; - }) - .exec(); - } else { - auto identity = Sink::ApplicationDomain::ApplicationDomainType::createEntity(); - mIdentityIdentifier = identity.identifier(); - identity.setProperty("account", mAccountIdentifier); - identity.setProperty("username", mUsername); - identity.setProperty("address", mEmailAddress); - Sink::Store::create(identity).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating identity: " << errorMessage; - }) - .exec(); - } + saveAccount(); + saveImapResource(); + saveMailtransportResource(); + saveIdentity(); } void ImapSettings::remove() { - if (mMailtransportIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(mailTransportResource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing resource: " << errorMessage; - }) - .exec(); - } - - if (mIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing resource: " << errorMessage; - }) - .exec(); - } - - if (mAccountIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(account).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing account: " << errorMessage; - }) - .exec(); - } + removeResource(mMailtransportIdentifier); + removeResource(mImapIdentifier); + removeIdentity(); + removeAccount(); } diff --git a/accounts/imap/imapsettings.h b/accounts/imap/imapsettings.h index 30bd67d1..ca2fd1ca 100644 --- a/accounts/imap/imapsettings.h +++ b/accounts/imap/imapsettings.h @@ -18,57 +18,16 @@ */ #pragma once -#include -#include +#include -class ImapSettings : public QObject +class ImapSettings : public AccountSettings { Q_OBJECT - Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier) - Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed) - Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed) - Q_PROPERTY(QString userName MEMBER mUsername NOTIFY identityChanged) - Q_PROPERTY(QString emailAddress MEMBER mEmailAddress NOTIFY identityChanged) - Q_PROPERTY(QString imapServer MEMBER mImapServer NOTIFY imapResourceChanged) - Q_PROPERTY(QValidator* imapServerValidator READ imapServerValidator CONSTANT) - Q_PROPERTY(QString imapUsername MEMBER mImapUsername NOTIFY imapResourceChanged) - Q_PROPERTY(QString imapPassword MEMBER mImapPassword NOTIFY imapResourceChanged) - Q_PROPERTY(QString smtpServer MEMBER mSmtpServer NOTIFY smtpResourceChanged) - Q_PROPERTY(QValidator* smtpServerValidator READ smtpServerValidator CONSTANT) - Q_PROPERTY(QString smtpUsername MEMBER mSmtpUsername NOTIFY smtpResourceChanged) - Q_PROPERTY(QString smtpPassword MEMBER mSmtpPassword NOTIFY smtpResourceChanged) public: ImapSettings(QObject *parent = 0); - void setAccountIdentifier(const QByteArray &); - QByteArray accountIdentifier() const; - - QValidator *imapServerValidator() const; - QValidator *smtpServerValidator() const; - - Q_INVOKABLE void save(); - Q_INVOKABLE void remove(); - -signals: - void imapResourceChanged(); - void smtpResourceChanged(); - void identityChanged(); - void changed(); - -private: - QByteArray mIdentifier; - QByteArray mAccountIdentifier; - QByteArray mMailtransportIdentifier; - QByteArray mIdentityIdentifier; - QString mIcon; - QString mName; - QString mUsername; - QString mEmailAddress; - QString mImapServer; - QString mImapUsername; - QString mImapPassword; - QString mSmtpServer; - QString mSmtpUsername; - QString mSmtpPassword; + Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE; }; diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt index a48295d5..e50d4179 100644 --- a/accounts/maildir/CMakeLists.txt +++ b/accounts/maildir/CMakeLists.txt @@ -35,11 +35,11 @@ set(SRCS add_library(maildiraccountplugin SHARED ${SRCS}) qt5_use_modules(maildiraccountplugin Core Quick Qml) -target_link_libraries(maildiraccountplugin sink settingsplugin) +target_link_libraries(maildiraccountplugin sink settingsplugin mailplugin) add_library(maildiraccount_static STATIC ${SRCS}) qt5_use_modules(maildiraccount_static Core Quick Qml) -target_link_libraries(maildiraccount_static sink settingsplugin) +target_link_libraries(maildiraccount_static sink settingsplugin mailplugin) add_subdirectory(tests) kpackage_install_package(package org.kube.accounts.maildir "genericqml") diff --git a/accounts/maildir/maildirsettings.cpp b/accounts/maildir/maildirsettings.cpp index 5c1fb177..7611251e 100644 --- a/accounts/maildir/maildirsettings.cpp +++ b/accounts/maildir/maildirsettings.cpp @@ -18,251 +18,32 @@ */ #include "maildirsettings.h" -#include - -#include -#include -#include -#include - MaildirSettings::MaildirSettings(QObject *parent) - : QObject(parent) -{ -} - - -void MaildirSettings::setAccountIdentifier(const QByteArray &id) -{ - if (id.isEmpty()) { - return; - } - mAccountIdentifier = id; - - //Clear - mIcon = QString(); - mName = QString(); - mPath = QString(); - mSmtpServer = QString(); - mSmtpUsername = QString(); - mSmtpPassword = QString(); - emit changed(); - emit pathChanged(); - emit smtpResourceChanged(); - - Q_ASSERT(!id.isEmpty()); - Sink::Store::fetchOne(Sink::Query::IdentityFilter(id)) - .then([this](const Sink::ApplicationDomain::SinkAccount &account) { - mIcon = account.getProperty("icon").toString(); - mName = account.getProperty("name").toString(); - emit changed(); - }).exec(); - - Sink::Store::fetchOne(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::storage)) - .then([this](const Sink::ApplicationDomain::SinkResource &resource) { - mIdentifier = resource.identifier(); - auto path = resource.getProperty("path").toString(); - if (mPath != path) { - mPath = path; - emit pathChanged(); - } - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the maildir resource: " << errorMessage; - }).exec(); - - Sink::Store::fetchOne(Sink::Query::AccountFilter(id) + Sink::Query::CapabilityFilter(Sink::ApplicationDomain::ResourceCapabilities::Mail::transport)) - .then([this](const Sink::ApplicationDomain::SinkResource &resource) { - mMailtransportIdentifier = resource.identifier(); - mSmtpServer = resource.getProperty("server").toString(); - mSmtpUsername = resource.getProperty("username").toString(); - mSmtpPassword = resource.getProperty("password").toString(); - emit smtpResourceChanged(); - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the maildir resource: " << errorMessage; - }).exec(); - - //FIXME this assumes that we only ever have one identity per account - Sink::Store::fetchOne(Sink::Query::AccountFilter(id)) - .then([this](const Sink::ApplicationDomain::Identity &identity) { - mIdentityIdentifier = identity.identifier(); - mUsername = identity.getProperty("username").toString(); - mEmailAddress = identity.getProperty("address").toString(); - emit identityChanged(); - }, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Failed to find the identity resource: " << errorMessage; - }).exec(); -} - -QByteArray MaildirSettings::accountIdentifier() const + : AccountSettings(parent) { - return mAccountIdentifier; } -void MaildirSettings::setPath(const QUrl &path) +void MaildirSettings::load() { - auto normalizedPath = path.path(); - if (mPath != normalizedPath) { - mPath = normalizedPath; - emit pathChanged(); - } -} - -QUrl MaildirSettings::path() const -{ - return QUrl(mPath); -} - -QValidator *MaildirSettings::pathValidator() const -{ - class PathValidator : public QValidator { - State validate(QString &input, int &pos) const { - Q_UNUSED(pos); - if (!input.isEmpty() && QDir(input).exists()) { - return Acceptable; - } else { - return Intermediate; - } - } - }; - static PathValidator *pathValidator = new PathValidator; - return pathValidator; -} - -QValidator *MaildirSettings::smtpServerValidator() const -{ - class SmtpServerValidator : public QValidator { - State validate(QString &input, int &pos) const { - Q_UNUSED(pos); - // smtps://mainserver.example.net:475 - const QUrl url(input); - static QSet validProtocols = QSet() << "smtp" << "smtps"; - if (url.isValid() && validProtocols.contains(url.scheme().toLower())) { - return Acceptable; - } else { - return Intermediate; - } - } - }; - static SmtpServerValidator *validator = new SmtpServerValidator; - return validator; + loadAccount(); + loadMaildirResource(); + loadMailtransportResource(); + loadIdentity(); } void MaildirSettings::save() { - if (!QDir(mPath).exists()) { - qWarning() << "The path doesn't exist: " << mPath; - return; - } - qDebug() << "Saving account " << mAccountIdentifier << mIdentifier << mMailtransportIdentifier; - Q_ASSERT(!mAccountIdentifier.isEmpty()); - Sink::ApplicationDomain::SinkAccount account(mAccountIdentifier); - account.setProperty("type", "maildir"); - account.setProperty("name", mName); - account.setProperty("icon", mIcon); - Q_ASSERT(!account.identifier().isEmpty()); - Sink::Store::modify(account).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating account: " << errorMessage; - }) - .exec(); - - if (!mIdentifier.isEmpty()) { - Sink::ApplicationDomain::SinkResource resource(mIdentifier); - resource.setProperty("path", mPath); - Sink::Store::modify(resource).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying resource: " << errorMessage; - }) - .exec(); - } else { - auto resource = Sink::ApplicationDomain::MaildirResource::create(mAccountIdentifier); - resource.setProperty("path", property("path")); - mIdentifier = resource.identifier(); - Sink::Store::create(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating resource: " << errorMessage; - }) - .exec(); - } - - if (!mMailtransportIdentifier.isEmpty()) { - Sink::ApplicationDomain::SinkResource resource(mMailtransportIdentifier); - resource.setProperty("server", mSmtpServer); - resource.setProperty("username", mSmtpUsername); - resource.setProperty("password", mSmtpPassword); - Sink::Store::modify(resource).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying resource: " << errorMessage; - }) - .exec(); - } else { - auto resource = Sink::ApplicationDomain::MailtransportResource::create(mAccountIdentifier); - mMailtransportIdentifier = resource.identifier(); - resource.setProperty("server", mSmtpServer); - resource.setProperty("username", mSmtpUsername); - resource.setProperty("password", mSmtpPassword); - Sink::Store::create(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating resource: " << errorMessage; - }) - .exec(); - } - - if (!mIdentityIdentifier.isEmpty()) { - Sink::ApplicationDomain::Identity identity(mMailtransportIdentifier); - identity.setProperty("username", mUsername); - identity.setProperty("address", mEmailAddress); - Sink::Store::modify(identity).then([](){}, [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while modifying identity: " << errorMessage; - }) - .exec(); - } else { - auto identity = Sink::ApplicationDomain::ApplicationDomainType::createEntity(); - mIdentityIdentifier = identity.identifier(); - identity.setProperty("account", mAccountIdentifier); - identity.setProperty("username", mUsername); - identity.setProperty("address", mEmailAddress); - Sink::Store::create(identity).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while creating identity: " << errorMessage; - }) - .exec(); - } + saveAccount(); + saveMaildirResource(); + saveMailtransportResource(); + saveIdentity(); } void MaildirSettings::remove() { - if (mMailtransportIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkResource mailTransportResource("", mMailtransportIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(mailTransportResource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing resource: " << errorMessage; - }) - .exec(); - } - - if (mIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkResource resource("", mIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(resource).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing resource: " << errorMessage; - }) - .exec(); - } - - if (mAccountIdentifier.isEmpty()) { - qWarning() << "We're missing an identifier"; - } else { - Sink::ApplicationDomain::SinkAccount account("", mAccountIdentifier, 0, QSharedPointer::create()); - Sink::Store::remove(account).then([]() {}, - [](int errorCode, const QString &errorMessage) { - qWarning() << "Error while removing account: " << errorMessage; - }) - .exec(); - } + removeResource(mMailtransportIdentifier); + removeResource(mMaildirIdentifier); + removeIdentity(); + removeAccount(); } diff --git a/accounts/maildir/maildirsettings.h b/accounts/maildir/maildirsettings.h index a02944d9..42336535 100644 --- a/accounts/maildir/maildirsettings.h +++ b/accounts/maildir/maildirsettings.h @@ -18,56 +18,15 @@ */ #pragma once -#include -#include +#include -class MaildirSettings : public QObject +class MaildirSettings : public AccountSettings { Q_OBJECT - Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier) - Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged) - Q_PROPERTY(QValidator* pathValidator READ pathValidator CONSTANT) - Q_PROPERTY(QString icon MEMBER mIcon NOTIFY changed) - Q_PROPERTY(QString accountName MEMBER mName NOTIFY changed) - Q_PROPERTY(QString userName MEMBER mUsername NOTIFY identityChanged) - Q_PROPERTY(QString emailAddress MEMBER mEmailAddress NOTIFY identityChanged) - Q_PROPERTY(QString smtpServer MEMBER mSmtpServer NOTIFY smtpResourceChanged) - Q_PROPERTY(QValidator* smtpServerValidator READ smtpServerValidator CONSTANT) - Q_PROPERTY(QString smtpUsername MEMBER mSmtpUsername NOTIFY smtpResourceChanged) - Q_PROPERTY(QString smtpPassword MEMBER mSmtpPassword NOTIFY smtpResourceChanged) - public: MaildirSettings(QObject *parent = 0); - void setAccountIdentifier(const QByteArray &); - QByteArray accountIdentifier() const; - - void setPath(const QUrl &); - QUrl path() const; - QValidator *pathValidator() const; - - QValidator *smtpServerValidator() const; - - Q_INVOKABLE void save(); - Q_INVOKABLE void remove(); - -signals: - void pathChanged(); - void smtpResourceChanged(); - void identityChanged(); - void changed(); - -private: - QByteArray mIdentifier; - QByteArray mAccountIdentifier; - QByteArray mMailtransportIdentifier; - QByteArray mIdentityIdentifier; - QString mPath; - QString mIcon; - QString mName; - QString mUsername; - QString mEmailAddress; - QString mSmtpServer; - QString mSmtpUsername; - QString mSmtpPassword; + Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE; }; -- cgit v1.2.3