diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 06aa3b511c..c084c7b2ab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,6 @@ mirall/statusdialog.cpp mirall/owncloudwizard.cpp mirall/owncloudsetupwizard.cpp mirall/owncloudinfo.cpp -mirall/mirallwebdav.cpp mirall/theme.cpp mirall/miralltheme.cpp mirall/owncloudtheme.cpp @@ -71,7 +70,6 @@ set(mirall_HEADERS mirall/folderwatcher.h mirall/folderwizard.h mirall/gitfolder.h - mirall/mirallwebdav.h mirall/owncloudfolder.h mirall/owncloudinfo.h mirall/owncloudsetupwizard.h diff --git a/src/mirall/folderwizard.cpp b/src/mirall/folderwizard.cpp index 74114cb3e7..bb891540fa 100644 --- a/src/mirall/folderwizard.cpp +++ b/src/mirall/folderwizard.cpp @@ -220,23 +220,8 @@ void FolderWizardTargetPage::slotCreateRemoteFolder() const QString folder = _ui.OCFolderLineEdit->text(); if( folder.isEmpty() ) return; + qDebug() << "creating folder on ownCloud: " << folder; _ownCloudDirCheck->mkdirRequest( folder ); -#if 0 - QString url = cfgFile.ownCloudUrl( cfgFile.defaultConnection(), true ); - url.append( folder ); - qDebug() << "creating folder on ownCloud: " << url; - - MirallWebDAV *webdav = new MirallWebDAV(this); - connect( webdav, SIGNAL(webdavFinished(QNetworkReply*)), - SLOT(slotCreateRemoteFolderFinished(QNetworkReply*))); - - webdav->httpConnect( url, cfgFile.ownCloudUser(), cfgFile.ownCloudPasswd() ); - if( webdav->mkdir( url ) ) { - qDebug() << "WebDAV mkdir request successfully started"; - } else { - qDebug() << "WebDAV mkdir request failed"; - } -#endif } void FolderWizardTargetPage::slotCreateRemoteFolderFinished( QNetworkReply *reply ) diff --git a/src/mirall/mirallwebdav.cpp b/src/mirall/mirallwebdav.cpp deleted file mode 100644 index 86f6d4ce70..0000000000 --- a/src/mirall/mirallwebdav.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) by Klaas Freitag - * - * 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 "mirallwebdav.h" - -#include -#include -#include - -MirallWebDAV::MirallWebDAV(QObject *parent) : - QObject(parent) -{ - _webdav = new QWebdav; - connect( _webdav, SIGNAL(webdavFinished(QNetworkReply*)), this, - SIGNAL(webdavFinished(QNetworkReply*)) ); - -} - -void MirallWebDAV::httpConnect( const QString& str, const QString& user, const QString& passwd) -{ - _host = str; - if( !_host.endsWith( "webdav.php")) { - _host.append( "/files/webdav.php"); - } - _webdav->init( _host, user, passwd ); -} - -bool MirallWebDAV::mkdir( const QString& dir ) -{ - bool re = true; - - QNetworkReply *reply = _webdav->mkdir( dir ); - if( reply->error() != QNetworkReply::NoError ) { - qDebug() << "WebDAV Mkdir failed."; - re = false; - } - return re; -} - diff --git a/src/mirall/mirallwebdav.h b/src/mirall/mirallwebdav.h deleted file mode 100644 index 4896170c23..0000000000 --- a/src/mirall/mirallwebdav.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) by Klaas Freitag - * - * 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. - */ -#ifndef MIRALLWEBDAV_H -#define MIRALLWEBDAV_H - -#include - -#include - -class MirallWebDAV : public QObject -{ - Q_OBJECT -public: - explicit MirallWebDAV(QObject *parent = 0); - - void httpConnect( const QString& url, const QString&, const QString& ); - - bool mkdir( const QString& dir ); - -protected: - -signals: - void webdavFinished( QNetworkReply* ); - -public slots: - -private: - QString _host; - QString _user; - QString _passwd; - QString _error; - - QWebdav *_webdav; -}; - -#endif // MIRALLWEBDAV_H diff --git a/src/mirall/owncloudsetupwizard.cpp b/src/mirall/owncloudsetupwizard.cpp index 080aa43f05..a9f5faac25 100644 --- a/src/mirall/owncloudsetupwizard.cpp +++ b/src/mirall/owncloudsetupwizard.cpp @@ -18,7 +18,6 @@ #include #include "mirall/owncloudsetupwizard.h" -#include "mirall/mirallwebdav.h" #include "mirall/mirallconfigfile.h" #include "mirall/owncloudinfo.h" #include "mirall/folderman.h" @@ -75,6 +74,7 @@ OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, Theme *theme, QO _ocInfo = new ownCloudInfo; connect(_ocInfo,SIGNAL(ownCloudInfoFound(QString,QString)),SLOT(slotOwnCloudFound(QString,QString))); connect(_ocInfo,SIGNAL(noOwncloudFound(QNetworkReply*)),SLOT(slotNoOwnCloudFound(QNetworkReply*))); + connect(_ocInfo,SIGNAL(webdavColCreated(QNetworkReply*)),SLOT(slotCreateRemoteFolderFinished(QNetworkReply*))); } OwncloudSetupWizard::~OwncloudSetupWizard() @@ -358,18 +358,7 @@ bool OwncloudSetupWizard::createRemoteFolder( const QString& folder ) url.append( folder ); qDebug() << "creating folder on ownCloud: " << url; - MirallWebDAV *webdav = new MirallWebDAV(this); - connect( webdav, SIGNAL(webdavFinished(QNetworkReply*)), - SLOT(slotCreateRemoteFolderFinished(QNetworkReply*))); - - webdav->httpConnect( url, cfgFile.ownCloudUser(), cfgFile.ownCloudPasswd() ); - if( webdav->mkdir( url ) ) { - qDebug() << "WebDAV mkdir request successfully started"; - return true; - } else { - qDebug() << "WebDAV mkdir request failed"; - return false; - } + _ocInfo->mkdirRequest( url ); } void OwncloudSetupWizard::slotCreateRemoteFolderFinished( QNetworkReply *reply )