mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-11-24 14:29:27 +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_SERVICE_NAME "ComunicWatcher"
|
||||
#define API_SERVICE_TOKEN "ComunicWatcher"
|
||||
|
||||
#define COMUNIC_URL "https://devweb.local/comunic/v2/"
|
||||
#endif
|
||||
|
@ -1,9 +1,11 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include "accounthelper.h"
|
||||
#include "loginwindow.h"
|
||||
#include "refreshservice.h"
|
||||
#include "config.h"
|
||||
|
||||
RefreshService *RefreshService::svc = nullptr;
|
||||
|
||||
@ -59,6 +61,11 @@ void RefreshService::onNewNeumberUnreadConvs(int num)
|
||||
mTrayIcon.onNewNumber(mNumbers);
|
||||
}
|
||||
|
||||
void RefreshService::openComunic()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(COMUNIC_URL));
|
||||
}
|
||||
|
||||
void RefreshService::confirmSignOut()
|
||||
{
|
||||
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::newNumberConvs, this, &RefreshService::onNewNeumberUnreadConvs);
|
||||
connect(&mTrayIcon, &TrayIcon::askForSignOut, this, &RefreshService::confirmSignOut);
|
||||
connect(&mTrayIcon, &TrayIcon::onOpenComunic, this, &RefreshService::openComunic);
|
||||
}
|
||||
|
||||
RefreshService::~RefreshService()
|
||||
|
@ -27,6 +27,7 @@ private slots:
|
||||
void onNewNumberNotifications(NotificationsNumber number);
|
||||
void onNewNeumberUnreadNotifs(int num);
|
||||
void onNewNeumberUnreadConvs(int num);
|
||||
void openComunic();
|
||||
void confirmSignOut();
|
||||
|
||||
private:
|
||||
|
@ -15,6 +15,9 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
||||
mUnreadConversations = mMenu->addAction(tr("Loading..."));
|
||||
mUnreadConversations->setDisabled(true);
|
||||
|
||||
QAction *openComunicAction = mMenu->addAction(tr("Open Comunic"));
|
||||
connect(openComunicAction, &QAction::triggered, this, &TrayIcon::onOpenComunic);
|
||||
|
||||
mMenu->addSeparator();
|
||||
|
||||
QAction *signOutAction = mMenu->addAction(tr("Sign out"));
|
||||
@ -26,6 +29,8 @@ TrayIcon::TrayIcon(QObject *parent) : QObject(parent)
|
||||
mTrayIcon.setIcon(QIcon(":/logo_large.png"));
|
||||
mTrayIcon.setContextMenu(mMenu);
|
||||
mTrayIcon.show();
|
||||
|
||||
connect(&mTrayIcon, &QSystemTrayIcon::messageClicked, this, &TrayIcon::onOpenComunic);
|
||||
}
|
||||
|
||||
TrayIcon::~TrayIcon()
|
||||
|
@ -24,6 +24,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void askForSignOut();
|
||||
void onOpenComunic();
|
||||
|
||||
private slots:
|
||||
void onQuit();
|
||||
|
Loading…
Reference in New Issue
Block a user