2011-04-06 13:48:02 +04:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2011-04-05 13:10:44 +04:00
|
|
|
|
|
|
|
#ifndef MIRALL_FOLDERWIZARD_H
|
|
|
|
#define MIRALL_FOLDERWIZARD_H
|
|
|
|
|
|
|
|
#include <QWizard>
|
2011-10-06 18:55:28 +04:00
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QTimer>
|
2011-04-05 13:10:44 +04:00
|
|
|
|
2011-10-11 16:23:32 +04:00
|
|
|
#include "folder.h"
|
2015-01-28 12:38:54 +03:00
|
|
|
#include "accountfwd.h"
|
2011-10-11 16:23:32 +04:00
|
|
|
|
2011-04-05 20:31:14 +04:00
|
|
|
#include "ui_folderwizardsourcepage.h"
|
|
|
|
#include "ui_folderwizardtargetpage.h"
|
|
|
|
|
2018-01-15 19:30:33 +03:00
|
|
|
class QCheckBox;
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
namespace OCC {
|
2011-04-05 13:10:44 +04:00
|
|
|
|
2017-01-03 17:33:06 +03:00
|
|
|
class SelectiveSyncWidget;
|
2014-08-15 18:26:38 +04:00
|
|
|
|
2011-10-06 18:55:28 +04:00
|
|
|
class ownCloudInfo;
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The FormatWarningsWizardPage class
|
|
|
|
* @ingroup gui
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2017-05-17 11:55:42 +03:00
|
|
|
class FormatWarningsWizardPage : public QWizardPage
|
|
|
|
{
|
2015-05-21 13:52:50 +03:00
|
|
|
Q_OBJECT
|
2013-11-26 05:02:56 +04:00
|
|
|
protected:
|
|
|
|
QString formatWarnings(const QStringList &warnings) const;
|
|
|
|
};
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief Page to ask for the local source folder
|
|
|
|
* @ingroup gui
|
2011-04-05 20:31:14 +04:00
|
|
|
*/
|
2014-01-14 20:40:42 +04:00
|
|
|
class FolderWizardLocalPath : public FormatWarningsWizardPage
|
2011-04-05 20:31:14 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-05-17 11:55:42 +03:00
|
|
|
explicit FolderWizardLocalPath(const AccountPtr &account);
|
2014-01-14 20:40:42 +04:00
|
|
|
~FolderWizardLocalPath();
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2018-11-11 13:09:29 +03:00
|
|
|
bool isComplete() const override;
|
|
|
|
void initializePage() override;
|
|
|
|
void cleanupPage() override;
|
2011-10-26 15:59:06 +04:00
|
|
|
|
2017-05-17 11:55:42 +03:00
|
|
|
void setFolderMap(const Folder::Map &fm) { _folderMap = fm; }
|
2011-04-05 20:31:14 +04:00
|
|
|
protected slots:
|
2014-01-14 20:40:42 +04:00
|
|
|
void slotChooseLocalFolder();
|
2011-04-05 20:31:14 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui_FolderWizardSourcePage _ui;
|
2013-07-04 21:59:40 +04:00
|
|
|
Folder::Map _folderMap;
|
2016-09-30 15:08:00 +03:00
|
|
|
AccountPtr _account;
|
2011-04-05 20:31:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief page to ask for the target folder
|
|
|
|
* @ingroup gui
|
2011-04-05 20:31:14 +04:00
|
|
|
*/
|
|
|
|
|
2014-01-14 20:40:42 +04:00
|
|
|
class FolderWizardRemotePath : public FormatWarningsWizardPage
|
2011-04-05 13:10:44 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-05-17 11:55:42 +03:00
|
|
|
explicit FolderWizardRemotePath(const AccountPtr &account);
|
2014-01-14 20:40:42 +04:00
|
|
|
~FolderWizardRemotePath();
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2018-11-11 13:09:29 +03:00
|
|
|
bool isComplete() const override;
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2018-11-11 13:09:29 +03:00
|
|
|
void initializePage() override;
|
|
|
|
void cleanupPage() override;
|
2011-10-26 15:59:06 +04:00
|
|
|
|
2011-04-05 20:31:14 +04:00
|
|
|
protected slots:
|
2013-07-22 20:07:44 +04:00
|
|
|
|
2017-05-17 11:55:42 +03:00
|
|
|
void showWarn(const QString & = QString()) const;
|
2013-07-22 20:07:44 +04:00
|
|
|
void slotAddRemoteFolder();
|
2017-05-17 11:55:42 +03:00
|
|
|
void slotCreateRemoteFolder(const QString &);
|
2013-11-11 18:20:07 +04:00
|
|
|
void slotCreateRemoteFolderFinished(QNetworkReply::NetworkError error);
|
2017-05-17 11:55:42 +03:00
|
|
|
void slotHandleMkdirNetworkError(QNetworkReply *);
|
|
|
|
void slotHandleLsColNetworkError(QNetworkReply *);
|
|
|
|
void slotUpdateDirectories(const QStringList &);
|
2020-12-08 17:36:17 +03:00
|
|
|
void slotGatherEncryptedPaths(const QString &, const QMap<QString, QString> &);
|
2013-07-22 20:07:44 +04:00
|
|
|
void slotRefreshFolders();
|
2017-05-17 11:55:42 +03:00
|
|
|
void slotItemExpanded(QTreeWidgetItem *);
|
|
|
|
void slotCurrentItemChanged(QTreeWidgetItem *);
|
|
|
|
void slotFolderEntryEdited(const QString &text);
|
2015-03-12 17:59:59 +03:00
|
|
|
void slotLsColFolderEntry();
|
2017-05-17 11:55:42 +03:00
|
|
|
void slotTypedPathFound(const QStringList &subpaths);
|
|
|
|
|
2011-04-05 13:10:44 +04:00
|
|
|
private:
|
2017-05-17 11:55:42 +03:00
|
|
|
LsColJob *runLsColJob(const QString &path);
|
2013-11-11 18:20:07 +04:00
|
|
|
void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path);
|
2015-03-12 17:59:59 +03:00
|
|
|
bool selectByPath(QString path);
|
2011-04-05 20:31:14 +04:00
|
|
|
Ui_FolderWizardTargetPage _ui;
|
2011-10-19 13:53:12 +04:00
|
|
|
bool _warnWasVisible;
|
2015-01-28 12:38:54 +03:00
|
|
|
AccountPtr _account;
|
2015-03-12 17:59:59 +03:00
|
|
|
QTimer _lscolTimer;
|
2020-12-08 17:36:17 +03:00
|
|
|
QStringList _encryptedPaths;
|
2011-04-05 20:31:14 +04:00
|
|
|
};
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The FolderWizardSelectiveSync class
|
|
|
|
* @ingroup gui
|
2015-06-26 18:07:47 +03:00
|
|
|
*/
|
2014-08-15 18:26:38 +04:00
|
|
|
class FolderWizardSelectiveSync : public QWizardPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-05-17 11:55:42 +03:00
|
|
|
explicit FolderWizardSelectiveSync(const AccountPtr &account);
|
2014-08-15 18:26:38 +04:00
|
|
|
~FolderWizardSelectiveSync();
|
|
|
|
|
2018-11-11 13:09:29 +03:00
|
|
|
bool validatePage() override;
|
2014-08-15 18:26:38 +04:00
|
|
|
|
2018-11-11 13:09:29 +03:00
|
|
|
void initializePage() override;
|
|
|
|
void cleanupPage() override;
|
2014-08-15 18:26:38 +04:00
|
|
|
|
2018-04-03 18:30:17 +03:00
|
|
|
private slots:
|
2018-05-18 09:29:40 +03:00
|
|
|
void virtualFilesCheckboxClicked();
|
2018-04-03 18:30:17 +03:00
|
|
|
|
2014-08-15 18:26:38 +04:00
|
|
|
private:
|
2017-01-03 17:33:06 +03:00
|
|
|
SelectiveSyncWidget *_selectiveSync;
|
2018-05-18 09:29:40 +03:00
|
|
|
QCheckBox *_virtualFilesCheckBox = nullptr;
|
2014-08-15 18:26:38 +04:00
|
|
|
};
|
|
|
|
|
2015-06-29 19:56:09 +03:00
|
|
|
/**
|
|
|
|
* @brief The FolderWizard class
|
|
|
|
* @ingroup gui
|
2011-04-06 12:40:15 +04:00
|
|
|
*/
|
2011-04-05 20:31:14 +04:00
|
|
|
class FolderWizard : public QWizard
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
Page_Source,
|
2014-08-15 18:26:38 +04:00
|
|
|
Page_Target,
|
|
|
|
Page_SelectiveSync
|
2011-04-05 20:31:14 +04:00
|
|
|
};
|
|
|
|
|
2018-11-11 12:56:22 +03:00
|
|
|
explicit FolderWizard(AccountPtr account, QWidget *parent = nullptr);
|
2013-04-08 16:50:26 +04:00
|
|
|
~FolderWizard();
|
2011-10-11 16:23:32 +04:00
|
|
|
|
2017-11-21 18:13:06 +03:00
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
|
2011-10-11 16:23:32 +04:00
|
|
|
private:
|
2014-01-14 20:40:42 +04:00
|
|
|
FolderWizardLocalPath *_folderWizardSourcePage;
|
|
|
|
FolderWizardRemotePath *_folderWizardTargetPage;
|
2014-08-15 18:26:38 +04:00
|
|
|
FolderWizardSelectiveSync *_folderWizardSelectiveSyncPage;
|
2011-04-05 13:10:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-11-10 00:34:07 +03:00
|
|
|
} // namespace OCC
|
2011-04-05 13:10:44 +04:00
|
|
|
|
|
|
|
#endif
|