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
|
|
|
*/
|
2013-11-26 05:02:56 +04:00
|
|
|
class FormatWarningsWizardPage : public QWizardPage
|
|
|
|
{
|
2015-05-21 13:52:50 +03:00
|
|
|
Q_OBJECT
|
2013-11-26 05:02:56 +04:00
|
|
|
protected:
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] QString formatWarnings(const QStringList &warnings) const;
|
2013-11-26 05:02:56 +04:00
|
|
|
};
|
|
|
|
|
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:
|
2016-11-29 12:39:20 +03:00
|
|
|
explicit FolderWizardLocalPath(const AccountPtr &account);
|
2021-08-17 13:39:31 +03:00
|
|
|
~FolderWizardLocalPath() override;
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] bool isComplete() const override;
|
2018-11-11 13:09:29 +03:00
|
|
|
void initializePage() override;
|
|
|
|
void cleanupPage() override;
|
2011-10-26 15:59:06 +04:00
|
|
|
|
2013-07-04 21:59:40 +04:00
|
|
|
void setFolderMap(const Folder::Map &fm) { _folderMap = fm; }
|
2022-02-15 15:53:39 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void changeEvent(QEvent *) override;
|
|
|
|
|
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:
|
2022-02-15 15:53:39 +03:00
|
|
|
void changeStyle();
|
|
|
|
|
2023-02-03 20:38:52 +03:00
|
|
|
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:
|
2016-11-29 12:39:20 +03:00
|
|
|
explicit FolderWizardRemotePath(const AccountPtr &account);
|
2021-08-17 13:39:31 +03:00
|
|
|
~FolderWizardRemotePath() override;
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2022-09-30 20:12:08 +03:00
|
|
|
[[nodiscard]] 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
|
|
|
|
|
|
|
void showWarn(const QString & = QString()) const;
|
|
|
|
void slotAddRemoteFolder();
|
2013-11-11 18:20:07 +04:00
|
|
|
void slotCreateRemoteFolder(const QString &);
|
2021-02-17 16:30:26 +03:00
|
|
|
void slotCreateRemoteFolderFinished();
|
2015-08-21 12:46:38 +03:00
|
|
|
void slotHandleMkdirNetworkError(QNetworkReply *);
|
|
|
|
void slotHandleLsColNetworkError(QNetworkReply *);
|
2013-11-11 18:20:07 +04:00
|
|
|
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();
|
2013-08-06 23:50:06 +04:00
|
|
|
void slotItemExpanded(QTreeWidgetItem *);
|
2015-03-12 17:59:59 +03:00
|
|
|
void slotCurrentItemChanged(QTreeWidgetItem *);
|
|
|
|
void slotFolderEntryEdited(const QString &text);
|
|
|
|
void slotLsColFolderEntry();
|
|
|
|
void slotTypedPathFound(const QStringList &subpaths);
|
2017-05-17 11:55:42 +03:00
|
|
|
|
2011-04-05 13:10:44 +04:00
|
|
|
private:
|
2015-08-21 12:46:38 +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);
|
2023-02-03 20:38:52 +03:00
|
|
|
Ui_FolderWizardTargetPage _ui{};
|
2023-02-06 12:38:59 +03:00
|
|
|
bool _warnWasVisible = false;
|
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:
|
2016-11-29 12:39:20 +03:00
|
|
|
explicit FolderWizardSelectiveSync(const AccountPtr &account);
|
2021-08-17 13:39:31 +03:00
|
|
|
~FolderWizardSelectiveSync() override;
|
2014-08-15 18:26:38 +04:00
|
|
|
|
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);
|
2021-08-17 13:39:31 +03:00
|
|
|
~FolderWizard() override;
|
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;
|
2023-02-06 12:38:59 +03:00
|
|
|
FolderWizardRemotePath *_folderWizardTargetPage = nullptr;
|
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
|