Skip to content

Commit

Permalink
Merge pull request #990 from ONLYOFFICE/patch/release/v7.5.0_r7
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L authored Oct 6, 2023
2 parents 772e628 + 1906a01 commit fe184ad
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 13 deletions.
11 changes: 10 additions & 1 deletion win-linux/extras/update-daemon/src/classes/csvcmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ auto restartService()->void
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}

auto verToAppVer(const wstring &ver)->wstring
{
size_t pos = ver.find(L'.');
if (pos == std::wstring::npos)
return ver;
pos = ver.find(L'.', pos + 1);
return (pos == std::wstring::npos) ? ver : ver.substr(0, pos);
}
#endif

CSvcManager::CSvcManager():
Expand Down Expand Up @@ -503,7 +512,7 @@ void CSvcManager::startReplacingFiles(const tstring &packageType, const bool res
wstring app_key(app_name);
app_key += (packageType == TEXT("iss")) ? L"_is1" : L"";
if (RegOpenKeyEx(hKey, app_key.c_str(), 0, KEY_ALL_ACCESS, &hAppKey) == ERROR_SUCCESS) {
wstring disp_name = app_name + L" " + ver + L" (" + currentArch().substr(1) + L")";
wstring disp_name = app_name + L" " + verToAppVer(ver) + L" (" + currentArch().substr(1) + L")";
if (RegSetValueEx(hAppKey, TEXT("DisplayName"), 0, REG_SZ, (const BYTE*)disp_name.c_str(), (DWORD)(disp_name.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
NS_Logger::WriteLog(L"Can't update DisplayName in registry!");
if (RegSetValueEx(hAppKey, TEXT("DisplayVersion"), 0, REG_SZ, (const BYTE*)ver.c_str(), (DWORD)(ver.length() + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
Expand Down
3 changes: 1 addition & 2 deletions win-linux/src/cascapplicationmanagerwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1716,8 +1716,7 @@ void CAscApplicationManagerWrapper::applyTheme(const wstring& theme, bool force)
{"type", _app.m_themes->current().stype()},
{"id", QString::fromStdWString(_app.m_themes->current().id())}
#ifndef Q_OS_LINUX
// ,{"system", _app.m_themes->isSystemSchemeDark() ? "dark" : "light"}
,{"system", "disabled"}
,{"system", _app.m_themes->isSystemSchemeDark() ? "dark" : "light"}
#else
,{"system", "disabled"}
#endif
Expand Down
7 changes: 7 additions & 0 deletions win-linux/src/components/celipsislabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ void CElipsisLabel::resizeEvent(QResizeEvent *event)
if ( event->size().width() != event->oldSize().width() ) {
QString elt = ellipsis_text_(this, orig_text, elide_mode);
QLabel::setText(elt);
QFontMetrics fm(font());
#if (QT_VERSION < QT_VERSION_CHECK(5,11,0))
int textWidth = fm.width(elt);
#else
int textWidth = fm.horizontalAdvance(elt);
#endif
emit onResize(event->size(), textWidth);
}
}

Expand Down
4 changes: 4 additions & 0 deletions win-linux/src/components/celipsislabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

class CElipsisLabel : public QLabel
{
Q_OBJECT
public:
CElipsisLabel(const QString &text, QWidget *parent = Q_NULLPTR);
CElipsisLabel(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
Expand All @@ -46,6 +47,9 @@ class CElipsisLabel : public QLabel
auto setEllipsisMode(Qt::TextElideMode) -> void;
auto updateText() -> void;

signals:
void onResize(QSize size, int textWidth);

protected:
virtual void resizeEvent(QResizeEvent *event) final;
using QLabel::setText;
Expand Down
2 changes: 1 addition & 1 deletion win-linux/src/components/ctabbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ bool CTabBar::eventFilter(QObject *watched, QEvent *event)
if (mouse_event->button() == Qt::LeftButton) {
while (d->animationInProgress)
PROCESSEVENTS();
if (d->movedTab) {
if (d->movedTab && !d->lock) {
if (d->currentIndex != d->movedTabIndex) {
d->reorderIndexes();
int posX = d->tabLayouts[d->currentIndex].x();
Expand Down
24 changes: 17 additions & 7 deletions win-linux/src/windows/ceditorwindow_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@

#define TOP_PANEL_OFFSET 6*TOOLBTN_WIDTH
#define ICON_SPACER_WIDTH 9
#define ICON_SIZE QSize(20,20)

using namespace NSEditorApi;

Expand Down Expand Up @@ -605,6 +606,7 @@ class CEditorWindowPrivate : public CCefEventsGate

if ( iconcrypted ) {
iconcrypted->setPixmap(QIcon{":/title/icons/secure.svg"}.pixmap(QSize(20,20) * f));
iconcrypted->setFixedSize(ICON_SIZE * f);
}

for (const auto& btn: m_mapTitleButtons) {
Expand Down Expand Up @@ -730,12 +732,22 @@ class CEditorWindowPrivate : public CCefEventsGate

QLabel * iconCrypted()
{
Q_ASSERT(window->m_boxTitleBtns != nullptr);
Q_ASSERT(window->m_labelTitle != nullptr);
if ( !iconcrypted ) {
iconcrypted = new QLabel(window->m_boxTitleBtns);
iconcrypted = new QLabel(window->m_labelTitle);
iconcrypted->setObjectName("iconcrypted");

iconcrypted->setPixmap(QIcon{":/title/icons/secure.svg"}.pixmap(QSize(20,20) * window->m_dpiRatio));
iconcrypted->setFixedSize(ICON_SIZE * window->m_dpiRatio);
int y = (window->m_labelTitle->height() - ICON_SIZE.height() * window->m_dpiRatio)/2;
iconcrypted->move(0, y);
connect(window->m_labelTitle, &CElipsisLabel::onResize, this, [=](QSize size, int textWidth) {
if (iconcrypted) {
int x = (size.width() - textWidth)/2 - ((ICON_SIZE.width() + 6) * window->m_dpiRatio);
int y = (size.height() - ICON_SIZE.height() * window->m_dpiRatio)/2;
iconcrypted->move(x, y);
}
});
}

return iconcrypted;
Expand All @@ -752,7 +764,7 @@ class CEditorWindowPrivate : public CCefEventsGate
}

if ( panel()->data()->hasFeature(L"crypted\":true") && boxtitlelabel && !iconcrypted ) {
qobject_cast<QBoxLayout *>(boxtitlelabel->layout())->insertWidget(0, iconCrypted());
iconCrypted();
}

if ( is_read_only != panel()->data()->hasFeature(L"readonly\":") && boxtitlelabel ) {
Expand Down Expand Up @@ -855,13 +867,11 @@ class CEditorWindowPrivate : public CCefEventsGate
boxtitlelabel->layout()->setSpacing(0);
boxtitlelabel->layout()->setMargin(0);
boxtitlelabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

boxtitlelabel->layout()->addWidget(window->m_labelTitle);
if ( m_panel->data()->hasFeature(L"crypted\":true") && !iconcrypted ) {
boxtitlelabel->layout()->addWidget(iconCrypted());
iconCrypted();
}

boxtitlelabel->layout()->addWidget(window->m_labelTitle);

if (usedOldEditorVersion) { // For old editors only
_layout->insertWidget(1, boxtitlelabel);
if ( _layout->itemAt(0)->widget() != leftboxbuttons )
Expand Down
4 changes: 2 additions & 2 deletions win-linux/src/windows/cmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ void CMainWindow::close()
onFullScreen(-1, false);

#ifdef _WIN32
if (isSessionInProgress() && m_pTabs->count() > 1) {
if (isSessionInProgress() && m_pTabs->count(cvwtEditor) > 1) {
#else
if (m_pTabs->count() > 1) {
if (m_pTabs->count(cvwtEditor) > 1) {
#endif
GET_REGISTRY_USER(reg_user);
if (!reg_user.value("ignoreMsgAboutOpenTabs", false).toBool()) {
Expand Down

0 comments on commit fe184ad

Please sign in to comment.