diff options
| author | Pekka Vuorela <pvuorela@iki.fi> | 2025-11-12 11:13:21 +0200 |
|---|---|---|
| committer | Pekka Vuorela <pvuorela@iki.fi> | 2025-11-12 16:33:27 +0200 |
| commit | de24e206b396395e4c73172371e488dbb1858e45 (patch) | |
| tree | 011487ae5ef413523b467ffd4f6bcc8166b91356 | |
| parent | cbe4896d8017f27dd30333fe229dcaa440e2e147 (diff) | |
Remove qwidgets support from qmfmessageserver
This has little real life value. Any environment and apps starting to
use the framework will or should have their own UI style. Predefined
forms for some protocol configuration editing unlikely fits the rest.
Moreover the support has been opt-out instead of opt-in,
QMF_NO_MESSAGE_SERVICE_EDITOR which the _app_ has needed defined
according to how the library has been built. Should have been some
config.h provided by the framework according to how it's compiled.
QMailMessageServiceConfigurator class without the editor makes little
sense so removed altogether.
There's qtmail example that was using this. For now just left some
TODO comments to reimplement the account configuration.
Unknown how the example works these days in general.
Change-Id: I4122e2524a61797753999e67ecec36cb46213a7b
Reviewed-by: Damien Caliste <dcaliste@free.fr>
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
34 files changed, 17 insertions, 3082 deletions
diff --git a/examples/qtmail/CMakeLists.txt b/examples/qtmail/CMakeLists.txt index f5f25e35..b6851df6 100644 --- a/examples/qtmail/CMakeLists.txt +++ b/examples/qtmail/CMakeLists.txt @@ -6,7 +6,7 @@ set(HEADERS readmail.h writemail.h accountsettings.h - editaccount.h + #editaccount.h statusmonitorwidget.h statusbar.h statusmonitor.h @@ -27,7 +27,7 @@ set(SRC readmail.cpp writemail.cpp accountsettings.cpp - editaccount.cpp + #editaccount.cpp statusmonitorwidget.cpp statusbar.cpp statusmonitor.cpp diff --git a/examples/qtmail/accountsettings.cpp b/examples/qtmail/accountsettings.cpp index e99b50dd..1ee76ea6 100644 --- a/examples/qtmail/accountsettings.cpp +++ b/examples/qtmail/accountsettings.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include "accountsettings.h" -#include "editaccount.h" +//#include "editaccount.h" #include "statusbar.h" #include <qmailaccountlistmodel.h> #include <qmaillog.h> @@ -275,17 +275,21 @@ void AccountSettings::editAccount(QMailAccount *account) account->setStatus(QMailAccount::UserRemovable, true); } - QDialog *editAccountView; + int ret = QDialog::Rejected; bool wasPreferred(account->status() & QMailAccount::PreferredSender); +#if 0 // editor support removed from qmfmessageserver. need to reimplement config on app side + QDialog *editAccountView; + EditAccount *e = new EditAccount(this, "EditAccount"); e->setAccount(account, &config); editAccountView = e; editAccountView->setMinimumSize(QSize(400,400)); - int ret = editAccountView->exec(); + ret = editAccountView->exec(); delete editAccountView; +#endif if (ret == QDialog::Accepted) { QMailAccountId previousPreferredId; diff --git a/examples/qtmail/editaccount.h b/examples/qtmail/editaccount.h index e94e7b95..ed547d54 100644 --- a/examples/qtmail/editaccount.h +++ b/examples/qtmail/editaccount.h @@ -49,6 +49,8 @@ QT_END_NAMESPACE class QMailAccountConfiguration; class QMailAccount; +// FIXME the class here depends on qmfmessageserver editor support which got removed. +// The account configuration needs to be reimplemented on the app side class EditAccount : public QDialog { Q_OBJECT diff --git a/examples/qtmail/qtmail.pro b/examples/qtmail/qtmail.pro index deaa10a4..b8e48b08 100644 --- a/examples/qtmail/qtmail.pro +++ b/examples/qtmail/qtmail.pro @@ -16,7 +16,7 @@ HEADERS += emailclient.h \ readmail.h \ writemail.h \ accountsettings.h \ - editaccount.h \ + #editaccount.h \ statusmonitorwidget.h \ statusbar.h \ statusmonitor.h \ @@ -37,7 +37,7 @@ SOURCES += emailclient.cpp \ readmail.cpp \ writemail.cpp \ accountsettings.cpp \ - editaccount.cpp \ + #editaccount.cpp \ statusmonitorwidget.cpp \ statusbar.cpp \ statusmonitor.cpp \ diff --git a/examples/serverobserver/CMakeLists.txt b/examples/serverobserver/CMakeLists.txt index 8d9cc4e7..a7ab9e2a 100644 --- a/examples/serverobserver/CMakeLists.txt +++ b/examples/serverobserver/CMakeLists.txt @@ -7,4 +7,4 @@ add_executable(serverobserver ${SRC}) target_include_directories(serverobserver PRIVATE ../../src/libraries/qmfclient ../../src/libraries/qmfclient/support) target_link_libraries(serverobserver - PRIVATE Qt6::Core Qt6::Test QmfClient QmfMessageServer) + PRIVATE Qt6::Core Qt6::Test Qt6::Widgets QmfClient QmfMessageServer) diff --git a/src/libraries/qmfmessageserver/CMakeLists.txt b/src/libraries/qmfmessageserver/CMakeLists.txt index 387fb907..c566d07c 100644 --- a/src/libraries/qmfmessageserver/CMakeLists.txt +++ b/src/libraries/qmfmessageserver/CMakeLists.txt @@ -31,12 +31,6 @@ endif() add_library(QmfMessageServer SHARED ${SRC} ${HEADERS}) -if (BUILD_WIDGETS) - target_link_libraries(QmfMessageServer PUBLIC Qt6::Widgets) -else() - target_compile_definitions(QmfMessageServer PRIVATE QMF_NO_WIDGETS) -endif() - target_compile_definitions(QmfMessageServer PRIVATE MESSAGESERVER_INTERNAL) target_include_directories(QmfMessageServer PRIVATE ../qmfclient ../qmfclient/support) target_link_libraries(QmfMessageServer diff --git a/src/libraries/qmfmessageserver/qmailmessageservice.cpp b/src/libraries/qmfmessageserver/qmailmessageservice.cpp index 29c0e343..440cb06e 100644 --- a/src/libraries/qmfmessageserver/qmailmessageservice.cpp +++ b/src/libraries/qmfmessageserver/qmailmessageservice.cpp @@ -161,18 +161,6 @@ QMailMessageService *QMailMessageServiceFactory::createService(const QString &ke } /*! - Returns a new instance of the configurator class for the service identified by \a key. -*/ -QMailMessageServiceConfigurator *QMailMessageServiceFactory::createServiceConfigurator(const QString &key) -{ - if (QMailMessageServicePlugin* plugin = mapping(key)) - return plugin->createServiceConfigurator(); - - return 0; -} - - -/*! \class QMailMessageServicePluginInterface \ingroup libmessageserver @@ -209,15 +197,6 @@ QMailMessageServiceConfigurator *QMailMessageServiceFactory::createServiceConfig */ /*! - Creates an instance of the configurator for the QMailMessageService class provided by the plugin. -*/ -QMailMessageServiceConfigurator *QMailMessageServicePluginInterface::createServiceConfigurator() -{ - return 0; -} - - -/*! \class QMailMessageServicePlugin \ingroup libmessageserver @@ -1543,92 +1522,6 @@ void QMailMessageService::updateStatus(int code, const QString &text, const QMai } } -#ifndef QMF_NO_WIDGETS -/*! - \class QMailMessageServiceEditor - \ingroup libmessageserver - - \preliminary - \brief The QMailMessageServiceEditor class provides an interface that allows a service to be edited graphically. - - QMailMessageServiceEditor provides the base class for a GUI component that can edit the configuration for a messaging service. -*/ - -/*! \internal */ -QMailMessageServiceEditor::QMailMessageServiceEditor() -{ -} - -/*! \internal */ -QMailMessageServiceEditor::~QMailMessageServiceEditor() -{ -} - -/*! - \fn void QMailMessageServiceEditor::displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config); - - Invoked to set the editor with the details of the account \a account, described by \a config. -*/ - -/*! - \fn bool QMailMessageServiceEditor::updateAccount(QMailAccount *account, QMailAccountConfiguration *config); - - Invoked to update the account \a account and configuration \a config with the details currently displayed by the editor. - Return true if the account and configuration are appropriately updated, and any necessary data storage external to the mail store has been performed. -*/ -#endif - -/*! - \class QMailMessageServiceConfigurator - \ingroup libmessageserver - - \preliminary - \brief The QMailMessageServiceConfigurator class provides an interface that allows a service to be configured. - - QMailMessageServiceConfigurator provides the interface that a messaging service must provide to allow - its configuration to be editted by a generic GUI editor framework. -*/ - -/*! \internal */ -QMailMessageServiceConfigurator::QMailMessageServiceConfigurator() -{ -} - -/*! \internal */ -QMailMessageServiceConfigurator::~QMailMessageServiceConfigurator() -{ -} - -/*! - \fn QString QMailMessageServiceConfigurator::service() const; - - Returns the identifier of the service configured by this class. -*/ - -/*! - \fn QString QMailMessageServiceConfigurator::displayName() const; - - Returns the name of the service configured by this class, in a form suitable for display. -*/ - -/*! - Returns a list of services of the type \a type that are compatible with this service. - If the service does not constrain the possible list of compatible services, an empty list should be returned. -*/ -QStringList QMailMessageServiceConfigurator::serviceConstraints(QMailMessageServiceFactory::ServiceType) const -{ - return QStringList(); -} - -#ifndef QMF_NO_WIDGETS -/*! - \fn QMailMessageServiceEditor *QMailMessageServiceConfigurator::createEditor(QMailMessageServiceFactory::ServiceType type); - - Creates an instance of the editor class for the service of type \a type. -*/ -#endif - - /*! \overload retrieveFolderList() diff --git a/src/libraries/qmfmessageserver/qmailmessageservice.h b/src/libraries/qmfmessageserver/qmailmessageservice.h index 560022a8..4de2d6e3 100644 --- a/src/libraries/qmfmessageserver/qmailmessageservice.h +++ b/src/libraries/qmfmessageserver/qmailmessageservice.h @@ -52,11 +52,7 @@ objects that it wishes to make available. */ class QMailAccount; -class QMailAccountConfiguration; - class QMailMessageService; -class QMailMessageServiceConfigurator; - class MESSAGESERVER_EXPORT QMailMessageServiceFactory { @@ -69,7 +65,6 @@ public: static bool supports(const QString &key, QMailMessage::MessageType messageType); static QMailMessageService *createService(const QString &key, const QMailAccountId &id); - static QMailMessageServiceConfigurator *createServiceConfigurator(const QString &key); }; @@ -80,7 +75,6 @@ struct MESSAGESERVER_EXPORT QMailMessageServicePluginInterface : public QFactory virtual bool supports(QMailMessage::MessageType messageType) const = 0; virtual QMailMessageService *createService(const QMailAccountId &id) = 0; - virtual QMailMessageServiceConfigurator *createServiceConfigurator(); }; @@ -334,35 +328,4 @@ private: const QMailMessageService &operator=(const QMailMessageService &other); }; -#ifndef QMF_NO_WIDGETS -#include <QWidget> -class MESSAGESERVER_EXPORT QMailMessageServiceEditor : public QWidget -{ - Q_OBJECT - -public: - QMailMessageServiceEditor(); - virtual ~QMailMessageServiceEditor(); - - virtual void displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) = 0; - virtual bool updateAccount(QMailAccount *account, QMailAccountConfiguration *config) = 0; -}; -#endif - -class MESSAGESERVER_EXPORT QMailMessageServiceConfigurator -{ -public: - QMailMessageServiceConfigurator(); - virtual ~QMailMessageServiceConfigurator(); - - virtual QString service() const = 0; - virtual QString displayName() const = 0; - - virtual QStringList serviceConstraints(QMailMessageServiceFactory::ServiceType type) const; - -#ifndef QMF_NO_WIDGETS - virtual QMailMessageServiceEditor *createEditor(QMailMessageServiceFactory::ServiceType type) = 0; -#endif -}; - #endif diff --git a/src/libraries/qmfmessageserver/qmfmessageserver.pro b/src/libraries/qmfmessageserver/qmfmessageserver.pro index b6ef3cb4..761866fa 100644 --- a/src/libraries/qmfmessageserver/qmfmessageserver.pro +++ b/src/libraries/qmfmessageserver/qmfmessageserver.pro @@ -15,10 +15,6 @@ contains(DEFINES,MESSAGESERVER_PLUGINS) { load(qt_module) CONFIG -= create_cmake -!contains(DEFINES,QMF_NO_WIDGETS) { - QT += gui widgets -} - DEFINES += MESSAGESERVER_INTERNAL HEADERS += \ diff --git a/src/plugins/messageservices/imap/CMakeLists.txt b/src/plugins/messageservices/imap/CMakeLists.txt index 60c339ea..3cba0484 100644 --- a/src/plugins/messageservices/imap/CMakeLists.txt +++ b/src/plugins/messageservices/imap/CMakeLists.txt @@ -27,26 +27,12 @@ set(HEADERS serviceactionqueue.h idlenetworksession.h) -if (BUILD_WIDGETS) - set(SRC ${SRC} imapsettings.cpp) - set(HEADERS ${HEADERS} imapsettings.h) - qt_add_resources(SRC imap.qrc) - qt_wrap_ui(SRC imapsettings.ui) -endif() - add_library(imap MODULE ${SRC} ${HEADERS}) target_include_directories(imap PRIVATE ../../../libraries/qmfclient ../../../libraries/qmfclient/support ../../../libraries/qmfmessageserver) target_link_libraries(imap PRIVATE Qt6::Core Qt6::Network QmfClient QmfMessageServer) -if (BUILD_WIDGETS) - target_link_libraries(imap PUBLIC QmfWidgets) - target_include_directories(imap - PRIVATE ../../../libraries/qmfwidgets) -else() - target_compile_definitions(imap PRIVATE QMF_NO_WIDGETS) -endif() install(TARGETS imap LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt6/plugins/messagingframework/messageservices) diff --git a/src/plugins/messageservices/imap/imap.pro b/src/plugins/messageservices/imap/imap.pro index 0e1c7c78..09955b59 100644 --- a/src/plugins/messageservices/imap/imap.pro +++ b/src/plugins/messageservices/imap/imap.pro @@ -33,20 +33,6 @@ SOURCES += imapclient.cpp \ serviceactionqueue.cpp \ idlenetworksession.cpp -!contains(DEFINES,QMF_NO_WIDGETS) { - QT += qmfwidgets - - HEADERS += \ - imapsettings.h - - FORMS += imapsettings.ui - - SOURCES += \ - imapsettings.cpp - - RESOURCES += imap.qrc -} - qtConfig(system-zlib) { QMAKE_USE_PRIVATE += zlib } else { diff --git a/src/plugins/messageservices/imap/imap.qrc b/src/plugins/messageservices/imap/imap.qrc deleted file mode 100644 index 6a8bf1dc..00000000 --- a/src/plugins/messageservices/imap/imap.qrc +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/icon"> -<file alias="clear_left">pics/clear_left.png</file> -<file alias="folder">../../../../src/libraries/qmfwidgets/pics/icons/16x16/folder.png</file> -<file alias="account">../../../../src/libraries/qmfwidgets/pics/icons/16x16/server.png</file> -<file alias="find">../../../../src/libraries/qmfwidgets/pics/icons/mail_find.png</file> -<file alias="inbox">../../../../src/libraries/qmfwidgets/pics/icons/16x16/folder_inbox.png</file> -<file alias="drafts">../../../../src/libraries/qmfwidgets/pics/icons/16x16/edit.png</file> -<file alias="sent">../../../../src/libraries/qmfwidgets/pics/icons/16x16/folder_sent_mail.png</file> -<file alias="outbox">../../../../src/libraries/qmfwidgets/pics/icons/16x16/folder_outbox.png</file> -<file alias="trash">../../../../src/libraries/qmfwidgets/pics/icons/16x16/trash.png</file> -</qresource> -</RCC> diff --git a/src/plugins/messageservices/imap/imapservice.cpp b/src/plugins/messageservices/imap/imapservice.cpp index f4f0d1dd..c432216e 100644 --- a/src/plugins/messageservices/imap/imapservice.cpp +++ b/src/plugins/messageservices/imap/imapservice.cpp @@ -32,13 +32,11 @@ ****************************************************************************/ #include "imapservice.h" -#ifndef QMF_NO_WIDGETS -#include "imapsettings.h" -#endif #include "imapconfiguration.h" #include "imapstrategy.h" #include "serviceactionqueue.h" #include "imaplog.h" + #include <QtPlugin> #include <QTimer> #include <qmailmessage.h> @@ -1788,47 +1786,6 @@ void ImapService::setPersistentConnectionStatus(bool status) _idling = status; } -class ImapConfigurator : public QMailMessageServiceConfigurator -{ -public: - ImapConfigurator(); - ~ImapConfigurator(); - - QString service() const override; - QString displayName() const override; - -#ifndef QMF_NO_WIDGETS - QMailMessageServiceEditor *createEditor(QMailMessageServiceFactory::ServiceType type) override; -#endif -}; - -ImapConfigurator::ImapConfigurator() -{ -} - -ImapConfigurator::~ImapConfigurator() -{ -} - -QString ImapConfigurator::service() const -{ - return serviceKey; -} - -QString ImapConfigurator::displayName() const -{ - return QCoreApplication::instance()->translate("QMailMessageService", "IMAP"); -} - -#ifndef QMF_NO_WIDGETS -QMailMessageServiceEditor *ImapConfigurator::createEditor(QMailMessageServiceFactory::ServiceType type) -{ - if (type == QMailMessageServiceFactory::Source) - return new ImapSettings; - - return 0; -} -#endif ImapServicePlugin::ImapServicePlugin() : QMailMessageServicePlugin() @@ -1855,9 +1812,4 @@ QMailMessageService *ImapServicePlugin::createService(const QMailAccountId &id) return new ImapService(id); } -QMailMessageServiceConfigurator *ImapServicePlugin::createServiceConfigurator() -{ - return new ImapConfigurator(); -} - #include "imapservice.moc" diff --git a/src/plugins/messageservices/imap/imapservice.h b/src/plugins/messageservices/imap/imapservice.h index 5adb68a5..727c2b0f 100644 --- a/src/plugins/messageservices/imap/imapservice.h +++ b/src/plugins/messageservices/imap/imapservice.h @@ -119,7 +119,6 @@ public: bool supports(QMailMessage::MessageType type) const override; QMailMessageService *createService(const QMailAccountId &id) override; - QMailMessageServiceConfigurator *createServiceConfigurator() override; }; #endif diff --git a/src/plugins/messageservices/imap/imapsettings.cpp b/src/plugins/messageservices/imap/imapsettings.cpp deleted file mode 100644 index 6ceb59c5..00000000 --- a/src/plugins/messageservices/imap/imapsettings.cpp +++ /dev/null @@ -1,510 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "imapsettings.h" -#include "imapconfiguration.h" -#include "imaplog.h" -#include <emailfoldermodel.h> -#include <qmailaccount.h> -#include <qmailaccountconfiguration.h> -#include <qmailtransport.h> -#include <qmailnamespace.h> -#include <selectfolder.h> -#include <QLineEdit> -#include <QMessageBox> - -namespace { - -const QString serviceKey("imap4"); - -class PortValidator : public QValidator -{ -public: - PortValidator(QWidget *parent = Q_NULLPTR, const char *name = Q_NULLPTR); - - QValidator::State validate(QString &str, int &) const override; -}; - -PortValidator::PortValidator(QWidget *parent, const char *name) - : QValidator(parent) -{ - setObjectName(name); -} - -QValidator::State PortValidator::validate(QString &str, int &) const -{ - // allow empty strings, as it's a bit awkward to edit otherwise - if ( str.isEmpty() ) - return QValidator::Acceptable; - - bool ok = false; - int i = str.toInt(&ok); - if ( !ok ) - return QValidator::Invalid; - - if ( i <= 0 || i >= 65536 ) - return QValidator::Invalid; - - return QValidator::Acceptable; -} - -} - -class PushFolderList : public QObject { - Q_OBJECT - -public: - PushFolderList(QWidget *parent, QGridLayout *parentLayout); - void setAccountId(const QMailAccountId &id); - void addRow(const QString &s); - void populate(const QStringList &pushFolderNames); - QStringList folderNames(); - -public slots: - void setHasFolders(bool hasFolders); - void setPushEnabled(int pushEnabled); - void selectFolder(); - -private: - QWidget *_parent; - QGridLayout *_parentLayout; - QMailAccountId _accountId; - bool _hasFolders; - bool _pushEnabled; - int _startRow; - int _items; - QList<QWidget*> _widgets; - QList<QHBoxLayout*> _layouts; - QList<QLineEdit*> _dirTexts; - QList<QToolButton*> _clearButtons; - QList<QToolButton*> _dirButtons; -}; - -PushFolderList::PushFolderList(QWidget *parent, QGridLayout *parentLayout) - : QObject(parent) - , _parent(parent) - , _parentLayout(parentLayout) - , _hasFolders(false) - , _pushEnabled(false) - , _startRow(parentLayout->rowCount()) - , _items(0) -{ -} - -void PushFolderList::setAccountId(const QMailAccountId &id) -{ - _accountId = id; -} - -void PushFolderList::setHasFolders(bool hasFolders) -{ - _hasFolders = hasFolders; - foreach (QWidget *widget, _widgets) - widget->setEnabled(_hasFolders && _pushEnabled); -} - -void PushFolderList::setPushEnabled(int pushEnabled) -{ - _pushEnabled = (pushEnabled != Qt::Unchecked); - foreach (QWidget *widget, _widgets) - widget->setEnabled(_hasFolders && _pushEnabled); -} - -void PushFolderList::addRow(const QString &s) -{ - QIcon clearIcon(":icon/clear_left"); - QLabel *pushLabel = new QLabel(tr("Push folder"), _parent); - QHBoxLayout *layout = new QHBoxLayout(); - QLineEdit *pushDir = new QLineEdit(_parent); - QToolButton *clearPushEmailButton = new QToolButton(_parent); - QToolButton *choosePushDirButton = new QToolButton(_parent); - pushDir->setReadOnly(true); - pushDir->setFocusPolicy(Qt::NoFocus); - pushDir->setText(s); - clearPushEmailButton->setIcon(clearIcon); - clearPushEmailButton->setEnabled(!s.isEmpty()); - choosePushDirButton->setText(tr("...")); - pushLabel->setEnabled(_hasFolders && _pushEnabled); - pushDir->setEnabled(_hasFolders && _pushEnabled); - clearPushEmailButton->setEnabled(_hasFolders && _pushEnabled); - choosePushDirButton->setEnabled(_hasFolders && _pushEnabled); - connect(clearPushEmailButton, SIGNAL(clicked()), pushDir, SLOT(clear())); - connect(choosePushDirButton, SIGNAL(clicked()), this, SLOT(selectFolder())); - _dirTexts.append(pushDir); - _clearButtons.append(clearPushEmailButton); - _dirButtons.append(choosePushDirButton); - _layouts.append(layout); - _widgets.append(pushLabel); - _widgets.append(pushDir); - _widgets.append(clearPushEmailButton); - _widgets.append(choosePushDirButton); - layout->addWidget(pushDir); - layout->addWidget(clearPushEmailButton); - layout->addWidget(choosePushDirButton); - _parentLayout->addWidget(pushLabel, _startRow + _items, 0); - _parentLayout->addLayout(layout, _startRow + _items, 1); - ++_items; -} - -void PushFolderList::populate(const QStringList &pushFolderNames) -{ - _items = 0; - foreach (QWidget *widget, _widgets) { - _parentLayout->removeWidget(widget); - delete widget; - } - foreach (QHBoxLayout *layout, _layouts) { - _parentLayout->removeItem(layout); - delete layout; - } - _widgets.clear(); - _layouts.clear(); - _dirTexts.clear(); - _clearButtons.clear(); - _dirButtons.clear(); - QStringList folderNames(pushFolderNames); - folderNames.append(""); - foreach (const QString &s, folderNames) { - addRow(s); - } -} - -void PushFolderList::selectFolder() -{ - AccountFolderModel model(_accountId, _parent); - model.init(); - - // The account itself is not a selectable folder - QList<QMailMessageSet*> invalidItems; - invalidItems.append(model.itemFromIndex(model.indexFromAccountId(_accountId))); - - SelectFolderDialog selectFolderDialog(&model); - selectFolderDialog.setInvalidSelections(invalidItems); - selectFolderDialog.exec(); - - if (selectFolderDialog.result() == QDialog::Accepted) { - QMailFolder folder(model.folderIdFromIndex(model.indexFromItem(selectFolderDialog.selectedItem()))); - - int index(_dirButtons.indexOf(static_cast<QToolButton*>(sender()))); - if (index != -1) { - _dirTexts.at(index)->setText(folder.path()); - _clearButtons.at(index)->setEnabled(true); - - if (index + 1 == _dirTexts.count()) { - addRow(""); - } - } - - } -} - -QStringList PushFolderList::folderNames() -{ - QStringList result; - foreach (QLineEdit* edit, _dirTexts) { - if (!edit->text().isEmpty()) - result.append(edit->text()); - } - result.removeDuplicates(); - return result; -} - -ImapSettings::ImapSettings() - : QMailMessageServiceEditor(), - warningEmitted(false), - pushFolderList(0) -{ - setupUi(this); - setLayoutDirection(qApp->layoutDirection()); - - connect(intervalCheckBox, SIGNAL(stateChanged(int)), this, SLOT(intervalCheckChanged(int))); - - const QString uncapitalised("email noautocapitalization"); - - // These fields should not be autocapitalised - mailPortInput->setValidator(new PortValidator(this)); - - mailPasswInput->setEchoMode(QLineEdit::Password); - - // This functionality is not currently used: - mailboxButton->hide(); - - connect(draftsButton, SIGNAL(clicked()), this, SLOT(selectFolder())); - connect(sentButton, SIGNAL(clicked()), this, SLOT(selectFolder())); - connect(trashButton, SIGNAL(clicked()), this, SLOT(selectFolder())); - connect(junkButton, SIGNAL(clicked()), this, SLOT(selectFolder())); - - QIcon clearIcon(":icon/clear_left"); - - clearBaseButton->setIcon(clearIcon); - connect(clearBaseButton, SIGNAL(clicked()), imapBaseDir, SLOT(clear())); - - clearDraftsButton->setIcon(clearIcon); - connect(clearDraftsButton, SIGNAL(clicked()), imapDraftsDir, SLOT(clear())); - - clearSentButton->setIcon(clearIcon); - connect(clearSentButton, SIGNAL(clicked()), imapSentDir, SLOT(clear())); - - clearTrashButton->setIcon(clearIcon); - connect(clearTrashButton, SIGNAL(clicked()), imapTrashDir, SLOT(clear())); - - clearJunkButton->setIcon(clearIcon); - connect(clearJunkButton, SIGNAL(clicked()), imapJunkDir, SLOT(clear())); - - QGridLayout *gridLayout = findChild<QGridLayout *>("gridlayout1"); - if (gridLayout) { - pushFolderList = new PushFolderList(this, gridLayout); - connect(pushCheckBox, SIGNAL(stateChanged(int)), pushFolderList, SLOT(setPushEnabled(int))); - } else { - qCWarning(lcIMAP) << "Gridlayout not found"; - } -} - -void ImapSettings::intervalCheckChanged(int enabled) -{ - intervalPeriod->setEnabled(enabled); - roamingCheckBox->setEnabled(enabled); -} - -void ImapSettings::selectFolder() -{ - AccountFolderModel model(accountId, this); - model.init(); - - // The account itself is not a selectable folder - QList<QMailMessageSet*> invalidItems; - invalidItems.append(model.itemFromIndex(model.indexFromAccountId(accountId))); - - SelectFolderDialog selectFolderDialog(&model); - selectFolderDialog.setInvalidSelections(invalidItems); - selectFolderDialog.exec(); - - if (selectFolderDialog.result() == QDialog::Accepted) { - QMailFolder folder(model.folderIdFromIndex(model.indexFromItem(selectFolderDialog.selectedItem()))); - - if (sender() == static_cast<QObject*>(draftsButton)) { - imapDraftsDir->setText(folder.path()); - clearDraftsButton->setEnabled(true); - } else if (sender() == static_cast<QObject*>(sentButton)) { - imapSentDir->setText(folder.path()); - clearSentButton->setEnabled(true); - } else if (sender() == static_cast<QObject*>(trashButton)) { - imapTrashDir->setText(folder.path()); - clearTrashButton->setEnabled(true); - } else if (sender() == static_cast<QObject*>(junkButton)) { - imapJunkDir->setText(folder.path()); - clearJunkButton->setEnabled(true); - } - } -} - -void ImapSettings::displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) -{ - accountId = account.id(); - QStringList pushFolders; - bool hasFolders(false); - if (accountId.isValid()) { - hasFolders = (QMailStore::instance()->countFolders(QMailFolderKey::parentAccountId(accountId)) > 0); - pushFolderList->setAccountId(accountId); - } - - // Only allow the base folder to be specified before retrieval occurs - baseFolderLabel->setEnabled(!hasFolders); - imapBaseDir->setEnabled(!hasFolders); - - // Only allow the other folders to be specified after we have a folder listing - draftsFolderLabel->setEnabled(hasFolders); - draftsButton->setEnabled(hasFolders); - imapDraftsDir->setEnabled(hasFolders); - - sentFolderLabel->setEnabled(hasFolders); - sentButton->setEnabled(hasFolders); - imapSentDir->setEnabled(hasFolders); - - trashFolderLabel->setEnabled(hasFolders); - trashButton->setEnabled(hasFolders); - imapTrashDir->setEnabled(hasFolders); - - junkFolderLabel->setEnabled(hasFolders); - junkButton->setEnabled(hasFolders); - imapJunkDir->setEnabled(hasFolders); - - pushCheckBox->setEnabled(hasFolders); - - if (!config.services().contains(serviceKey)) { - // New account - mailUserInput->setText(""); - mailPasswInput->setText(""); - mailServerInput->setText(""); - mailPortInput->setText("143"); - encryptionIncoming->setCurrentIndex(0); - preferHtml->setChecked(true); - pushCheckBox->setChecked(false); - intervalCheckBox->setChecked(false); - roamingCheckBox->setChecked(false); - pushFolders << "INBOX"; - } else { - ImapConfiguration imapConfig(config); - - mailUserInput->setText(imapConfig.mailUserName()); - mailPasswInput->setText(imapConfig.mailPassword()); - mailServerInput->setText(imapConfig.mailServer()); - mailPortInput->setText(QString::number(imapConfig.mailPort())); - encryptionIncoming->setCurrentIndex(static_cast<int>(imapConfig.mailEncryption())); - authentication->setCurrentIndex(imapConfig.mailAuthentication()); - deleteCheckBox->setChecked(imapConfig.canDeleteMail()); - maxSize->setValue(imapConfig.maxMailSize()); - thresholdCheckBox->setChecked(imapConfig.maxMailSize() != -1); - preferHtml->setChecked(imapConfig.preferredTextSubtype() == "html"); - pushCheckBox->setChecked(imapConfig.pushEnabled()); - intervalCheckBox->setChecked(imapConfig.checkInterval() > 0); - intervalPeriod->setValue(qAbs(imapConfig.checkInterval())); - roamingCheckBox->setChecked(!imapConfig.intervalCheckRoamingEnabled()); - imapBaseDir->setText(imapConfig.baseFolder()); - clearBaseButton->setEnabled(!imapBaseDir->text().isEmpty()); - - QMailFolderId draftFolderId = account.standardFolder(QMailFolder::DraftsFolder); - imapDraftsDir->setText(draftFolderId.isValid() ? QMailFolder(draftFolderId).path() : ""); - clearDraftsButton->setEnabled(!imapDraftsDir->text().isEmpty()); - - QMailFolderId sentFolderId = account.standardFolder(QMailFolder::SentFolder); - imapSentDir->setText(sentFolderId.isValid() ? QMailFolder(sentFolderId).path() : ""); - clearSentButton->setEnabled(!imapSentDir->text().isEmpty()); - - QMailFolderId trashFolderId = account.standardFolder(QMailFolder::TrashFolder); - imapTrashDir->setText(trashFolderId.isValid() ? QMailFolder(trashFolderId).path() : ""); - clearTrashButton->setEnabled(!imapTrashDir->text().isEmpty()); - - QMailFolderId junkFolderId = account.standardFolder(QMailFolder::JunkFolder); - imapJunkDir->setText(junkFolderId.isValid() ? QMailFolder(junkFolderId).path() : ""); - clearJunkButton->setEnabled(!imapJunkDir->text().isEmpty()); - - pushFolders = imapConfig.pushFolders(); - } - - if (pushFolderList) { - pushFolderList->setHasFolders(hasFolders); - pushFolderList->setPushEnabled(pushCheckBox->checkState()); - pushFolderList->populate(pushFolders); - } -} - -bool ImapSettings::updateAccount(QMailAccount *account, QMailAccountConfiguration *config) -{ - bool result; - int port = mailPortInput->text().toInt(&result); - if ( (!result) ) { - // should only happen when the string is empty, since we use a validator. - port = -1; - } - - if (!config->services().contains(serviceKey)) - config->addServiceConfiguration(serviceKey); - - ImapConfigurationEditor imapConfig(config); - - imapConfig.setVersion(100); - imapConfig.setType(QMailServiceConfiguration::Source); - - imapConfig.setMailUserName(mailUserInput->text()); - imapConfig.setMailPassword(mailPasswInput->text()); - imapConfig.setMailServer(mailServerInput->text()); - imapConfig.setMailPort(port == -1 ? 143 : port); - imapConfig.setMailEncryption(static_cast<QMailTransport::EncryptType>(encryptionIncoming->currentIndex())); - int index(authentication->currentIndex()); - Q_ASSERT(index >= 0); - imapConfig.setMailAuthentication(index); - imapConfig.setDeleteMail(deleteCheckBox->isChecked()); - imapConfig.setMaxMailSize(thresholdCheckBox->isChecked() ? maxSize->value() : -1); - imapConfig.setPreferredTextSubtype(preferHtml->isChecked() ? "html" : "plain"); - imapConfig.setAutoDownload(false); - imapConfig.setPushEnabled(pushCheckBox->isChecked()); - imapConfig.setCheckInterval(intervalPeriod->value() * (intervalCheckBox->isChecked() ? 1 : -1)); - imapConfig.setIntervalCheckRoamingEnabled(!roamingCheckBox->isChecked()); - imapConfig.setBaseFolder(imapBaseDir->text()); - - setStandardFolder(account, QMailFolder::DraftsFolder, imapDraftsDir->text()); - setStandardFolder(account, QMailFolder::SentFolder, imapSentDir->text()); - setStandardFolder(account, QMailFolder::TrashFolder, imapTrashDir->text()); - setStandardFolder(account, QMailFolder::JunkFolder, imapJunkDir->text()); - - if (pushFolderList) - imapConfig.setPushFolders(pushFolderList->folderNames()); - - account->setStatus(QMailAccount::CanCreateFolders, true); - // Do we have a configuration we can use? - if (!imapConfig.mailServer().isEmpty() && !imapConfig.mailUserName().isEmpty()) - account->setStatus(QMailAccount::CanRetrieve, true); - - return true; -} - -void ImapSettings::setStandardFolder(QMailAccount *account, QMailFolder::StandardFolder folderType, const QString &path) -{ - QMailFolderIdList folders( - QMailStore::instance()->queryFolders(QMailFolderKey::path(path) - & QMailFolderKey::parentAccountId(account->id())) - ); - - Q_ASSERT(folders.count() <= 1); - if (folders.count() == 0) { - // remove standard folder - account->setStandardFolder(folderType, QMailFolderId()); - return; - } - if (folders.count() != 1) - return; - - QMailFolder folder(folders.first()); - - if (folderType == QMailFolder::DraftsFolder) - folder.setStatus(QMailFolder::Drafts | QMailFolder::OutboxFolder, true); - else if (folderType == QMailFolder::SentFolder) - folder.setStatus(QMailFolder::Sent | QMailFolder::OutboxFolder, true); - else if (folderType == QMailFolder::InboxFolder) - folder.setStatus(QMailFolder::Incoming, true); - else if (folderType == QMailFolder::JunkFolder) - folder.setStatus(QMailFolder::Junk | QMailFolder::Incoming, true); - else if (folderType == QMailFolder::TrashFolder) - folder.setStatus(QMailFolder::Trash | QMailFolder::Incoming, true); - else if (folderType == QMailFolder::OutboxFolder) - folder.setStatus(QMailFolder::Outgoing, true); - else - qCWarning(lcIMAP) << "Unable to set unsupported folder type"; - - QMailStore::instance()->updateFolder(&folder); - - account->setStandardFolder(folderType, folder.id()); -} - -#include "imapsettings.moc" diff --git a/src/plugins/messageservices/imap/imapsettings.h b/src/plugins/messageservices/imap/imapsettings.h deleted file mode 100644 index 574edcd5..00000000 --- a/src/plugins/messageservices/imap/imapsettings.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef IMAPSETTINGS_H -#define IMAPSETTINGS_H - -#include "ui_imapsettings.h" -#include <qmailmessageservice.h> - -class PushFolderList; - -class ImapSettings : public QMailMessageServiceEditor, private Ui::ImapSettings -{ - Q_OBJECT - -public: - ImapSettings(); - - void displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) override; - bool updateAccount(QMailAccount *account, QMailAccountConfiguration *config) override; - -private slots: - void intervalCheckChanged(int enabled); - void selectFolder(); - -private: - QMailAccountId accountId; - bool warningEmitted; - PushFolderList *pushFolderList; - void setStandardFolder(QMailAccount *account, QMailFolder::StandardFolder folderType, const QString &path); -}; - -#endif diff --git a/src/plugins/messageservices/imap/imapsettings.ui b/src/plugins/messageservices/imap/imapsettings.ui deleted file mode 100644 index abea2e09..00000000 --- a/src/plugins/messageservices/imap/imapsettings.ui +++ /dev/null @@ -1,777 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ImapSettings</class> - <widget class="QWidget" name="ImapSettings"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>389</width> - <height>505</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>-1</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QScrollArea" name="scrollArea_2"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>389</width> - <height>505</height> - </rect> - </property> - <layout class="QGridLayout" name="gridlayout1"> - <item row="0" column="0"> - <widget class="QLabel" name="usernameLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Username</string> - </property> - <property name="buddy"> - <cstring>mailUserInput</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="mailUserInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Password</string> - </property> - <property name="buddy"> - <cstring>mailPasswInput</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="mailPasswInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="serverLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Server</string> - </property> - <property name="buddy"> - <cstring>mailServerInput</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="mailServerInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="portLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Port</string> - </property> - <property name="buddy"> - <cstring>mailPortInput</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="mailPortInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblEncryptionIncoming"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Encryption</string> - </property> - <property name="buddy"> - <cstring>encryptionIncoming</cstring> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="encryptionIncoming"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>SSL</string> - </property> - </item> - <item> - <property name="text"> - <string>TLS</string> - </property> - </item> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="lblAuthentication"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Authentication</string> - </property> - <property name="buddy"> - <cstring>authentication</cstring> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="authentication"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Login</string> - </property> - </item> - <item> - <property name="text"> - <string>Plain</string> - </property> - </item> - <item> - <property name="text"> - <string>Cram MD5</string> - </property> - </item> - </widget> - </item> - <item row="6" column="0" colspan="2"> - <widget class="QCheckBox" name="deleteCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Remove deleted messages from server</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QCheckBox" name="thresholdCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Download limit</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QSpinBox" name="maxSize"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix"> - <string>K</string> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>5000</number> - </property> - <property name="singleStep"> - <number>5</number> - </property> - <property name="value"> - <number>100</number> - </property> - </widget> - </item> - <item row="8" column="0" colspan="2"> - <widget class="QCheckBox" name="preferHtml"> - <property name="text"> - <string>Prefer HTML content over Plain</string> - </property> - </widget> - </item> - <item row="9" column="0"> - <widget class="QCheckBox" name="intervalCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Interval</string> - </property> - </widget> - </item> - <item row="9" column="1"> - <widget class="QSpinBox" name="intervalPeriod"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix"> - <string comment="short for minutes">min</string> - </property> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>1440</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>60</number> - </property> - </widget> - </item> - <item row="10" column="1"> - <widget class="QCheckBox" name="roamingCheckBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Disable when Roaming</string> - </property> - </widget> - </item> - <item row="11" column="0"> - <widget class="QLabel" name="baseFolderLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Base folder</string> - </property> - <property name="buddy"> - <cstring>imapBaseDir</cstring> - </property> - </widget> - </item> - <item row="11" column="1"> - <layout class="QHBoxLayout" name="_2a"> - <item> - <widget class="QLineEdit" name="imapBaseDir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="readOnly"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="clearBaseButton"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="mailboxButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>24</width> - <height>26</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="13" column="0"> - <widget class="QLabel" name="draftsFolderLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Drafts folder</string> - </property> - <property name="buddy"> - <cstring>imapDraftsDir</cstring> - </property> - </widget> - </item> - <item row="13" column="1"> - <layout class="QHBoxLayout" name="_2b"> - <item> - <widget class="QLineEdit" name="imapDraftsDir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="clearDraftsButton"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="draftsButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>24</width> - <height>26</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="14" column="0"> - <widget class="QLabel" name="sentFolderLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Sent folder</string> - </property> - <property name="buddy"> - <cstring>imapSentDir</cstring> - </property> - </widget> - </item> - <item row="14" column="1"> - <layout class="QHBoxLayout" name="_2c"> - <item> - <widget class="QLineEdit" name="imapSentDir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="clearSentButton"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="sentButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>24</width> - <height>26</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="15" column="0"> - <widget class="QLabel" name="trashFolderLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Trash folder</string> - </property> - <property name="buddy"> - <cstring>imapTrashDir</cstring> - </property> - </widget> - </item> - <item row="15" column="1"> - <layout class="QHBoxLayout" name="_2d"> - <item> - <widget class="QLineEdit" name="imapTrashDir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="clearTrashButton"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="trashButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>24</width> - <height>26</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="16" column="0"> - <widget class="QLabel" name="junkFolderLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Junk folder</string> - </property> - <property name="buddy"> - <cstring>imapJunkDir</cstring> - </property> - </widget> - </item> - <item row="16" column="1"> - <layout class="QHBoxLayout" name="_2e"> - <item> - <widget class="QLineEdit" name="imapJunkDir"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="clearJunkButton"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="junkButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>24</width> - <height>26</height> - </size> - </property> - <property name="baseSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>...</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="17" column="0" colspan="2"> - <widget class="QCheckBox" name="pushCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Push Enabled</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>mailUserInput</tabstop> - <tabstop>mailPasswInput</tabstop> - <tabstop>mailServerInput</tabstop> - <tabstop>mailPortInput</tabstop> - <tabstop>encryptionIncoming</tabstop> - <tabstop>authentication</tabstop> - <tabstop>deleteCheckBox</tabstop> - <tabstop>thresholdCheckBox</tabstop> - <tabstop>maxSize</tabstop> - <tabstop>preferHtml</tabstop> - <tabstop>pushCheckBox</tabstop> - <tabstop>intervalCheckBox</tabstop> - <tabstop>intervalPeriod</tabstop> - <tabstop>roamingCheckBox</tabstop> - <tabstop>imapBaseDir</tabstop> - <tabstop>clearBaseButton</tabstop> - <tabstop>mailboxButton</tabstop> - <tabstop>clearDraftsButton</tabstop> - <tabstop>draftsButton</tabstop> - <tabstop>clearSentButton</tabstop> - <tabstop>sentButton</tabstop> - <tabstop>clearTrashButton</tabstop> - <tabstop>trashButton</tabstop> - <tabstop>clearJunkButton</tabstop> - <tabstop>junkButton</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/messageservices/imap/pics/clear_left.png b/src/plugins/messageservices/imap/pics/clear_left.png Binary files differdeleted file mode 100644 index 0d29007c..00000000 --- a/src/plugins/messageservices/imap/pics/clear_left.png +++ /dev/null diff --git a/src/plugins/messageservices/pop/CMakeLists.txt b/src/plugins/messageservices/pop/CMakeLists.txt index 33294c70..3ad52305 100644 --- a/src/plugins/messageservices/pop/CMakeLists.txt +++ b/src/plugins/messageservices/pop/CMakeLists.txt @@ -12,25 +12,12 @@ set(HEADERS popservice.h popauthenticator.h) -if (BUILD_WIDGETS) - set(SRC ${SRC} popsettings.cpp) - set(HEADERS ${HEADERS} popsettings.h) - qt_wrap_ui(SRC popsettings.ui) -endif() - add_library(pop MODULE ${SRC} ${HEADERS}) target_include_directories(pop PRIVATE ../../../libraries/qmfclient ../../../libraries/qmfclient/support ../../../libraries/qmfmessageserver) target_link_libraries(pop PRIVATE Qt6::Core Qt6::Network QmfClient QmfMessageServer) -if (BUILD_WIDGETS) - target_link_libraries(pop PUBLIC QmfWidgets) - target_include_directories(pop - PRIVATE ../../../libraries/qmfwidgets) -else() - target_compile_definitions(pop PRIVATE QMF_NO_WIDGETS) -endif() install(TARGETS pop LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt6/plugins/messagingframework/messageservices) diff --git a/src/plugins/messageservices/pop/pop.pro b/src/plugins/messageservices/pop/pop.pro index 549d0329..bbbe3c06 100644 --- a/src/plugins/messageservices/pop/pop.pro +++ b/src/plugins/messageservices/pop/pop.pro @@ -17,16 +17,3 @@ SOURCES += popclient.cpp \ poplog.cpp \ popservice.cpp \ popauthenticator.cpp - -!contains(DEFINES,QMF_NO_WIDGETS) { - QT += gui widgets - - HEADERS += \ - popsettings.h - - FORMS += popsettings.ui - - SOURCES += \ - popsettings.cpp \ -} - diff --git a/src/plugins/messageservices/pop/popservice.cpp b/src/plugins/messageservices/pop/popservice.cpp index c5f1cfb5..7eeb3868 100644 --- a/src/plugins/messageservices/pop/popservice.cpp +++ b/src/plugins/messageservices/pop/popservice.cpp @@ -33,9 +33,7 @@ #include "popservice.h" #include "popconfiguration.h" -#ifndef QMF_NO_WIDGETS -#include "popsettings.h" -#endif + #include <QTimer> #include <QtPlugin> #include <QtGlobal> @@ -399,48 +397,6 @@ void PopService::accountsUpdated(const QMailAccountIdList &ids) } -class PopConfigurator : public QMailMessageServiceConfigurator -{ -public: - PopConfigurator(); - ~PopConfigurator(); - - QString service() const override; - QString displayName() const override; - -#ifndef QMF_NO_WIDGETS - QMailMessageServiceEditor *createEditor(QMailMessageServiceFactory::ServiceType type) override; -#endif -}; - -PopConfigurator::PopConfigurator() -{ -} - -PopConfigurator::~PopConfigurator() -{ -} - -QString PopConfigurator::service() const -{ - return serviceKey; -} - -QString PopConfigurator::displayName() const -{ - return QCoreApplication::instance()->translate("QMailMessageService", "POP"); -} - -#ifndef QMF_NO_WIDGETS -QMailMessageServiceEditor *PopConfigurator::createEditor(QMailMessageServiceFactory::ServiceType type) -{ - if (type == QMailMessageServiceFactory::Source) - return new PopSettings; - - return 0; -} -#endif - PopServicePlugin::PopServicePlugin() : QMailMessageServicePlugin() { @@ -466,9 +422,4 @@ QMailMessageService *PopServicePlugin::createService(const QMailAccountId &id) return new PopService(id); } -QMailMessageServiceConfigurator *PopServicePlugin::createServiceConfigurator() -{ - return new PopConfigurator(); -} - #include "popservice.moc" diff --git a/src/plugins/messageservices/pop/popservice.h b/src/plugins/messageservices/pop/popservice.h index 896d564c..f67b08b7 100644 --- a/src/plugins/messageservices/pop/popservice.h +++ b/src/plugins/messageservices/pop/popservice.h @@ -86,7 +86,6 @@ public: bool supports(QMailMessage::MessageType type) const override; QMailMessageService *createService(const QMailAccountId &id) override; - QMailMessageServiceConfigurator *createServiceConfigurator() override; }; #endif diff --git a/src/plugins/messageservices/pop/popsettings.cpp b/src/plugins/messageservices/pop/popsettings.cpp deleted file mode 100644 index ed9a3cec..00000000 --- a/src/plugins/messageservices/pop/popsettings.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "popsettings.h" -#include "popconfiguration.h" -#include <QLineEdit> -#include <QMessageBox> -#include <qmailaccount.h> -#include <qmailaccountconfiguration.h> -#include <qmailtransport.h> - -namespace { - -const QString serviceKey("pop3"); - -class PortValidator : public QValidator -{ -public: - PortValidator(QWidget *parent = Q_NULLPTR, const char *name = Q_NULLPTR); - - QValidator::State validate(QString &str, int &) const override; -}; - -PortValidator::PortValidator(QWidget *parent, const char *name) - : QValidator(parent) -{ - setObjectName(name); -} - -QValidator::State PortValidator::validate(QString &str, int &) const -{ - // allow empty strings, as it's a bit awkward to edit otherwise - if ( str.isEmpty() ) - return QValidator::Acceptable; - - bool ok = false; - int i = str.toInt(&ok); - if ( !ok ) - return QValidator::Invalid; - - if ( i <= 0 || i >= 65536 ) - return QValidator::Invalid; - - return QValidator::Acceptable; -} - -} - - -PopSettings::PopSettings() - : QMailMessageServiceEditor(), - warningEmitted(false) -{ - setupUi(this); - setLayoutDirection(qApp->layoutDirection()); - - connect(intervalCheckBox, SIGNAL(stateChanged(int)), this, SLOT(intervalCheckChanged(int))); - - const QString uncapitalised("email noautocapitalization"); - - // These fields should not be autocapitalised - - mailPortInput->setValidator(new PortValidator(this)); - mailPasswInput->setEchoMode(QLineEdit::Password); -} - -void PopSettings::intervalCheckChanged(int enabled) -{ - intervalPeriod->setEnabled(enabled); - roamingCheckBox->setEnabled(enabled); -} - -void PopSettings::displayConfiguration(const QMailAccount &, const QMailAccountConfiguration &config) -{ - if (!config.services().contains(serviceKey)) { - // New account - mailUserInput->setText(""); - mailPasswInput->setText(""); - mailServerInput->setText(""); - mailPortInput->setText("110"); - encryptionIncoming->setCurrentIndex(0); - intervalCheckBox->setChecked(false); - roamingCheckBox->setChecked(false); - } else { - PopConfiguration popConfig(config); - - mailUserInput->setText(popConfig.mailUserName()); - mailPasswInput->setText(popConfig.mailPassword()); - mailServerInput->setText(popConfig.mailServer()); - mailPortInput->setText(QString::number(popConfig.mailPort())); - encryptionIncoming->setCurrentIndex(static_cast<int>(popConfig.mailEncryption())); - deleteCheckBox->setChecked(popConfig.canDeleteMail()); - maxSize->setValue(popConfig.maxMailSize()); - thresholdCheckBox->setChecked(popConfig.maxMailSize() != -1); - intervalCheckBox->setChecked(popConfig.checkInterval() > 0); - intervalPeriod->setValue(qAbs(popConfig.checkInterval() )); - roamingCheckBox->setChecked(!popConfig.intervalCheckRoamingEnabled()); - } - - intervalPeriod->setEnabled(false); - roamingCheckBox->setEnabled(intervalCheckBox->isChecked()); -} - -bool PopSettings::updateAccount(QMailAccount *account, QMailAccountConfiguration *config) -{ - bool result; - int port = mailPortInput->text().toInt(&result); - if ( (!result) ) { - // should only happen when the string is empty, since we use a validator. - port = -1; - } - - if (!config->services().contains(serviceKey)) - config->addServiceConfiguration(serviceKey); - - PopConfigurationEditor popConfig(config); - - popConfig.setVersion(100 ); - popConfig.setType(QMailServiceConfiguration::Source ); - - popConfig.setMailUserName(mailUserInput->text()); - popConfig.setMailPassword(mailPasswInput->text()); - popConfig.setMailServer(mailServerInput->text()); - popConfig.setMailPort(port == -1 ? 110 : port); - popConfig.setMailEncryption(static_cast<QMailTransport::EncryptType>(encryptionIncoming->currentIndex())); - popConfig.setDeleteMail(deleteCheckBox->isChecked()); - popConfig.setMaxMailSize(thresholdCheckBox->isChecked() ? maxSize->value() : -1); - popConfig.setAutoDownload(false ); - popConfig.setCheckInterval(intervalPeriod->value() * (intervalCheckBox->isChecked() ? 1 : -1)); - popConfig.setIntervalCheckRoamingEnabled(!roamingCheckBox->isChecked()); - - account->setStatus(QMailAccount::CanCreateFolders, false); - // Do we have a configuration we can use? - if (!popConfig.mailServer().isEmpty() && !popConfig.mailUserName().isEmpty()) - account->setStatus(QMailAccount::CanRetrieve, true); - - return true; -} diff --git a/src/plugins/messageservices/pop/popsettings.h b/src/plugins/messageservices/pop/popsettings.h deleted file mode 100644 index 38c15dbc..00000000 --- a/src/plugins/messageservices/pop/popsettings.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef POPSETTINGS_H -#define POPSETTINGS_H - -#include "ui_popsettings.h" -#include <qmailmessageservice.h> - -class PopSettings : public QMailMessageServiceEditor, private Ui::PopSettings -{ - Q_OBJECT - -public: - PopSettings(); - - void displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) override; - bool updateAccount(QMailAccount *account, QMailAccountConfiguration *config) override; - -private slots: - void intervalCheckChanged(int enabled); - -private: - bool warningEmitted; -}; - -#endif diff --git a/src/plugins/messageservices/pop/popsettings.ui b/src/plugins/messageservices/pop/popsettings.ui deleted file mode 100644 index 9ad9ea0c..00000000 --- a/src/plugins/messageservices/pop/popsettings.ui +++ /dev/null @@ -1,351 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>PopSettings</class> - <widget class="QWidget" name="PopSettings"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>365</width> - <height>256</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QScrollArea" name="scrollArea_2"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>-25</y> - <width>348</width> - <height>281</height> - </rect> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="usernameLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Username</string> - </property> - <property name="buddy"> - <cstring>mailUserInput</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="mailUserInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Password</string> - </property> - <property name="buddy"> - <cstring>mailPasswInput</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="mailPasswInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="serverLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Server</string> - </property> - <property name="buddy"> - <cstring>mailServerInput</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="mailServerInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="portLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Port</string> - </property> - <property name="buddy"> - <cstring>mailPortInput</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="mailPortInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblEncryptionIncoming"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Encryption</string> - </property> - <property name="buddy"> - <cstring>encryptionIncoming</cstring> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="encryptionIncoming"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>SSL</string> - </property> - </item> - <item> - <property name="text"> - <string>TLS</string> - </property> - </item> - </widget> - </item> - <item row="5" column="0" colspan="2"> - <widget class="QCheckBox" name="deleteCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Remove deleted mail from server</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QCheckBox" name="thresholdCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Skip larger</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QCheckBox" name="intervalCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Interval</string> - </property> - </widget> - </item> - <item row="8" column="1"> - <widget class="QCheckBox" name="roamingCheckBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Disable when Roaming</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QSpinBox" name="intervalPeriod"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix"> - <string comment="short for minutes">min</string> - </property> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>1440</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - <property name="value"> - <number>60</number> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QSpinBox" name="maxSize"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix"> - <string>K</string> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>5000</number> - </property> - <property name="singleStep"> - <number>5</number> - </property> - <property name="value"> - <number>100</number> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>mailUserInput</tabstop> - <tabstop>mailPasswInput</tabstop> - <tabstop>mailServerInput</tabstop> - <tabstop>mailPortInput</tabstop> - <tabstop>encryptionIncoming</tabstop> - <tabstop>deleteCheckBox</tabstop> - <tabstop>thresholdCheckBox</tabstop> - <tabstop>maxSize</tabstop> - <tabstop>intervalCheckBox</tabstop> - <tabstop>intervalPeriod</tabstop> - <tabstop>roamingCheckBox</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/plugins/messageservices/smtp/CMakeLists.txt b/src/plugins/messageservices/smtp/CMakeLists.txt index 62eccec9..939c1cad 100644 --- a/src/plugins/messageservices/smtp/CMakeLists.txt +++ b/src/plugins/messageservices/smtp/CMakeLists.txt @@ -10,25 +10,12 @@ set(HEADERS smtpconfiguration.h smtpservice.h) -if (BUILD_WIDGETS) - set(SRC ${SRC} smtpsettings.cpp) - set(HEADERS ${HEADERS} smtpsettings.h) - qt_wrap_ui(SRC smtpsettings.ui) -endif() - add_library(smtp MODULE ${SRC} ${HEADERS}) target_include_directories(smtp PRIVATE ../../../libraries/qmfclient ../../../libraries/qmfclient/support ../../../libraries/qmfmessageserver) target_link_libraries(smtp PRIVATE Qt6::Core Qt6::Network QmfClient QmfMessageServer) -if (BUILD_WIDGETS) - target_link_libraries(smtp PUBLIC QmfWidgets) - target_include_directories(smtp - PRIVATE ../../../libraries/qmfwidgets) -else() - target_compile_definitions(smtp PRIVATE QMF_NO_WIDGETS) -endif() install(TARGETS smtp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt6/plugins/messagingframework/messageservices) diff --git a/src/plugins/messageservices/smtp/smtp.pro b/src/plugins/messageservices/smtp/smtp.pro index d74447ce..168192a0 100644 --- a/src/plugins/messageservices/smtp/smtp.pro +++ b/src/plugins/messageservices/smtp/smtp.pro @@ -15,16 +15,3 @@ SOURCES += smtpauthenticator.cpp \ smtpclient.cpp \ smtpconfiguration.cpp \ smtpservice.cpp - -!contains(DEFINES,QMF_NO_WIDGETS) { - QT += gui widgets qmfwidgets - - HEADERS += \ - smtpsettings.h - - FORMS += smtpsettings.ui - - SOURCES += \ - smtpsettings.cpp -} - diff --git a/src/plugins/messageservices/smtp/smtpservice.cpp b/src/plugins/messageservices/smtp/smtpservice.cpp index 32356c75..7a944246 100644 --- a/src/plugins/messageservices/smtp/smtpservice.cpp +++ b/src/plugins/messageservices/smtp/smtpservice.cpp @@ -32,9 +32,7 @@ ****************************************************************************/ #include "smtpservice.h" -#ifndef QMF_NO_WIDGETS -#include "smtpsettings.h" -#endif + #include <QtPlugin> #include <QTimer> #include <QCoreApplication> @@ -214,48 +212,6 @@ void SmtpService::updateStatus(const QString &text) } -class SmtpConfigurator : public QMailMessageServiceConfigurator -{ -public: - SmtpConfigurator(); - ~SmtpConfigurator(); - - QString service() const override; - QString displayName() const override; - -#ifndef QMF_NO_WIDGETS - QMailMessageServiceEditor *createEditor(QMailMessageServiceFactory::ServiceType type) override; -#endif -}; - -SmtpConfigurator::SmtpConfigurator() -{ -} - -SmtpConfigurator::~SmtpConfigurator() -{ -} - -QString SmtpConfigurator::service() const -{ - return serviceKey; -} - -QString SmtpConfigurator::displayName() const -{ - return QCoreApplication::instance()->translate("QMailMessageService", "SMTP"); -} - -#ifndef QMF_NO_WIDGETS -QMailMessageServiceEditor *SmtpConfigurator::createEditor(QMailMessageServiceFactory::ServiceType type) -{ - if (type == QMailMessageServiceFactory::Sink) - return new SmtpSettings; - - return 0; -} -#endif - SmtpServicePlugin::SmtpServicePlugin() : QMailMessageServicePlugin() { @@ -281,9 +237,4 @@ QMailMessageService *SmtpServicePlugin::createService(const QMailAccountId &id) return new SmtpService(id); } -QMailMessageServiceConfigurator *SmtpServicePlugin::createServiceConfigurator() -{ - return new SmtpConfigurator(); -} - #include "smtpservice.moc" diff --git a/src/plugins/messageservices/smtp/smtpservice.h b/src/plugins/messageservices/smtp/smtpservice.h index 8f73cd05..078a3818 100644 --- a/src/plugins/messageservices/smtp/smtpservice.h +++ b/src/plugins/messageservices/smtp/smtpservice.h @@ -93,7 +93,6 @@ public: bool supports(QMailMessage::MessageType type) const override; QMailMessageService *createService(const QMailAccountId &id) override; - QMailMessageServiceConfigurator *createServiceConfigurator() override; }; #endif diff --git a/src/plugins/messageservices/smtp/smtpsettings.cpp b/src/plugins/messageservices/smtp/smtpsettings.cpp deleted file mode 100644 index 6220fbbf..00000000 --- a/src/plugins/messageservices/smtp/smtpsettings.cpp +++ /dev/null @@ -1,313 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "smtpsettings.h" -#include "smtpconfiguration.h" -#include <QGridLayout> -#include <QLineEdit> -#include <QTextEdit> -#include <QValidator> -#include <qmailaccount.h> -#include <qmailaccountconfiguration.h> -#include <qmailtransport.h> -#include <QDialog> -#include <QPointer> - -namespace { - -const QString serviceKey("smtp"); - -class SigEntry : public QDialog -{ - Q_OBJECT - -public: - SigEntry(QWidget *parent, const char* name, Qt::WindowFlags fl = Qt::Widget); - - void setEntry(QString sig); - QString entry() const; - -protected: - void closeEvent(QCloseEvent *event) override; - -private: - QTextEdit *input; -}; - -SigEntry::SigEntry(QWidget *parent, const char *name, Qt::WindowFlags fl) - : QDialog(parent, fl) -{ - setObjectName(name); - setWindowTitle(tr("Signature")); - - QGridLayout *grid = new QGridLayout(this); - input = new QTextEdit(this); - grid->addWidget(input, 0, 0); -} - -void SigEntry::setEntry(QString sig) -{ - input->insertPlainText(sig); -} - -QString SigEntry::entry() const -{ - return input->toPlainText(); -} - -void SigEntry::closeEvent(QCloseEvent *) -{ - accept(); -} - - -class PortValidator : public QValidator -{ -public: - PortValidator(QWidget *parent = Q_NULLPTR, const char *name = Q_NULLPTR); - - QValidator::State validate(QString &str, int &) const override; -}; - -PortValidator::PortValidator(QWidget *parent, const char *name) - : QValidator(parent) -{ - setObjectName(name); -} - -QValidator::State PortValidator::validate(QString &str, int &) const -{ - // allow empty strings, as it's a bit awkward to edit otherwise - if ( str.isEmpty() ) - return QValidator::Acceptable; - - bool ok = false; - int i = str.toInt(&ok); - if ( !ok ) - return QValidator::Invalid; - - if ( i <= 0 || i >= 65536 ) - return QValidator::Invalid; - - return QValidator::Acceptable; -} - - -const SmtpConfiguration::AuthType authenticationType[] = { - SmtpConfiguration::Auth_NONE, - SmtpConfiguration::Auth_LOGIN, - SmtpConfiguration::Auth_PLAIN, - SmtpConfiguration::Auth_CRAMMD5, - SmtpConfiguration::Auth_INCOMING -}; - -int authenticationIndex(int type) -{ - const int numTypes = sizeof(authenticationType)/sizeof(SmtpConfiguration::AuthType); - for (int i = 0; i < numTypes; ++i) - if (type == authenticationType[i]) - return i; - - return 0; -} - -} - - -SmtpSettings::SmtpSettings() - : QMailMessageServiceEditor(), - addressModified(false) -{ - setupUi(this); - setLayoutDirection(qApp->layoutDirection()); - - connect(setSignatureButton, SIGNAL(clicked()), this, SLOT(sigPressed())); - connect(authentication, SIGNAL(currentIndexChanged(int)), this, SLOT(authChanged(int))); - connect(emailInput, SIGNAL(textChanged(QString)), this, SLOT(emailModified())); - connect(sigCheckBox, SIGNAL(clicked(bool)), setSignatureButton, SLOT(setEnabled(bool))); - - const QString uncapitalised("email noautocapitalization"); - - // These fields should not be autocapitalised - - smtpPortInput->setValidator(new PortValidator(this)); - - smtpPasswordInput->setEchoMode(QLineEdit::Password); -} - -void SmtpSettings::sigPressed() -{ - if (sigCheckBox->isChecked()) { - QString sigText; - if (signature.isEmpty()) - sigText = QLatin1String("~~\n") + nameInput->text(); - else - sigText = signature; - - QPointer<SigEntry> sigEntry(new SigEntry(this, "sigEntry", static_cast<Qt::WindowFlags>(1))); - sigEntry->setEntry(sigText); - if (sigEntry->exec() == QDialog::Accepted) - signature = sigEntry->entry(); - - delete sigEntry; - - } -} - -void SmtpSettings::emailModified() -{ - addressModified = true; -} - -void SmtpSettings::authChanged(int index) -{ - SmtpConfiguration::AuthType type = authenticationType[index]; - bool enableCredentials = (type == SmtpConfiguration::Auth_LOGIN - || type == SmtpConfiguration::Auth_PLAIN - || type == SmtpConfiguration::Auth_CRAMMD5); - - smtpUsernameInput->setEnabled(enableCredentials); - lblSmtpUsername->setEnabled(enableCredentials); - smtpPasswordInput->setEnabled(enableCredentials); - lblSmtpPassword->setEnabled(enableCredentials); - - if (!enableCredentials) { - smtpUsernameInput->clear(); - smtpPasswordInput->clear(); - } -} - -void SmtpSettings::displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) -{ - // Any reason to re-enable this facility? - //authentication->setItemText(3, tr("Incoming"); - - if (!config.services().contains(serviceKey)) { - // New account - nameInput->setText(""); - emailInput->setText(""); - smtpServerInput->setText(""); - smtpPortInput->setText("25"); - smtpUsernameInput->setText(""); - smtpPasswordInput->setText(""); - encryption->setCurrentIndex(0); - authentication->setCurrentIndex(0); - smtpUsernameInput->setEnabled(false); - lblSmtpUsername->setEnabled(false); - smtpPasswordInput->setEnabled(false); - lblSmtpPassword->setEnabled(false); - signature.clear(); - } else { - SmtpConfiguration smtpConfig(config); - nameInput->setText(smtpConfig.userName());; - emailInput->setText(smtpConfig.emailAddress()); - smtpServerInput->setText(smtpConfig.smtpServer()); - smtpPortInput->setText(QString::number(smtpConfig.smtpPort())); - smtpUsernameInput->setText(smtpConfig.smtpUsername()); - smtpPasswordInput->setText(smtpConfig.smtpPassword()); - authentication->setCurrentIndex(authenticationIndex(smtpConfig.smtpAuthentication())); - encryption->setCurrentIndex(static_cast<int>(smtpConfig.smtpEncryption())); - - int index(authentication->currentIndex()); - Q_ASSERT(index >= 0); - SmtpConfiguration::AuthType type = authenticationType[index]; - const bool enableCredentials(type == SmtpConfiguration::Auth_LOGIN || type == SmtpConfiguration::Auth_PLAIN || type == SmtpConfiguration::Auth_CRAMMD5); - smtpUsernameInput->setEnabled(enableCredentials); - lblSmtpUsername->setEnabled(enableCredentials); - smtpPasswordInput->setEnabled(enableCredentials); - lblSmtpPassword->setEnabled(enableCredentials); - defaultMailCheckBox->setChecked(account.status() & QMailAccount::PreferredSender); - sigCheckBox->setChecked(account.status() & QMailAccount::AppendSignature); - setSignatureButton->setEnabled(sigCheckBox->isChecked()); - signature = account.signature(); - } -} - -bool SmtpSettings::updateAccount(QMailAccount *account, QMailAccountConfiguration *config) -{ - QString username(nameInput->text()); - QString address(emailInput->text()); - - if (!username.isEmpty() || !address.isEmpty()) { - account->setFromAddress(QMailAddress(username, address)); - } - - bool result; - int port = smtpPortInput->text().toInt(&result); - if ( (!result) ) { - // should only happen when the string is empty, since we use a validator. - port = 25; - } - - if (!config->services().contains(serviceKey)) - config->addServiceConfiguration(serviceKey); - - SmtpConfigurationEditor smtpConfig(config); - - smtpConfig.setVersion(100); - smtpConfig.setType(QMailServiceConfiguration::Sink); - - if ((!addressModified) && (address.isEmpty())) { - // Try to guess email address - QString server(smtpConfig.smtpServer()); - if (server.count('.')) { - address = username + "@" + server.mid(server.indexOf('.') + 1, server.length()); - } else if (server.count('.') == 1) { - address = username + "@" + server; - } - } - smtpConfig.setUserName(username); - smtpConfig.setEmailAddress(address); - smtpConfig.setSmtpServer(smtpServerInput->text()); - smtpConfig.setSmtpPort(port); - smtpConfig.setSmtpUsername(smtpUsernameInput->text()); - smtpConfig.setSmtpPassword(smtpPasswordInput->text()); - int index(authentication->currentIndex()); - Q_ASSERT(index >= 0); - smtpConfig.setSmtpAuthentication(authenticationType[index]); - smtpConfig.setSmtpEncryption(static_cast<QMailTransport::EncryptType>(encryption->currentIndex())); - - account->setStatus(QMailAccount::PreferredSender, defaultMailCheckBox->isChecked()); - account->setStatus(QMailAccount::AppendSignature, sigCheckBox->isChecked()); - account->setSignature(signature); - - // Do we have a configuration we can use? - if (!smtpConfig.smtpServer().isEmpty() && !smtpConfig.emailAddress().isEmpty()) - account->setStatus(QMailAccount::CanTransmit, true); - - account->setStatus(QMailAccount::UseSmartReply, false); - - return true; -} - -#include "smtpsettings.moc" diff --git a/src/plugins/messageservices/smtp/smtpsettings.h b/src/plugins/messageservices/smtp/smtpsettings.h deleted file mode 100644 index 6fd20e3f..00000000 --- a/src/plugins/messageservices/smtp/smtpsettings.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Messaging Framework. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef SMTPSETTINGS_H -#define SMTPSETTINGS_H - -#include "ui_smtpsettings.h" -#include <qmailmessageservice.h> - -class QMailAccount; -class QMailAccountConfiguration; - - -class SmtpSettings : public QMailMessageServiceEditor, private Ui::SmtpSettings -{ - Q_OBJECT - -public: - SmtpSettings(); - - void displayConfiguration(const QMailAccount &account, const QMailAccountConfiguration &config) override; - bool updateAccount(QMailAccount *account, QMailAccountConfiguration *config) override; - -private slots: - void sigPressed(); - void emailModified(); - void authChanged(int index); - -private: - bool addressModified; - QString signature; -}; - -#endif diff --git a/src/plugins/messageservices/smtp/smtpsettings.ui b/src/plugins/messageservices/smtp/smtpsettings.ui deleted file mode 100644 index e31a36ef..00000000 --- a/src/plugins/messageservices/smtp/smtpsettings.ui +++ /dev/null @@ -1,362 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>SmtpSettings</class> - <widget class="QWidget" name="SmtpSettings"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="focusPolicy"> - <enum>Qt::NoFocus</enum> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <layout class="QGridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="nameLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>From</string> - </property> - <property name="buddy"> - <cstring>nameInput</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLineEdit" name="nameInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="emailLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Email</string> - </property> - <property name="buddy"> - <cstring>emailInput</cstring> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="emailInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="serverLabel_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Server</string> - </property> - <property name="buddy"> - <cstring>smtpServerInput</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLineEdit" name="smtpServerInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="portLabel_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Port</string> - </property> - <property name="buddy"> - <cstring>smtpPortInput</cstring> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="smtpPortInput"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="lblEncryption"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Encryption</string> - </property> - <property name="buddy"> - <cstring>encryption</cstring> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="encryption"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>SSL</string> - </property> - </item> - <item> - <property name="text"> - <string>TLS</string> - </property> - </item> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="lblAuthentication"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Authentication</string> - </property> - <property name="buddy"> - <cstring>authentication</cstring> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="authentication"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>Login</string> - </property> - </item> - <item> - <property name="text"> - <string>Plain</string> - </property> - </item> - <item> - <property name="text"> - <string>Cram MD5</string> - </property> - </item> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="lblSmtpUsername"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Username</string> - </property> - <property name="buddy"> - <cstring>smtpUsernameInput</cstring> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QLineEdit" name="smtpUsernameInput"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="lblSmtpPassword"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Password</string> - </property> - <property name="buddy"> - <cstring>smtpPasswordInput</cstring> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QLineEdit" name="smtpPasswordInput"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="9" column="0"> - <widget class="QCheckBox" name="sigCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Signature</string> - </property> - </widget> - </item> - <item row="9" column="1"> - <widget class="QToolButton" name="setSignatureButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Set...</string> - </property> - </widget> - </item> - <item row="10" column="0" colspan="2"> - <widget class="QCheckBox" name="defaultMailCheckBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Default sending account</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>nameInput</tabstop> - <tabstop>emailInput</tabstop> - <tabstop>smtpServerInput</tabstop> - <tabstop>smtpPortInput</tabstop> - <tabstop>encryption</tabstop> - <tabstop>authentication</tabstop> - <tabstop>smtpUsernameInput</tabstop> - <tabstop>smtpPasswordInput</tabstop> - <tabstop>sigCheckBox</tabstop> - <tabstop>setSignatureButton</tabstop> - <tabstop>defaultMailCheckBox</tabstop> - </tabstops> - <resources/> - <connections/> -</ui> diff --git a/src/tools/messageserver/CMakeLists.txt b/src/tools/messageserver/CMakeLists.txt index 7cb8b5b0..5454dc55 100644 --- a/src/tools/messageserver/CMakeLists.txt +++ b/src/tools/messageserver/CMakeLists.txt @@ -10,12 +10,6 @@ qt_add_dbus_adaptor(GENERATED_SOURCES ../../libraries/qmfclient/qmailservice.xml add_library(MessageServer ${SRC} ${GENERATED_SOURCES} ${HEADERS}) -if (BUILD_WIDGETS) - target_link_libraries(MessageServer - PRIVATE Qt6::Widgets) -else() - target_compile_definitions(MessageServer PRIVATE QMF_NO_WIDGETS) -endif() target_include_directories(MessageServer PUBLIC ../../libraries/qmfmessageserver ../../libraries/qmfclient diff --git a/src/tools/messageserver/messageserver.pro b/src/tools/messageserver/messageserver.pro index 95defd28..1ecfbdf6 100644 --- a/src/tools/messageserver/messageserver.pro +++ b/src/tools/messageserver/messageserver.pro @@ -7,10 +7,6 @@ contains(DEFINES, USE_HTML_PARSER) { QT += gui } -!contains(DEFINES,QMF_NO_WIDGETS) { - QT += gui widgets -} - CONFIG -= app_bundle target.path += $$QMF_INSTALL_ROOT/bin |
