Skip to content

Commit

Permalink
Merge pull request #1021 from ONLYOFFICE/feature/hotfix-7-5-2
Browse files Browse the repository at this point in the history
Feature/hotfix 7 5 2
  • Loading branch information
maxkadushkin authored Nov 1, 2023
2 parents 3652a81 + 2dbb61d commit d6285bf
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 13 deletions.
3 changes: 3 additions & 0 deletions win-linux/src/casctabdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ void CAscTabData::setFeatures(const wstring& fs)

if ( _str_readonly.isEmpty() )
_str_readonly = " (" + QObject::tr("Read only") + ")";
} else
if ( hasFeature(L"readonly\":false") ) {
_is_readonly = false;
}
}

Expand Down
3 changes: 3 additions & 0 deletions win-linux/src/ccefeventstransformer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ void CCefEventsTransformer::OnEvent(QObject * target, NSEditorApi::CAscCefMenuEv
// if ( !(cmd.find(L"files:check") == std::wstring::npos) ) {
// QMetaObject::invokeMethod( target, "onLocalFilesCheck", Qt::QueuedConnection,
// Q_ARG(QString, QString::fromStdWString(pData->get_Param())) );
if ( cmd.compare(L"portal:uitheme") == 0 ) {
QMetaObject::invokeMethod(target, "onPortalUITheme", Qt::QueuedConnection, Q_ARG(std::wstring, pData->get_Param()));
} else
if ( !(cmd.find(L"files:explore") == std::wstring::npos) ) {
QMetaObject::invokeMethod( target, "onLocalFileLocation", Qt::QueuedConnection,
Q_ARG(QString, QString::fromStdWString(pData->get_Param())) );
Expand Down
14 changes: 7 additions & 7 deletions win-linux/src/components/asctabwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,15 @@ void CAscTabWidget::setTabActiveColor(int index, const std::wstring& color)
{
}

void CAscTabWidget::setTabThemeType(int index, const QString& type)
void CAscTabWidget::setTabTheme(int index, const QString& type, const QString& color)
{
if ( !(index < 0) && index < count() ) {
if ( type == "dark" ) {
m_pBar->setActiveTabColor(index, "#333");
m_pBar->setTabThemeType(index, CTabBar::DarkTab);
} else {
m_pBar->setActiveTabColor(index, "#fff");
m_pBar->setTabThemeType(index, CTabBar::LightTab);
if ( !type.isEmpty() ) {
m_pBar->setTabThemeType(index, type == "dark" ? CTabBar::DarkTab : CTabBar::LightTab);
}

if ( !color.isEmpty() ) {
m_pBar->setActiveTabColor(index, color);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion win-linux/src/components/asctabwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class CAscTabWidget : public QStackedWidget, public CScalingWrapper
void setTabIcons(CTabIconSet&);
void reloadTabIcons();
void setTabActiveColor(int index, const std::wstring& color);
void setTabThemeType(int index, const QString& type);
void setTabTheme(int index, const QString& type, const QString& color);
void setFocusedView(int index = -1);
void setFullScreen(bool, int id = -1);
QWidget * fullScreenWidget();
Expand Down
2 changes: 1 addition & 1 deletion win-linux/src/windows/ceditorwindow_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ class CEditorWindowPrivate : public CCefEventsGate
iconCrypted();
}

if ( is_read_only != panel()->data()->hasFeature(L"readonly\":") && boxtitlelabel ) {
if ( is_read_only != panel()->data()->hasFeature(L"readonly\":true") && boxtitlelabel ) {
window->setWindowTitle(m_panel->data()->title());
window->m_boxTitleBtns->repaint();
}
Expand Down
24 changes: 20 additions & 4 deletions win-linux/src/windows/cmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,11 +697,27 @@ void CMainWindow::onPortalLogin(int viewid, const std::wstring &json)
if( jerror.error == QJsonParseError::NoError ) {
QJsonObject objRoot = jdoc.object();
QString _ui_theme = objRoot["uiTheme"].toString();
if ( !_ui_theme.isEmpty() ) {
// onFileLocation(vid, _url);

if ( _ui_theme == "default-dark" )
m_pTabs->setTabThemeType(m_pTabs->tabIndexByView(viewid), "dark");
if ( !_ui_theme.isEmpty() )
onPortalUITheme(viewid, _ui_theme.toStdWString());
}
}
}

void CMainWindow::onPortalUITheme(int viewid, const std::wstring& json)
{
if ( !json.empty() ) {
if ( json.rfind(L"default-", 0) == 0 ) {
if ( json.compare(L"default-dark") == 0 )
m_pTabs->setTabTheme(m_pTabs->tabIndexByView(viewid), "dark", "#333");
else m_pTabs->setTabTheme(m_pTabs->tabIndexByView(viewid), "light", "#fff");
} else {
QJsonParseError jerror;
QJsonDocument jdoc = QJsonDocument::fromJson(QString::fromStdWString(json).toLatin1(), &jerror);

if( jerror.error == QJsonParseError::NoError ) {
QJsonObject objRoot = jdoc.object();
m_pTabs->setTabTheme(m_pTabs->tabIndexByView(viewid), objRoot["type"].toString(), objRoot["color"].toString());
}
}
}
Expand Down
1 change: 1 addition & 0 deletions win-linux/src/windows/cmainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public slots:
void onPortalOpen(QString);
void onPortalLogout(std::wstring portal);
void onPortalLogin(int viewid, const std::wstring& json);
void onPortalUITheme(int viewid, const std::wstring& json);
void onPortalNew(QString);
void onPortalCreate();
void onOutsideAuth(QString);
Expand Down

0 comments on commit d6285bf

Please sign in to comment.