File indexing completed on 2024-11-10 04:40:31

0001 /*
0002     SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "kjobprivatebase_p.h"
0008 
0009 using namespace Akonadi;
0010 
0011 void KJobPrivateBase::start()
0012 {
0013     const ServerManager::State serverState = ServerManager::state();
0014 
0015     if (serverState == ServerManager::Running) {
0016         doStart();
0017         return;
0018     }
0019 
0020     connect(ServerManager::self(), &ServerManager::stateChanged, this, &KJobPrivateBase::serverStateChanged);
0021 
0022     if (serverState == ServerManager::NotRunning) {
0023         ServerManager::start();
0024     }
0025 }
0026 
0027 void KJobPrivateBase::serverStateChanged(Akonadi::ServerManager::State state)
0028 {
0029     if (state == ServerManager::Running) {
0030         disconnect(ServerManager::self(), &ServerManager::stateChanged, this, &KJobPrivateBase::serverStateChanged);
0031         doStart();
0032     }
0033 }
0034 
0035 #include "moc_kjobprivatebase_p.cpp"