Skip to content

Commit 04cc424

Browse files
claucambramgallien
authored andcommitted
gui/wizard: Display macOS-specific VFS information where relevant in advanced setup page
Signed-off-by: Claudio Cambra <[email protected]>
1 parent db1f1a8 commit 04cc424

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/gui/wizard/owncloudadvancedsetuppage.cpp

+30-1
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,14 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage(OwncloudWizard *wizard)
8383
connect(_ui.rSyncEverything, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSyncEverythingClicked);
8484
connect(_ui.rSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
8585
connect(_ui.rVirtualFileSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotVirtualFileSyncClicked);
86-
connect(_ui.rVirtualFileSync, &QRadioButton::toggled, this, [this](bool checked) {
86+
connect(_ui.rVirtualFileSync, &QRadioButton::toggled, this, [this](const bool checked) {
8787
if (checked) {
8888
_ui.lSelectiveSyncSizeLabel->clear();
8989
_selectiveSyncBlacklist.clear();
9090
}
91+
#ifdef BUILD_FILE_PROVIDER_MODULE
92+
updateMacOsFileProviderRelatedViews();
93+
#endif
9194
});
9295
connect(_ui.bSelectiveSync, &QAbstractButton::clicked, this, &OwncloudAdvancedSetupPage::slotSelectiveSyncClicked);
9396

@@ -328,10 +331,14 @@ void OwncloudAdvancedSetupPage::updateStatus()
328331
setResolutionGuiVisible(false);
329332
}
330333

334+
#ifdef BUILD_FILE_PROVIDER_MODULE
335+
updateMacOsFileProviderRelatedViews();
336+
#else
331337
_filePathLabel->setText(QDir::toNativeSeparators(locFolder));
332338

333339
QString lfreeSpaceStr = Utility::octetsToString(availableLocalSpace());
334340
_ui.lFreeSpace->setText(QString(tr("%1 free space", "%1 gets replaced with the size and a matching unit. Example: 3 MB or 5 GB")).arg(lfreeSpaceStr));
341+
#endif
335342

336343
_ui.syncModeLabel->setText(t);
337344
_ui.syncModeLabel->setFixedHeight(_ui.syncModeLabel->sizeHint().height());
@@ -636,6 +643,28 @@ void OwncloudAdvancedSetupPage::setRadioChecked(QRadioButton *radio)
636643
_ui.rVirtualFileSync->setCheckable(false);
637644
}
638645

646+
#ifdef BUILD_FILE_PROVIDER_MODULE
647+
void OwncloudAdvancedSetupPage::updateMacOsFileProviderRelatedViews()
648+
{
649+
if (!Mac::FileProvider::fileProviderAvailable()) {
650+
return;
651+
}
652+
653+
const auto freeSpaceHidden = _ui.rVirtualFileSync->isChecked();
654+
const auto folderSelectionButtonHidden = _ui.rVirtualFileSync->isChecked();
655+
const auto filePathLabelText =
656+
_ui.rVirtualFileSync->isChecked() ? tr("In Finder's \"Locations\" sidebar section") : QDir::toNativeSeparators(localFolder());
657+
const auto freeSpaceString = freeSpaceHidden ? QString() : Utility::octetsToString(availableLocalSpace());
658+
const auto freeSpaceText = freeSpaceHidden ? QString() : QString(tr("%1 free space", "%1 gets replaced with the size and a matching unit. Example: 3 MB or 5 GB")).arg(freeSpaceString);
659+
660+
_ui.lFreeSpace->setHidden(freeSpaceHidden);
661+
_ui.lFreeSpace->setText(freeSpaceText);
662+
_ui.pbSelectLocalFolder->setHidden(folderSelectionButtonHidden);
663+
_ui.pbSelectLocalFolder->setEnabled(!folderSelectionButtonHidden);
664+
_filePathLabel->setText(filePathLabelText);
665+
}
666+
#endif
667+
639668
void OwncloudAdvancedSetupPage::styleSyncLogo()
640669
{
641670
const auto syncArrowIcon = Theme::createColorAwareIcon(QLatin1String(":/client/theme/sync-arrow.svg"), palette());

src/gui/wizard/owncloudadvancedsetuppage.h

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ private slots:
6969
private:
7070
void setRadioChecked(QRadioButton *radio);
7171

72+
#ifdef BUILD_FILE_PROVIDER_MODULE
73+
void updateMacOsFileProviderRelatedViews();
74+
#endif
75+
7276
void setupCustomization();
7377
void updateStatus();
7478
bool dataChanged();

0 commit comments

Comments
 (0)