From 02da8c84e30a832ed29852ca47e114dbc3689833 Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Sun, 24 Nov 2024 00:41:43 +0300 Subject: [PATCH] [win-nix] for bug 71691 --- .../src/cascapplicationmanagerwrapper.cpp | 8 ++++++++ .../cascapplicationmanagerwrapper_private.h | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/win-linux/src/cascapplicationmanagerwrapper.cpp b/win-linux/src/cascapplicationmanagerwrapper.cpp index a72e4b545..7c5364c62 100644 --- a/win-linux/src/cascapplicationmanagerwrapper.cpp +++ b/win-linux/src/cascapplicationmanagerwrapper.cpp @@ -416,6 +416,14 @@ bool CAscApplicationManagerWrapper::processCommonEvent(NSEditorApi::CAscCefMenuE CExistanceController::check(QString::fromStdWString(pData->get_Param())); return true; } else + if ( !(cmd.find(L"recent:forget") == std::wstring::npos) ) { + int id = m_private->recentFromViewId(event->get_SenderId()); + if ( !(id < 0) ){ + AscAppManager::sendCommandTo(SEND_TO_ALL_START_PAGE, "file:skip", QString::number(id)); + } + + return true; + } else if ( !(cmd.find(L"system:changed") == std::wstring::npos) ) { QRegularExpression re(":\\s?\"(dark|light)"); QRegularExpressionMatch match = re.match(QString::fromStdWString(pData->get_Param())); diff --git a/win-linux/src/cascapplicationmanagerwrapper_private.h b/win-linux/src/cascapplicationmanagerwrapper_private.h index f1b93c531..11e282e8f 100644 --- a/win-linux/src/cascapplicationmanagerwrapper_private.h +++ b/win-linux/src/cascapplicationmanagerwrapper_private.h @@ -408,6 +408,24 @@ class CAscApplicationManagerWrapper_Private return m_appmanager.editorWindowFromViewId(viewid); } + auto recentFromViewId(int viewid) -> int + { + CCefView * _cef = nullptr; + int _recent_id = -1; + while(true) { + _cef = m_appmanager.GetViewByRecentId(_recent_id); + if ( !_cef ) + break; + else + if ( _cef->GetId() == viewid ) + return _recent_id; + + ++_recent_id; + } + + return -1; + } + auto openDocument(const COpenOptions& opts) -> bool { COpenOptions opts_ext{opts};