mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Make sure that the libcloudprovider integration is using a valid D-Bus path
Set a simple unique identifier per folder to ensure that it is always unique. Fixes https://github.com/nextcloud/desktop/issues/1704 Signed-off-by: Corentin Noël <corentin@elementary.io>
This commit is contained in:
parent
37377bf470
commit
a7d6555de2
4 changed files with 7 additions and 6 deletions
|
@ -52,8 +52,8 @@ void CloudProviderManager::registerSignals()
|
||||||
CloudProviderManager::CloudProviderManager(QObject *parent) : QObject(parent)
|
CloudProviderManager::CloudProviderManager(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
_map = new QMap<QString, CloudProviderWrapper*>();
|
_map = new QMap<QString, CloudProviderWrapper*>();
|
||||||
QString busName = QString(LIBCLOUDPROVIDERS_DBUS_BUS_NAME);
|
_folder_index = 0;
|
||||||
g_bus_own_name (G_BUS_TYPE_SESSION, busName.toAscii().data(), G_BUS_NAME_OWNER_FLAGS_NONE, nullptr, on_name_acquired, nullptr, this, nullptr);
|
g_bus_own_name (G_BUS_TYPE_SESSION, LIBCLOUDPROVIDERS_DBUS_BUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE, nullptr, on_name_acquired, nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloudProviderManager::slotFolderListChanged(const Folder::Map &folderMap)
|
void CloudProviderManager::slotFolderListChanged(const Folder::Map &folderMap)
|
||||||
|
@ -72,7 +72,7 @@ void CloudProviderManager::slotFolderListChanged(const Folder::Map &folderMap)
|
||||||
while (j.hasNext()) {
|
while (j.hasNext()) {
|
||||||
j.next();
|
j.next();
|
||||||
if (!_map->contains(j.key())) {
|
if (!_map->contains(j.key())) {
|
||||||
auto *cpo = new CloudProviderWrapper(this, j.value(), _providerExporter);
|
auto *cpo = new CloudProviderWrapper(this, j.value(), _folder_index++, _providerExporter);
|
||||||
_map->insert(j.key(), cpo);
|
_map->insert(j.key(), cpo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, CloudProviderWrapper*> *_map;
|
QMap<QString, CloudProviderWrapper*> *_map;
|
||||||
|
unsigned int _folder_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLOUDPROVIDERMANAGER_H
|
#endif // CLOUDPROVIDERMANAGER_H
|
||||||
|
|
|
@ -33,13 +33,13 @@ using namespace OCC;
|
||||||
|
|
||||||
GSimpleActionGroup *actionGroup = nullptr;
|
GSimpleActionGroup *actionGroup = nullptr;
|
||||||
|
|
||||||
CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, CloudProvidersProviderExporter* cloudprovider) : QObject(parent)
|
CloudProviderWrapper::CloudProviderWrapper(QObject *parent, Folder *folder, int folderId, CloudProvidersProviderExporter* cloudprovider) : QObject(parent)
|
||||||
, _folder(folder)
|
, _folder(folder)
|
||||||
{
|
{
|
||||||
GMenuModel *model;
|
GMenuModel *model;
|
||||||
GActionGroup *action_group;
|
GActionGroup *action_group;
|
||||||
_recentlyChanged = new QList<QPair<QString, QString>>();
|
_recentlyChanged = new QList<QPair<QString, QString>>();
|
||||||
QString accountName = QString("Account%1Folder%2").arg(folder->alias(), folder->accountState()->account()->id());
|
QString accountName = QString("Folder/%1").arg(folderId);
|
||||||
|
|
||||||
_cloudProvider = CLOUD_PROVIDERS_PROVIDER_EXPORTER(cloudprovider);
|
_cloudProvider = CLOUD_PROVIDERS_PROVIDER_EXPORTER(cloudprovider);
|
||||||
_cloudProviderAccount = cloud_providers_account_exporter_new(_cloudProvider, accountName.toUtf8().data());
|
_cloudProviderAccount = cloud_providers_account_exporter_new(_cloudProvider, accountName.toUtf8().data());
|
||||||
|
|
|
@ -38,7 +38,7 @@ class CloudProviderWrapper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CloudProviderWrapper(QObject *parent = nullptr, Folder *folder = nullptr, CloudProvidersProviderExporter* cloudprovider = nullptr);
|
explicit CloudProviderWrapper(QObject *parent = nullptr, Folder *folder = nullptr, int folderId = 0, CloudProvidersProviderExporter* cloudprovider = nullptr);
|
||||||
~CloudProviderWrapper();
|
~CloudProviderWrapper();
|
||||||
CloudProvidersAccountExporter* accountExporter();
|
CloudProvidersAccountExporter* accountExporter();
|
||||||
Folder* folder();
|
Folder* folder();
|
||||||
|
|
Loading…
Reference in a new issue