From 5c198f5d659fdb897fb4217e948b90c0f8bbd4cc Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Fri, 12 Sep 2025 16:26:09 +0200 Subject: [PATCH 1/3] fix(cloudprovider): add open main dialog action when opening the contextual menu of a cloud folder, add an entry to open the main dialog also improve the text of the entry to open in the browser Signed-off-by: Matthieu Gallien --- src/gui/cloudproviders/cloudproviderwrapper.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gui/cloudproviders/cloudproviderwrapper.cpp b/src/gui/cloudproviders/cloudproviderwrapper.cpp index 023e571495..3cb2593be3 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.cpp +++ b/src/gui/cloudproviders/cloudproviderwrapper.cpp @@ -221,7 +221,14 @@ GMenuModel* CloudProviderWrapper::getMenuModel() { _mainMenu = g_menu_new(); section = g_menu_new(); - item = addMenuItem(tr("Open website"), "cloudprovider.openwebsite"); + item = addMenuItem(tr("Open main dialog"), "cloudprovider.openmaindialog"); + g_menu_append_item(section, item); + g_clear_object (&item); + g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); + g_clear_object (§ion); + + section = g_menu_new(); + item = addMenuItem(tr("Open in browser"), "cloudprovider.openwebsite"); g_menu_append_item(section, item); g_clear_object (&item); g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); @@ -281,6 +288,10 @@ activate_action_open (GSimpleAction *action, GVariant *parameter, gpointer user_ gui->slotShowSettings(); } + if(g_str_equal(name, "openmaindialog")) { + gui->slotOpenMainDialog(); + } + if(g_str_equal(name, "openwebsite")) { QDesktopServices::openUrl(self->folder()->accountState()->account()->url()); } @@ -330,6 +341,7 @@ activate_action_pause (GSimpleAction *action, } static GActionEntry actions[] = { + { "openmaindialog", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, { "openwebsite", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, { "quit", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, { "logout", activate_action_open, nullptr, nullptr, nullptr, {0,0,0}}, From 6fe5a540c64287546f72d5b3a7fae0f5a658e40f Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 15 Sep 2025 11:05:02 +0200 Subject: [PATCH 2/3] fix: better user facing action name to open the client Signed-off-by: Matthieu Gallien --- src/gui/cloudproviders/cloudproviderwrapper.cpp | 2 +- src/gui/systray.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/cloudproviders/cloudproviderwrapper.cpp b/src/gui/cloudproviders/cloudproviderwrapper.cpp index 3cb2593be3..de8f76aefa 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.cpp +++ b/src/gui/cloudproviders/cloudproviderwrapper.cpp @@ -221,7 +221,7 @@ GMenuModel* CloudProviderWrapper::getMenuModel() { _mainMenu = g_menu_new(); section = g_menu_new(); - item = addMenuItem(tr("Open main dialog"), "cloudprovider.openmaindialog"); + item = addMenuItem(tr("Open %1 Desktop", "Open Nextcloud main window. Placeholer will be the application name. Please keep it.").arg(APPLICATION_NAME), "cloudprovider.openmaindialog"); g_menu_append_item(section, item); g_clear_object (&item); g_menu_append_section(_mainMenu, nullptr, G_MENU_MODEL(section)); diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index 6ed0b78399..7b7b6e12c2 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -176,7 +176,7 @@ void Systray::setupContextMenu() if (AccountManager::instance()->accounts().isEmpty()) { _contextMenu->addAction(tr("Add account"), this, &Systray::openAccountWizard); } else { - _contextMenu->addAction(tr("Open main dialog"), this, [this]{ showWindow(); }); + _contextMenu->addAction(tr("Open %1 Desktop", "Open Nextcloud main window. Placeholer will be the application name. Please keep it.").arg(APPLICATION_NAME), this, [this]{ showWindow(); }); } auto pauseAction = _contextMenu->addAction(tr("Pause sync"), this, &Systray::slotPauseAllFolders); From 0cc81bd7a470e1f2c2b466b58bd5ceda86b44537 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Mon, 15 Sep 2025 13:58:24 +0200 Subject: [PATCH 3/3] fix(staticCodeChecks): fix warnings reported by clang or clazy fixes warning detected by clang static analyzer or clang analyzer Signed-off-by: Matthieu Gallien --- src/gui/cloudproviders/cloudproviderwrapper.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/cloudproviders/cloudproviderwrapper.cpp b/src/gui/cloudproviders/cloudproviderwrapper.cpp index de8f76aefa..666c161664 100644 --- a/src/gui/cloudproviders/cloudproviderwrapper.cpp +++ b/src/gui/cloudproviders/cloudproviderwrapper.cpp @@ -95,7 +95,7 @@ void CloudProviderWrapper::slotUpdateProgress(const QString &folder, const Progr // Build recently changed files list if (!progress._lastCompletedItem.isEmpty() && shouldShowInRecentsMenu(progress._lastCompletedItem)) { - QFontMetrics fm = QApplication::fontMetrics(); + const auto fm = QFontMetricsF{QApplication::font()}; QString kindStr = Progress::asResultString(progress._lastCompletedItem); QString elidedKindStr = fm.elidedText(kindStr, Qt::ElideRight, preferredTextWidth); QString timeStr = QTime::currentTime().toString("hh:mm"); @@ -168,6 +168,10 @@ void CloudProviderWrapper::slotUpdateProgress(const QString &folder, const Progr void CloudProviderWrapper::updateStatusText(QString statusText) { + if (!_folder) { + return; + } + QString status = QStringLiteral("%1 - %2").arg(_folder->accountState()->stateString(_folder->accountState()->state()), statusText); cloud_providers_account_exporter_set_status_details(_cloudProviderAccount, status.toUtf8().data()); } @@ -207,7 +211,7 @@ void CloudProviderWrapper::slotSyncFinished(const SyncResult &result) static GMenuItem* addMenuItem(const QString text, const gchar *action) { - QFontMetrics fm = QApplication::fontMetrics(); + const auto fm = QFontMetricsF{QApplication::font()}; CloudProviderWrapper::preferredTextWidth = MAX (CloudProviderWrapper::preferredTextWidth, (fm.boundingRect (text)).width ()); return menu_item_new (text, action); } @@ -216,7 +220,6 @@ GMenuModel* CloudProviderWrapper::getMenuModel() { GMenu* section = nullptr; GMenuItem* item = nullptr; - QString item_label; _mainMenu = g_menu_new();