[win-linux] cnotification: extend usage scope

This commit is contained in:
SimplestStudio
2025-08-30 10:51:39 +03:00
parent bdaf7dbe2d
commit 83b56278fe
6 changed files with 28 additions and 21 deletions

View File

@ -88,6 +88,7 @@ HEADERS += \
$$PWD/src/components/cprintprogress.h \
$$PWD/src/components/ctabbar.h \
$$PWD/src/components/cmessage.h \
$$PWD/src/components/cnotification.h \
$$PWD/src/components/canimatedicon.h \
$$PWD/src/components/ctabpanel.h \
$$PWD/src/components/csvgpushbutton.h \
@ -131,6 +132,7 @@ SOURCES += \
$$PWD/src/components/cprintprogress.cpp \
$$PWD/src/components/ctabbar.cpp \
$$PWD/src/components/cmessage.cpp \
$$PWD/src/components/cnotification.cpp \
$$PWD/src/components/canimatedicon.cpp \
$$PWD/src/components/ctabpanel.cpp \
$$PWD/src/components/csvgpushbutton.cpp \
@ -160,10 +162,8 @@ SOURCES += \
$$PWD/src/cthemes.cpp
updmodule:!build_xp {
HEADERS += $$PWD/src/cupdatemanager.h \
$$PWD/src/components/cnotification.h
SOURCES += $$PWD/src/cupdatemanager.cpp \
$$PWD/src/components/cnotification.cpp
HEADERS += $$PWD/src/cupdatemanager.h
SOURCES += $$PWD/src/cupdatemanager.cpp
}
RESOURCES += $$PWD/resources.qrc
@ -199,7 +199,7 @@ ADD_DEPENDENCY(PdfFile, DjVuFile, XpsFile, UnicodeConverter, hunspell, ooxmlsign
include($$CORE_ROOT_DIR/../desktop-sdk/ChromiumBasedEditors/videoplayerlib/videoplayerlib_deps.pri)
core_linux {
QT += network x11extras
QT += network x11extras dbus
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/converter\'"
@ -232,13 +232,8 @@ core_linux {
$$PWD/src/platform_linux/xcbutils.cpp \
$$PWD/extras/update-daemon/src/classes/csocket.cpp
updmodule {
QT += dbus
PKGCONFIG += libnotify
}
CONFIG += link_pkgconfig
PKGCONFIG += glib-2.0 gtk+-3.0 atk gtk+-unix-print-3.0 xcb xext
PKGCONFIG += glib-2.0 gtk+-3.0 atk gtk+-unix-print-3.0 xcb xext libnotify
LIBS += -lX11 -lX11-xcb -lcups
cef_version_107 {
@ -263,6 +258,7 @@ core_windows {
HEADERS += $$PWD/src/windows/platform_win/cwindowplatform.h \
$$PWD/src/windows/platform_win/caption.h \
$$PWD/src/platform_win/singleapplication.h \
$$PWD/src/platform_win/wintoastlib.h \
$$PWD/src/platform_win/association.h \
$$PWD/src/platform_win/filechooser.h \
$$PWD/src/platform_win/printdialog.h \
@ -270,6 +266,7 @@ core_windows {
SOURCES += $$PWD/src/windows/platform_win/cwindowplatform.cpp \
$$PWD/src/platform_win/singleapplication.cpp \
$$PWD/src/platform_win/wintoastlib.cpp \
$$PWD/src/platform_win/association.cpp \
$$PWD/src/platform_win/filechooser.cpp \
$$PWD/src/platform_win/printdialog.cpp
@ -278,10 +275,8 @@ core_windows {
updmodule:!build_xp {
INCLUDEPATH += $$PWD/extras/update-daemon/src/classes
HEADERS += $$PWD/src/platform_win/wintoastlib.h \
$$PWD/extras/update-daemon/src/classes/csocket.h
SOURCES += $$PWD/src/platform_win/wintoastlib.cpp \
$$PWD/extras/update-daemon/src/classes/csocket.cpp
HEADERS += $$PWD/extras/update-daemon/src/classes/csocket.h
SOURCES += $$PWD/extras/update-daemon/src/classes/csocket.cpp
}
LIBS += -lwininet \

View File

@ -24,6 +24,7 @@
#include "ctabundockevent.h"
#include "clangater.h"
#include "components/cmessage.h"
#include "components/cnotification.h"
#include "ceditortools.h"
#include "cfilechecker.h"
#include "OfficeFileFormats.h"
@ -1101,6 +1102,12 @@ void CAscApplicationManagerWrapper::handleDeeplinkActions(const std::vector<std:
void CAscApplicationManagerWrapper::onDocumentReady(int uid)
{
static bool runOnce = false;
if (!runOnce) {
runOnce = true;
m_private->m_notificationSupported = CNotification::instance().init();
}
#ifdef _UPDMODULE
if (!m_pUpdateManager) {
m_pUpdateManager = new CUpdateManager(this);
@ -1867,6 +1874,12 @@ bool CAscApplicationManagerWrapper::isRtlEnabled()
return m_rtlEnabled;
}
bool CAscApplicationManagerWrapper::notificationSupported()
{
APP_CAST(_app);
return _app.m_private->m_notificationSupported;
}
bool CAscApplicationManagerWrapper::applySettings(const wstring& wstrjson)
{
QJsonParseError jerror;

View File

@ -42,7 +42,6 @@
#include "ccefeventstransformer.h"
#include "ccefeventsgate.h"
#include "windows/ceditorwindow.h"
#include "components/cnotification.h"
#include "cwindowsqueue.h"
#include "ceventdriver.h"
#include "cprintdata.h"
@ -210,6 +209,7 @@ public:
static void cancelClose();
static void setRtlEnabled(bool);
static bool isRtlEnabled();
static bool notificationSupported();
std::wstring GetExternalSchemeName();
using CAscApplicationManager::GetExternalSchemeName;

View File

@ -557,6 +557,7 @@ public:
QPointer<QCefView> m_pStartPanel;
bool m_openEditorWindow = false;
bool m_needRestart = false;
bool m_notificationSupported = false;
std::shared_ptr<CPrintData> m_printData;
#ifndef _CAN_SCALE_IMMEDIATELY
std::wstring uiscaling;

View File

@ -42,7 +42,7 @@
#include "version.h"
#include "clangater.h"
#include "clogger.h"
#include "components/cmessage.h"
#include "components/cnotification.h"
#include "cascapplicationmanagerwrapper.h"
#include <QCryptographicHash>
#ifdef _WIN32
@ -403,7 +403,6 @@ void CUpdateManager::init()
if (m_interval < MINIMUM_INTERVAL)
m_interval = MINIMUM_INTERVAL;
reg_user.endGroup();
m_notificationSupported = CNotification::instance().init();
m_socket->onMessageReceived([this](void *data, size_t) {
vector<tstring> params;
@ -890,7 +889,7 @@ void CUpdateManager::showUpdateMessage(QWidget *parent, bool forceModal, int res
tr("The current version does not support installing this update directly. "
"To install updates, you can download the required package from the official website.");
QString title = tr("Update is available");
if (!forceModal && m_notificationSupported) {
if (!forceModal && AscAppManager::notificationSupported()) {
if (CNotification::instance().show(title,
QString("%1\n%2: %3\n%4: %5").arg(name, tr("Current version"),
curr_version, tr("New version"), m_packageData->version),
@ -936,7 +935,7 @@ void CUpdateManager::showStartInstallMessage(QWidget *parent, bool forceModal, i
QString curr_version = (m_packageData->object == "app") ? QString(VER_FILEVERSION_STR) :
getFileVersion(QStrToTStr(qApp->applicationDirPath()) + DAEMON_NAME);
QString title = tr("Update is ready to install");
if (!forceModal && m_notificationSupported) {
if (!forceModal && AscAppManager::notificationSupported()) {
if (CNotification::instance().show(title,
QString("%1\n%2: %3\n%4: %5").arg(name, tr("Current version"),
curr_version, tr("New version"), m_packageData->version),

View File

@ -117,7 +117,6 @@ private:
bool m_startUpdateOnClose = false,
m_restartAfterUpdate = false,
m_notificationSupported = false,
m_manualCheck = false,
m_lock = false;