2022-12-22 15:30:08 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 by Claudio Cambra <claudio.cambra@nextcloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
2024-07-16 13:57:52 +03:00
|
|
|
#include "gui/accountstate.h"
|
|
|
|
#include "libsync/syncresult.h"
|
2022-12-29 00:28:30 +03:00
|
|
|
|
2023-03-15 18:04:41 +03:00
|
|
|
class QLocalSocket;
|
|
|
|
|
2022-12-22 16:37:30 +03:00
|
|
|
namespace OCC {
|
2022-12-22 15:30:08 +03:00
|
|
|
|
2022-12-22 16:37:30 +03:00
|
|
|
namespace Mac {
|
2022-12-22 15:30:08 +03:00
|
|
|
|
|
|
|
class FileProviderSocketController : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-03-11 03:56:20 +03:00
|
|
|
explicit FileProviderSocketController(QLocalSocket * const socket, QObject * const parent = nullptr);
|
2022-12-22 15:30:08 +03:00
|
|
|
|
2024-07-17 12:27:38 +03:00
|
|
|
[[nodiscard]] AccountStatePtr accountState() const;
|
2024-07-19 11:10:31 +03:00
|
|
|
|
2022-12-22 16:37:30 +03:00
|
|
|
signals:
|
2024-07-19 11:10:31 +03:00
|
|
|
void socketDestroyed(const QLocalSocket * const socket);
|
2024-07-16 13:57:52 +03:00
|
|
|
void syncStateChanged(const AccountPtr &account, SyncResult::Status state) const;
|
2022-12-22 16:37:30 +03:00
|
|
|
|
2022-12-28 19:46:12 +03:00
|
|
|
public slots:
|
|
|
|
void sendMessage(const QString &message) const;
|
2022-12-29 00:28:30 +03:00
|
|
|
void start();
|
2022-12-28 19:46:12 +03:00
|
|
|
|
2022-12-22 16:37:30 +03:00
|
|
|
private slots:
|
|
|
|
void slotOnDisconnected();
|
2023-03-11 03:56:20 +03:00
|
|
|
void slotSocketDestroyed(const QObject * const object);
|
2022-12-28 17:10:43 +03:00
|
|
|
void slotReadyRead();
|
2022-12-22 16:37:30 +03:00
|
|
|
|
2023-03-15 18:04:41 +03:00
|
|
|
void slotAccountStateChanged(const OCC::AccountState::State state);
|
2023-03-11 17:40:56 +03:00
|
|
|
|
2022-12-29 00:28:30 +03:00
|
|
|
void parseReceivedLine(const QString &receivedLine);
|
|
|
|
void requestFileProviderDomainInfo() const;
|
2023-01-27 01:01:31 +03:00
|
|
|
void sendAccountDetails() const;
|
2023-03-11 17:55:46 +03:00
|
|
|
void sendNotAuthenticated() const;
|
2022-12-29 00:28:30 +03:00
|
|
|
|
2024-07-17 12:28:11 +03:00
|
|
|
void reportSyncState(const QString &receivedState);
|
2024-07-16 13:57:52 +03:00
|
|
|
|
2022-12-22 15:30:08 +03:00
|
|
|
private:
|
|
|
|
QPointer<QLocalSocket> _socket;
|
2022-12-29 00:28:30 +03:00
|
|
|
AccountStatePtr _accountState;
|
2022-12-22 15:30:08 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Mac
|
|
|
|
|
|
|
|
} // namespace OCC
|