2011-09-30 19:42:28 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@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.
|
|
|
|
*/
|
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
#ifndef OWNCLOUDSETUPWIZARD_H
|
|
|
|
#define OWNCLOUDSETUPWIZARD_H
|
2011-09-28 20:14:48 +04:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QProcess>
|
2012-02-17 18:54:39 +04:00
|
|
|
#include <QNetworkReply>
|
2013-02-10 17:03:09 +04:00
|
|
|
#include <QPointer>
|
2011-09-28 20:14:48 +04:00
|
|
|
|
2012-03-26 17:19:40 +04:00
|
|
|
#include "mirall/theme.h"
|
2013-10-28 23:01:59 +04:00
|
|
|
#include "mirall/networkjobs.h"
|
|
|
|
|
|
|
|
#include "wizard/owncloudwizardcommon.h"
|
2011-09-28 20:14:48 +04:00
|
|
|
|
|
|
|
namespace Mirall {
|
|
|
|
|
2013-07-30 13:19:22 +04:00
|
|
|
class OwncloudWizard;
|
2013-10-28 23:01:59 +04:00
|
|
|
class Account;
|
|
|
|
|
|
|
|
class ValidateDavAuthJob : public AbstractNetworkJob {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ValidateDavAuthJob(Account* account, QObject *parent = 0);
|
2013-11-14 22:20:09 +04:00
|
|
|
void start();
|
2013-10-28 23:01:59 +04:00
|
|
|
signals:
|
|
|
|
void authResult(QNetworkReply*);
|
|
|
|
private slots:
|
2014-04-14 17:08:43 +04:00
|
|
|
bool finished();
|
2013-10-28 23:01:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class DetermineAuthTypeJob : public AbstractNetworkJob {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit DetermineAuthTypeJob(Account *account, QObject *parent = 0);
|
2013-11-14 22:20:09 +04:00
|
|
|
void start();
|
2013-10-28 23:01:59 +04:00
|
|
|
signals:
|
|
|
|
void authType(WizardCommon::AuthType);
|
|
|
|
private slots:
|
2014-04-14 17:08:43 +04:00
|
|
|
bool finished();
|
2013-10-28 23:01:59 +04:00
|
|
|
private:
|
|
|
|
int _redirects;
|
|
|
|
};
|
|
|
|
|
2011-09-28 20:14:48 +04:00
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
class OwncloudSetupWizard : public QObject
|
2011-09-28 20:14:48 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-07-04 21:59:40 +04:00
|
|
|
/** Run the wizard */
|
2013-07-22 15:59:52 +04:00
|
|
|
static void runWizard(QObject *obj, const char* amember, QWidget *parent = 0 );
|
2013-07-04 21:59:40 +04:00
|
|
|
|
2011-09-28 20:14:48 +04:00
|
|
|
signals:
|
2012-04-12 13:37:48 +04:00
|
|
|
// overall dialog close signal.
|
2013-07-31 17:46:41 +04:00
|
|
|
void ownCloudWizardDone( int );
|
2011-09-28 20:14:48 +04:00
|
|
|
|
2013-07-31 17:46:41 +04:00
|
|
|
private slots:
|
2013-07-22 16:54:14 +04:00
|
|
|
void slotDetermineAuthType(const QString&);
|
2013-10-28 23:01:59 +04:00
|
|
|
void slotOwnCloudFoundAuth(const QUrl&, const QVariantMap&);
|
|
|
|
void slotNoOwnCloudFoundAuth(QNetworkReply *reply);
|
2013-11-14 20:02:41 +04:00
|
|
|
void slotNoOwnCloudFoundAuthTimeout(const QUrl&url);
|
2012-12-04 20:27:59 +04:00
|
|
|
|
2013-07-31 17:46:41 +04:00
|
|
|
void slotConnectToOCUrl(const QString&);
|
2013-10-28 23:01:59 +04:00
|
|
|
void slotConnectionCheck(QNetworkReply*);
|
2013-07-31 17:46:41 +04:00
|
|
|
|
|
|
|
void slotCreateLocalAndRemoteFolders(const QString&, const QString&);
|
2013-10-28 23:01:59 +04:00
|
|
|
void slotAuthCheckReply(QNetworkReply*);
|
2013-07-31 17:46:41 +04:00
|
|
|
void slotCreateRemoteFolderFinished(QNetworkReply::NetworkError);
|
2012-06-12 14:30:05 +04:00
|
|
|
void slotAssistantFinished( int );
|
2013-07-22 16:54:14 +04:00
|
|
|
|
2011-09-28 20:14:48 +04:00
|
|
|
private:
|
2013-07-31 17:46:41 +04:00
|
|
|
explicit OwncloudSetupWizard(QObject *parent = 0 );
|
|
|
|
~OwncloudSetupWizard();
|
2012-02-17 18:54:39 +04:00
|
|
|
|
2013-07-31 17:46:41 +04:00
|
|
|
void startWizard();
|
2012-04-12 13:37:48 +04:00
|
|
|
void testOwnCloudConnect();
|
2013-10-28 23:01:59 +04:00
|
|
|
void createRemoteFolder();
|
2013-07-31 17:46:41 +04:00
|
|
|
void finalizeSetup( bool );
|
2013-10-30 19:31:47 +04:00
|
|
|
bool ensureStartFromScratch(const QString &localFolder);
|
|
|
|
void replaceDefaultAccountWith(Account *newAccount);
|
2012-02-17 18:54:39 +04:00
|
|
|
|
2013-10-28 23:01:59 +04:00
|
|
|
Account* _account;
|
2013-07-31 17:46:41 +04:00
|
|
|
OwncloudWizard* _ocWizard;
|
|
|
|
QString _remoteFolder;
|
2013-10-28 23:01:59 +04:00
|
|
|
|
2011-09-28 20:14:48 +04:00
|
|
|
};
|
|
|
|
|
2012-03-14 14:26:00 +04:00
|
|
|
}
|
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
#endif // OWNCLOUDSETUPWIZARD_H
|