Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ecdb2acf authored by Laurent Montel's avatar Laurent Montel 😁

Now we can define imap folder in manage vacation

parent af4b8e6a
cmake_minimum_required(VERSION 3.0)
set(PIM_VERSION "5.6.43")
set(PIM_VERSION "5.6.44")
project(libksieve VERSION ${PIM_VERSION})
......
......@@ -262,7 +262,7 @@ set_target_properties(KF5KSieveUi PROPERTIES
)
target_include_directories(KF5KSieveUi INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KSieveUi/;${KDE_INSTALL_INCLUDEDIR_KF5}/ksieveui;${KDE_INSTALL_INCLUDEDIR_KF5}>")
target_include_directories(KF5KSieveUi PUBLIC "$<BUILD_INTERFACE:${libksieve_SOURCE_DIR}/src/ksieveui;${libksieve_BINARY_DIR}/src/ksieveui>")
target_include_directories(KF5KSieveUi PUBLIC "$<BUILD_INTERFACE:${libksieve_SOURCE_DIR}/src/ksieveui;${libksieve_SOURCE_DIR}/src/ksieveui/util/;${libksieve_BINARY_DIR}/src/ksieveui>")
ecm_generate_headers(ksieveui_CamelCase_HEADERS
HEADER_NAMES
......@@ -370,6 +370,7 @@ install(FILES
${ksieveui_editor_HEADERS}
${ksieveui_util_HEADERS}
${ksieveui_managescriptsjob_HEADERS}
util/util_p.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/ksieveui
COMPONENT Devel
)
......
......@@ -39,7 +39,7 @@
#ifndef KSIEVE_KSIEVEUI_UTIL_P_H
#define KSIEVE_KSIEVEUI_UTIL_P_H
#include "ksieveui_private_export.h"
#include "ksieveui_export.h"
#include <KSieveUi/SieveImapAccountSettings>
#include <KSieveUi/SieveImapInstance>
#include <memory>
......@@ -58,9 +58,9 @@ namespace Util {
struct AccountInfo {
KSieveUi::SieveImapAccountSettings sieveImapAccountSettings;
QUrl sieveUrl;
KSIEVEUI_TESTS_EXPORT bool operator==(const AccountInfo &other) const;
KSIEVEUI_EXPORT bool operator==(const AccountInfo &other) const;
};
KSIEVEUI_TESTS_EXPORT QDebug operator <<(QDebug d, const Util::AccountInfo &info);
KSIEVEUI_EXPORT QDebug operator <<(QDebug d, const Util::AccountInfo &info);
/**
* Returns the list of configured IMAP agent instances.
......@@ -79,12 +79,12 @@ bool hasKep14Support(const QStringList &sieveCapabilities, const QStringList &av
*/
bool isKep14ProtectedName(const QString &scriptName);
KSIEVEUI_TESTS_EXPORT KSieveUi::Util::AccountInfo findAccountInfo(const QString &identifier, SieveImapPasswordProvider *provider, bool withVacationFileName,
KSIEVEUI_EXPORT KSieveUi::Util::AccountInfo findAccountInfo(const QString &identifier, SieveImapPasswordProvider *provider, bool withVacationFileName,
std::unique_ptr<KSieveUi::AbstractAkonadiImapSettingInterface> &interface);
/**
* Returns all sieve account info with the given @p identifier.
*/
KSIEVEUI_TESTS_EXPORT KSieveUi::Util::AccountInfo fullAccountInfo(const QString &identifier, SieveImapPasswordProvider *provider, bool withVacationFileName = true);
KSIEVEUI_EXPORT KSieveUi::Util::AccountInfo fullAccountInfo(const QString &identifier, SieveImapPasswordProvider *provider, bool withVacationFileName = true);
}
}
......
......@@ -118,12 +118,11 @@ void MultiImapVacationDialog::init()
bool foundOneImap = false;
QDialogButtonBox *buttonBox = nullptr;
const QMap <QString, QUrl> list = d->mVacationManager->serverList();
QMapIterator<QString, QUrl> i(list);
const QMap <QString, KSieveUi::Util::AccountInfo> list = d->mVacationManager->serverList();
QMapIterator<QString, KSieveUi::Util::AccountInfo> i(list);
while (i.hasNext()) {
i.next();
const QUrl url = i.value();
createPage(i.key(), url);
createPage(i.key(), i.value());
foundOneImap = true;
}
if (foundOneImap) {
......@@ -151,13 +150,14 @@ void MultiImapVacationDialog::slotCanceled()
Q_EMIT cancelClicked();
}
void MultiImapVacationDialog::createPage(const QString &serverName, const QUrl &url)
void MultiImapVacationDialog::createPage(const QString &serverName, const KSieveUi::Util::AccountInfo &info)
{
VacationPageWidget *page = new VacationPageWidget;
page->setServerUrl(url);
page->setServerUrl(info.sieveUrl);
page->setServerName(serverName);
page->setVacationManager(d->mVacationManager);
d->mTabWidget->addTab(page, serverName + QStringLiteral(" (%1)").arg(url.userName()));
page->setSieveImapAccountSettings(info.sieveImapAccountSettings);
d->mTabWidget->addTab(page, serverName + QStringLiteral(" (%1)").arg(info.sieveUrl.userName()));
}
void MultiImapVacationDialog::readConfig()
......
......@@ -23,6 +23,7 @@
#include <QDialog>
#include <QUrl>
#include "ksieveui_export.h"
#include "util_p.h"
namespace KSieveUi {
class VacationCreateScriptJob;
......@@ -47,7 +48,7 @@ private:
void slotOkClicked();
void slotDefaultClicked();
void slotCanceled();
void createPage(const QString &serverName, const QUrl &url);
void createPage(const QString &serverName, const KSieveUi::Util::AccountInfo &info);
void init();
void readConfig();
void writeConfig();
......
......@@ -40,9 +40,9 @@ MultiImapVacationManager::~MultiImapVacationManager()
{
}
QMap <QString, QUrl> MultiImapVacationManager::serverList() const
QMap <QString, KSieveUi::Util::AccountInfo> MultiImapVacationManager::serverList() const
{
QMap <QString, QUrl> list;
QMap <QString, KSieveUi::Util::AccountInfo> list;
const QVector<KSieveUi::SieveImapInstance> instances = KSieveUi::Util::sieveImapInstances();
for (const KSieveUi::SieveImapInstance &instance : instances) {
if (instance.status() == KSieveUi::SieveImapInstance::Broken) {
......@@ -52,7 +52,7 @@ QMap <QString, QUrl> MultiImapVacationManager::serverList() const
const KSieveUi::Util::AccountInfo info = KSieveUi::Util::fullAccountInfo(instance.identifier(), mPasswordProvider);
const QUrl url = info.sieveUrl;
if (!url.isEmpty()) {
list.insert(instance.name(), url);
list.insert(instance.name(), info);
}
}
return list;
......@@ -84,10 +84,10 @@ void MultiImapVacationManager::checkVacation()
mNumberOfJobs = 0;
mCheckInProgress = true;
QMapIterator<QString, QUrl> i(serverList());
QMapIterator<QString, KSieveUi::Util::AccountInfo> i(serverList());
while (i.hasNext()) {
i.next();
checkVacation(i.key(), i.value());
checkVacation(i.key(), i.value().sieveUrl);
}
}
......
......@@ -22,7 +22,7 @@
#include <QObject>
#include <QMap>
#include "util_p.h"
#include "ksieveui_export.h"
class QUrl;
......@@ -39,7 +39,7 @@ public:
~MultiImapVacationManager();
void checkVacation();
QMap<QString, QUrl> serverList() const;
QMap<QString, KSieveUi::Util::AccountInfo> serverList() const;
void checkVacation(const QString &serverName, const QUrl &url);
bool kep14Support(const QString &serverName) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment