File indexing completed on 2024-12-15 04:51:47

0001 /*******************************************************************
0002  KNotes -- Notes for the KDE project
0003 
0004  SPDX-FileCopyrightText: 2003 Daniel Martin <daniel.martin@pirack.com>
0005  SPDX-FileCopyrightText: 2004, 2006 Michael Brade <brade@kde.org>
0006  SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel.org>
0007 
0008  SPDX-License-Identifier: GPL-2.0-or-later
0009 *******************************************************************/
0010 
0011 #pragma once
0012 
0013 #include <QTcpSocket>
0014 
0015 namespace NoteShared
0016 {
0017 class NotesNetworkSender : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit NotesNetworkSender(QTcpSocket *socket);
0022     ~NotesNetworkSender() override;
0023 
0024     void setSenderId(const QString &sender);
0025     void setNote(const QString &title, const QString &text);
0026 
0027 protected Q_SLOTS:
0028     void slotConnected();
0029     void slotError();
0030     void slotClosed();
0031     void slotWritten(qint64);
0032 
0033 private:
0034     QTcpSocket *const m_socket;
0035     QByteArray m_note;
0036     QByteArray m_title;
0037     QByteArray m_sender;
0038 };
0039 }