Akonadi::ControlGui Class

Provides methods to ControlGui the Akonadi server process. More...

Header: #include <Akonadi/ControlGui>
CMake: find_package(KPim6 REQUIRED COMPONENTS AkonadiWidgets)
target_link_libraries(mytarget PRIVATE KPim6::AkonadiWidgets)

Public Functions

virtual ~ControlGui() override

Static Public Members

bool restart()
bool restart(QWidget *parent)
bool start()
bool start(QWidget *parent)
bool stop()
bool stop(QWidget *parent)
void widgetNeedsAkonadi(QWidget *widget)

Protected Functions

Detailed Description

This class provides synchronous methods (ie. use a sub-eventloop) to ControlGui the Akonadi service. For asynchronous methods see Akonadi::ServerManager.

The most important method in here is widgetNeedsAkonadi(). It is recommended to call it with every top-level widget of your application as argument, assuming your application relies on Akonadi being operational of course.

While the Akonadi server automatically started by Akonadi::Session on first use, it might be necessary for some use-cases to guarantee a running Akonadi service at some point. This can be done using start().

Example:

 if ( !Akonadi::ControlGui::start() ) {
   qDebug() << "Unable to start Akonadi server, exit application";
   return 1;
 } else {
   ...
 }

Author: Volker Krause <vkrause@kde.org>

See also Akonadi::ServerManager.

Member Function Documentation

[protected] ControlGui::ControlGui()

Creates the ControlGui object.

[override virtual noexcept] ControlGui::~ControlGui()

Destroys the ControlGui object.

[static] bool ControlGui::restart()

Restarts the Akonadi server synchronously. Returns \ true if the restart was successful, \ false otherwise, the server state is undefined in this case.

[static] bool ControlGui::restart(QWidget *parent)

Same as restart(), but with GUI feedback. parent The parent widget.

[static] bool ControlGui::start()

Starts the Akonadi server synchronously if it is not already running. Returns \ true if the server was started successfully or was already running, \ false otherwise

[static] bool ControlGui::start(QWidget *parent)

Same as start(), but with GUI feedback. parent The parent widget.

[static] bool ControlGui::stop()

Stops the Akonadi server synchronously if it is currently running. Returns \ true if the server was shutdown successfully or was not running at all, \ false otherwise.

[static] bool ControlGui::stop(QWidget *parent)

Same as stop(), but with GUI feedback. parent The parent widget.

[static] void ControlGui::widgetNeedsAkonadi(QWidget *widget)

Disable the given widget when Akonadi is not operational and show an error overlay (given enough space). Cascading use is automatically detected and resolved. widget The widget depending on Akonadi being operational.