mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-11-24 22:39:25 +00:00
Can open Comunic from Tray Icon
This commit is contained in:
parent
951cde4c4e
commit
47ed7f40b5
2
config.h
2
config.h
@ -25,5 +25,5 @@
|
|||||||
#define API_BASE_PATH "/comunic/api-v2/"
|
#define API_BASE_PATH "/comunic/api-v2/"
|
||||||
#define API_SERVICE_NAME "ComunicWatcher"
|
#define API_SERVICE_NAME "ComunicWatcher"
|
||||||
#define API_SERVICE_TOKEN "ComunicWatcher"
|
#define API_SERVICE_TOKEN "ComunicWatcher"
|
||||||
|
#define COMUNIC_URL "https://devweb.local/comunic/v2/"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "accounthelper.h"
|
#include "accounthelper.h"
|
||||||
#include "loginwindow.h"
|
#include "loginwindow.h"
|
||||||
#include "refreshservice.h"
|
#include "refreshservice.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
RefreshService *RefreshService::svc = nullptr;
|
RefreshService *RefreshService::svc = nullptr;
|
||||||
|
|
||||||
@ -59,6 +61,11 @@ void RefreshService::onNewNeumberUnreadConvs(int num)
|
|||||||
mTrayIcon.onNewNumber(mNumbers);
|
mTrayIcon.onNewNumber(mNumbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RefreshService::openComunic()
|
||||||
|
{
|
||||||
|
QDesktopServices::openUrl(QUrl(COMUNIC_URL));
|
||||||
|
}
|
||||||
|
|
||||||
void RefreshService::confirmSignOut()
|
void RefreshService::confirmSignOut()
|
||||||
{
|
{
|
||||||
if(QMessageBox::question(nullptr, tr("Sign out"), tr("Do you really want to disconnect ComunicWatcher from your Comunic account?")) != QMessageBox::Yes)
|
if(QMessageBox::question(nullptr, tr("Sign out"), tr("Do you really want to disconnect ComunicWatcher from your Comunic account?")) != QMessageBox::Yes)
|
||||||
@ -76,6 +83,7 @@ RefreshService::RefreshService()
|
|||||||
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);
|
connect(&mTrayIcon, &TrayIcon::askForSignOut, this, &RefreshService::confirmSignOut);
|
||||||
|
connect(&mTrayIcon, &TrayIcon::onOpenComunic, this, &RefreshService::openComunic);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 openComunic();
|
||||||
void confirmSignOut();
|
void confirmSignOut();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -15,6 +15,9 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
|||||||
mUnreadConversations = mMenu->addAction(tr("Loading..."));
|
mUnreadConversations = mMenu->addAction(tr("Loading..."));
|
||||||
mUnreadConversations->setDisabled(true);
|
mUnreadConversations->setDisabled(true);
|
||||||
|
|
||||||
|
QAction *openComunicAction = mMenu->addAction(tr("Open Comunic"));
|
||||||
|
connect(openComunicAction, &QAction::triggered, this, &TrayIcon::onOpenComunic);
|
||||||
|
|
||||||
mMenu->addSeparator();
|
mMenu->addSeparator();
|
||||||
|
|
||||||
QAction *signOutAction = mMenu->addAction(tr("Sign out"));
|
QAction *signOutAction = mMenu->addAction(tr("Sign out"));
|
||||||
@ -26,6 +29,8 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
|||||||
mTrayIcon.setIcon(QIcon(":/logo_large.png"));
|
mTrayIcon.setIcon(QIcon(":/logo_large.png"));
|
||||||
mTrayIcon.setContextMenu(mMenu);
|
mTrayIcon.setContextMenu(mMenu);
|
||||||
mTrayIcon.show();
|
mTrayIcon.show();
|
||||||
|
|
||||||
|
connect(&mTrayIcon, &QSystemTrayIcon::messageClicked, this, &TrayIcon::onOpenComunic);
|
||||||
}
|
}
|
||||||
|
|
||||||
TrayIcon::~TrayIcon()
|
TrayIcon::~TrayIcon()
|
||||||
|
@ -24,6 +24,7 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void askForSignOut();
|
void askForSignOut();
|
||||||
|
void onOpenComunic();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onQuit();
|
void onQuit();
|
||||||
|
Loading…
Reference in New Issue
Block a user