mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-11-22 13:29:25 +00:00
Can sign out from account
This commit is contained in:
parent
f190572d42
commit
10cd03b167
@ -1,9 +1,10 @@
|
|||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "accounthelper.h"
|
#include "accounthelper.h"
|
||||||
#include "loginwindow.h"
|
#include "loginwindow.h"
|
||||||
#include "refreshservice.h"
|
#include "refreshservice.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
|
||||||
|
|
||||||
RefreshService *RefreshService::svc = nullptr;
|
RefreshService *RefreshService::svc = nullptr;
|
||||||
|
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ void RefreshService::signOutUser()
|
|||||||
{
|
{
|
||||||
AccountHelper::RemoveLoginToken();
|
AccountHelper::RemoveLoginToken();
|
||||||
RefreshService::stopService();
|
RefreshService::stopService();
|
||||||
LoginWindow().exec();
|
(new LoginWindow())->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshService::connectedToWebSocket()
|
void RefreshService::connectedToWebSocket()
|
||||||
@ -58,6 +59,14 @@ void RefreshService::onNewNeumberUnreadConvs(int num)
|
|||||||
mTrayIcon.onNewNumber(mNumbers);
|
mTrayIcon.onNewNumber(mNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RefreshService::confirmSignOut()
|
||||||
|
{
|
||||||
|
if(QMessageBox::question(nullptr, tr("Sign out"), tr("Do you really want to disconnect ComunicWatcher from your Comunic account?")) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
|
signOutUser();
|
||||||
|
}
|
||||||
|
|
||||||
RefreshService::RefreshService()
|
RefreshService::RefreshService()
|
||||||
{
|
{
|
||||||
qDebug("Start refresh service");
|
qDebug("Start refresh service");
|
||||||
@ -66,6 +75,7 @@ RefreshService::RefreshService()
|
|||||||
connect(&mNotifsHelper, &NotificationsHelper::onNewNumber, this, &RefreshService::onNewNumberNotifications);
|
connect(&mNotifsHelper, &NotificationsHelper::onNewNumber, this, &RefreshService::onNewNumberNotifications);
|
||||||
connect(&mWsClient, &WsClient::newNumberNotifs, this, &RefreshService::onNewNeumberUnreadNotifs);
|
connect(&mWsClient, &WsClient::newNumberNotifs, this, &RefreshService::onNewNeumberUnreadNotifs);
|
||||||
connect(&mWsClient, &WsClient::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs);
|
connect(&mWsClient, &WsClient::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs);
|
||||||
|
connect(&mTrayIcon, &TrayIcon::askForSignOut, this, &RefreshService::confirmSignOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshService::~RefreshService()
|
RefreshService::~RefreshService()
|
||||||
|
@ -27,6 +27,7 @@ private slots:
|
|||||||
void onNewNumberNotifications(NotificationsNumber number);
|
void onNewNumberNotifications(NotificationsNumber number);
|
||||||
void onNewNeumberUnreadNotifs(int num);
|
void onNewNeumberUnreadNotifs(int num);
|
||||||
void onNewNeumberUnreadConvs(int num);
|
void onNewNeumberUnreadConvs(int num);
|
||||||
|
void confirmSignOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefreshService();
|
RefreshService();
|
||||||
|
@ -9,6 +9,9 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
|||||||
{
|
{
|
||||||
mMenu = new QMenu;
|
mMenu = new QMenu;
|
||||||
|
|
||||||
|
QAction *signOutAction = mMenu->addAction(tr("Sign out"));
|
||||||
|
connect(signOutAction, &QAction::triggered, this, &TrayIcon::askForSignOut);
|
||||||
|
|
||||||
QAction *closeAction = mMenu->addAction(tr("Quit"));
|
QAction *closeAction = mMenu->addAction(tr("Quit"));
|
||||||
connect(closeAction, &QAction::triggered, this, &TrayIcon::onQuit);
|
connect(closeAction, &QAction::triggered, this, &TrayIcon::onQuit);
|
||||||
|
|
||||||
@ -37,6 +40,7 @@ void TrayIcon::onQuit()
|
|||||||
QApplication::exit();
|
QApplication::exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrayIcon::showNotification(const NotificationsNumber &n)
|
void TrayIcon::showNotification(const NotificationsNumber &n)
|
||||||
{
|
{
|
||||||
QString msg;
|
QString msg;
|
||||||
|
@ -22,6 +22,7 @@ public slots:
|
|||||||
void onNewNumber(const NotificationsNumber &number);
|
void onNewNumber(const NotificationsNumber &number);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void askForSignOut();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onQuit();
|
void onQuit();
|
||||||
|
Loading…
Reference in New Issue
Block a user