@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import Qt.labs.platform 1.1 as Platform
|
||||
import org.kde.kirigami 2.15 as Kirigami
|
||||
|
||||
@@ -48,6 +49,31 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
id: connectionPaneSeparator
|
||||
visible: connectionPane.visible
|
||||
width: parent.width
|
||||
height: visible ? implicitHeight : 0
|
||||
anchors.bottom: connectionPane.top
|
||||
z: 1
|
||||
}
|
||||
|
||||
QQC2.Pane {
|
||||
id: connectionPane
|
||||
padding: fontMetrics.lineSpacing * 0.25
|
||||
spacing: 0
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||
background: Rectangle {
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
}
|
||||
visible: !Controller.isOnline
|
||||
width: parent.width
|
||||
QQC2.Label {
|
||||
text: i18n("NeoChat is online. Please check your network connection.")
|
||||
}
|
||||
anchors.bottom: emojiPickerLoaderSeparator.top
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
id: emojiPickerLoaderSeparator
|
||||
visible: emojiPickerLoader.visible
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QSysInfo>
|
||||
#include <QTimer>
|
||||
#include <utility>
|
||||
#include <QNetworkConfigurationManager>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
@@ -56,6 +57,7 @@ using namespace Quotient;
|
||||
|
||||
Controller::Controller(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_mgr(new QNetworkConfigurationManager(this))
|
||||
{
|
||||
Connection::setRoomType<NeoChatRoom>();
|
||||
Connection::setUserType<NeoChatUser>();
|
||||
@@ -110,6 +112,9 @@ Controller::Controller(QObject *parent)
|
||||
sigaction(sig, &sa, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
connect(m_mgr, &QNetworkConfigurationManager::onlineStateChanged,
|
||||
this, &Controller::isOnlineChanged);
|
||||
}
|
||||
|
||||
Controller::~Controller()
|
||||
@@ -575,6 +580,11 @@ void Controller::createRoom(const QString &name, const QString &topic)
|
||||
});
|
||||
}
|
||||
|
||||
bool Controller::isOnline() const
|
||||
{
|
||||
return m_mgr->isOnline();
|
||||
}
|
||||
|
||||
void Controller::joinRoom(const QString &alias)
|
||||
{
|
||||
if (!alias.contains(":")) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <KAboutData>
|
||||
class QKeySequences;
|
||||
class QNetworkConfigurationManager;
|
||||
|
||||
#include "connection.h"
|
||||
#include "csapi/list_public_rooms.h"
|
||||
@@ -31,6 +32,7 @@ class Controller : public QObject
|
||||
Q_PROPERTY(bool busy READ busy WRITE setBusy NOTIFY busyChanged)
|
||||
Q_PROPERTY(KAboutData aboutData READ aboutData WRITE setAboutData NOTIFY aboutDataChanged)
|
||||
Q_PROPERTY(bool supportSystemTray READ supportSystemTray CONSTANT)
|
||||
Q_PROPERTY(bool isOnline READ isOnline NOTIFY isOnlineChanged)
|
||||
|
||||
public:
|
||||
static Controller &instance();
|
||||
@@ -78,6 +80,7 @@ public:
|
||||
/// \brief Join a room.
|
||||
Q_INVOKABLE void joinRoom(const QString &alias);
|
||||
|
||||
bool isOnline() const;
|
||||
private:
|
||||
explicit Controller(QObject *parent = nullptr);
|
||||
~Controller() override;
|
||||
@@ -126,6 +129,7 @@ Q_SIGNALS:
|
||||
void openRoom(NeoChatRoom *room);
|
||||
void userConsentRequired(QUrl url);
|
||||
void testConnectionResult(const QString &connection, bool usable);
|
||||
void isOnlineChanged(bool isOnline);
|
||||
|
||||
public Q_SLOTS:
|
||||
void logout(Quotient::Connection *conn, bool serverSideLogout);
|
||||
@@ -133,6 +137,9 @@ public Q_SLOTS:
|
||||
void changeAvatar(Quotient::Connection *conn, const QUrl &localFile);
|
||||
static void markAllMessagesAsRead(Quotient::Connection *conn);
|
||||
void saveWindowGeometry(QQuickWindow *);
|
||||
|
||||
private:
|
||||
QNetworkConfigurationManager *m_mgr;
|
||||
};
|
||||
|
||||
// TODO libQuotient 0.7: Drop
|
||||
|
||||
Reference in New Issue
Block a user