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

react if akonadi status change

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