fix(cloudproviders): use a class static variable instead of a global one

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2025-05-13 13:29:39 +02:00
parent 02d62417da
commit 64b75c8f00
No known key found for this signature in database
GPG Key ID: 7D0F74F05C22F553
2 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,8 @@
using namespace OCC;
GSimpleActionGroup *actionGroup = nullptr;
int preferredTextWidth = 0;
int CloudProviderWrapper::preferredTextWidth = 0;
CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, int folderId, CloudProvidersProviderExporter* cloudprovider) : QObject(parent)
, _folder(folder)
@ -207,7 +208,7 @@ void CloudProviderWrapper::slotSyncFinished(const SyncResult &result)
static GMenuItem* addMenuItem(const QString text, const gchar *action)
{
QFontMetrics fm = QApplication::fontMetrics();
preferredTextWidth = MAX (preferredTextWidth, (fm.boundingRect (text)).width ());
CloudProviderWrapper::preferredTextWidth = MAX (CloudProviderWrapper::preferredTextWidth, (fm.boundingRect (text)).width ());
return menu_item_new (text, action);
}

View File

@ -29,6 +29,8 @@ class CloudProviderWrapper : public QObject
{
Q_OBJECT
public:
static int preferredTextWidth;
explicit CloudProviderWrapper(QObject *parent = nullptr, Folder *folder = nullptr, int folderId = 0, CloudProvidersProviderExporter* cloudprovider = nullptr);
~CloudProviderWrapper() override;
CloudProvidersAccountExporter* accountExporter();