Git commit 5cc7fe3dc1ac28bbd9fb4af68dc644c7a0b2c521 by Alex Fiestas. Committed on 02/05/2012 at 10:44. Pushed by mklapetek into branch 'master'. Move all owncloud jobs into owncloud/jobs (and one facebook into facebooks) A +49 -0 jobs/ocreatecalendar.cpp [License: GPL (v2+)] A +37 -0 jobs/ocreatecalendar.h [License: GPL (v2+)] A +172 -0 jobs/ocreatecontact.cpp [License: GPL (v2+)] A +56 -0 jobs/ocreatecontact.h [License: GPL (v2+)] A +111 -0 jobs/ocreatefile.cpp [License: GPL (v2+)] A +41 -0 jobs/ocreatefile.h [License: GPL (v2+)] A +89 -0 jobs/oremovecalendar.cpp [License: GPL (v2+)] A +46 -0 jobs/oremovecalendar.h [License: GPL (v2+)] A +89 -0 jobs/oremovecontact.cpp [License: GPL (v2+)] A +46 -0 jobs/oremovecontact.h [License: GPL (v2+)] A +49 -0 jobs/oremovefile.cpp [License: GPL (v2+)] A +41 -0 jobs/oremovefile.h [License: GPL (v2+)] A +49 -0 jobs/org.kde.Akonadi.davGroupware.Settings.xml http://commits.kde.org/kaccounts-providers/5cc7fe3dc1ac28bbd9fb4af68dc644c7= a0b2c521 diff --git a/jobs/ocreatecalendar.cpp b/jobs/ocreatecalendar.cpp new file mode 100644 index 0000000..8a59270 --- /dev/null +++ b/jobs/ocreatecalendar.cpp @@ -0,0 +1,49 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "ocreatecalendar.h" + +OCreateCalendar::OCreateCalendar(KConfigGroup group, QObject* parent) + : OCreateContact(group, parent) +{ + +} + +OCreateCalendar::~OCreateCalendar() +{ + +} + +void OCreateCalendar::start() +{ + OCreateContact::start(); +} + +const QString OCreateCalendar::davUrl() +{ + KUrl url(m_config.readEntry("server", "")); + url.addPath("apps/calendar/caldav.php/"); + + QString str("$default$|CalDav|"); + str.append(url.url()); + + m_config.group("services").writeEntry("Calendar", 1); + + return str; +} + diff --git a/jobs/ocreatecalendar.h b/jobs/ocreatecalendar.h new file mode 100644 index 0000000..8c69450 --- /dev/null +++ b/jobs/ocreatecalendar.h @@ -0,0 +1,37 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OCREATECALENDAR_H +#define OCREATECALENDAR_H + +#include "ocreatecontact.h" + +class OCreateCalendar : public OCreateContact +{ + Q_OBJECT + public: + explicit OCreateCalendar(KConfigGroup group, QObject* parent); + virtual ~OCreateCalendar(); + + virtual void start(); + + protected: + virtual const QString davUrl(); +}; + +#endif //OCREATECALENDAR_H \ No newline at end of file diff --git a/jobs/ocreatecontact.cpp b/jobs/ocreatecontact.cpp new file mode 100644 index 0000000..5717922 --- /dev/null +++ b/jobs/ocreatecontact.cpp @@ -0,0 +1,172 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "ocreatecontact.h" +#include "davGroupware_settings.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +using namespace KWallet; +using namespace Akonadi; +using namespace KGoogle; + +OCreateContact::OCreateContact(KConfigGroup group, QObject* parent) +: KJob(parent) +, m_config(group) +{ +} + +OCreateContact::~OCreateContact() +{ + +} + +void OCreateContact::start() +{ + m_config.sync(); + if (m_config.hasGroup("private") && m_config.group("private").hasKey(= "contactAndCalendarResource")) { + QMetaObject::invokeMethod(this, "useCalendarResource", Qt::QueuedC= onnection); + return; + } + QMetaObject::invokeMethod(this, "createResource", Qt::QueuedConnection= ); +} + +KConfigGroup OCreateContact::config() const +{ + return m_config; +} + +void OCreateContact::createResource() +{ + kDebug() << "Creating new resource"; + const AgentType type =3D AgentManager::self()->type("akonadi_davgroupw= are_resource"); + + AgentInstanceCreateJob *job =3D new AgentInstanceCreateJob( type, this= ); + connect( job, SIGNAL(result(KJob*)), SLOT(resourceCreated(KJob*)) ); + job->start(); +} + +const QString OCreateContact::davUrl() +{ + KUrl url(m_config.readEntry("server", "")); + url.addPath("apps/contacts/carddav.php/"); + + QString str("$default$|CardDav|"); + str.append(url.url()); + + m_config.group("services").writeEntry("Contact", 1); + + return str; +} + +void OCreateContact::resourceCreated(KJob* job) +{ + if (job->error()) { + setError(-1); + emitResult(); + return; + } + + AgentInstance agent =3D qobject_cast( job )->= instance(); + agent.setName(m_config.name() + " " + i18n("Calendar and Contacts")); + + QString service =3D "org.freedesktop.Akonadi.Resource." + agent.identi= fier(); + + KConfigGroup privates(&m_config, "private"); + privates.writeEntry("contactAndCalendarResource", service); + m_config.sync(); + + org::kde::Akonadi::davGroupware::Settings *settings =3D new org::kde::= Akonadi::davGroupware::Settings(service, "/Settings", QDBusConnection::sess= ionBus()); + settings->setDefaultUsername(m_config.name()); + settings->setRemoteUrls(QStringList(davUrl())); + settings->setDisplayName(m_config.name()); + settings->setSettingsVersion(2); + + settings->writeConfig(); + agent.reconfigure(); + + WId windowId =3D 0; + if (qApp->activeWindow()) { + windowId =3D qApp->activeWindow()->winId(); + } + Wallet *wallet =3D Wallet::openWallet(Wallet::NetworkWallet(), windowI= d, Wallet::Synchronous); + + if (!wallet->isOpen() || !wallet->isEnabled()) { + setError(-1); + emitResult(); + return; + } + + QString password; + wallet->setFolder("WebAccounts"); + wallet->readPassword("owncloud-" + m_config.name(), password); + + QString key (agent.identifier()); + key.append(",$default$"); + + wallet->setFolder(Wallet::PasswordFolder()); + wallet->writePassword(key, password); + + agent.synchronize(); + + emitResult(); +} + +void OCreateContact::useCalendarResource() +{ + QString resource =3D m_config.group("private").readEntry("contactAndCa= lendarResource"); + org::kde::Akonadi::davGroupware::Settings *settings =3D new org::kde::= Akonadi::davGroupware::Settings(resource, "/Settings", QDBusConnection::ses= sionBus()); + + QStringList list =3D settings->remoteUrls().value(); + list.append(davUrl()); + kDebug() << list; + settings->setRemoteUrls(list).waitForFinished(); + settings->setDefaultUsername(m_config.name()).waitForFinished(); + + settings->writeConfig().waitForFinished(); + + resource.remove("org.freedesktop.Akonadi.Resource."); + + AgentInstance instance =3D AgentManager::self()->instance(resource); + if (!instance.isValid()) { + return; + } + + instance.reconfigure(); + instance.synchronize(); + + emitResult(); +} \ No newline at end of file diff --git a/jobs/ocreatecontact.h b/jobs/ocreatecontact.h new file mode 100644 index 0000000..f048c14 --- /dev/null +++ b/jobs/ocreatecontact.h @@ -0,0 +1,56 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OCREATECONTACT_H +#define OCREATECONTACT_H + +#include + +#include +#include + +#include + + +using namespace Akonadi; +class KConfigGroup; + +class OCreateContact : public KJob +{ + Q_OBJECT + public: + explicit OCreateContact(KConfigGroup group, QObject* parent); + virtual ~OCreateContact(); + + virtual void start(); + + KConfigGroup config() const; + + protected: + virtual const QString davUrl(); + + private Q_SLOTS: + void useCalendarResource(); + void createResource(); + void resourceCreated(KJob *job); + + protected: + KConfigGroup m_config; +}; + +#endif //OCREATECONTACT_H \ No newline at end of file diff --git a/jobs/ocreatefile.cpp b/jobs/ocreatefile.cpp new file mode 100644 index 0000000..ce421e6 --- /dev/null +++ b/jobs/ocreatefile.cpp @@ -0,0 +1,111 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "ocreatefile.h" + +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace KWallet; + +OCreateFile::OCreateFile(KConfigGroup group, QObject* parent) + : KJob(parent) + , m_config(group) +{ + +} + +OCreateFile::~OCreateFile() +{ + +} + +void OCreateFile::start() +{ + QMetaObject::invokeMethod(this, "createNetAttach", Qt::QueuedConnectio= n); +} + +void OCreateFile::createNetAttach() +{ + KGlobal::dirs()->addResourceType("remote_entries", "data", "remoteview= "); + + KUrl url(m_config.readEntry("server", "")); + url.setUser(m_config.name()); + url.setScheme("webdav"); + url.addPath("files/webdav.php/"); + + QString path =3D KGlobal::dirs()->saveLocation("remote_entries"); + path +=3D m_config.name() + "ownCloud.desktop"; + + kDebug() << "Creating knetAttach place"; + kDebug() << path; + kDebug() << url.prettyUrl(); + + m_config.group("private").writeEntry("fileDesktop", path); + + KConfig _desktopFile( path, KConfig::SimpleConfig ); + KConfigGroup desktopFile(&_desktopFile, "Desktop Entry"); + + desktopFile.writeEntry("Icon", "owncloud"); + desktopFile.writeEntry("Name", url.host()); + desktopFile.writeEntry("Type", "Link"); + desktopFile.writeEntry("URL", url.prettyUrl()); + desktopFile.writeEntry("Charset", url.fileEncoding()); + desktopFile.sync(); + + org::kde::KDirNotify::emitFilesAdded( "remote:/" ); + + QString walletUrl(url.scheme()); + walletUrl.append("-"); + walletUrl.append(m_config.name()); + walletUrl.append("@"); + walletUrl.append(url.host()); + walletUrl.append(":-1");//Overwrite the first option + + WId windowId =3D 0; + if (qApp->activeWindow()) { + windowId =3D qApp->activeWindow()->winId(); + } + Wallet *wallet =3D Wallet::openWallet(Wallet::NetworkWallet(), windowI= d, Wallet::Synchronous); + + if (!wallet->isOpen() || !wallet->isEnabled()) { + return; + } + + QString password; + wallet->setFolder("WebAccounts"); + wallet->readPassword("owncloud-" + m_config.name(), password); + + QMap info; + info["login"] =3D m_config.name(); + info["password"] =3D password; + + wallet->setFolder("Passwords"); + wallet->writeMap(walletUrl, info); + wallet->sync(); + + m_config.group("services").writeEntry("File", 1); + emitResult(); +} diff --git a/jobs/ocreatefile.h b/jobs/ocreatefile.h new file mode 100644 index 0000000..cd911d8 --- /dev/null +++ b/jobs/ocreatefile.h @@ -0,0 +1,41 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OCREATEFILE_H +#define OCREATEFILE_H + +#include +#include + +class OCreateFile : public KJob +{ + Q_OBJECT + public: + explicit OCreateFile(KConfigGroup group, QObject* parent =3D 0); + virtual ~OCreateFile(); + + virtual void start(); + + private Q_SLOTS: + void createNetAttach(); + + private: + KConfigGroup m_config; +}; + +#endif //OCREATEFILE_H \ No newline at end of file diff --git a/jobs/oremovecalendar.cpp b/jobs/oremovecalendar.cpp new file mode 100644 index 0000000..4002b66 --- /dev/null +++ b/jobs/oremovecalendar.cpp @@ -0,0 +1,89 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "oremovecalendar.h" +#include "jobs/removeakonadiresource.h" +#include "davGroupware_settings.h" + +#include + +ORemoveCalendar::ORemoveCalendar(KConfigGroup group, QObject* parent) + : KJob(parent) + , m_config(group) +{ + setObjectName(m_config.name()); + setProperty("type", QVariant::fromValue(m_config.readEntry("type"))); +} + +ORemoveCalendar::~ORemoveCalendar() +{ + +} + +void ORemoveCalendar::start() +{ + QMetaObject::invokeMethod(this, "deleteCalendar", Qt::QueuedConnection= ); +} + +void ORemoveCalendar::deleteCalendar() +{ + KConfigGroup services =3D m_config.group("services"); + if (services.readEntry("Contact", 0) =3D=3D 0) { + removeResource(); + return; + } + + removeCalendarsInResource(); +} + +void ORemoveCalendar::removeResource() +{ + RemoveAkonadiResource *remove =3D new RemoveAkonadiResource("contactAn= dCalendarResource", "Calendar", m_config, this); + connect(remove, SIGNAL(finished(KJob*)), this, SLOT(resourceRemoved())= ); + remove->start(); +} + +void ORemoveCalendar::removeCalendarsInResource() +{ + org::kde::Akonadi::davGroupware::Settings *settings =3D new org::kde::= Akonadi::davGroupware::Settings(m_config.group("private").readEntry("contac= tAndCalendarResource"), "/Settings", QDBusConnection::sessionBus()); + + QStringList list =3D settings->remoteUrls().value(); + Q_FOREACH(const QString &url, list) { + if (url.contains("CalDav")) { + list.removeOne(url); + } + } + kDebug() << "Updated list: " << list; + settings->setRemoteUrls(list); + + settings->writeConfig(); + + if (m_config.group("services").readEntry("Contact", 0) =3D=3D 0) { + removeResource(); + return; + } + + resourceRemoved(); +} + +void ORemoveCalendar::resourceRemoved() +{ + m_config.group("services").writeEntry("Calendar", 0); + emitResult(); +} + diff --git a/jobs/oremovecalendar.h b/jobs/oremovecalendar.h new file mode 100644 index 0000000..7559dfa --- /dev/null +++ b/jobs/oremovecalendar.h @@ -0,0 +1,46 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OREMOVE_CALENDAR_H +#define OREMOVE_CALENDAR_H + +#include +#include + +class ORemoveCalendar : public KJob +{ + Q_OBJECT + public: + explicit ORemoveCalendar(KConfigGroup group, QObject* parent); + virtual ~ORemoveCalendar(); + + virtual void start(); + + protected Q_SLOTS: + void deleteCalendar(); + void removeResource(); + void resourceRemoved(); + + private Q_SLOTS: + void removeCalendarsInResource(); + + private: + KConfigGroup m_config; +}; + +#endif //OREMOVE_CONTACT_H diff --git a/jobs/oremovecontact.cpp b/jobs/oremovecontact.cpp new file mode 100644 index 0000000..0d68914 --- /dev/null +++ b/jobs/oremovecontact.cpp @@ -0,0 +1,89 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "oremovecontact.h" +#include "jobs/removeakonadiresource.h" +#include "davGroupware_settings.h" + +#include + +ORemoveContact::ORemoveContact(KConfigGroup group, QObject* parent) + : KJob(parent) + , m_config(group) +{ + setObjectName(m_config.name()); + setProperty("type", QVariant::fromValue(m_config.readEntry("type"))); +} + +ORemoveContact::~ORemoveContact() +{ + +} + +void ORemoveContact::start() +{ + QMetaObject::invokeMethod(this, "deleteContact", Qt::QueuedConnection); +} + +void ORemoveContact::deleteContact() +{ + KConfigGroup services =3D m_config.group("services"); + if (services.readEntry("Calendar", 0) =3D=3D 0) { + removeResource(); + return; + } + + removeCalendarsInResource(); +} + +void ORemoveContact::removeResource() +{ + RemoveAkonadiResource *remove =3D new RemoveAkonadiResource("contactAn= dCalendarResource", "Contact", m_config, this); + connect(remove, SIGNAL(finished(KJob*)), this, SLOT(resourceRemoved())= ); + remove->start(); +} + +void ORemoveContact::removeCalendarsInResource() +{ + org::kde::Akonadi::davGroupware::Settings *settings =3D new org::kde::= Akonadi::davGroupware::Settings(m_config.group("private").readEntry("contac= tAndCalendarResource"), "/Settings", QDBusConnection::sessionBus()); + + QStringList list =3D settings->remoteUrls().value(); + Q_FOREACH(const QString &url, list) { + if (url.contains("CardDav")) { + list.removeOne(url); + } + } + kDebug() << "Updated list: " << list; + settings->setRemoteUrls(list); + + settings->writeConfig(); + + if (m_config.group("services").readEntry("Calendar", 0) =3D=3D 0) { + removeResource(); + return; + } + + resourceRemoved(); +} + +void ORemoveContact::resourceRemoved() +{ + m_config.group("services").writeEntry("Contact", 0); + emitResult(); +} + diff --git a/jobs/oremovecontact.h b/jobs/oremovecontact.h new file mode 100644 index 0000000..ec01721 --- /dev/null +++ b/jobs/oremovecontact.h @@ -0,0 +1,46 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OREMOVE_CONTACT_H +#define OREMOVE_CONTACT_H + +#include +#include + +class ORemoveContact : public KJob +{ + Q_OBJECT + public: + explicit ORemoveContact(KConfigGroup group, QObject* parent); + virtual ~ORemoveContact(); + + virtual void start(); + + protected Q_SLOTS: + void deleteContact(); + void removeResource(); + void resourceRemoved(); + + private Q_SLOTS: + void removeCalendarsInResource(); + + private: + KConfigGroup m_config; +}; + +#endif //OREMOVE_CONTACT_H \ No newline at end of file diff --git a/jobs/oremovefile.cpp b/jobs/oremovefile.cpp new file mode 100644 index 0000000..0216fd9 --- /dev/null +++ b/jobs/oremovefile.cpp @@ -0,0 +1,49 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#include "oremovefile.h" + +#include + +#include + +ORemoveFile::ORemoveFile(KConfigGroup group, QObject* parent) + : KJob(parent) + , m_config(group) +{ + setObjectName(m_config.name()); + setProperty("type", QVariant::fromValue(m_config.readEntry("type"))); +} + +ORemoveFile::~ORemoveFile() +{ + +} + +void ORemoveFile::start() +{ + QMetaObject::invokeMethod(this, "removeFile", Qt::QueuedConnection); +} + +void ORemoveFile::removeFile() +{ + QFile::remove(m_config.group("private").readEntry("fileDesktop")); + org::kde::KDirNotify::emitFilesAdded( "remote:/" ); + m_config.group("services").writeEntry("File", 0); + emitResult(); +} diff --git a/jobs/oremovefile.h b/jobs/oremovefile.h new file mode 100644 index 0000000..6eec22a --- /dev/null +++ b/jobs/oremovefile.h @@ -0,0 +1,41 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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. = * + * = * + * You should have received a copy of the GNU General Public License = * + * along with this program; if not, write to the Free Software = * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OREMOVEFILE_H +#define OREMOVEFILE_H + +#include +#include + +class ORemoveFile : public KJob +{ + Q_OBJECT + public: + explicit ORemoveFile(KConfigGroup group, QObject* parent =3D 0); + virtual ~ORemoveFile(); + + virtual void start(); + + private Q_SLOTS: + void removeFile(); + + private: + KConfigGroup m_config; +}; + +#endif //OREMOVEFILE_H \ No newline at end of file diff --git a/jobs/org.kde.Akonadi.davGroupware.Settings.xml b/jobs/org.kde.= Akonadi.davGroupware.Settings.xml new file mode 100644 index 0000000..3b0e5c1 --- /dev/null +++ b/jobs/org.kde.Akonadi.davGroupware.Settings.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file