Akonadi

control.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10
11#include <QObject>
12
13#include <memory>
14
15namespace Akonadi
16{
17class ControlPrivate;
18
19/**
20 * @short Provides methods to control the Akonadi server process.
21 *
22 * This class provides synchronous methods (ie. use a sub-eventloop)
23 * to control the Akonadi service. For asynchronous methods see
24 * Akonadi::ServerManager.
25 *
26 * The most important method in here is widgetNeedsAkonadi(). It is
27 * recommended to call it with every top-level widget of your application
28 * as argument, assuming your application relies on Akonadi being operational
29 * of course.
30 *
31 * While the Akonadi server automatically started by Akonadi::Session
32 * on first use, it might be necessary for some use-cases to guarantee
33 * a running Akonadi service at some point. This can be done using
34 * start().
35 *
36 * Example:
37 *
38 * @code
39 *
40 * if ( !Akonadi::Control::start() ) {
41 * qDebug() << "Unable to start Akonadi server, exit application";
42 * return 1;
43 * } else {
44 * ...
45 * }
46 *
47 * @endcode
48 *
49 * @author Volker Krause <vkrause@kde.org>
50 *
51 * @see Akonadi::ServerManager
52 */
53class AKONADICORE_EXPORT Control : public QObject
54{
55 Q_OBJECT
56
57public:
58 /**
59 * Destroys the control object.
60 */
61 ~Control() override;
62
63 /**
64 * Starts the Akonadi server synchronously if it is not already running.
65 * @return @c true if the server was started successfully or was already
66 * running, @c false otherwise
67 */
68 static bool start();
69
70 /**
71 * Stops the Akonadi server synchronously if it is currently running.
72 * @return @c true if the server was shutdown successfully or was
73 * not running at all, @c false otherwise.
74 * @since 4.2
75 */
76 static bool stop();
77
78 /**
79 * Restarts the Akonadi server synchronously.
80 * @return @c true if the restart was successful, @c false otherwise,
81 * the server state is undefined in this case.
82 * @since 4.2
83 */
84 static bool restart();
85
86protected:
87 /**
88 * Creates the control object.
89 */
90 Control();
91
92private:
93 /// @cond PRIVATE
94 std::unique_ptr<ControlPrivate> const d;
95 /// @endcond
96};
97
98}
Provides methods to control the Akonadi server process.
Definition control.h:54
~Control() override
Destroys the control object.
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE Q_NOREPLY void start()
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.