mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Merge pull request 'Fix bug 58026' (#205) from fix/bug-58026 into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/desktop-apps/pulls/205
This commit is contained in:
@ -217,11 +217,8 @@ public:
|
||||
opts.parent_id = event.m_nSenderId;
|
||||
opts.name = QString::fromStdWString(data.get_Name());
|
||||
|
||||
// TODO: remove for ver 8.2 if unused
|
||||
// if ( CCefView * _v = m_appmanager.GetViewById(opts.id) ) {
|
||||
// bringEditorToFront(_v->GetId());
|
||||
// } else openDocument(opts);
|
||||
openDocument(opts);
|
||||
if ( !bringEditorToFront(QString::fromStdWString(opts.wurl)) )
|
||||
openDocument(opts);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ int CAscTabWidget::tabIndexByUrl(const wstring& url)
|
||||
for (int i(count()); !(--i < 0);) {
|
||||
doc = panel(i)->data();
|
||||
|
||||
if (doc && doc->url().compare(url) == 0)
|
||||
if (doc && Utils::normalizeAppProtocolUrl(doc->url()).compare(Utils::normalizeAppProtocolUrl(url)) == 0)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@
|
||||
#define APP_DEFAULT_SYSTEM_LOCALE 1
|
||||
#define APP_USER_MODEL_ID "ASC.Documents.5"
|
||||
#define APP_SIMPLE_WINDOW_TITLE "ONLYOFFICE Editor"
|
||||
#define APP_PROTOCOL "oo-office"
|
||||
#define FILE_PREFIX "onlyoffice_"
|
||||
|
||||
#define URL_SITE "http://www.onlyoffice.com"
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QScreen>
|
||||
@ -856,6 +857,18 @@ QString Utils::replaceBackslash(const QString& path)
|
||||
return QString(path).replace(QRegularExpression("\\\\"), "/");
|
||||
}
|
||||
|
||||
std::wstring Utils::normalizeAppProtocolUrl(const std::wstring &url)
|
||||
{
|
||||
QUrl _url(QString::fromStdWString(url));
|
||||
if (_url.scheme() == APP_PROTOCOL) {
|
||||
QUrlQuery query(_url);
|
||||
query.addQueryItem("placement", "desktop");
|
||||
_url.setQuery(query);
|
||||
return _url.toString(QUrl::RemoveScheme).toStdWString();
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
void Utils::replaceAll(std::wstring& subject, const std::wstring& search, const std::wstring& replace)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
@ -103,6 +103,7 @@ public:
|
||||
static double getScreenDpiRatioByWidget(QWidget*);
|
||||
static QScreen * screenAt(const QPoint&);
|
||||
static QString replaceBackslash(const QString&);
|
||||
static std::wstring normalizeAppProtocolUrl(const std::wstring &url);
|
||||
static void replaceAll(std::wstring& subject, const std::wstring& search, const std::wstring& replace);
|
||||
static bool isFileLocal(const QString&);
|
||||
static QString uniqFileName(const QString& path);
|
||||
|
||||
@ -164,7 +164,8 @@ bool CEditorWindow::modified() const
|
||||
|
||||
bool CEditorWindow::holdView(const std::wstring& portal) const
|
||||
{
|
||||
return qobject_cast<CTabPanel *>(m_pMainView)->data()->url().find(portal) != std::wstring::npos;
|
||||
auto url = qobject_cast<CTabPanel*>(m_pMainView)->data()->url();
|
||||
return Utils::normalizeAppProtocolUrl(url).find(Utils::normalizeAppProtocolUrl(portal)) != std::wstring::npos;
|
||||
}
|
||||
|
||||
void CEditorWindow::undock(bool maximized)
|
||||
|
||||
Reference in New Issue
Block a user