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"
|
|
|
|
|
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:
|
|
|
|
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:
|
2016-11-29 12:39:20 +03:00
|
|
|
explicit FolderWizardLocalPath(const AccountPtr& account);
|
2014-01-14 20:40:42 +04:00
|
|
|
~FolderWizardLocalPath();
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2014-07-10 01:22:28 +04:00
|
|
|
virtual bool isComplete() const Q_DECL_OVERRIDE;
|
|
|
|
void initializePage() Q_DECL_OVERRIDE;
|
|
|
|
void cleanupPage() Q_DECL_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; }
|
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:
|
2016-11-29 12:39:20 +03:00
|
|
|
explicit FolderWizardRemotePath(const AccountPtr& account);
|
2014-01-14 20:40:42 +04:00
|
|
|
~FolderWizardRemotePath();
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2014-07-10 01:22:28 +04:00
|
|
|
virtual bool isComplete() const Q_DECL_OVERRIDE;
|
2011-04-05 20:31:14 +04:00
|
|
|
|
2014-07-10 01:22:28 +04:00
|
|
|
virtual void initializePage() Q_DECL_OVERRIDE;
|
|
|
|
virtual void cleanupPage() Q_DECL_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&);
|
|
|
|
void slotCreateRemoteFolderFinished(QNetworkReply::NetworkError error);
|
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&);
|
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);
|
2016-04-27 11:37:17 +03:00
|
|
|
void slotTypedPathError(QNetworkReply* reply);
|
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);
|
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;
|
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);
|
2014-08-15 18:26:38 +04:00
|
|
|
~FolderWizardSelectiveSync();
|
|
|
|
|
|
|
|
virtual bool validatePage() Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void initializePage() Q_DECL_OVERRIDE;
|
|
|
|
virtual void cleanupPage() Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
private:
|
2017-01-03 17:33:06 +03:00
|
|
|
SelectiveSyncWidget *_selectiveSync;
|
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
|
|
|
};
|
|
|
|
|
2015-01-28 12:38:54 +03:00
|
|
|
explicit FolderWizard(AccountPtr account, QWidget *parent = 0);
|
2013-04-08 16:50:26 +04:00
|
|
|
~FolderWizard();
|
2011-10-11 16:23:32 +04:00
|
|
|
|
|
|
|
private:
|
2011-04-05 20:31:14 +04:00
|
|
|
|
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
|