Commit 407348b5 authored by Laurent Montel's avatar Laurent Montel 😁

react if akonadi status change

parent 8071c0e1
......@@ -21,7 +21,6 @@
#include "sieveeditoremaillineditplugin_debug.h"
#include <kpluginfactory.h>
#include <Akonadi/Contact/EmailAddressSelectionDialog>
#include <AkonadiCore/ServerManager>
#include <QHBoxLayout>
#include <QLineEdit>
......@@ -53,12 +52,18 @@ EmailLineEdit::EmailLineEdit(QWidget *parent, const QList<QVariant> &)
mainLayout->addWidget(mEmailButton);
connect(mEmailButton, &QToolButton::clicked, this, &EmailLineEdit::slotSelectEmail);
verifyAkonadiStatus();
connect(Akonadi::ServerManager::self(), &Akonadi::ServerManager::stateChanged, this, &EmailLineEdit::akonadiStateChanged);
}
EmailLineEdit::~EmailLineEdit()
{
}
void EmailLineEdit::akonadiStateChanged(Akonadi::ServerManager::State state)
{
mEmailButton->setVisible(state == Akonadi::ServerManager::Running);
}
void EmailLineEdit::verifyAkonadiStatus()
{
Akonadi::ServerManager::State state = Akonadi::ServerManager::self()->state();
......
......@@ -20,8 +20,8 @@
#ifndef EMAILLINEEDIT_H
#define EMAILLINEEDIT_H
#include <QWidget>
#include <KSieveUi/AbstractSelectEmailLineEdit>
#include <AkonadiCore/ServerManager>
class QLineEdit;
class QToolButton;
class EmailLineEdit : public KSieveUi::AbstractSelectEmailLineEdit
......@@ -40,6 +40,7 @@ private:
void verifyAddress();
void slotSelectEmail();
void verifyAkonadiStatus();
void akonadiStateChanged(Akonadi::ServerManager::State state);
QString mNegativeBackground;
QLineEdit *mLineEdit = nullptr;
QToolButton *mEmailButton = nullptr;
......
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