From 13a953ae790aff165855f849666a9b5d5953bafa Mon Sep 17 00:00:00 2001 From: memurats Date: Fri, 24 Oct 2025 15:07:30 +0200 Subject: [PATCH 01/21] account settings dialog changes --- src/gui/CMakeLists.txt | 7 ++ src/gui/accountsettings.cpp | 9 +- src/gui/accountsettings.h | 8 +- src/gui/nmcgui/nmcaccountsettings.cpp | 147 ++++++++++++++++++++++++++ src/gui/nmcgui/nmcaccountsettings.h | 85 +++++++++++++++ src/gui/settingsdialog.cpp | 7 +- 6 files changed, 257 insertions(+), 6 deletions(-) create mode 100644 src/gui/nmcgui/nmcaccountsettings.cpp create mode 100644 src/gui/nmcgui/nmcaccountsettings.h diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 736d8bc3cc622..32b5bf7a93b8c 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -6,6 +6,9 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui find_package(KF6Archive REQUIRED) find_package(KF6GuiAddons) +#NMC customization: needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + if(CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DQT_QML_DEBUG) endif() @@ -259,6 +262,10 @@ set(client_SRCS integration/fileactionsmodel.cpp ) +file(GLOB NMC_FILES "nmcgui/*") +set(NMC_SRCS ${NMC_FILES}) +list(APPEND client_SRCS ${NMC_SRCS}) + if (NOT DISABLE_ACCOUNT_MIGRATION) list(APPEND client_SRCS legacyaccountselectiondialog.h diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index fe7c66e315bbc..11074e0873361 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1275,7 +1275,6 @@ void AccountSettings::showConnectionLabel(const QString &message, QStringList er _ui->connectLabel->setToolTip({}); _ui->connectLabel->setStyleSheet(errStyle); } - _ui->accountStatus->setVisible(!message.isEmpty()); } void AccountSettings::slotEnableCurrentFolder(bool terminate) @@ -1370,7 +1369,12 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used) if (total > 0) { const auto usedStr = Utility::octetsToString(used); const auto totalStr = Utility::octetsToString(total); - _spaceUsageText = tr("%1 of %2 in use").arg(usedStr, totalStr); + const auto percentStr = Utility::compactFormatDouble(percent, 1); + const auto toolTip = tr("%1 (%3%) of %2 in use. Some folders, including network mounted or shared folders, might have different limits.").arg(usedStr, totalStr, percentStr); + _ui->quotaInfoLabel->setText(QCoreApplication::translate("", "%1_OF_%2").arg(usedStr, totalStr)); + _ui->quotaInfoLabel->setToolTip(toolTip); + _ui->quotaProgressBar->setToolTip(toolTip); + _ui->quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(percentStr)); } else { /* -1 means not computed; -2 means unknown; -3 means unlimited (#owncloud/client/issues/3940)*/ if (total == 0 || total == -1) { @@ -1379,6 +1383,7 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used) const auto usedStr = Utility::octetsToString(used); _spaceUsageText = tr("%1 in use").arg(usedStr); } + _ui->quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(QString::number(0))); } slotAccountStateChanged(); diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index 1b875845b4891..1244b6269aa56 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -119,6 +119,7 @@ protected slots: const QVector &roles); void slotPossiblyUnblacklistE2EeFoldersAndRestartSync(); + void checkClientSideEncryptionState(); void slotE2eEncryptionCertificateNeedMigration(); private slots: @@ -135,9 +136,14 @@ private slots: void setupE2eEncryption(); void forgetE2eEncryption(); - void checkClientSideEncryptionState(); void removeActionFromEncryptionMessage(const QString &actionId); +protected: + Ui::AccountSettings *getUi() const + { + return _ui; + } + private: bool event(QEvent *) override; QAction *addActionToEncryptionMessage(const QString &actionTitle, const QString &actionId); diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp new file mode 100644 index 0000000000000..391ac940c4db6 --- /dev/null +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -0,0 +1,147 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + + #include "nmcgui/nmcaccountsettings.h" + #include "ui_accountsettings.h" + #include "../common/utility.h" + #include "guiutility.h" + + #include + #include + #include + #include + #include + #include + #include + #include + + namespace OCC { + + NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) + : AccountSettings(accountState, parent) + , m_liveAccountButton(new CustomButton(QCoreApplication::translate("", "ADD_LIVE_BACKUP"), QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")).pixmap(24,24))) + , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"))) + , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"))) + , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"))) + { + setDefaultSettings(); + setLayout(); + connect(m_liveAccountButton, &CustomButton::clicked, this, &NMCAccountSettings::slotAddFolder); + } + + void NMCAccountSettings::setDefaultSettings() + { + getUi()->encryptionMessage->setCloseButtonVisible(true); + getUi()->selectiveSyncStatus->setVisible(false); + getUi()->selectiveSyncNotification->setVisible(false); + getUi()->accountStatus->setVisible(false); + getUi()->bigFolderUi->setVisible(false); + getUi()->gridLayout->setSpacing(8); + } + + void NMCAccountSettings::setLayout() + { + // Entferne alte Quota-Widgets + getUi()->storageGroupBox->removeWidget(getUi()->quotaInfoLabel); + getUi()->storageGroupBox->removeWidget(getUi()->quotaProgressBar); + getUi()->storageGroupBox->removeWidget(getUi()->quotaInfoText); + + getUi()->gridLayout->removeWidget(getUi()->encryptionMessage); + getUi()->gridLayout->addWidget(getUi()->encryptionMessage, 0, 0); + + // Titel für Folder Sync + m_folderSync->setStyleSheet("font-size: 15px; font-weight: 600; padding: 8px;"); + m_folderSync->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + getUi()->gridLayout->addWidget(m_folderSync, 1, 0); + + // Live-Backup-Bereich + auto *liveHLayout = new QHBoxLayout(); + liveHLayout->setContentsMargins(8, 8, 8, 8); + + auto *liveVLayout = new QVBoxLayout(); + auto *liveWidget = new QWidget(this); + liveWidget->setStyleSheet("QWidget {border-radius: 4px;}"); + liveWidget->setLayout(liveHLayout); + + liveHLayout->addLayout(liveVLayout); + liveHLayout->addStretch(); + + const QString styleSheet = QStringLiteral( + "QPushButton { font-size: %5px; border: %1px solid; border-color: black; " + "border-radius: 4px; background-color: %2; color: %3; } " + "QPushButton:hover { background-color: %4; }"); + + m_liveAccountButton->setStyleSheet(styleSheet.arg("0", "#E20074", "white", "#c00063", "13")); + m_liveAccountButton->setFixedSize(180, 32); + m_liveAccountButton->setLeftIconMargin(4); + + liveHLayout->addWidget(m_liveAccountButton); + + liveVLayout->addWidget(m_liveTitle); + m_liveTitle->setStyleSheet("font-size: 15px; font-weight: 600;"); + + liveVLayout->addWidget(m_liveDescription); + m_liveDescription->setStyleSheet("font-size: 13px;"); + m_liveDescription->setText(QCoreApplication::translate("", "LIVE_BACKUPS_DESCRIPTION")); + m_liveDescription->setWordWrap(true); + m_liveDescription->setFixedWidth(450); + + getUi()->gridLayout->addWidget(liveWidget, 4, 0); + + // Speicherbereich + auto *magentaHLayout = new QHBoxLayout(); + magentaHLayout->setSpacing(32); + + auto *quotaVLayout = new QVBoxLayout(); + quotaVLayout->setSpacing(4); + quotaVLayout->addSpacing(12); + + quotaVLayout->addWidget(getUi()->quotaInfoLabel); + getUi()->quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; padding: 8px; font-weight: 500; }"); + + quotaVLayout->addWidget(getUi()->quotaProgressBar); + getUi()->quotaProgressBar->setStyleSheet( + "QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } " + "QProgressBar::chunk { background-color: #E20074; }"); + getUi()->quotaProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + quotaVLayout->addWidget(getUi()->quotaInfoText); + getUi()->quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 8px; }"); + + quotaVLayout->addSpacing(20); + magentaHLayout->addLayout(quotaVLayout); + + auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), this); + storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + storageLinkButton->setStyleSheet( + "QPushButton { height: 32px; width: 180px; border: 1px solid black; background-color: #ededed; " + "color: black; font-size: 13px; border-radius: 4px; } " + "QPushButton::hover { background-color: white; }"); + + connect(storageLinkButton, &QPushButton::clicked, this, []() { + QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); + }); + + magentaHLayout->addWidget(storageLinkButton); + magentaHLayout->addSpacing(8); + + getUi()->gridLayout->addLayout(magentaHLayout, 5, 0); + + // Sichtbarkeit initial ausblenden + getUi()->encryptionMessage->hide(); + checkClientSideEncryptionState(); + } + + } // namespace OCC + \ No newline at end of file diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h new file mode 100644 index 0000000000000..b8ebc65c86516 --- /dev/null +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) by Eugen Fischer + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + + #ifndef MIRALL_ACCOUNTSETTINGSMAGENTA_H + #define MIRALL_ACCOUNTSETTINGSMAGENTA_H + + #include + #include + #include + #include + + #include + + namespace OCC { + + /** + * @brief A QPushButton with a custom left icon margin. + */ + class CustomButton : public QPushButton { + Q_OBJECT + + public: + explicit CustomButton(const QString &text, const QIcon &icon, QWidget *parent = nullptr) + : QPushButton(text, parent) + , m_icon(icon) + { + setIconSize(QSize(24, 24)); + } + + void setLeftIconMargin(int margin) { m_leftMargin = margin; } + + protected: + void paintEvent(QPaintEvent *event) override { + QPushButton::paintEvent(event); + // Optional icon rendering (currently disabled) + // if (!m_icon.isNull()) { + // QRect iconRect(m_leftMargin, + // (height() - iconSize().height()) / 2, + // iconSize().width(), + // iconSize().height()); + // QPainter painter(this); + // painter.drawPixmap(iconRect, m_icon.pixmap(iconSize())); + // } + } + + private: + QIcon m_icon; + int m_leftMargin = 4; + }; + + /** + * @brief Erweiterte AccountSettings-Ansicht für Magenta. + */ + class NMCAccountSettings : public AccountSettings { + Q_OBJECT + + public: + explicit NMCAccountSettings(AccountState *accountState, QWidget *parent = nullptr); + ~NMCAccountSettings() override = default; + + private: + void setDefaultSettings(); + void setLayout(); + + CustomButton *m_liveAccountButton = nullptr; + QLabel *m_liveTitle = nullptr; + QLabel *m_liveDescription = nullptr; + QLabel *m_folderSync = nullptr; + }; + + } // namespace OCC + + #endif // MIRALL_ACCOUNTSETTINGSMAGENTA_H + \ No newline at end of file diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index d6e8336f83281..e71a145d2160a 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -11,6 +11,7 @@ #include "generalsettings.h" #include "networksettings.h" #include "accountsettings.h" +#include "nmcgui/nmcaccountsettings.h" #include "configfile.h" #include "progressdispatcher.h" #include "owncloudgui.h" @@ -343,8 +344,8 @@ void SettingsDialog::accountAdded(AccountState *s) accountAction->setIconText(shortDisplayNameForSettings(s->account().data(), static_cast(height * buttonSizeRatio))); } - _toolBar->addAction(accountAction); - auto accountSettings = new AccountSettings(s, this); + _toolBar->insertAction(_toolBar->actions().at(0), accountAction); + auto accountSettings = new NMCAccountSettings(s, this); QString objectName = QLatin1String("accountSettings_"); objectName += s->account()->displayName(); accountSettings->setObjectName(objectName); @@ -418,7 +419,7 @@ void SettingsDialog::slotAccountDisplayNameChanged() void SettingsDialog::accountRemoved(AccountState *s) { for (auto it = _actionGroupWidgets.begin(); it != _actionGroupWidgets.end(); ++it) { - auto as = qobject_cast(*it); + auto as = qobject_cast(*it); if (!as) { continue; } From 02850cfa7325622abd3e64aa2cec34366665e0f7 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 27 Oct 2025 14:51:59 +0100 Subject: [PATCH 02/21] updated gui cmake file --- src/gui/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 32b5bf7a93b8c..7233e45df8f81 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -6,9 +6,6 @@ find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Svg Qml Quick Qui find_package(KF6Archive REQUIRED) find_package(KF6GuiAddons) -#NMC customization: needed to find the ui file in a different location than the header file -set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") - if(CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DQT_QML_DEBUG) endif() @@ -26,6 +23,9 @@ endif() configure_file(${CMAKE_SOURCE_DIR}/theme.qrc.in ${CMAKE_SOURCE_DIR}/theme.qrc) set(theme_dir ${CMAKE_SOURCE_DIR}/theme) +#NMC customization: needed to find the ui file in a different location than the header file +set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/src/gui") + set(client_UI_SRCS accountsettings.ui conflictdialog.ui From 7b7a15257c4b0fa3ef1a2207eaa136b98a6044d8 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 26 May 2026 12:37:35 +0200 Subject: [PATCH 03/21] fix error --- src/gui/nmcgui/nmcaccountsettings.cpp | 284 ++++++++++++++------------ src/gui/nmcgui/nmcaccountsettings.h | 10 +- 2 files changed, 159 insertions(+), 135 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 391ac940c4db6..3151e2783d973 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -12,136 +12,154 @@ * for more details. */ - #include "nmcgui/nmcaccountsettings.h" - #include "ui_accountsettings.h" - #include "../common/utility.h" - #include "guiutility.h" - - #include - #include - #include - #include - #include - #include - #include - #include - - namespace OCC { - - NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) - : AccountSettings(accountState, parent) - , m_liveAccountButton(new CustomButton(QCoreApplication::translate("", "ADD_LIVE_BACKUP"), QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")).pixmap(24,24))) - , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"))) - , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"))) - , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"))) - { - setDefaultSettings(); - setLayout(); - connect(m_liveAccountButton, &CustomButton::clicked, this, &NMCAccountSettings::slotAddFolder); - } - - void NMCAccountSettings::setDefaultSettings() - { - getUi()->encryptionMessage->setCloseButtonVisible(true); - getUi()->selectiveSyncStatus->setVisible(false); - getUi()->selectiveSyncNotification->setVisible(false); - getUi()->accountStatus->setVisible(false); - getUi()->bigFolderUi->setVisible(false); - getUi()->gridLayout->setSpacing(8); - } - - void NMCAccountSettings::setLayout() - { - // Entferne alte Quota-Widgets - getUi()->storageGroupBox->removeWidget(getUi()->quotaInfoLabel); - getUi()->storageGroupBox->removeWidget(getUi()->quotaProgressBar); - getUi()->storageGroupBox->removeWidget(getUi()->quotaInfoText); - - getUi()->gridLayout->removeWidget(getUi()->encryptionMessage); - getUi()->gridLayout->addWidget(getUi()->encryptionMessage, 0, 0); - - // Titel für Folder Sync - m_folderSync->setStyleSheet("font-size: 15px; font-weight: 600; padding: 8px;"); - m_folderSync->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - getUi()->gridLayout->addWidget(m_folderSync, 1, 0); - - // Live-Backup-Bereich - auto *liveHLayout = new QHBoxLayout(); - liveHLayout->setContentsMargins(8, 8, 8, 8); - - auto *liveVLayout = new QVBoxLayout(); - auto *liveWidget = new QWidget(this); - liveWidget->setStyleSheet("QWidget {border-radius: 4px;}"); - liveWidget->setLayout(liveHLayout); - - liveHLayout->addLayout(liveVLayout); - liveHLayout->addStretch(); - - const QString styleSheet = QStringLiteral( - "QPushButton { font-size: %5px; border: %1px solid; border-color: black; " - "border-radius: 4px; background-color: %2; color: %3; } " - "QPushButton:hover { background-color: %4; }"); - - m_liveAccountButton->setStyleSheet(styleSheet.arg("0", "#E20074", "white", "#c00063", "13")); - m_liveAccountButton->setFixedSize(180, 32); - m_liveAccountButton->setLeftIconMargin(4); - - liveHLayout->addWidget(m_liveAccountButton); - - liveVLayout->addWidget(m_liveTitle); - m_liveTitle->setStyleSheet("font-size: 15px; font-weight: 600;"); - - liveVLayout->addWidget(m_liveDescription); - m_liveDescription->setStyleSheet("font-size: 13px;"); - m_liveDescription->setText(QCoreApplication::translate("", "LIVE_BACKUPS_DESCRIPTION")); - m_liveDescription->setWordWrap(true); - m_liveDescription->setFixedWidth(450); - - getUi()->gridLayout->addWidget(liveWidget, 4, 0); - - // Speicherbereich - auto *magentaHLayout = new QHBoxLayout(); - magentaHLayout->setSpacing(32); - - auto *quotaVLayout = new QVBoxLayout(); - quotaVLayout->setSpacing(4); - quotaVLayout->addSpacing(12); - - quotaVLayout->addWidget(getUi()->quotaInfoLabel); - getUi()->quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; padding: 8px; font-weight: 500; }"); - - quotaVLayout->addWidget(getUi()->quotaProgressBar); - getUi()->quotaProgressBar->setStyleSheet( - "QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } " - "QProgressBar::chunk { background-color: #E20074; }"); - getUi()->quotaProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - - quotaVLayout->addWidget(getUi()->quotaInfoText); - getUi()->quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 8px; }"); - - quotaVLayout->addSpacing(20); - magentaHLayout->addLayout(quotaVLayout); - - auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), this); - storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - storageLinkButton->setStyleSheet( - "QPushButton { height: 32px; width: 180px; border: 1px solid black; background-color: #ededed; " - "color: black; font-size: 13px; border-radius: 4px; } " - "QPushButton::hover { background-color: white; }"); - - connect(storageLinkButton, &QPushButton::clicked, this, []() { - QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); - }); - - magentaHLayout->addWidget(storageLinkButton); - magentaHLayout->addSpacing(8); - - getUi()->gridLayout->addLayout(magentaHLayout, 5, 0); - - // Sichtbarkeit initial ausblenden - getUi()->encryptionMessage->hide(); - checkClientSideEncryptionState(); - } - - } // namespace OCC - \ No newline at end of file +#include "nmcgui/nmcaccountsettings.h" +#include "ui_accountsettings.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace OCC { + +NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) + : AccountSettings(accountState, parent) + , m_liveAccountButton(new CustomButton(QCoreApplication::translate("", "ADD_LIVE_BACKUP"), QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")).pixmap(24,24))) + , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"))) + , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"))) + , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"))) + , m_quotaInfoLabel(new QLabel(this)) + , m_quotaProgressBar(new QProgressBar(this)) + , m_quotaInfoText(new QLabel(this)) +{ + setDefaultSettings(); + setLayout(); + connect(m_liveAccountButton, &CustomButton::clicked, this, &NMCAccountSettings::slotAddFolder); +} + +void NMCAccountSettings::setDefaultSettings() +{ + getUi()->selectiveSyncStatus->setVisible(false); + getUi()->selectiveSyncNotification->setVisible(false); + getUi()->accountStatus->setVisible(false); + getUi()->bigFolderUi->setVisible(false); + getUi()->verticalLayout_2->setSpacing(8); +} + +void NMCAccountSettings::setLayout() +{ + m_folderSync->setStyleSheet("font-size: 15px; font-weight: 600; padding: 8px;"); + m_folderSync->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + getUi()->verticalLayout_2->insertWidget(1, m_folderSync); + + auto *liveHLayout = new QHBoxLayout(); + liveHLayout->setContentsMargins(8, 8, 8, 8); + + auto *liveVLayout = new QVBoxLayout(); + auto *liveWidget = new QWidget(this); + liveWidget->setStyleSheet("QWidget { border-radius: 4px; }"); + liveWidget->setLayout(liveHLayout); + + liveHLayout->addLayout(liveVLayout); + liveHLayout->addStretch(); + + const QString styleSheet = QStringLiteral( + "QPushButton { font-size: %5px; border: %1px solid; border-color: black; " + "border-radius: 4px; background-color: %2; color: %3; } " + "QPushButton:hover { background-color: %4; }"); + + m_liveAccountButton->setStyleSheet(styleSheet.arg("0", "#E20074", "white", "#c00063", "13")); + m_liveAccountButton->setFixedSize(180, 32); + m_liveAccountButton->setLeftIconMargin(4); + + liveHLayout->addWidget(m_liveAccountButton); + + liveVLayout->addWidget(m_liveTitle); + m_liveTitle->setStyleSheet("font-size: 15px; font-weight: 600;"); + + liveVLayout->addWidget(m_liveDescription); + m_liveDescription->setStyleSheet("font-size: 13px;"); + m_liveDescription->setText(QCoreApplication::translate("", "LIVE_BACKUPS_DESCRIPTION")); + m_liveDescription->setWordWrap(true); + m_liveDescription->setFixedWidth(450); + + getUi()->verticalLayout_2->addWidget(liveWidget); + + auto *quotaWidget = new QWidget(this); + auto *magentaHLayout = new QHBoxLayout(quotaWidget); + magentaHLayout->setContentsMargins(8, 8, 8, 8); + magentaHLayout->setSpacing(32); + + auto *quotaVLayout = new QVBoxLayout(); + quotaVLayout->setSpacing(4); + quotaVLayout->addSpacing(12); + + quotaVLayout->addWidget(m_quotaInfoLabel); + m_quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; padding: 8px; font-weight: 500; }"); + + quotaVLayout->addWidget(m_quotaProgressBar); + m_quotaProgressBar->setRange(0, 100); + m_quotaProgressBar->setStyleSheet( + "QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } " + "QProgressBar::chunk { background-color: #E20074; }"); + m_quotaProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + + quotaVLayout->addWidget(m_quotaInfoText); + m_quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 8px; }"); + + magentaHLayout->addLayout(quotaVLayout); + + auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), quotaWidget); + storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + storageLinkButton->setStyleSheet( + "QPushButton { height: 32px; width: 180px; border: 1px solid black; background-color: #ededed; " + "color: black; font-size: 13px; border-radius: 4px; } " + "QPushButton::hover { background-color: white; }"); + + connect(storageLinkButton, &QPushButton::clicked, this, []() { + QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); + }); + + magentaHLayout->addWidget(storageLinkButton); + magentaHLayout->addStretch(); + + getUi()->verticalLayout_2->addWidget(quotaWidget); + + getUi()->encryptionMessage->hide(); + checkClientSideEncryptionState(); +} + +void NMCAccountSettings::slotUpdateQuota(qint64 total, qint64 used) +{ + if (total > 0) { + const auto usedStr = Utility::octetsToString(used); + const auto totalStr = Utility::octetsToString(total); + const auto percent = (double(used) / double(total)) * 100.0; + const auto percentStr = Utility::compactFormatDouble(percent, 1); + + const auto toolTip = tr("%1 (%3%) of %2 in use. Some folders, including network mounted or shared folders, might have different limits.") + .arg(usedStr, totalStr, percentStr); + + m_quotaInfoLabel->setText(QCoreApplication::translate("", "%1_OF_%2").arg(usedStr, totalStr)); + m_quotaInfoLabel->setToolTip(toolTip); + + m_quotaProgressBar->setValue(static_cast(std::round(percent))); + m_quotaProgressBar->setToolTip(toolTip); + + m_quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(percentStr)); + } else { + m_quotaInfoLabel->setText({}); + m_quotaProgressBar->setValue(0); + m_quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(QString::number(0))); + } + + AccountSettings::slotUpdateQuota(total, used); +} + +} // namespace OCC diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h index b8ebc65c86516..2d0abcb5719fe 100644 --- a/src/gui/nmcgui/nmcaccountsettings.h +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -15,10 +15,11 @@ #ifndef MIRALL_ACCOUNTSETTINGSMAGENTA_H #define MIRALL_ACCOUNTSETTINGSMAGENTA_H - #include #include - #include #include + #include + #include + #include #include @@ -39,6 +40,7 @@ } void setLeftIconMargin(int margin) { m_leftMargin = margin; } + void slotUpdateQuota(qint64 total, qint64 used); protected: void paintEvent(QPaintEvent *event) override { @@ -77,6 +79,10 @@ QLabel *m_liveTitle = nullptr; QLabel *m_liveDescription = nullptr; QLabel *m_folderSync = nullptr; + + QLabel *m_quotaInfoLabel = nullptr; + QProgressBar *m_quotaProgressBar = nullptr; + QLabel *m_quotaInfoText = nullptr; }; } // namespace OCC From 3ce6b8728e68feb5440e5c8b346df276cac3c70d Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 26 May 2026 13:06:30 +0200 Subject: [PATCH 04/21] fix error --- src/gui/nmcgui/nmcaccountsettings.h | 152 +++++++++++++--------------- 1 file changed, 73 insertions(+), 79 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h index 2d0abcb5719fe..09c834ca35136 100644 --- a/src/gui/nmcgui/nmcaccountsettings.h +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -8,84 +8,78 @@ * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ - #ifndef MIRALL_ACCOUNTSETTINGSMAGENTA_H - #define MIRALL_ACCOUNTSETTINGSMAGENTA_H - - #include - #include - #include - #include - #include - - #include - - namespace OCC { - - /** - * @brief A QPushButton with a custom left icon margin. - */ - class CustomButton : public QPushButton { - Q_OBJECT - - public: - explicit CustomButton(const QString &text, const QIcon &icon, QWidget *parent = nullptr) - : QPushButton(text, parent) - , m_icon(icon) - { - setIconSize(QSize(24, 24)); - } - - void setLeftIconMargin(int margin) { m_leftMargin = margin; } - void slotUpdateQuota(qint64 total, qint64 used); - - protected: - void paintEvent(QPaintEvent *event) override { - QPushButton::paintEvent(event); - // Optional icon rendering (currently disabled) - // if (!m_icon.isNull()) { - // QRect iconRect(m_leftMargin, - // (height() - iconSize().height()) / 2, - // iconSize().width(), - // iconSize().height()); - // QPainter painter(this); - // painter.drawPixmap(iconRect, m_icon.pixmap(iconSize())); - // } - } - - private: - QIcon m_icon; - int m_leftMargin = 4; - }; - - /** - * @brief Erweiterte AccountSettings-Ansicht für Magenta. - */ - class NMCAccountSettings : public AccountSettings { - Q_OBJECT - - public: - explicit NMCAccountSettings(AccountState *accountState, QWidget *parent = nullptr); - ~NMCAccountSettings() override = default; - - private: - void setDefaultSettings(); - void setLayout(); - - CustomButton *m_liveAccountButton = nullptr; - QLabel *m_liveTitle = nullptr; - QLabel *m_liveDescription = nullptr; - QLabel *m_folderSync = nullptr; - - QLabel *m_quotaInfoLabel = nullptr; - QProgressBar *m_quotaProgressBar = nullptr; - QLabel *m_quotaInfoText = nullptr; - }; - - } // namespace OCC - - #endif // MIRALL_ACCOUNTSETTINGSMAGENTA_H - \ No newline at end of file +#ifndef MIRALL_ACCOUNTSETTINGSMAGENTA_H +#define MIRALL_ACCOUNTSETTINGSMAGENTA_H + +#include +#include +#include +#include +#include + +#include + +namespace OCC { + +/** + * @brief A QPushButton with a custom left icon margin. + */ +class CustomButton : public QPushButton +{ + Q_OBJECT + +public: + explicit CustomButton(const QString &text, const QIcon &icon, QWidget *parent = nullptr) + : QPushButton(text, parent) + , m_icon(icon) + { + setIconSize(QSize(24, 24)); + } + + void setLeftIconMargin(int margin) { m_leftMargin = margin; } + +protected: + void paintEvent(QPaintEvent *event) override + { + QPushButton::paintEvent(event); + } + +private: + QIcon m_icon; + int m_leftMargin = 4; +}; + +/** + * @brief Erweiterte AccountSettings-Ansicht für Magenta. + */ +class NMCAccountSettings : public AccountSettings +{ + Q_OBJECT + +public: + explicit NMCAccountSettings(AccountState *accountState, QWidget *parent = nullptr); + ~NMCAccountSettings() override = default; + +public slots: + void slotUpdateQuota(qint64 total, qint64 used); + +private: + void setDefaultSettings(); + void setLayout(); + + CustomButton *m_liveAccountButton = nullptr; + QLabel *m_liveTitle = nullptr; + QLabel *m_liveDescription = nullptr; + QLabel *m_folderSync = nullptr; + + QLabel *m_quotaInfoLabel = nullptr; + QProgressBar *m_quotaProgressBar = nullptr; + QLabel *m_quotaInfoText = nullptr; +}; + +} // namespace OCC + +#endif // MIRALL_ACCOUNTSETTINGSMAGENTA_H From f11723804c1b19254e96d2a80798db4d5b88a5b0 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 26 May 2026 13:19:04 +0200 Subject: [PATCH 05/21] fix error --- src/gui/accountsettings.h | 2 +- src/gui/nmcgui/nmcaccountsettings.cpp | 3 ++- src/gui/nmcgui/nmcaccountsettings.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/accountsettings.h b/src/gui/accountsettings.h index 1244b6269aa56..9f5e8afea6f5d 100644 --- a/src/gui/accountsettings.h +++ b/src/gui/accountsettings.h @@ -74,7 +74,7 @@ class AccountSettings : public QWidget public slots: void slotOpenOC(); - void slotUpdateQuota(qint64 total, qint64 used); + virtual void slotUpdateQuota(qint64 total, qint64 used); void slotAccountStateChanged(); void slotStyleChanged(); void slotHideSelectiveSyncWidget(); diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 3151e2783d973..61840a1fb0996 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -14,8 +14,10 @@ #include "nmcgui/nmcaccountsettings.h" #include "ui_accountsettings.h" +#include "common/utility.h" #include +#include #include #include #include @@ -25,7 +27,6 @@ #include #include - namespace OCC { NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h index 09c834ca35136..2a3f3f02b8e4a 100644 --- a/src/gui/nmcgui/nmcaccountsettings.h +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -64,7 +64,7 @@ class NMCAccountSettings : public AccountSettings ~NMCAccountSettings() override = default; public slots: - void slotUpdateQuota(qint64 total, qint64 used); + void slotUpdateQuota(qint64 total, qint64 used) override; private: void setDefaultSettings(); From 6ef2825f4e481c53cc4fe0b66f37aa7787df8a29 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 26 May 2026 14:02:22 +0200 Subject: [PATCH 06/21] fix error --- src/gui/nmcgui/nmcaccountsettings.cpp | 16 +++++++++------- src/gui/nmcgui/nmcaccountsettings.h | 17 +++-------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 61840a1fb0996..42ea1c739b182 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -31,10 +31,13 @@ namespace OCC { NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) : AccountSettings(accountState, parent) - , m_liveAccountButton(new CustomButton(QCoreApplication::translate("", "ADD_LIVE_BACKUP"), QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")).pixmap(24,24))) - , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"))) - , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"))) - , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"))) + , m_liveAccountButton(new CustomButton( + QCoreApplication::translate("", "ADD_LIVE_BACKUP"), + QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")), + this)) + , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"), this)) + , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"), this)) + , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"), this)) , m_quotaInfoLabel(new QLabel(this)) , m_quotaProgressBar(new QProgressBar(this)) , m_quotaInfoText(new QLabel(this)) @@ -62,11 +65,10 @@ void NMCAccountSettings::setLayout() auto *liveHLayout = new QHBoxLayout(); liveHLayout->setContentsMargins(8, 8, 8, 8); - auto *liveVLayout = new QVBoxLayout(); auto *liveWidget = new QWidget(this); + auto *liveHLayout = new QHBoxLayout(liveWidget); + auto *liveVLayout = new QVBoxLayout(); liveWidget->setStyleSheet("QWidget { border-radius: 4px; }"); - liveWidget->setLayout(liveHLayout); - liveHLayout->addLayout(liveVLayout); liveHLayout->addStretch(); diff --git a/src/gui/nmcgui/nmcaccountsettings.h b/src/gui/nmcgui/nmcaccountsettings.h index 2a3f3f02b8e4a..67b5aa9b1142c 100644 --- a/src/gui/nmcgui/nmcaccountsettings.h +++ b/src/gui/nmcgui/nmcaccountsettings.h @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -25,7 +24,7 @@ namespace OCC { /** - * @brief A QPushButton with a custom left icon margin. + * @brief Simple QPushButton with predefined icon size. */ class CustomButton : public QPushButton { @@ -34,22 +33,12 @@ class CustomButton : public QPushButton public: explicit CustomButton(const QString &text, const QIcon &icon, QWidget *parent = nullptr) : QPushButton(text, parent) - , m_icon(icon) { + setIcon(icon); setIconSize(QSize(24, 24)); } - void setLeftIconMargin(int margin) { m_leftMargin = margin; } - -protected: - void paintEvent(QPaintEvent *event) override - { - QPushButton::paintEvent(event); - } - -private: - QIcon m_icon; - int m_leftMargin = 4; + void setLeftIconMargin(int) {} }; /** From 7aa2daec4ac88dd7d38769e0d0619305a64f13d2 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 27 May 2026 08:48:58 +0200 Subject: [PATCH 07/21] fix error --- src/gui/accountsettings.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 11074e0873361..a93d6f0bb8cd5 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -1369,21 +1369,14 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used) if (total > 0) { const auto usedStr = Utility::octetsToString(used); const auto totalStr = Utility::octetsToString(total); - const auto percentStr = Utility::compactFormatDouble(percent, 1); - const auto toolTip = tr("%1 (%3%) of %2 in use. Some folders, including network mounted or shared folders, might have different limits.").arg(usedStr, totalStr, percentStr); - _ui->quotaInfoLabel->setText(QCoreApplication::translate("", "%1_OF_%2").arg(usedStr, totalStr)); - _ui->quotaInfoLabel->setToolTip(toolTip); - _ui->quotaProgressBar->setToolTip(toolTip); - _ui->quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(percentStr)); + _spaceUsageText = tr("%1 of %2 in use").arg(usedStr, totalStr); } else { - /* -1 means not computed; -2 means unknown; -3 means unlimited (#owncloud/client/issues/3940)*/ if (total == 0 || total == -1) { _spaceUsageText.clear(); } else { const auto usedStr = Utility::octetsToString(used); _spaceUsageText = tr("%1 in use").arg(usedStr); } - _ui->quotaInfoText->setText(QCoreApplication::translate("", "USED_STORAGE_%1").arg(QString::number(0))); } slotAccountStateChanged(); From 3c97280cc5302498d28681bb214978dddbb439e2 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 27 May 2026 09:24:54 +0200 Subject: [PATCH 08/21] fix error --- src/gui/nmcgui/nmcaccountsettings.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 42ea1c739b182..3e9e7c8e098c5 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -62,13 +62,14 @@ void NMCAccountSettings::setLayout() m_folderSync->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); getUi()->verticalLayout_2->insertWidget(1, m_folderSync); - auto *liveHLayout = new QHBoxLayout(); - liveHLayout->setContentsMargins(8, 8, 8, 8); - auto *liveWidget = new QWidget(this); + liveWidget->setStyleSheet("QWidget { border-radius: 4px; }"); + auto *liveHLayout = new QHBoxLayout(liveWidget); + liveHLayout->setContentsMargins(8, 8, 8, 8); + auto *liveVLayout = new QVBoxLayout(); - liveWidget->setStyleSheet("QWidget { border-radius: 4px; }"); + liveHLayout->addLayout(liveVLayout); liveHLayout->addStretch(); From 23de0295401c9ba72e77cee0f47c1d7526181b93 Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 1 Jun 2026 15:13:34 +0200 Subject: [PATCH 09/21] fix layout issues --- src/gui/nmcgui/nmcaccountsettings.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 3e9e7c8e098c5..4fb1c7b9686cc 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -37,7 +37,6 @@ NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *pare this)) , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"), this)) , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"), this)) - , m_folderSync(new QLabel(QCoreApplication::translate("", "YOUR_FOLDER_SYNC"), this)) , m_quotaInfoLabel(new QLabel(this)) , m_quotaProgressBar(new QProgressBar(this)) , m_quotaInfoText(new QLabel(this)) @@ -58,12 +57,15 @@ void NMCAccountSettings::setDefaultSettings() void NMCAccountSettings::setLayout() { - m_folderSync->setStyleSheet("font-size: 15px; font-weight: 600; padding: 8px;"); - m_folderSync->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - getUi()->verticalLayout_2->insertWidget(1, m_folderSync); - auto *liveWidget = new QWidget(this); - liveWidget->setStyleSheet("QWidget { border-radius: 4px; }"); + liveWidget->setObjectName(QStringLiteral("nmcLiveBackupPanel")); + liveWidget->setAttribute(Qt::WA_StyledBackground, true); + liveWidget->setStyleSheet(QStringLiteral( + "#nmcLiveBackupPanel {" + " background: palette(base);" + " border-radius: 4px;" + "}" + )); auto *liveHLayout = new QHBoxLayout(liveWidget); liveHLayout->setContentsMargins(8, 8, 8, 8); @@ -96,6 +98,14 @@ void NMCAccountSettings::setLayout() getUi()->verticalLayout_2->addWidget(liveWidget); auto *quotaWidget = new QWidget(this); + quotaWidget->setObjectName(QStringLiteral("nmcQuotaPanel")); + quotaWidget->setAttribute(Qt::WA_StyledBackground, true); + quotaWidget->setStyleSheet(QStringLiteral( + "#nmcQuotaPanel {" + " background: palette(base);" + " border-radius: 4px;" + "}" + )); auto *magentaHLayout = new QHBoxLayout(quotaWidget); magentaHLayout->setContentsMargins(8, 8, 8, 8); magentaHLayout->setSpacing(32); @@ -109,6 +119,7 @@ void NMCAccountSettings::setLayout() quotaVLayout->addWidget(m_quotaProgressBar); m_quotaProgressBar->setRange(0, 100); + m_quotaProgressBar->setTextVisible(false); m_quotaProgressBar->setStyleSheet( "QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } " "QProgressBar::chunk { background-color: #E20074; }"); From 191e31a192524095ea612e09984ee7f92254ce5a Mon Sep 17 00:00:00 2001 From: memurats Date: Mon, 1 Jun 2026 17:31:24 +0200 Subject: [PATCH 10/21] fix layout --- src/gui/nmcgui/nmcaccountsettings.cpp | 70 +++++++++++++++++++-------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 4fb1c7b9686cc..555aabdcd028f 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -26,14 +26,26 @@ #include #include #include +#include namespace OCC { +namespace { +constexpr int panelPadding = 24; +constexpr int contentWidth = 450; +} + +#ifdef Q_OS_WIN + #define BACKGROUND_PALETTE "alternate-base" +#else + #define BACKGROUND_PALETTE "light" +#endif + NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) : AccountSettings(accountState, parent) , m_liveAccountButton(new CustomButton( QCoreApplication::translate("", "ADD_LIVE_BACKUP"), - QIcon(QLatin1String(":/client/theme/NMCIcons/action-add.svg")), + QIcon(), this)) , m_liveTitle(new QLabel(QCoreApplication::translate("", "LIVE_BACKUPS"), this)) , m_liveDescription(new QLabel(QCoreApplication::translate("", "LIVE_DESCRIPTION"), this)) @@ -62,15 +74,17 @@ void NMCAccountSettings::setLayout() liveWidget->setAttribute(Qt::WA_StyledBackground, true); liveWidget->setStyleSheet(QStringLiteral( "#nmcLiveBackupPanel {" - " background: palette(base);" - " border-radius: 4px;" + " background: palette(" BACKGROUND_PALETTE ");" + " border-radius: 6px;" "}" )); auto *liveHLayout = new QHBoxLayout(liveWidget); - liveHLayout->setContentsMargins(8, 8, 8, 8); + liveHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); + liveHLayout->setSpacing(32); auto *liveVLayout = new QVBoxLayout(); + liveVLayout->setSpacing(4); liveHLayout->addLayout(liveVLayout); liveHLayout->addStretch(); @@ -82,9 +96,9 @@ void NMCAccountSettings::setLayout() m_liveAccountButton->setStyleSheet(styleSheet.arg("0", "#E20074", "white", "#c00063", "13")); m_liveAccountButton->setFixedSize(180, 32); - m_liveAccountButton->setLeftIconMargin(4); + m_liveAccountButton->setIcon(QIcon()); - liveHLayout->addWidget(m_liveAccountButton); + liveHLayout->addWidget(m_liveAccountButton, 0, Qt::AlignRight | Qt::AlignVCenter); liveVLayout->addWidget(m_liveTitle); m_liveTitle->setStyleSheet("font-size: 15px; font-weight: 600;"); @@ -93,7 +107,7 @@ void NMCAccountSettings::setLayout() m_liveDescription->setStyleSheet("font-size: 13px;"); m_liveDescription->setText(QCoreApplication::translate("", "LIVE_BACKUPS_DESCRIPTION")); m_liveDescription->setWordWrap(true); - m_liveDescription->setFixedWidth(450); + m_liveDescription->setFixedWidth(contentWidth); getUi()->verticalLayout_2->addWidget(liveWidget); @@ -102,47 +116,61 @@ void NMCAccountSettings::setLayout() quotaWidget->setAttribute(Qt::WA_StyledBackground, true); quotaWidget->setStyleSheet(QStringLiteral( "#nmcQuotaPanel {" - " background: palette(base);" - " border-radius: 4px;" + " background: palette(" BACKGROUND_PALETTE ");" + " border-radius: 6px;" "}" )); + auto *magentaHLayout = new QHBoxLayout(quotaWidget); - magentaHLayout->setContentsMargins(8, 8, 8, 8); + magentaHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); magentaHLayout->setSpacing(32); auto *quotaVLayout = new QVBoxLayout(); quotaVLayout->setSpacing(4); - quotaVLayout->addSpacing(12); quotaVLayout->addWidget(m_quotaInfoLabel); - m_quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; padding: 8px; font-weight: 500; }"); + m_quotaInfoLabel->setFixedWidth(contentWidth); + m_quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; font-weight: 500; padding: 0px; }"); quotaVLayout->addWidget(m_quotaProgressBar); m_quotaProgressBar->setRange(0, 100); m_quotaProgressBar->setTextVisible(false); + m_quotaProgressBar->setFixedWidth(contentWidth); + m_quotaProgressBar->setFixedHeight(8); m_quotaProgressBar->setStyleSheet( - "QProgressBar { background-color: #e5e5e5; color: black; border: 1px solid black; border-radius: 4px; margin-left: 8px; } " - "QProgressBar::chunk { background-color: #E20074; }"); - m_quotaProgressBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + "QProgressBar {" + " background-color: #e5e5e5;" + " color: black;" + " border: 1px solid black;" + " border-radius: 4px;" + " margin: 0px;" + " padding: 0px;" + "} " + "QProgressBar::chunk {" + " background-color: #E20074;" + " border-radius: 3px;" + "}"); + m_quotaProgressBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); quotaVLayout->addWidget(m_quotaInfoText); - m_quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 8px; }"); + m_quotaInfoText->setFixedWidth(contentWidth); + m_quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 0px; }"); magentaHLayout->addLayout(quotaVLayout); + magentaHLayout->addStretch(); auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), quotaWidget); - storageLinkButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + storageLinkButton->setFixedSize(180, 32); storageLinkButton->setStyleSheet( - "QPushButton { height: 32px; width: 180px; border: 1px solid black; background-color: #ededed; " + "QPushButton { border: 1px solid black; background-color: #ededed; " "color: black; font-size: 13px; border-radius: 4px; } " - "QPushButton::hover { background-color: white; }"); + "QPushButton:hover { background-color: white; }"); connect(storageLinkButton, &QPushButton::clicked, this, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); }); - magentaHLayout->addWidget(storageLinkButton); - magentaHLayout->addStretch(); + magentaHLayout->addWidget(storageLinkButton, 0, Qt::AlignRight | Qt::AlignVCenter); getUi()->verticalLayout_2->addWidget(quotaWidget); From 67fd3f5d343f18d9b5b6991442376cd873901d3d Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 2 Jun 2026 14:36:32 +0200 Subject: [PATCH 11/21] implement e2ee --- src/gui/nmcgui/nmcaccountsettings.cpp | 141 ++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 10 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 555aabdcd028f..9716718d8c829 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) by Eugen Fischer + * Copyright (C) by Mauro Mura * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,22 +17,47 @@ #include "common/utility.h" #include +#include #include #include -#include +#include +#include +#include #include #include -#include -#include -#include #include -#include +#include +#include +#include namespace OCC { namespace { constexpr int panelPadding = 24; constexpr int contentWidth = 450; +constexpr int actionButtonWidth = 180; +constexpr int actionButtonHeight = 32; + +void styleSecondaryButton(QPushButton *button) +{ + if (!button) { + return; + } + + button->setFixedSize(actionButtonWidth, actionButtonHeight); + button->setStyleSheet(QStringLiteral( + "QPushButton {" + " border: 1px solid black;" + " background-color: #ededed;" + " color: black;" + " font-size: 13px;" + " border-radius: 4px;" + "}" + "QPushButton:hover {" + " background-color: white;" + "}" + )); +} } #ifdef Q_OS_WIN @@ -69,6 +94,103 @@ void NMCAccountSettings::setDefaultSettings() void NMCAccountSettings::setLayout() { + auto *e2eePanel = new QWidget(this); + e2eePanel->setObjectName(QStringLiteral("nmcE2eePanel")); + e2eePanel->setAttribute(Qt::WA_StyledBackground, true); + e2eePanel->setStyleSheet(QStringLiteral( + "#nmcE2eePanel {" + " background: palette(" BACKGROUND_PALETTE ");" + " border-radius: 6px;" + "}" + )); + + auto *e2eeHLayout = new QHBoxLayout(e2eePanel); + e2eeHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); + e2eeHLayout->setSpacing(32); + + auto *e2eeVLayout = new QVBoxLayout(); + e2eeVLayout->setSpacing(4); + + auto *e2eeTitle = new QLabel(QCoreApplication::translate("", "E2E_ENCRYPTION"), e2eePanel); + e2eeTitle->setStyleSheet(QStringLiteral("font-size: 15px; font-weight: 600;")); + + auto *e2eeTitleIcon = new QLabel(e2eePanel); + e2eeTitleIcon->setFixedSize(24, 24); + e2eeTitleIcon->setPixmap(QIcon(QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")).pixmap(24, 24)); + e2eeTitleIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + auto *e2eeTitleLayout = new QHBoxLayout(); + e2eeTitleLayout->setContentsMargins(0, 0, 0, 0); + e2eeTitleLayout->setSpacing(8); + e2eeTitleLayout->addWidget(e2eeTitleIcon); + e2eeTitleLayout->addWidget(e2eeTitle); + e2eeTitleLayout->addStretch(); + + getUi()->accountStatusLayout->removeWidget(getUi()->encryptionMessage); + getUi()->encryptionMessageLayout->removeItem(getUi()->encryptionMessageButtonsLayout); + + getUi()->encryptionMessage->setStyleSheet(QStringLiteral( + "QWidget {" + " background: transparent;" + " border: none;" + "}" + )); + + getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); + getUi()->encryptionMessageLabel->setWordWrap(true); + + e2eeVLayout->addLayout(e2eeTitleLayout); + e2eeVLayout->addWidget(getUi()->encryptionMessage); + + auto *e2eeButtonContainer = new QWidget(e2eePanel); + auto *e2eeButtonContainerLayout = new QVBoxLayout(e2eeButtonContainer); + e2eeButtonContainerLayout->setContentsMargins(0, 0, 0, 0); + e2eeButtonContainerLayout->setSpacing(8); + + auto syncEncryptionButtons = [this, e2eeButtonContainerLayout]() { + auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; + if (!sourceLayout) { + return; + } + + bool hasSourceButtons = false; + for (int i = 0; i < sourceLayout->count(); ++i) { + if (qobject_cast(sourceLayout->itemAt(i)->widget())) { + hasSourceButtons = true; + break; + } + } + + if (!hasSourceButtons) { + return; + } + + while (auto *item = e2eeButtonContainerLayout->takeAt(0)) { + if (auto *widget = item->widget()) { + widget->deleteLater(); + } + delete item; + } + + while (auto *item = sourceLayout->takeAt(0)) { + if (auto *button = qobject_cast(item->widget())) { + styleSecondaryButton(button); + e2eeButtonContainerLayout->addWidget(button, 0, Qt::AlignRight); + } + delete item; + } + + e2eeButtonContainerLayout->addStretch(); + }; + + e2eeHLayout->addLayout(e2eeVLayout); + e2eeHLayout->addStretch(); + e2eeHLayout->addWidget(e2eeButtonContainer, 0, Qt::AlignRight | Qt::AlignVCenter); + + getUi()->accountStatusLayout->addWidget(e2eePanel); + + QTimer::singleShot(0, this, syncEncryptionButtons); + auto *liveWidget = new QWidget(this); liveWidget->setObjectName(QStringLiteral("nmcLiveBackupPanel")); liveWidget->setAttribute(Qt::WA_StyledBackground, true); @@ -161,10 +283,7 @@ void NMCAccountSettings::setLayout() auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), quotaWidget); storageLinkButton->setFixedSize(180, 32); - storageLinkButton->setStyleSheet( - "QPushButton { border: 1px solid black; background-color: #ededed; " - "color: black; font-size: 13px; border-radius: 4px; } " - "QPushButton:hover { background-color: white; }"); + styleSecondaryButton(storageLinkButton); connect(storageLinkButton, &QPushButton::clicked, this, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); @@ -176,6 +295,8 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessage->hide(); checkClientSideEncryptionState(); + + QTimer::singleShot(0, this, syncEncryptionButtons); } void NMCAccountSettings::slotUpdateQuota(qint64 total, qint64 used) From 18d90a4d440cd9a7de133fb70ab742b42d7bd6fd Mon Sep 17 00:00:00 2001 From: Mauro Mura Date: Tue, 2 Jun 2026 15:09:46 +0200 Subject: [PATCH 12/21] Replace insertAction with addAction for accountAction --- src/gui/settingsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index e71a145d2160a..bd9f7ff91f19e 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -344,7 +344,7 @@ void SettingsDialog::accountAdded(AccountState *s) accountAction->setIconText(shortDisplayNameForSettings(s->account().data(), static_cast(height * buttonSizeRatio))); } - _toolBar->insertAction(_toolBar->actions().at(0), accountAction); + _toolBar->addAction(accountAction); auto accountSettings = new NMCAccountSettings(s, this); QString objectName = QLatin1String("accountSettings_"); objectName += s->account()->displayName(); From d62d92f51f991a5099241095609b479546d836ae Mon Sep 17 00:00:00 2001 From: Mauro Mura Date: Tue, 2 Jun 2026 16:03:08 +0200 Subject: [PATCH 13/21] Change action addition to insert at first position --- src/gui/settingsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp index bd9f7ff91f19e..e71a145d2160a 100644 --- a/src/gui/settingsdialog.cpp +++ b/src/gui/settingsdialog.cpp @@ -344,7 +344,7 @@ void SettingsDialog::accountAdded(AccountState *s) accountAction->setIconText(shortDisplayNameForSettings(s->account().data(), static_cast(height * buttonSizeRatio))); } - _toolBar->addAction(accountAction); + _toolBar->insertAction(_toolBar->actions().at(0), accountAction); auto accountSettings = new NMCAccountSettings(s, this); QString objectName = QLatin1String("accountSettings_"); objectName += s->account()->displayName(); From 4de7a8ddb4332cd0c17aa75040c3a67ea9f38673 Mon Sep 17 00:00:00 2001 From: memurats Date: Tue, 2 Jun 2026 18:13:55 +0200 Subject: [PATCH 14/21] removed spacing --- src/gui/nmcgui/nmcaccountsettings.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 9716718d8c829..7753c889cd97e 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -109,7 +109,6 @@ void NMCAccountSettings::setLayout() e2eeHLayout->setSpacing(32); auto *e2eeVLayout = new QVBoxLayout(); - e2eeVLayout->setSpacing(4); auto *e2eeTitle = new QLabel(QCoreApplication::translate("", "E2E_ENCRYPTION"), e2eePanel); e2eeTitle->setStyleSheet(QStringLiteral("font-size: 15px; font-weight: 600;")); From 87ad4326c5878ee244cb75fc5fd71a561596d734 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 08:48:06 +0200 Subject: [PATCH 15/21] fix encryption box --- src/gui/nmcgui/nmcaccountsettings.cpp | 83 ++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 7753c889cd97e..f74d9686467c4 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -8,13 +8,14 @@ * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ #include "nmcgui/nmcaccountsettings.h" #include "ui_accountsettings.h" #include "common/utility.h" +#include "accountstate.h" +#include "account.h" #include #include @@ -38,6 +39,12 @@ constexpr int contentWidth = 450; constexpr int actionButtonWidth = 180; constexpr int actionButtonHeight = 32; +enum class NmcMessageType { + Information, + Positive, + Warning +}; + void styleSecondaryButton(QPushButton *button) { if (!button) { @@ -61,9 +68,9 @@ void styleSecondaryButton(QPushButton *button) } #ifdef Q_OS_WIN - #define BACKGROUND_PALETTE "alternate-base" +#define BACKGROUND_PALETTE "alternate-base" #else - #define BACKGROUND_PALETTE "light" +#define BACKGROUND_PALETTE "light" #endif NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) @@ -80,6 +87,7 @@ NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *pare { setDefaultSettings(); setLayout(); + connect(m_liveAccountButton, &CustomButton::clicked, this, &NMCAccountSettings::slotAddFolder); } @@ -109,6 +117,8 @@ void NMCAccountSettings::setLayout() e2eeHLayout->setSpacing(32); auto *e2eeVLayout = new QVBoxLayout(); + e2eeVLayout->setContentsMargins(0, 0, 0, 0); + e2eeVLayout->setSpacing(8); auto *e2eeTitle = new QLabel(QCoreApplication::translate("", "E2E_ENCRYPTION"), e2eePanel); e2eeTitle->setStyleSheet(QStringLiteral("font-size: 15px; font-weight: 600;")); @@ -128,25 +138,73 @@ void NMCAccountSettings::setLayout() getUi()->accountStatusLayout->removeWidget(getUi()->encryptionMessage); getUi()->encryptionMessageLayout->removeItem(getUi()->encryptionMessageButtonsLayout); + getUi()->encryptionMessage->setAutoFillBackground(false); + getUi()->encryptionMessage->setAttribute(Qt::WA_StyledBackground, false); getUi()->encryptionMessage->setStyleSheet(QStringLiteral( - "QWidget {" + "#encryptionMessage," + "#encryptionMessage QLabel," + "#encryptionMessage QWidget {" " background: transparent;" " border: none;" + " padding: 0px;" + " margin: 0px;" "}" )); + getUi()->encryptionMessageLayout->setContentsMargins(0, 0, 0, 0); + getUi()->encryptionMessageLayout->setSpacing(0); + getUi()->encryptionMessageHeaderLayout->setContentsMargins(0, 0, 0, 0); + getUi()->encryptionMessageHeaderLayout->setSpacing(0); + + getUi()->encryptionMessageIcon->hide(); getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); getUi()->encryptionMessageLabel->setWordWrap(true); + getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral("background: transparent; padding: 0px; margin: 0px;")); e2eeVLayout->addLayout(e2eeTitleLayout); e2eeVLayout->addWidget(getUi()->encryptionMessage); auto *e2eeButtonContainer = new QWidget(e2eePanel); + e2eeButtonContainer->setAutoFillBackground(false); + e2eeButtonContainer->setAttribute(Qt::WA_StyledBackground, false); + e2eeButtonContainer->setStyleSheet(QStringLiteral("background: transparent; border: none;")); + auto *e2eeButtonContainerLayout = new QVBoxLayout(e2eeButtonContainer); e2eeButtonContainerLayout->setContentsMargins(0, 0, 0, 0); e2eeButtonContainerLayout->setSpacing(8); - auto syncEncryptionButtons = [this, e2eeButtonContainerLayout]() { + auto styleEncryptionMessage = [this, e2eeTitleIcon]() { + auto messageType = NmcMessageType::Information; + + const auto accountState = accountsState(); + if (accountState && accountState->isConnected() && accountState->account() && accountState->account()->e2e()) { + if (accountState->account()->e2e()->isInitialized()) { + messageType = accountState->account()->e2e()->userCertificateNeedsMigration() + ? NmcMessageType::Warning + : NmcMessageType::Positive; + } + } + + QString iconPath = QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg"); + + switch (messageType) { + case NmcMessageType::Information: + iconPath = QStringLiteral(":/client/theme/info.svg"); + break; + case NmcMessageType::Positive: + iconPath = QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg"); + break; + case NmcMessageType::Warning: + iconPath = QStringLiteral(":/client/theme/warning.svg"); + break; + } + + e2eeTitleIcon->setPixmap(QIcon(iconPath).pixmap(24, 24)); + }; + + auto syncEncryptionButtons = [this, e2eeButtonContainerLayout, styleEncryptionMessage]() { + styleEncryptionMessage(); + auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; if (!sourceLayout) { return; @@ -188,6 +246,18 @@ void NMCAccountSettings::setLayout() getUi()->accountStatusLayout->addWidget(e2eePanel); + if (auto *accountState = accountsState()) { + connect(accountState, &AccountState::stateChanged, this, [this, syncEncryptionButtons]() { + QTimer::singleShot(0, this, syncEncryptionButtons); + }); + + if (accountState->account() && accountState->account()->e2e()) { + connect(accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, [this, syncEncryptionButtons]() { + QTimer::singleShot(0, this, syncEncryptionButtons); + }); + } + } + QTimer::singleShot(0, this, syncEncryptionButtons); auto *liveWidget = new QWidget(this); @@ -281,7 +351,6 @@ void NMCAccountSettings::setLayout() magentaHLayout->addStretch(); auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), quotaWidget); - storageLinkButton->setFixedSize(180, 32); styleSecondaryButton(storageLinkButton); connect(storageLinkButton, &QPushButton::clicked, this, []() { From 38ea590af84908533ea8a9250d76db2e89deea20 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 10:09:09 +0200 Subject: [PATCH 16/21] fix encryption colors --- src/gui/nmcgui/nmcaccountsettings.cpp | 56 +++++++-------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index f74d9686467c4..31b03e4a961ae 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -18,7 +18,6 @@ #include "account.h" #include -#include #include #include #include @@ -39,12 +38,6 @@ constexpr int contentWidth = 450; constexpr int actionButtonWidth = 180; constexpr int actionButtonHeight = 32; -enum class NmcMessageType { - Information, - Positive, - Warning -}; - void styleSecondaryButton(QPushButton *button) { if (!button) { @@ -126,6 +119,10 @@ void NMCAccountSettings::setLayout() auto *e2eeTitleIcon = new QLabel(e2eePanel); e2eeTitleIcon->setFixedSize(24, 24); e2eeTitleIcon->setPixmap(QIcon(QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")).pixmap(24, 24)); + e2eeTitleIcon->setPixmap( + Theme::createColorAwareIcon( + QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")) + .pixmap(24, 24)); e2eeTitleIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); auto *e2eeTitleLayout = new QHBoxLayout(); @@ -141,9 +138,7 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessage->setAutoFillBackground(false); getUi()->encryptionMessage->setAttribute(Qt::WA_StyledBackground, false); getUi()->encryptionMessage->setStyleSheet(QStringLiteral( - "#encryptionMessage," - "#encryptionMessage QLabel," - "#encryptionMessage QWidget {" + "#encryptionMessage {" " background: transparent;" " border: none;" " padding: 0px;" @@ -159,7 +154,11 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessageIcon->hide(); getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); getUi()->encryptionMessageLabel->setWordWrap(true); - getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral("background: transparent; padding: 0px; margin: 0px;")); + getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral( + "background: transparent;" + "padding: 0px;" + "margin: 0px;" + )); e2eeVLayout->addLayout(e2eeTitleLayout); e2eeVLayout->addWidget(getUi()->encryptionMessage); @@ -173,37 +172,8 @@ void NMCAccountSettings::setLayout() e2eeButtonContainerLayout->setContentsMargins(0, 0, 0, 0); e2eeButtonContainerLayout->setSpacing(8); - auto styleEncryptionMessage = [this, e2eeTitleIcon]() { - auto messageType = NmcMessageType::Information; - - const auto accountState = accountsState(); - if (accountState && accountState->isConnected() && accountState->account() && accountState->account()->e2e()) { - if (accountState->account()->e2e()->isInitialized()) { - messageType = accountState->account()->e2e()->userCertificateNeedsMigration() - ? NmcMessageType::Warning - : NmcMessageType::Positive; - } - } - - QString iconPath = QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg"); - - switch (messageType) { - case NmcMessageType::Information: - iconPath = QStringLiteral(":/client/theme/info.svg"); - break; - case NmcMessageType::Positive: - iconPath = QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg"); - break; - case NmcMessageType::Warning: - iconPath = QStringLiteral(":/client/theme/warning.svg"); - break; - } - - e2eeTitleIcon->setPixmap(QIcon(iconPath).pixmap(24, 24)); - }; - - auto syncEncryptionButtons = [this, e2eeButtonContainerLayout, styleEncryptionMessage]() { - styleEncryptionMessage(); + auto syncEncryptionButtons = [this, e2eeButtonContainerLayout]() { + getUi()->encryptionMessageIcon->hide(); auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; if (!sourceLayout) { @@ -244,7 +214,7 @@ void NMCAccountSettings::setLayout() e2eeHLayout->addStretch(); e2eeHLayout->addWidget(e2eeButtonContainer, 0, Qt::AlignRight | Qt::AlignVCenter); - getUi()->accountStatusLayout->addWidget(e2eePanel); + getUi()->verticalLayout_2->insertWidget(0, e2eePanel); if (auto *accountState = accountsState()) { connect(accountState, &AccountState::stateChanged, this, [this, syncEncryptionButtons]() { From 737f751500119283be285a16aa930e00f04cbef2 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 10:20:51 +0200 Subject: [PATCH 17/21] added theme --- src/gui/nmcgui/nmcaccountsettings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 31b03e4a961ae..3d4e458e916ca 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -16,6 +16,7 @@ #include "common/utility.h" #include "accountstate.h" #include "account.h" +#include "theme.h" #include #include From d37c3fc59b9187c701096a85ef49d6867bd9bc7d Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 11:43:11 +0200 Subject: [PATCH 18/21] fix layout --- src/gui/nmcgui/nmcaccountsettings.cpp | 97 +++++++++++++++++---------- 1 file changed, 62 insertions(+), 35 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 3d4e458e916ca..6843df8dd68db 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -102,7 +102,7 @@ void NMCAccountSettings::setLayout() e2eePanel->setStyleSheet(QStringLiteral( "#nmcE2eePanel {" " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 6px;" + " border-radius: 10px;" "}" )); @@ -119,11 +119,9 @@ void NMCAccountSettings::setLayout() auto *e2eeTitleIcon = new QLabel(e2eePanel); e2eeTitleIcon->setFixedSize(24, 24); - e2eeTitleIcon->setPixmap(QIcon(QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")).pixmap(24, 24)); e2eeTitleIcon->setPixmap( - Theme::createColorAwareIcon( - QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")) - .pixmap(24, 24)); + Theme::createColorAwareIcon(QStringLiteral(":/client/theme/NMCIcons/cloud-security.svg")) + .pixmap(24, 24)); e2eeTitleIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); auto *e2eeTitleLayout = new QHBoxLayout(); @@ -152,7 +150,9 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessageHeaderLayout->setContentsMargins(0, 0, 0, 0); getUi()->encryptionMessageHeaderLayout->setSpacing(0); + getUi()->encryptionMessageIcon->clear(); getUi()->encryptionMessageIcon->hide(); + getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); getUi()->encryptionMessageLabel->setWordWrap(true); getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral( @@ -173,63 +173,90 @@ void NMCAccountSettings::setLayout() e2eeButtonContainerLayout->setContentsMargins(0, 0, 0, 0); e2eeButtonContainerLayout->setSpacing(8); - auto syncEncryptionButtons = [this, e2eeButtonContainerLayout]() { + auto normalizeEncryptionLayout = [this, e2eeButtonContainerLayout]() { + getUi()->encryptionMessageIcon->clear(); getUi()->encryptionMessageIcon->hide(); - auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; - if (!sourceLayout) { - return; - } - - bool hasSourceButtons = false; - for (int i = 0; i < sourceLayout->count(); ++i) { - if (qobject_cast(sourceLayout->itemAt(i)->widget())) { - hasSourceButtons = true; - break; - } - } - - if (!hasSourceButtons) { - return; - } + getUi()->encryptionMessage->setAutoFillBackground(false); + getUi()->encryptionMessage->setAttribute(Qt::WA_StyledBackground, false); + getUi()->encryptionMessage->setStyleSheet(QStringLiteral( + "#encryptionMessage {" + " background: transparent;" + " border: none;" + " padding: 0px;" + " margin: 0px;" + "}" + )); + + getUi()->encryptionMessageLayout->setContentsMargins(0, 0, 0, 0); + getUi()->encryptionMessageLayout->setSpacing(0); + getUi()->encryptionMessageHeaderLayout->setContentsMargins(0, 0, 0, 0); + getUi()->encryptionMessageHeaderLayout->setSpacing(0); + + getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); + getUi()->encryptionMessageLabel->setWordWrap(true); + getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral( + "background: transparent;" + "padding: 0px;" + "margin: 0px;" + )); while (auto *item = e2eeButtonContainerLayout->takeAt(0)) { if (auto *widget = item->widget()) { + widget->setParent(nullptr); widget->deleteLater(); } delete item; } - while (auto *item = sourceLayout->takeAt(0)) { - if (auto *button = qobject_cast(item->widget())) { - styleSecondaryButton(button); - e2eeButtonContainerLayout->addWidget(button, 0, Qt::AlignRight); + auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; + if (sourceLayout) { + while (auto *item = sourceLayout->takeAt(0)) { + if (auto *button = qobject_cast(item->widget())) { + styleSecondaryButton(button); + e2eeButtonContainerLayout->addWidget(button, 0, Qt::AlignRight); + } + delete item; } - delete item; } e2eeButtonContainerLayout->addStretch(); + + getUi()->encryptionMessage->updateGeometry(); + getUi()->encryptionMessage->adjustSize(); + + if (auto *panel = getUi()->encryptionMessage->parentWidget()) { + panel->updateGeometry(); + panel->adjustSize(); + } + + updateGeometry(); }; e2eeHLayout->addLayout(e2eeVLayout); e2eeHLayout->addStretch(); e2eeHLayout->addWidget(e2eeButtonContainer, 0, Qt::AlignRight | Qt::AlignVCenter); + getUi()->accountStatusPanel->setVisible(false); getUi()->verticalLayout_2->insertWidget(0, e2eePanel); if (auto *accountState = accountsState()) { - connect(accountState, &AccountState::stateChanged, this, [this, syncEncryptionButtons]() { - QTimer::singleShot(0, this, syncEncryptionButtons); + connect(accountState, &AccountState::stateChanged, this, [this, normalizeEncryptionLayout]() { + QTimer::singleShot(0, this, normalizeEncryptionLayout); }); if (accountState->account() && accountState->account()->e2e()) { - connect(accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, [this, syncEncryptionButtons]() { - QTimer::singleShot(0, this, syncEncryptionButtons); + connect(accountState->account()->e2e(), &ClientSideEncryption::initializationFinished, this, [this, normalizeEncryptionLayout]() { + QTimer::singleShot(0, this, normalizeEncryptionLayout); + }); + + connect(accountState->account()->e2e(), &ClientSideEncryption::sensitiveDataForgotten, this, [this, normalizeEncryptionLayout]() { + QTimer::singleShot(0, this, normalizeEncryptionLayout); }); } } - QTimer::singleShot(0, this, syncEncryptionButtons); + QTimer::singleShot(0, this, normalizeEncryptionLayout); auto *liveWidget = new QWidget(this); liveWidget->setObjectName(QStringLiteral("nmcLiveBackupPanel")); @@ -237,7 +264,7 @@ void NMCAccountSettings::setLayout() liveWidget->setStyleSheet(QStringLiteral( "#nmcLiveBackupPanel {" " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 6px;" + " border-radius: 10px;" "}" )); @@ -279,7 +306,7 @@ void NMCAccountSettings::setLayout() quotaWidget->setStyleSheet(QStringLiteral( "#nmcQuotaPanel {" " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 6px;" + " border-radius: 10px;" "}" )); @@ -335,7 +362,7 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessage->hide(); checkClientSideEncryptionState(); - QTimer::singleShot(0, this, syncEncryptionButtons); + QTimer::singleShot(0, this, normalizeEncryptionLayout); } void NMCAccountSettings::slotUpdateQuota(qint64 total, qint64 used) From d8538434218a3964ca65f0edc8e3a34707be7567 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 12:19:35 +0200 Subject: [PATCH 19/21] fixed coding --- src/gui/nmcgui/nmcaccountsettings.cpp | 284 ++++++++++++++------------ 1 file changed, 148 insertions(+), 136 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 6843df8dd68db..53f80f4d3a0ac 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -31,6 +31,12 @@ #include #include +#ifdef Q_OS_WIN +#define BACKGROUND_PALETTE "alternate-base" +#else +#define BACKGROUND_PALETTE "light" +#endif + namespace OCC { namespace { @@ -38,6 +44,62 @@ constexpr int panelPadding = 24; constexpr int contentWidth = 450; constexpr int actionButtonWidth = 180; constexpr int actionButtonHeight = 32; +constexpr int panelRadius = 10; +constexpr int panelSpacing = 32; + +QString panelStyleSheet(const QString &objectName) +{ + return QStringLiteral( + "#%1 {" + " background: palette(" BACKGROUND_PALETTE ");" + " border-radius: %2px;" + "}" + ).arg(objectName).arg(panelRadius); +} + +QWidget *createPanel(const QString &objectName, QWidget *parent) +{ + auto *panel = new QWidget(parent); + panel->setObjectName(objectName); + panel->setAttribute(Qt::WA_StyledBackground, true); + panel->setStyleSheet(panelStyleSheet(objectName)); + return panel; +} + +QHBoxLayout *createPanelHorizontalLayout(QWidget *panel) +{ + auto *layout = new QHBoxLayout(panel); + layout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); + layout->setSpacing(panelSpacing); + return layout; +} + +QVBoxLayout *createContentVerticalLayout(int spacing = 4) +{ + auto *layout = new QVBoxLayout(); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(spacing); + return layout; +} + +void styleTitleLabel(QLabel *label) +{ + if (!label) { + return; + } + + label->setStyleSheet(QStringLiteral("font-size: 15px; font-weight: 600;")); +} + +void setupContentLabel(QLabel *label) +{ + if (!label) { + return; + } + + label->setWordWrap(true); + label->setFixedWidth(contentWidth); +} void styleSecondaryButton(QPushButton *button) { @@ -59,13 +121,48 @@ void styleSecondaryButton(QPushButton *button) "}" )); } + +void clearLayout(QLayout *layout) +{ + if (!layout) { + return; + } + + while (auto *item = layout->takeAt(0)) { + if (auto *widget = item->widget()) { + widget->setParent(nullptr); + widget->deleteLater(); + } + delete item; + } } -#ifdef Q_OS_WIN -#define BACKGROUND_PALETTE "alternate-base" -#else -#define BACKGROUND_PALETTE "light" -#endif +void setupTransparentWidget(QWidget *widget) +{ + if (!widget) { + return; + } + + widget->setAutoFillBackground(false); + widget->setAttribute(Qt::WA_StyledBackground, false); + widget->setStyleSheet(QStringLiteral( + "background: transparent;" + "border: none;" + "padding: 0px;" + "margin: 0px;" + )); +} + +void setupTransparentLayout(QLayout *layout, int spacing = 0) +{ + if (!layout) { + return; + } + + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(spacing); +} +} NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) : AccountSettings(accountState, parent) @@ -96,26 +193,12 @@ void NMCAccountSettings::setDefaultSettings() void NMCAccountSettings::setLayout() { - auto *e2eePanel = new QWidget(this); - e2eePanel->setObjectName(QStringLiteral("nmcE2eePanel")); - e2eePanel->setAttribute(Qt::WA_StyledBackground, true); - e2eePanel->setStyleSheet(QStringLiteral( - "#nmcE2eePanel {" - " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 10px;" - "}" - )); - - auto *e2eeHLayout = new QHBoxLayout(e2eePanel); - e2eeHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); - e2eeHLayout->setSpacing(32); - - auto *e2eeVLayout = new QVBoxLayout(); - e2eeVLayout->setContentsMargins(0, 0, 0, 0); - e2eeVLayout->setSpacing(8); + auto *e2eePanel = createPanel(QStringLiteral("nmcE2eePanel"), this); + auto *e2eeHLayout = createPanelHorizontalLayout(e2eePanel); + auto *e2eeVLayout = createContentVerticalLayout(8); auto *e2eeTitle = new QLabel(QCoreApplication::translate("", "E2E_ENCRYPTION"), e2eePanel); - e2eeTitle->setStyleSheet(QStringLiteral("font-size: 15px; font-weight: 600;")); + styleTitleLabel(e2eeTitle); auto *e2eeTitleIcon = new QLabel(e2eePanel); e2eeTitleIcon->setFixedSize(24, 24); @@ -125,8 +208,7 @@ void NMCAccountSettings::setLayout() e2eeTitleIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); auto *e2eeTitleLayout = new QHBoxLayout(); - e2eeTitleLayout->setContentsMargins(0, 0, 0, 0); - e2eeTitleLayout->setSpacing(8); + setupTransparentLayout(e2eeTitleLayout, 8); e2eeTitleLayout->addWidget(e2eeTitleIcon); e2eeTitleLayout->addWidget(e2eeTitle); e2eeTitleLayout->addStretch(); @@ -134,83 +216,39 @@ void NMCAccountSettings::setLayout() getUi()->accountStatusLayout->removeWidget(getUi()->encryptionMessage); getUi()->encryptionMessageLayout->removeItem(getUi()->encryptionMessageButtonsLayout); - getUi()->encryptionMessage->setAutoFillBackground(false); - getUi()->encryptionMessage->setAttribute(Qt::WA_StyledBackground, false); - getUi()->encryptionMessage->setStyleSheet(QStringLiteral( - "#encryptionMessage {" - " background: transparent;" - " border: none;" - " padding: 0px;" - " margin: 0px;" - "}" - )); - - getUi()->encryptionMessageLayout->setContentsMargins(0, 0, 0, 0); - getUi()->encryptionMessageLayout->setSpacing(0); - getUi()->encryptionMessageHeaderLayout->setContentsMargins(0, 0, 0, 0); - getUi()->encryptionMessageHeaderLayout->setSpacing(0); + setupTransparentWidget(getUi()->encryptionMessage); + setupTransparentLayout(getUi()->encryptionMessageLayout); + setupTransparentLayout(getUi()->encryptionMessageHeaderLayout); getUi()->encryptionMessageIcon->clear(); getUi()->encryptionMessageIcon->hide(); - getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); - getUi()->encryptionMessageLabel->setWordWrap(true); - getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral( - "background: transparent;" - "padding: 0px;" - "margin: 0px;" - )); + setupContentLabel(getUi()->encryptionMessageLabel); + setupTransparentWidget(getUi()->encryptionMessageLabel); e2eeVLayout->addLayout(e2eeTitleLayout); e2eeVLayout->addWidget(getUi()->encryptionMessage); auto *e2eeButtonContainer = new QWidget(e2eePanel); - e2eeButtonContainer->setAutoFillBackground(false); - e2eeButtonContainer->setAttribute(Qt::WA_StyledBackground, false); - e2eeButtonContainer->setStyleSheet(QStringLiteral("background: transparent; border: none;")); + setupTransparentWidget(e2eeButtonContainer); auto *e2eeButtonContainerLayout = new QVBoxLayout(e2eeButtonContainer); - e2eeButtonContainerLayout->setContentsMargins(0, 0, 0, 0); - e2eeButtonContainerLayout->setSpacing(8); + setupTransparentLayout(e2eeButtonContainerLayout, 8); auto normalizeEncryptionLayout = [this, e2eeButtonContainerLayout]() { getUi()->encryptionMessageIcon->clear(); getUi()->encryptionMessageIcon->hide(); - getUi()->encryptionMessage->setAutoFillBackground(false); - getUi()->encryptionMessage->setAttribute(Qt::WA_StyledBackground, false); - getUi()->encryptionMessage->setStyleSheet(QStringLiteral( - "#encryptionMessage {" - " background: transparent;" - " border: none;" - " padding: 0px;" - " margin: 0px;" - "}" - )); - - getUi()->encryptionMessageLayout->setContentsMargins(0, 0, 0, 0); - getUi()->encryptionMessageLayout->setSpacing(0); - getUi()->encryptionMessageHeaderLayout->setContentsMargins(0, 0, 0, 0); - getUi()->encryptionMessageHeaderLayout->setSpacing(0); - - getUi()->encryptionMessageLabel->setFixedWidth(contentWidth); - getUi()->encryptionMessageLabel->setWordWrap(true); - getUi()->encryptionMessageLabel->setStyleSheet(QStringLiteral( - "background: transparent;" - "padding: 0px;" - "margin: 0px;" - )); - - while (auto *item = e2eeButtonContainerLayout->takeAt(0)) { - if (auto *widget = item->widget()) { - widget->setParent(nullptr); - widget->deleteLater(); - } - delete item; - } + setupTransparentWidget(getUi()->encryptionMessage); + setupTransparentLayout(getUi()->encryptionMessageLayout); + setupTransparentLayout(getUi()->encryptionMessageHeaderLayout); + + setupContentLabel(getUi()->encryptionMessageLabel); + setupTransparentWidget(getUi()->encryptionMessageLabel); - auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; - if (sourceLayout) { + clearLayout(e2eeButtonContainerLayout); + + if (auto *sourceLayout = getUi()->encryptionMessageButtonsLayout) { while (auto *item = sourceLayout->takeAt(0)) { if (auto *button = qobject_cast(item->widget())) { styleSecondaryButton(button); @@ -258,75 +296,48 @@ void NMCAccountSettings::setLayout() QTimer::singleShot(0, this, normalizeEncryptionLayout); - auto *liveWidget = new QWidget(this); - liveWidget->setObjectName(QStringLiteral("nmcLiveBackupPanel")); - liveWidget->setAttribute(Qt::WA_StyledBackground, true); - liveWidget->setStyleSheet(QStringLiteral( - "#nmcLiveBackupPanel {" - " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 10px;" - "}" - )); - - auto *liveHLayout = new QHBoxLayout(liveWidget); - liveHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); - liveHLayout->setSpacing(32); - - auto *liveVLayout = new QVBoxLayout(); - liveVLayout->setSpacing(4); + auto *liveWidget = createPanel(QStringLiteral("nmcLiveBackupPanel"), this); + auto *liveHLayout = createPanelHorizontalLayout(liveWidget); + auto *liveVLayout = createContentVerticalLayout(); liveHLayout->addLayout(liveVLayout); liveHLayout->addStretch(); - const QString styleSheet = QStringLiteral( + const QString primaryButtonStyle = QStringLiteral( "QPushButton { font-size: %5px; border: %1px solid; border-color: black; " "border-radius: 4px; background-color: %2; color: %3; } " "QPushButton:hover { background-color: %4; }"); - m_liveAccountButton->setStyleSheet(styleSheet.arg("0", "#E20074", "white", "#c00063", "13")); - m_liveAccountButton->setFixedSize(180, 32); + m_liveAccountButton->setStyleSheet(primaryButtonStyle.arg("0", "#E20074", "white", "#c00063", "13")); + m_liveAccountButton->setFixedSize(actionButtonWidth, actionButtonHeight); m_liveAccountButton->setIcon(QIcon()); liveHLayout->addWidget(m_liveAccountButton, 0, Qt::AlignRight | Qt::AlignVCenter); + styleTitleLabel(m_liveTitle); liveVLayout->addWidget(m_liveTitle); - m_liveTitle->setStyleSheet("font-size: 15px; font-weight: 600;"); - liveVLayout->addWidget(m_liveDescription); - m_liveDescription->setStyleSheet("font-size: 13px;"); + m_liveDescription->setStyleSheet(QStringLiteral("font-size: 13px;")); m_liveDescription->setText(QCoreApplication::translate("", "LIVE_BACKUPS_DESCRIPTION")); - m_liveDescription->setWordWrap(true); - m_liveDescription->setFixedWidth(contentWidth); + setupContentLabel(m_liveDescription); + liveVLayout->addWidget(m_liveDescription); getUi()->verticalLayout_2->addWidget(liveWidget); - auto *quotaWidget = new QWidget(this); - quotaWidget->setObjectName(QStringLiteral("nmcQuotaPanel")); - quotaWidget->setAttribute(Qt::WA_StyledBackground, true); - quotaWidget->setStyleSheet(QStringLiteral( - "#nmcQuotaPanel {" - " background: palette(" BACKGROUND_PALETTE ");" - " border-radius: 10px;" - "}" - )); + auto *quotaWidget = createPanel(QStringLiteral("nmcQuotaPanel"), this); + auto *quotaHLayout = createPanelHorizontalLayout(quotaWidget); + auto *quotaVLayout = createContentVerticalLayout(); - auto *magentaHLayout = new QHBoxLayout(quotaWidget); - magentaHLayout->setContentsMargins(panelPadding, panelPadding, panelPadding, panelPadding); - magentaHLayout->setSpacing(32); - - auto *quotaVLayout = new QVBoxLayout(); - quotaVLayout->setSpacing(4); - - quotaVLayout->addWidget(m_quotaInfoLabel); m_quotaInfoLabel->setFixedWidth(contentWidth); - m_quotaInfoLabel->setStyleSheet("QLabel { font-size: 18px; font-weight: 500; padding: 0px; }"); + m_quotaInfoLabel->setStyleSheet(QStringLiteral("QLabel { font-size: 18px; font-weight: 500; padding: 0px; }")); + quotaVLayout->addWidget(m_quotaInfoLabel); - quotaVLayout->addWidget(m_quotaProgressBar); m_quotaProgressBar->setRange(0, 100); m_quotaProgressBar->setTextVisible(false); m_quotaProgressBar->setFixedWidth(contentWidth); m_quotaProgressBar->setFixedHeight(8); - m_quotaProgressBar->setStyleSheet( + m_quotaProgressBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + m_quotaProgressBar->setStyleSheet(QStringLiteral( "QProgressBar {" " background-color: #e5e5e5;" " color: black;" @@ -338,15 +349,16 @@ void NMCAccountSettings::setLayout() "QProgressBar::chunk {" " background-color: #E20074;" " border-radius: 3px;" - "}"); - m_quotaProgressBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + "}" + )); + quotaVLayout->addWidget(m_quotaProgressBar); - quotaVLayout->addWidget(m_quotaInfoText); m_quotaInfoText->setFixedWidth(contentWidth); - m_quotaInfoText->setStyleSheet("QLabel { font-size: 13px; padding: 0px; }"); + m_quotaInfoText->setStyleSheet(QStringLiteral("QLabel { font-size: 13px; padding: 0px; }")); + quotaVLayout->addWidget(m_quotaInfoText); - magentaHLayout->addLayout(quotaVLayout); - magentaHLayout->addStretch(); + quotaHLayout->addLayout(quotaVLayout); + quotaHLayout->addStretch(); auto *storageLinkButton = new QPushButton(QCoreApplication::translate("", "STORAGE_EXTENSION"), quotaWidget); styleSecondaryButton(storageLinkButton); @@ -355,7 +367,7 @@ void NMCAccountSettings::setLayout() QDesktopServices::openUrl(QUrl(QStringLiteral("https://cloud.telekom-dienste.de/tarife"))); }); - magentaHLayout->addWidget(storageLinkButton, 0, Qt::AlignRight | Qt::AlignVCenter); + quotaHLayout->addWidget(storageLinkButton, 0, Qt::AlignRight | Qt::AlignVCenter); getUi()->verticalLayout_2->addWidget(quotaWidget); From 9ed15834d2eae3534236fee67bd88d049dcbf847 Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 13:34:37 +0200 Subject: [PATCH 20/21] fix e2ee buttons --- src/gui/nmcgui/nmcaccountsettings.cpp | 35 ++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 53f80f4d3a0ac..15807b25dfb37 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -162,6 +163,21 @@ void setupTransparentLayout(QLayout *layout, int spacing = 0) layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(spacing); } + +bool layoutContainsPushButton(QLayout *layout) +{ + if (!layout) { + return false; + } + + for (int i = 0; i < layout->count(); ++i) { + if (qobject_cast(layout->itemAt(i)->widget())) { + return true; + } + } + + return false; +} } NMCAccountSettings::NMCAccountSettings(AccountState *accountState, QWidget *parent) @@ -246,9 +262,12 @@ void NMCAccountSettings::setLayout() setupContentLabel(getUi()->encryptionMessageLabel); setupTransparentWidget(getUi()->encryptionMessageLabel); - clearLayout(e2eeButtonContainerLayout); + auto *sourceLayout = getUi()->encryptionMessageButtonsLayout; + const bool hasNewSourceButtons = layoutContainsPushButton(sourceLayout); + + if (hasNewSourceButtons) { + clearLayout(e2eeButtonContainerLayout); - if (auto *sourceLayout = getUi()->encryptionMessageButtonsLayout) { while (auto *item = sourceLayout->takeAt(0)) { if (auto *button = qobject_cast(item->widget())) { styleSecondaryButton(button); @@ -256,16 +275,20 @@ void NMCAccountSettings::setLayout() } delete item; } - } - e2eeButtonContainerLayout->addStretch(); + e2eeButtonContainerLayout->addStretch(); + } else { + for (int i = 0; i < e2eeButtonContainerLayout->count(); ++i) { + if (auto *button = qobject_cast(e2eeButtonContainerLayout->itemAt(i)->widget())) { + styleSecondaryButton(button); + } + } + } getUi()->encryptionMessage->updateGeometry(); - getUi()->encryptionMessage->adjustSize(); if (auto *panel = getUi()->encryptionMessage->parentWidget()) { panel->updateGeometry(); - panel->adjustSize(); } updateGeometry(); From 711fe9736bfe4ae448fcbc112d52aaa4b674548a Mon Sep 17 00:00:00 2001 From: memurats Date: Wed, 3 Jun 2026 14:39:59 +0200 Subject: [PATCH 21/21] fix --- src/gui/nmcgui/nmcaccountsettings.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/nmcgui/nmcaccountsettings.cpp b/src/gui/nmcgui/nmcaccountsettings.cpp index 15807b25dfb37..8e26aae33d178 100644 --- a/src/gui/nmcgui/nmcaccountsettings.cpp +++ b/src/gui/nmcgui/nmcaccountsettings.cpp @@ -251,7 +251,22 @@ void NMCAccountSettings::setLayout() auto *e2eeButtonContainerLayout = new QVBoxLayout(e2eeButtonContainer); setupTransparentLayout(e2eeButtonContainerLayout, 8); - auto normalizeEncryptionLayout = [this, e2eeButtonContainerLayout]() { + auto updateE2eePanelVisibility = [this, e2eePanel]() { + const auto accountState = accountsState(); + const auto account = accountState ? accountState->account() : nullptr; + + const bool visible = account + && account->capabilities().clientSideEncryptionAvailable(); + + e2eePanel->setVisible(visible); + return visible; + }; + + auto normalizeEncryptionLayout = [this, e2eeButtonContainerLayout, updateE2eePanelVisibility]() { + if (!updateE2eePanelVisibility()) { + return; + } + getUi()->encryptionMessageIcon->clear(); getUi()->encryptionMessageIcon->hide(); @@ -396,6 +411,7 @@ void NMCAccountSettings::setLayout() getUi()->encryptionMessage->hide(); checkClientSideEncryptionState(); + updateE2eePanelVisibility(); QTimer::singleShot(0, this, normalizeEncryptionLayout); }