Skip to content

Commit 6b4e11e

Browse files
committed
Add space() helper to folder
1 parent 24963b3 commit 6b4e11e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/gui/folder.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ Result<void, QString> Folder::checkPathLength(const QString &path)
187187
return {};
188188
}
189189

190+
GraphApi::Space *Folder::space() const
191+
{
192+
if (_accountState->supportsSpaces()) {
193+
return _accountState->account()->spacesManager()->space(spaceId());
194+
}
195+
return nullptr;
196+
}
197+
190198
bool Folder::checkLocalPath()
191199
{
192200
#ifdef Q_OS_WIN
@@ -302,6 +310,9 @@ QByteArray Folder::id() const
302310

303311
QString Folder::displayName() const
304312
{
313+
if (auto *s = space()) {
314+
return s->displayName();
315+
}
305316
return _definition.displayName();
306317
}
307318

src/gui/folder.h

+9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class SyncEngine;
4444
class SyncRunFileLog;
4545
class FolderWatcher;
4646
class LocalDiscoveryTracker;
47+
namespace GraphApi {
48+
class Space;
49+
}
4750

4851
/**
4952
* @brief The FolderDefinition class
@@ -345,6 +348,12 @@ class OWNCLOUDGUI_EXPORT Folder : public QObject
345348

346349
static Result<void, QString> checkPathLength(const QString &path);
347350

351+
/**
352+
*
353+
* @return The corresponding space object or null
354+
*/
355+
GraphApi::Space *space() const;
356+
348357
Q_SIGNALS:
349358
void syncStateChange();
350359
void syncStarted();

0 commit comments

Comments
 (0)