mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Expose account user id with host to QML
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
3c26e25a3c
commit
ba3baa406b
4 changed files with 11 additions and 3 deletions
|
@ -201,7 +201,9 @@ AccountSettings::AccountSettings(AccountState *accountState, QWidget *parent)
|
|||
if (Mac::FileProvider::fileProviderAvailable()) {
|
||||
const auto fileProviderTab = _ui->fileProviderTab;
|
||||
const auto fpSettingsLayout = new QVBoxLayout(fileProviderTab);
|
||||
const auto fpSettingsWidget = Mac::FileProviderSettingsController::instance()->settingsViewWidget(fileProviderTab);
|
||||
const auto fpAccountUserIdAtHost = _accountState->account()->userIdAtHostWithPort();
|
||||
const auto fpSettingsController = Mac::FileProviderSettingsController::instance();
|
||||
const auto fpSettingsWidget = fpSettingsController->settingsViewWidget(fpAccountUserIdAtHost, fileProviderTab);
|
||||
fpSettingsLayout->setMargin(0);
|
||||
fpSettingsLayout->addWidget(fpSettingsWidget);
|
||||
fileProviderTab->setLayout(fpSettingsLayout);
|
||||
|
|
|
@ -25,6 +25,7 @@ Page {
|
|||
|
||||
property bool showBorder: true
|
||||
property var controller: FileProviderSettingsController
|
||||
property var accountUserIdAtHost: AccountUserIdAtHost
|
||||
|
||||
title: qsTr("Virtual files settings")
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ class FileProviderSettingsController : public QObject
|
|||
public:
|
||||
static FileProviderSettingsController *instance();
|
||||
|
||||
[[nodiscard]] QQuickWidget *settingsViewWidget(QWidget *const parent = nullptr,
|
||||
[[nodiscard]] QQuickWidget *settingsViewWidget(const QString &accountUserIdAtHost,
|
||||
QWidget *const parent = nullptr,
|
||||
const QQuickWidget::ResizeMode resizeMode = QQuickWidget::SizeRootObjectToView);
|
||||
|
||||
[[nodiscard]] Q_INVOKABLE bool vfsEnabledForAccount(const QString &userIdAtHost) const;
|
||||
|
|
|
@ -27,6 +27,7 @@ constexpr auto fpSettingsQmlPath = "qrc:/qml/src/gui/macOS/ui/FileProviderSettin
|
|||
|
||||
// FileProviderSettingsPage properties -- make sure they match up in QML file!
|
||||
constexpr auto fpSettingsControllerProp = "FileProviderSettingsController";
|
||||
constexpr auto fpSettingsAccountUserIdAtHostProp = "AccountUserIdAtHost";
|
||||
|
||||
// NSUserDefaults entries
|
||||
constexpr auto enabledAccountsSettingsKey = "enabledAccounts";
|
||||
|
@ -120,12 +121,15 @@ FileProviderSettingsController::FileProviderSettingsController(QObject *parent)
|
|||
d = std::make_unique<FileProviderSettingsController::MacImplementation>(this);
|
||||
}
|
||||
|
||||
QQuickWidget *FileProviderSettingsController::settingsViewWidget(QWidget *const parent, const QQuickWidget::ResizeMode resizeMode)
|
||||
QQuickWidget *FileProviderSettingsController::settingsViewWidget(const QString &accountUserIdAtHost,
|
||||
QWidget *const parent,
|
||||
const QQuickWidget::ResizeMode resizeMode)
|
||||
{
|
||||
const auto settingsViewWidget = new QQuickWidget(Systray::instance()->trayEngine(), parent);
|
||||
settingsViewWidget->setResizeMode(resizeMode);
|
||||
settingsViewWidget->setSource(QUrl(fpSettingsQmlPath));
|
||||
settingsViewWidget->rootContext()->setContextProperty(fpSettingsControllerProp, this);
|
||||
settingsViewWidget->rootContext()->setContextProperty(fpSettingsAccountUserIdAtHostProp, accountUserIdAtHost);
|
||||
return settingsViewWidget;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue