Commit ce9b02eb authored by Àlex Fiestas's avatar Àlex Fiestas
Browse files

First restoration of owncloud functionality (webdav files)

parent 6f58d03d
......@@ -16,13 +16,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#include "ocreatefile.h"
#include "createnetattachjob.h"
#include <QWidget>
#include <QApplication>
#include <Accounts/Manager>
#include <KGlobal>
#include <KConfig>
#include <KDirNotify>
#include <KStandardDirs>
#include <KWallet/Wallet>
......@@ -30,27 +31,34 @@
using namespace KWallet;
OCreateFile::OCreateFile(KConfigGroup group, QObject* parent)
CreateNetAttachJob::CreateNetAttachJob(QObject* parent)
: KJob(parent)
, m_config(group)
{
}
OCreateFile::~OCreateFile()
void CreateNetAttachJob::start()
{
QMetaObject::invokeMethod(this, "createNetAttach", Qt::QueuedConnection);
}
void CreateNetAttachJob::setServiceName(const QString& serviceName)
{
m_serviceName = serviceName;
}
void OCreateFile::start()
void CreateNetAttachJob::setAccountId(const Accounts::AccountId& accId)
{
QMetaObject::invokeMethod(this, "createNetAttach", Qt::QueuedConnection);
m_accountId = accId;
}
void OCreateFile::createNetAttach()
void CreateNetAttachJob::createNetAttach()
{
KGlobal::dirs()->addResourceType("remote_entries", "data", "remoteview");
Accounts::Manager *manager = new Accounts::Manager();
Accounts::Account* account = manager->account(m_accountId);
KUrl url(m_config.readEntry("server", ""));
url.setUser(m_config.name());
url.setScheme("webdav");
......
......@@ -16,26 +16,30 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#ifndef OCREATEFILE_H
#define OCREATEFILE_H
#ifndef CREATE_NETATTACH_H
#define CREATE_NETATTACH_H
#include <KJob>
#include <KConfigGroup>
class OCreateFile : public KJob
#include <Accounts/Account>
class CreateNetAttachJob : public KJob
{
Q_OBJECT
public:
explicit OCreateFile(KConfigGroup group, QObject* parent = 0);
virtual ~OCreateFile();
explicit CreateNetAttachJob(QObject* parent = 0);
virtual void start();
void setServiceName(const QString &serviceName);
void setAccountId(const Accounts::AccountId &accId);
private Q_SLOTS:
void createNetAttach();
private:
KConfigGroup m_config;
QString m_serviceName;
Accounts::AccountId m_accountId;
};
#endif //OCREATEFILE_H
\ No newline at end of file
#endif //CREATE_NETATTACH_H
\ No newline at end of file
......@@ -16,13 +16,13 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#include "oremovefile.h"
#include "removenetattachjob.h"
#include <QFile>
#include <KDirNotify>
ORemoveFile::ORemoveFile(KConfigGroup group, QObject* parent)
RemoveNetAttachJob::ORemoveFile(KConfigGroup group, QObject* parent)
: KJob(parent)
, m_config(group)
{
......@@ -30,17 +30,17 @@ ORemoveFile::ORemoveFile(KConfigGroup group, QObject* parent)
setProperty("type", QVariant::fromValue(m_config.readEntry("type")));
}
ORemoveFile::~ORemoveFile()
RemoveNetAttachJob::~ORemoveFile()
{
}
void ORemoveFile::start()
void RemoveNetAttachJob::start()
{
QMetaObject::invokeMethod(this, "removeFile", Qt::QueuedConnection);
}
void ORemoveFile::removeFile()
void RemoveNetAttachJob::removeFile()
{
QFile::remove(m_config.group("private").readEntry("fileDesktop"));
org::kde::KDirNotify::emitFilesAdded( "remote:/" );
......
......@@ -22,12 +22,12 @@
#include <KJob>
#include <KConfigGroup>
class ORemoveFile : public KJob
class RemoveNetAttachJob : public KJob
{
Q_OBJECT
public:
explicit ORemoveFile(KConfigGroup group, QObject* parent = 0);
virtual ~ORemoveFile();
explicit RemoveNetAttachJob(KConfigGroup group, QObject* parent = 0);
virtual ~RemoveNetAttachJob();
virtual void start();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment