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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Stephen Kelly <steveire@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "akonaditestfake_export.h"
0010 #include "collection.h"
0011 #include "session.h"
0012 
0013 using namespace Akonadi;
0014 
0015 class AKONADITESTFAKE_EXPORT FakeSession : public Session
0016 {
0017     Q_OBJECT
0018 public:
0019     enum Mode {
0020         EndJobsImmediately,
0021         EndJobsManually,
0022     };
0023 
0024     explicit FakeSession(const QByteArray &sessionId = QByteArray(), Mode mode = EndJobsImmediately, QObject *parent = nullptr);
0025 
0026     /** Make this the default session returned by Akonadi::Session::defaultSession().
0027      *  Note that ownership is taken over by the thread-local storage.
0028      */
0029     void setAsDefaultSession();
0030 
0031 Q_SIGNALS:
0032     void jobAdded(Akonadi::Job *job);
0033 
0034     friend class FakeSessionPrivate;
0035 };