From 92030ef5358cc73b73d1ab716d6ab6e4c8c7872c Mon Sep 17 00:00:00 2001 From: Modspike Date: Wed, 12 Aug 2026 16:36:41 +0200 Subject: [PATCH 1/2] put the Theme::urlActions() in menu this makes more sense than putting them in a button --- src/gui/mainwindow/mainwindowcontroller.cpp | 33 +++++++++++++++++++++ src/gui/mainwindow/mainwindowcontroller.h | 3 ++ 2 files changed, 36 insertions(+) diff --git a/src/gui/mainwindow/mainwindowcontroller.cpp b/src/gui/mainwindow/mainwindowcontroller.cpp index c66103177b1..67b13b8a498 100644 --- a/src/gui/mainwindow/mainwindowcontroller.cpp +++ b/src/gui/mainwindow/mainwindowcontroller.cpp @@ -16,6 +16,7 @@ #include "aboutview.h" #include "application.h" +#include "guiutility.h" #include "localactivitywidget.h" #include "mainwindow.h" #include "modalwrapperwidget.h" @@ -43,10 +44,42 @@ void MainWindowController::setup() buildMenuActions(); } +QList MainWindowController::buildUrlActions() +{ + QList actions; + if (!Theme::instance()->urlActions().isEmpty()) { + QVector> themeDefs = Theme::instance()->urlActions(); + int num = themeDefs.count(); + for (int i = 0; i < num; i++) { + QAction *urlAction = new QAction(this); + auto def = themeDefs[i]; + // todo: the theme should provide any path to subdir relative to "universal" + QString iconName = QString("urlIcons/%1").arg(std::get<0>(def)); + if (!iconName.isEmpty()) { + QIcon ic = Resources::themeUniversalIcon(iconName); + Q_ASSERT(!ic.isNull()); + urlAction->setIcon(ic); + urlAction->setIconVisibleInMenu(true); + } + urlAction->setText(std::get<1>(def)); + QUrl url = std::get<2>(def); + connect(urlAction, &QAction::triggered, this, [url]() { Utility::openBrowser(url, nullptr); }); + actions.push_back(urlAction); + } + QAction *urlsSeparator = new QAction(this); + urlsSeparator->setObjectName("urlsSeparatorAction"); + urlsSeparator->setSeparator(true); + actions.push_back(urlsSeparator); + } + return actions; +} + void MainWindowController::buildMenuActions() { QList menuActions; + menuActions.append(buildUrlActions()); + QAction *addAccountAction = new QAction(tr("Add account..."), this); addAccountAction->setObjectName("addAcountAction"); connect(addAccountAction, &QAction::triggered, this, &MainWindowController::requestAccountWizard); diff --git a/src/gui/mainwindow/mainwindowcontroller.h b/src/gui/mainwindow/mainwindowcontroller.h index e34a0806323..72a8e20d33e 100644 --- a/src/gui/mainwindow/mainwindowcontroller.h +++ b/src/gui/mainwindow/mainwindowcontroller.h @@ -16,6 +16,8 @@ #include +class QAction; + namespace OCC { class MainWindow; @@ -37,6 +39,7 @@ class MainWindowController : public QObject void requestAccountWizard(); private: + QList buildUrlActions(); void buildMenuActions(); void createSyncErrorsAction(); void createActivityAction(); From 2c00b26c44bac9a34c49ae9d9cbf540489aebed6 Mon Sep 17 00:00:00 2001 From: Modspike Date: Fri, 28 Aug 2026 17:02:03 +0200 Subject: [PATCH 2/2] fixed build new function still used old Resources --- src/gui/mainwindow/mainwindowcontroller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/mainwindow/mainwindowcontroller.cpp b/src/gui/mainwindow/mainwindowcontroller.cpp index e70ea3d3f49..26480d48492 100644 --- a/src/gui/mainwindow/mainwindowcontroller.cpp +++ b/src/gui/mainwindow/mainwindowcontroller.cpp @@ -57,7 +57,7 @@ QList MainWindowController::buildUrlActions() // todo: the theme should provide any path to subdir relative to "universal" QString iconName = QString("urlIcons/%1").arg(std::get<0>(def)); if (!iconName.isEmpty()) { - QIcon ic = Resources::themeUniversalIcon(iconName); + QIcon ic = IconResources::getUniversalIcon(iconName); Q_ASSERT(!ic.isNull()); urlAction->setIcon(ic); urlAction->setIconVisibleInMenu(true);