Commit ab30fcbf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to load settings as async

parent 82ef2ec3
Pipeline #40519 failed with stage
in 13 minutes and 35 seconds
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.16.40")
set(PIM_VERSION "5.16.41")
project(libksieve VERSION ${PIM_VERSION})
......
......@@ -26,12 +26,17 @@ CustomManageSieveWidget::~CustomManageSieveWidget()
{
}
void CustomManageSieveWidget::updateSieveSettings()
{
mSieveImapInstances = KSieveUi::Util::sieveImapInstances();
Q_EMIT updateSieveSettingsDone();
}
bool CustomManageSieveWidget::refreshList()
{
bool noImapFound = true;
SieveTreeWidgetItem *last = nullptr;
const QVector<KSieveUi::SieveImapInstance> lst = KSieveUi::Util::sieveImapInstances();
for (const KSieveUi::SieveImapInstance &type : lst) {
for (const KSieveUi::SieveImapInstance &type : mSieveImapInstances) {
if (type.status() == KSieveUi::SieveImapInstance::Broken) {
continue;
}
......
......@@ -8,6 +8,7 @@
#define CUSTOMMANAGESIEVEWIDGET_H
#include <widgets/managesievewidget.h>
#include <KSieveUi/SieveImapInstance>
namespace KSieveUi {
class SieveImapPasswordProvider;
......@@ -20,8 +21,10 @@ public:
protected:
Q_REQUIRED_RESULT bool refreshList() override;
void updateSieveSettings() override;
private:
QVector<KSieveUi::SieveImapInstance> mSieveImapInstances;
SieveImapPasswordProvider *const mPasswordProvider;
};
}
......
......@@ -65,6 +65,7 @@ ManageSieveWidget::ManageSieveWidget(QWidget *parent)
connect(d->mTreeView, &ManageSieveTreeView::itemDoubleClicked, this, &ManageSieveWidget::slotDoubleClicked);
connect(d->mTreeView, &ManageSieveTreeView::itemSelectionChanged, this, &ManageSieveWidget::slotUpdateButtons);
connect(d->mTreeView, &ManageSieveTreeView::itemChanged, this, &ManageSieveWidget::slotItemChanged);
connect(this, &ManageSieveWidget::updateSieveSettingsDone, this, &ManageSieveWidget::updateSieveSettingsFinished);
connect(PimCommon::NetworkManager::self()->networkConfigureManager(), &QNetworkConfigurationManager::onlineStateChanged, this, &ManageSieveWidget::slotSystemNetworkOnlineStateChanged);
......@@ -507,6 +508,11 @@ void ManageSieveWidget::slotRefresh()
{
d->mBlockSignal = true;
clear();
updateSieveSettings();
}
void ManageSieveWidget::updateSieveSettingsFinished()
{
const bool noImapFound = refreshList();
slotUpdateButtons();
d->mTreeView->setNoImapFound(noImapFound);
......
......@@ -57,9 +57,11 @@ Q_SIGNALS:
void scriptDeleted(const QUrl &u);
void serverSieveFound(bool imapFound);
void scriptRenamed(const QUrl &oldUrl, const QUrl &newUrl);
void updateSieveSettingsDone();
protected:
virtual bool refreshList() = 0;
virtual void updateSieveSettings() = 0;
private Q_SLOTS:
void slotItemChanged(QTreeWidgetItem *item, int col);
......@@ -89,6 +91,7 @@ protected:
QMap<QTreeWidgetItem *, QUrl> mUrls;
private:
void updateSieveSettingsFinished();
enum sieveServerStatus {
SIEVE_SERVER_ERROR = Qt::UserRole + 1,
SIEVE_SERVER_CAPABILITIES = Qt::UserRole + 2,
......
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