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

Move as async

parent 94e39f6a
Pipeline #41381 failed with stage
in 12 minutes and 38 seconds
......@@ -6,7 +6,7 @@
#include "custommanagesievewidget.h"
#include "widgets/managesievetreeview.h"
#include "util/util_p.h"
#include "util/findaccountinfojob.h"
#include <KLocalizedString>
#include <QIcon>
......@@ -68,11 +68,20 @@ void CustomManageSieveWidget::searchNextServerSieve()
void CustomManageSieveWidget::slotSearchSieveScript(const QString &name, const QString &identifier)
{
QString serverName = name;
mLastSieveTreeWidgetItem = new SieveTreeWidgetItem(treeView(), mLastSieveTreeWidgetItem);
mLastSieveTreeWidgetItem->setIcon(0, QIcon::fromTheme(QStringLiteral("network-server")));
const KSieveUi::Util::AccountInfo info = KSieveUi::Util::fullAccountInfo(identifier, mPasswordProvider, false);
FindAccountInfoJob *job = new FindAccountInfoJob(this);
connect(job, &FindAccountInfoJob::findAccountInfoFinished, this, &CustomManageSieveWidget::slotFindAccountInfoFinished);
job->setIdentifier(identifier);
job->setProperty("serverName", name);
job->setProvider(mPasswordProvider);
job->start();
}
void CustomManageSieveWidget::slotFindAccountInfoFinished(const KSieveUi::Util::AccountInfo &info)
{
QString serverName = sender()->property("serverName").toString();
const QUrl u = info.sieveUrl;
if (u.isEmpty()) {
auto *item = new QTreeWidgetItem(mLastSieveTreeWidgetItem);
......
......@@ -9,6 +9,7 @@
#include <widgets/managesievewidget.h>
#include <KSieveUi/SieveImapInstance>
#include "util/util_p.h"
namespace KSieveUi {
class SieveImapPasswordProvider;
......@@ -28,6 +29,7 @@ private:
void searchNextServerSieve();
void searchSieveScript();
void slotSearchSieveScript(const QString &name, const QString &identifier);
void slotFindAccountInfoFinished(const KSieveUi::Util::AccountInfo &info);
QVector<KSieveUi::SieveImapInstance> mSieveImapInstances;
QMap<QString, QString>::const_iterator mSieveServerMapIterator;
//name, identifier
......
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