File indexing completed on 2024-05-05 05:21:07
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include <QObject> 0009 0010 #include "notesagentalarmdialog.h" 0011 0012 #include <Akonadi/Item> 0013 #include <QPointer> 0014 class QTcpServer; 0015 class QTimer; 0016 namespace NoteShared 0017 { 0018 class NotesChangeRecorder; 0019 } 0020 0021 namespace Akonadi 0022 { 0023 class Session; 0024 } 0025 0026 class NotesManager : public QObject 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit NotesManager(QObject *parent = nullptr); 0031 ~NotesManager() override; 0032 0033 void stopAll(); 0034 void updateNetworkListener(); 0035 0036 public Q_SLOTS: 0037 void load(); 0038 0039 private: 0040 void slotAcceptConnection(); 0041 void slotNewNote(const QString &name, const QString &text); 0042 void slotCheckAlarm(); 0043 0044 void slotItemAdded(const Akonadi::Item &item); 0045 void slotItemRemoved(const Akonadi::Item &item); 0046 void slotItemChanged(const Akonadi::Item &item, const QSet<QByteArray> &set); 0047 0048 void slotCollectionsReceived(const Akonadi::Collection::List &collections); 0049 0050 void clear(); 0051 Akonadi::Item::List mListItem; 0052 QTcpServer *mListener = nullptr; 0053 QTimer *mCheckAlarm = nullptr; 0054 NoteShared::NotesChangeRecorder *mNoteRecorder = nullptr; 0055 Akonadi::Session *const mSession; 0056 QPointer<NotesAgentAlarmDialog> mAlarmDialog; 0057 };