Initial QSfera import
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
target_sources(QSferaGui PRIVATE
|
||||
folderwizard.cpp
|
||||
folderwizardlocalpath.cpp
|
||||
folderwizardsourcepage.ui
|
||||
|
||||
folderwizardtargetpage.ui
|
||||
|
||||
folderwizardselectivesync.cpp
|
||||
|
||||
spacespage.cpp
|
||||
spacespage.ui
|
||||
)
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include "folderwizard.h"
|
||||
#include "folderwizard_p.h"
|
||||
|
||||
#include "folderwizardlocalpath.h"
|
||||
#include "folderwizardselectivesync.h"
|
||||
|
||||
#include "spacespage.h"
|
||||
|
||||
#include "account.h"
|
||||
#include "gui/application.h"
|
||||
#include "gui/settingsdialog.h"
|
||||
#include "theme.h"
|
||||
|
||||
#include "gui/accountstate.h"
|
||||
#include "gui/folderman.h"
|
||||
|
||||
#include "libsync/graphapi/space.h"
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
Q_LOGGING_CATEGORY(lcFolderWizard, "gui.folderwizard", QtInfoMsg)
|
||||
|
||||
QString FolderWizardPrivate::formatWarnings(const QStringList &warnings, bool isError)
|
||||
{
|
||||
QString ret;
|
||||
if (warnings.count() == 1) {
|
||||
ret = isError ? QCoreApplication::translate("FolderWizard", "<b>Error:</b> %1").arg(warnings.first()) : QCoreApplication::translate("FolderWizard", "<b>Warning:</b> %1").arg(warnings.first());
|
||||
} else if (warnings.count() > 1) {
|
||||
QStringList w2;
|
||||
for (const auto &warning : warnings) {
|
||||
w2.append(QStringLiteral("<li>%1</li>").arg(warning));
|
||||
}
|
||||
ret = isError ? QCoreApplication::translate("FolderWizard", "<b>Error:</b><ul>%1</ul>").arg(w2.join(QString()))
|
||||
: QCoreApplication::translate("FolderWizard", "<b>Warning:</b><ul>%1</ul>").arg(w2.join(QString()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString FolderWizardPrivate::defaultSyncRoot() const
|
||||
{
|
||||
if (!_account->account()->hasDefaultSyncRoot()) {
|
||||
return FolderMan::suggestSyncFolder(FolderMan::NewFolderType::SpacesSyncRoot, _account->account()->uuid());
|
||||
} else {
|
||||
return _account->account()->defaultSyncRoot();
|
||||
}
|
||||
}
|
||||
|
||||
FolderWizardPrivate::FolderWizardPrivate(FolderWizard *q, const AccountStatePtr &account)
|
||||
: q_ptr(q)
|
||||
, _account(account)
|
||||
, _spacesPage(new SpacesPage(account->account(), q))
|
||||
{
|
||||
if (!_account->account()->hasDefaultSyncRoot()) {
|
||||
_folderWizardSourcePage = new FolderWizardLocalPath(this);
|
||||
q->setPage(FolderWizard::Page_Source, _folderWizardSourcePage);
|
||||
}
|
||||
|
||||
q->setPage(FolderWizard::Page_Space, _spacesPage);
|
||||
|
||||
if (VfsPluginManager::instance().bestAvailableVfsMode() == Vfs::Mode::Off) {
|
||||
_folderWizardSelectiveSyncPage = new FolderWizardSelectiveSync(this);
|
||||
q->setPage(FolderWizard::Page_SelectiveSync, _folderWizardSelectiveSyncPage);
|
||||
}
|
||||
}
|
||||
|
||||
QString FolderWizardPrivate::localPath() const
|
||||
{
|
||||
return FolderMan::findGoodPathForNewSyncFolder(
|
||||
defaultSyncRoot(), _spacesPage->currentSpace()->displayName(), FolderMan::NewFolderType::SpacesFolder, _account->account()->uuid());
|
||||
}
|
||||
|
||||
uint32_t FolderWizardPrivate::priority() const
|
||||
{
|
||||
return _spacesPage->currentSpace()->priority();
|
||||
}
|
||||
|
||||
QUrl FolderWizardPrivate::davUrl() const
|
||||
{
|
||||
auto url = _spacesPage->currentSpace()->webdavUrl();
|
||||
if (!url.path().endsWith(QLatin1Char('/'))) {
|
||||
url.setPath(url.path() + QLatin1Char('/'));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
QString FolderWizardPrivate::spaceId() const
|
||||
{
|
||||
return _spacesPage->currentSpace()->id();
|
||||
}
|
||||
|
||||
QString FolderWizardPrivate::displayName() const
|
||||
{
|
||||
return _spacesPage->currentSpace()->displayName();
|
||||
}
|
||||
|
||||
const AccountStatePtr &FolderWizardPrivate::accountState()
|
||||
{
|
||||
return _account;
|
||||
}
|
||||
|
||||
bool FolderWizardPrivate::useVirtualFiles() const
|
||||
{
|
||||
return VfsPluginManager::instance().bestAvailableVfsMode() != Vfs::Mode::Off;
|
||||
}
|
||||
|
||||
FolderWizard::FolderWizard(const AccountStatePtr &account, QWidget *parent)
|
||||
: QWizard(parent)
|
||||
, d_ptr(new FolderWizardPrivate(this, account))
|
||||
{
|
||||
setWindowTitle(tr("Add Space"));
|
||||
setOptions(QWizard::CancelButtonOnLeft);
|
||||
setButtonText(QWizard::FinishButton, tr("Add Space"));
|
||||
setWizardStyle(QWizard::ModernStyle);
|
||||
}
|
||||
|
||||
FolderWizard::~FolderWizard()
|
||||
{
|
||||
}
|
||||
|
||||
FolderMan::SyncConnectionDescription FolderWizard::result()
|
||||
{
|
||||
Q_D(FolderWizard);
|
||||
if (d->_folderWizardSourcePage) {
|
||||
d->_account->account()->setDefaultSyncRoot(d->_folderWizardSourcePage->localPath());
|
||||
}
|
||||
const QString localPath = d->localPath();
|
||||
// the local path must be a child of defaultSyncRoot
|
||||
Q_ASSERT(FileSystem::isChildPathOf(localPath, d->defaultSyncRoot()));
|
||||
|
||||
return {
|
||||
d->davUrl(), //
|
||||
d->spaceId(), //
|
||||
localPath, //
|
||||
d->displayName(), //
|
||||
d->useVirtualFiles(), //
|
||||
d->priority(), //
|
||||
d->_folderWizardSelectiveSyncPage ? d->_folderWizardSelectiveSyncPage->selectiveSyncBlackList() : QSet<QString>{} //
|
||||
};
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QUrl>
|
||||
#include <QWizard>
|
||||
|
||||
#include "accountfwd.h"
|
||||
#include "gui/folderman.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class Ui_FolderWizardTargetPage;
|
||||
|
||||
namespace OCC {
|
||||
|
||||
class FolderWizardPrivate;
|
||||
|
||||
/**
|
||||
* @brief The FolderWizard class
|
||||
* @ingroup gui
|
||||
*/
|
||||
class FolderWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum PageType { Page_Source, Page_Space, Page_SelectiveSync };
|
||||
Q_ENUM(PageType)
|
||||
|
||||
explicit FolderWizard(const AccountStatePtr &account, QWidget *parent = nullptr);
|
||||
~FolderWizard() override;
|
||||
|
||||
FolderMan::SyncConnectionDescription result();
|
||||
|
||||
Q_DECLARE_PRIVATE(FolderWizard)
|
||||
|
||||
private:
|
||||
QScopedPointer<FolderWizardPrivate> d_ptr;
|
||||
};
|
||||
|
||||
} // namespace OCC
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "folderwizard.h"
|
||||
|
||||
#include "libsync/accountfwd.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QLoggingCategory>
|
||||
#include <QStringList>
|
||||
|
||||
namespace OCC {
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcFolderWizard);
|
||||
|
||||
class FolderWizardPrivate
|
||||
{
|
||||
public:
|
||||
FolderWizardPrivate(FolderWizard *q, const AccountStatePtr &account);
|
||||
static QString formatWarnings(const QStringList &warnings, bool isError = false);
|
||||
|
||||
QString localPath() const;
|
||||
|
||||
QString remotePath() const;
|
||||
|
||||
uint32_t priority() const;
|
||||
|
||||
QString defaultSyncRoot() const;
|
||||
|
||||
QUrl davUrl() const;
|
||||
QString spaceId() const;
|
||||
bool useVirtualFiles() const;
|
||||
QString displayName() const;
|
||||
|
||||
const AccountStatePtr &accountState();
|
||||
|
||||
private:
|
||||
Q_DECLARE_PUBLIC(FolderWizard)
|
||||
FolderWizard *q_ptr;
|
||||
|
||||
AccountStatePtr _account;
|
||||
class SpacesPage *_spacesPage;
|
||||
class FolderWizardLocalPath *_folderWizardSourcePage = nullptr;
|
||||
class FolderWizardRemotePath *_folderWizardTargetPage = nullptr;
|
||||
class FolderWizardSelectiveSync *_folderWizardSelectiveSyncPage = nullptr;
|
||||
};
|
||||
|
||||
|
||||
class FolderWizardPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FolderWizardPage(FolderWizardPrivate *parent)
|
||||
: QWizardPage(nullptr)
|
||||
, _parent(parent)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
inline FolderWizardPrivate *folderWizardPrivate() const
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
|
||||
private:
|
||||
FolderWizardPrivate *_parent;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "folderwizardlocalpath.h"
|
||||
#include "ui_folderwizardsourcepage.h"
|
||||
|
||||
#include "folderwizard.h"
|
||||
#include "folderwizard_p.h"
|
||||
|
||||
#include "gui/folderman.h"
|
||||
#include "libsync/account.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
FolderWizardLocalPath::FolderWizardLocalPath(FolderWizardPrivate *parent)
|
||||
: FolderWizardPage(parent)
|
||||
, _ui(new Ui_FolderWizardSourcePage)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
connect(_ui->localFolderChooseBtn, &QAbstractButton::clicked, this, &FolderWizardLocalPath::slotChooseLocalFolder);
|
||||
connect(_ui->localFolderLineEdit, &QLineEdit::textChanged, this, &FolderWizardLocalPath::completeChanged);
|
||||
|
||||
_ui->warnLabel->setTextFormat(Qt::RichText);
|
||||
_ui->warnLabel->hide();
|
||||
}
|
||||
|
||||
FolderWizardLocalPath::~FolderWizardLocalPath()
|
||||
{
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void FolderWizardLocalPath::initializePage()
|
||||
{
|
||||
_ui->warnLabel->hide();
|
||||
_ui->localFolderLineEdit->setText(QDir::toNativeSeparators(folderWizardPrivate()->defaultSyncRoot()));
|
||||
}
|
||||
|
||||
QString FolderWizardLocalPath::localPath() const
|
||||
{
|
||||
return QDir::fromNativeSeparators(_ui->localFolderLineEdit->text());
|
||||
}
|
||||
|
||||
bool FolderWizardLocalPath::isComplete() const
|
||||
{
|
||||
auto accountUuid = folderWizardPrivate()->accountState()->account()->uuid();
|
||||
QString errorStr = FolderMan::instance()->checkPathValidityForNewFolder(localPath(), FolderMan::NewFolderType::SpacesSyncRoot, accountUuid);
|
||||
if (errorStr.isEmpty()) {
|
||||
if (auto result = VfsPluginManager::instance().prepare(localPath(), accountUuid, VfsPluginManager::instance().bestAvailableVfsMode()); !result) {
|
||||
errorStr = result.error();
|
||||
}
|
||||
}
|
||||
|
||||
bool isOk = errorStr.isEmpty();
|
||||
QStringList warnStrings;
|
||||
if (!isOk) {
|
||||
warnStrings << errorStr;
|
||||
}
|
||||
|
||||
_ui->warnLabel->setWordWrap(true);
|
||||
if (isOk) {
|
||||
_ui->warnLabel->hide();
|
||||
_ui->warnLabel->clear();
|
||||
} else {
|
||||
_ui->warnLabel->show();
|
||||
QString warnings = FolderWizardPrivate::formatWarnings(warnStrings);
|
||||
_ui->warnLabel->setText(warnings);
|
||||
}
|
||||
return isOk;
|
||||
}
|
||||
|
||||
void FolderWizardLocalPath::slotChooseLocalFolder()
|
||||
{
|
||||
QString sf = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
QDir d(sf);
|
||||
|
||||
// open the first entry of the home dir. Otherwise the dir picker comes
|
||||
// up with the closed home dir icon, stupid Qt default...
|
||||
QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks,
|
||||
QDir::DirsFirst | QDir::Name);
|
||||
|
||||
if (dirs.count() > 0)
|
||||
sf += QLatin1Char('/') + dirs.at(0); // Take the first dir in home dir.
|
||||
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select the Spaces root folder"), sf);
|
||||
if (!dir.isEmpty()) {
|
||||
// set the last directory component name as alias
|
||||
_ui->localFolderLineEdit->setText(QDir::toNativeSeparators(dir));
|
||||
}
|
||||
Q_EMIT completeChanged();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "gui/folder.h"
|
||||
#include "gui/folderwizard/folderwizard_p.h"
|
||||
|
||||
class Ui_FolderWizardSourcePage;
|
||||
namespace OCC {
|
||||
|
||||
|
||||
/**
|
||||
* @brief Page to ask for the local source folder
|
||||
* @ingroup gui
|
||||
*/
|
||||
class FolderWizardLocalPath : public FolderWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FolderWizardLocalPath(FolderWizardPrivate *parent);
|
||||
~FolderWizardLocalPath() override;
|
||||
|
||||
bool isComplete() const override;
|
||||
void initializePage() override;
|
||||
|
||||
QString localPath() const;
|
||||
protected Q_SLOTS:
|
||||
void slotChooseLocalFolder();
|
||||
|
||||
private:
|
||||
Ui_FolderWizardSourcePage *_ui;
|
||||
QMap<QString, Folder *> _folderMap;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "folderwizardselectivesync.h"
|
||||
|
||||
#include "folderwizard.h"
|
||||
#include "folderwizard_p.h"
|
||||
|
||||
#include "gui/application.h"
|
||||
#include "gui/selectivesyncwidget.h"
|
||||
|
||||
#include "libsync/theme.h"
|
||||
|
||||
#include "gui/settingsdialog.h"
|
||||
#include "libsync/vfs/vfs.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
FolderWizardSelectiveSync::FolderWizardSelectiveSync(FolderWizardPrivate *parent)
|
||||
: FolderWizardPage(parent)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
_selectiveSync = new SelectiveSyncWidget(folderWizardPrivate()->accountState()->account(), this);
|
||||
layout->addWidget(_selectiveSync);
|
||||
}
|
||||
|
||||
FolderWizardSelectiveSync::~FolderWizardSelectiveSync()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FolderWizardSelectiveSync::initializePage()
|
||||
{
|
||||
const auto *wizardPrivate = dynamic_cast<FolderWizard *>(wizard())->d_func();
|
||||
_selectiveSync->setDavUrl(wizardPrivate->davUrl());
|
||||
_selectiveSync->setFolderInfo(wizardPrivate->displayName());
|
||||
QWizardPage::initializePage();
|
||||
}
|
||||
|
||||
bool FolderWizardSelectiveSync::validatePage()
|
||||
{
|
||||
_selectiveSyncBlackList = _selectiveSync->createBlackList();
|
||||
return true;
|
||||
}
|
||||
|
||||
const QSet<QString> &FolderWizardSelectiveSync::selectiveSyncBlackList() const
|
||||
{
|
||||
return _selectiveSyncBlackList;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
* Copyright (C) by Duncan Mac-Vicar P. <duncan@kde.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gui/folderwizard/folderwizard_p.h"
|
||||
#include "libsync/accountfwd.h"
|
||||
|
||||
namespace OCC {
|
||||
|
||||
class SelectiveSyncWidget;
|
||||
|
||||
/**
|
||||
* @brief The FolderWizardSelectiveSync class
|
||||
* @ingroup gui
|
||||
*/
|
||||
class FolderWizardSelectiveSync : public FolderWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FolderWizardSelectiveSync(FolderWizardPrivate *parent);
|
||||
~FolderWizardSelectiveSync() override;
|
||||
|
||||
bool validatePage() override;
|
||||
|
||||
void initializePage() override;
|
||||
|
||||
const QSet<QString> &selectiveSyncBlackList() const;
|
||||
|
||||
private:
|
||||
SelectiveSyncWidget *_selectiveSync;
|
||||
QSet<QString> _selectiveSyncBlackList;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FolderWizardSourcePage</class>
|
||||
<widget class="QWidget" name="FolderWizardSourcePage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>423</width>
|
||||
<height>174</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Select a local folder to synchronize your Spaces to:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>localFolderLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="localFolderLineEdit">
|
||||
<property name="toolTip">
|
||||
<string>Enter the path to the Spaces root folder. This folder will contain all your synchronized Spaces.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="localFolderChooseBtn">
|
||||
<property name="toolTip">
|
||||
<string>Click to select the Spaces root folder.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Choose...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="warnLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::TextFormat::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>349</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FolderWizardTargetPage</class>
|
||||
<widget class="QWidget" name="FolderWizardTargetPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>350</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Select a remote destination folder</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="folderTreeWidget">
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Folders</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addFolderButton">
|
||||
<property name="text">
|
||||
<string>Create Folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="refreshButton">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="folderEntry"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="warningFrame">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active/>
|
||||
<inactive/>
|
||||
<disabled/>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="warningIcon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../resources/client.qrc">:/client/resources/light/warning.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="warningLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../resources/client.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
#include "spacespage.h"
|
||||
#include "ui_spacespage.h"
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
SpacesPage::SpacesPage(AccountPtr acc, QWidget *parent)
|
||||
: QWizardPage(parent)
|
||||
, ui(new Ui::SpacesPage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->widget->setAccount(acc);
|
||||
|
||||
connect(ui->widget, &Spaces::SpacesBrowser::currentSpaceChanged, this, &QWizardPage::completeChanged);
|
||||
}
|
||||
|
||||
SpacesPage::~SpacesPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool OCC::SpacesPage::isComplete() const
|
||||
{
|
||||
return ui->widget->currentSpace();
|
||||
}
|
||||
|
||||
GraphApi::Space *OCC::SpacesPage::currentSpace() const
|
||||
{
|
||||
return ui->widget->currentSpace();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "gui/spaces/spacesmodel.h"
|
||||
|
||||
#include "accountfwd.h"
|
||||
|
||||
#include <QWizardPage>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class SpacesPage;
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
class SpacesPage : public QWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SpacesPage(AccountPtr acc, QWidget *parent = nullptr);
|
||||
~SpacesPage();
|
||||
|
||||
bool isComplete() const override;
|
||||
|
||||
|
||||
GraphApi::Space *currentSpace() const;
|
||||
|
||||
private:
|
||||
::Ui::SpacesPage *ui;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SpacesPage</class>
|
||||
<widget class="QWizardPage" name="SpacesPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>362</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Choose a Space to sync</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="OCC::Spaces::SpacesBrowser" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::FocusPolicy::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Spaces list</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>OCC::Spaces::SpacesBrowser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/spaces/spacesbrowser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user