From 5f5e7a1f89e9c7c2e87039a404a96b85b47f7584 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 9 Feb 2016 08:36:01 +0100 Subject: [PATCH] Added some ownCloud plugin class files. --- CMakeLists.txt | 2 + src/definitions/definitions.h.in | 1 + src/miscellaneous/application.cpp | 2 + src/services/owncloud/definitions.h | 7 ++ .../owncloud/owncloudserviceentrypoint.cpp | 69 +++++++++++++++++ .../owncloud/owncloudserviceentrypoint.h | 40 ++++++++++ src/services/owncloud/owncloudserviceroot.cpp | 77 +++++++++++++++++++ src/services/owncloud/owncloudserviceroot.h | 49 ++++++++++++ src/services/tt-rss/definitions.h | 6 +- 9 files changed, 250 insertions(+), 3 deletions(-) create mode 100755 src/services/owncloud/definitions.h create mode 100755 src/services/owncloud/owncloudserviceentrypoint.cpp create mode 100755 src/services/owncloud/owncloudserviceentrypoint.h create mode 100755 src/services/owncloud/owncloudserviceroot.cpp create mode 100755 src/services/owncloud/owncloudserviceroot.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f631f1b13..5595ee335 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,6 +360,7 @@ file( GLOB APP_SOURCES_GL "src/services/tt-rss/*.cpp" "src/services/tt-rss/gui/*.cpp" "src/services/tt-rss/network/*.cpp" + "src/services/owncloud/*.cpp" "src/network-web/*.cpp" "src/network-web/adblock/*.cpp" "src/*.cpp") @@ -389,6 +390,7 @@ file( GLOB APP_HEADERS "src/services/tt-rss/*.h" "src/services/tt-rss/gui/*.h" "src/services/tt-rss/network/*.h" + "src/services/owncloud/*.h" "src/network-web/*.h" "src/network-web/adblock/*.h") diff --git a/src/definitions/definitions.h.in b/src/definitions/definitions.h.in index 6714c2812..76c73cfc8 100755 --- a/src/definitions/definitions.h.in +++ b/src/definitions/definitions.h.in @@ -40,6 +40,7 @@ #define SERVICE_CODE_STD_RSS "std-rss" #define SERVICE_CODE_TT_RSS "tt-rss" +#define SERVICE_CODE_OWNCLOUD "owncloud" #define ARGUMENTS_LIST_SEPARATOR "\n" diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 91fd6818b..ff5e850a6 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -32,6 +32,7 @@ #include "services/standard/standardserviceroot.h" #include "services/standard/standardserviceentrypoint.h" #include "services/tt-rss/ttrssserviceentrypoint.h" +#include "services/owncloud/owncloudserviceentrypoint.h" #include #include @@ -59,6 +60,7 @@ QList Application::feedServices() { // NOTE: All installed services create their entry points here. m_feedServices.append(new StandardServiceEntryPoint()); m_feedServices.append(new TtRssServiceEntryPoint()); + m_feedServices.append(new OwnCloudServiceEntryPoint()); } return m_feedServices; diff --git a/src/services/owncloud/definitions.h b/src/services/owncloud/definitions.h new file mode 100755 index 000000000..afe3f58e1 --- /dev/null +++ b/src/services/owncloud/definitions.h @@ -0,0 +1,7 @@ +#ifndef OWNCLOUD_DEFINITIONS_H +#define OWNCLOUD_DEFINITIONS_H + +#define API_VERSION "1.2" + +#endif // OWNCLOUD_DEFINITIONS_H + diff --git a/src/services/owncloud/owncloudserviceentrypoint.cpp b/src/services/owncloud/owncloudserviceentrypoint.cpp new file mode 100755 index 000000000..597c04fb9 --- /dev/null +++ b/src/services/owncloud/owncloudserviceentrypoint.cpp @@ -0,0 +1,69 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2016 by Martin Rotter +// +// RSS Guard 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 3 of the License, or +// (at your option) any later version. +// +// RSS Guard 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 RSS Guard. If not, see . + +#include "services/owncloud/owncloudserviceentrypoint.h" + +#include "definitions/definitions.h" +#include "miscellaneous/application.h" +#include "miscellaneous/iconfactory.h" +#include "services/owncloud/definitions.h" + + +OwnCloudServiceEntryPoint::OwnCloudServiceEntryPoint() { +} + +OwnCloudServiceEntryPoint::~OwnCloudServiceEntryPoint() { +} + +ServiceRoot *OwnCloudServiceEntryPoint::createNewRoot() const { + // TODO: TODO + return NULL; +} + +QList OwnCloudServiceEntryPoint::initializeSubtree() const { + // TODO: TODO + return QList(); +} + +bool OwnCloudServiceEntryPoint::isSingleInstanceService() const { + return false; +} + +QString OwnCloudServiceEntryPoint::name() const { + return QSL("ownCloud News"); +} + +QString OwnCloudServiceEntryPoint::code() const { + return SERVICE_CODE_OWNCLOUD; +} + +QString OwnCloudServiceEntryPoint::description() const { + return QObject::tr("The News app is an RSS/Atom feed aggregator. It is part of ownCloud suite. This plugin implements %1 API.").arg(API_VERSION); +} + +QString OwnCloudServiceEntryPoint::version() const { + return APP_VERSION; +} + +QString OwnCloudServiceEntryPoint::author() const { + return APP_AUTHOR; +} + +QIcon OwnCloudServiceEntryPoint::icon() const { + return qApp->icons()->fromTheme(QSL("application-owncloud")); +} + diff --git a/src/services/owncloud/owncloudserviceentrypoint.h b/src/services/owncloud/owncloudserviceentrypoint.h new file mode 100755 index 000000000..6f4421d00 --- /dev/null +++ b/src/services/owncloud/owncloudserviceentrypoint.h @@ -0,0 +1,40 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2016 by Martin Rotter +// +// RSS Guard 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 3 of the License, or +// (at your option) any later version. +// +// RSS Guard 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 RSS Guard. If not, see . + +#ifndef OWNCLOUDSERVICEENTRYPOINT_H +#define OWNCLOUDSERVICEENTRYPOINT_H + +#include "services/abstract/serviceentrypoint.h" + + +class OwnCloudServiceEntryPoint : public ServiceEntryPoint { + public: + explicit OwnCloudServiceEntryPoint(); + virtual ~OwnCloudServiceEntryPoint(); + + ServiceRoot *createNewRoot() const; + QList initializeSubtree() const; + bool isSingleInstanceService() const; + QString name() const; + QString code() const; + QString description() const; + QString version() const; + QString author() const; + QIcon icon() const; +}; + +#endif // OWNCLOUDSERVICEENTRYPOINT_H diff --git a/src/services/owncloud/owncloudserviceroot.cpp b/src/services/owncloud/owncloudserviceroot.cpp new file mode 100755 index 000000000..bc25a4114 --- /dev/null +++ b/src/services/owncloud/owncloudserviceroot.cpp @@ -0,0 +1,77 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2016 by Martin Rotter +// +// RSS Guard 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 3 of the License, or +// (at your option) any later version. +// +// RSS Guard 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 RSS Guard. If not, see . + +#include "services/owncloud/owncloudserviceroot.h" + +#include "definitions/definitions.h" + + +OwnCloudServiceRoot::OwnCloudServiceRoot(RootItem *parent) : ServiceRoot(parent) { +} + +OwnCloudServiceRoot::~OwnCloudServiceRoot() { +} + +bool OwnCloudServiceRoot::supportsFeedAdding() const { + // TODO: TODO + return false; +} + +bool OwnCloudServiceRoot::supportsCategoryAdding() const { + // TODO: TODO + return false; +} + +QList OwnCloudServiceRoot::addItemMenu() { + // TODO: TODO + return QList(); +} + +QList OwnCloudServiceRoot::serviceMenu() { + // TODO: TODO + return QList(); +} + +RecycleBin *OwnCloudServiceRoot::recycleBin() const { + // TODO: TODO + return NULL; +} + +void OwnCloudServiceRoot::start(bool freshly_activated) { + // TODO: TODO +} + +void OwnCloudServiceRoot::stop() { + // TODO: TODO +} + +QString OwnCloudServiceRoot::code() const { + return SERVICE_CODE_OWNCLOUD; +} + +bool OwnCloudServiceRoot::loadMessagesForItem(RootItem *item, QSqlTableModel *model) { + // TODO: TODO + return false; +} + +void OwnCloudServiceRoot::addNewFeed(const QString &url) { + // TODO: TODO +} + +void OwnCloudServiceRoot::addNewCategory() { + // TODO: TODO +} diff --git a/src/services/owncloud/owncloudserviceroot.h b/src/services/owncloud/owncloudserviceroot.h new file mode 100755 index 000000000..b903448e2 --- /dev/null +++ b/src/services/owncloud/owncloudserviceroot.h @@ -0,0 +1,49 @@ +// This file is part of RSS Guard. +// +// Copyright (C) 2011-2016 by Martin Rotter +// +// RSS Guard 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 3 of the License, or +// (at your option) any later version. +// +// RSS Guard 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 RSS Guard. If not, see . + +#ifndef OWNCLOUDSERVICEROOT_H +#define OWNCLOUDSERVICEROOT_H + +#include "services/abstract/serviceroot.h" + + +class OwnCloudServiceRoot : public ServiceRoot { + public: + explicit OwnCloudServiceRoot(RootItem *parent = NULL); + virtual ~OwnCloudServiceRoot(); + + bool supportsFeedAdding() const; + bool supportsCategoryAdding() const; + + QList addItemMenu(); + QList serviceMenu(); + + RecycleBin *recycleBin() const; + + void start(bool freshly_activated); + void stop(); + + QString code() const; + + bool loadMessagesForItem(RootItem *item, QSqlTableModel *model); + + public slots: + void addNewFeed(const QString &url); + void addNewCategory(); +}; + +#endif // OWNCLOUDSERVICEROOT_H diff --git a/src/services/tt-rss/definitions.h b/src/services/tt-rss/definitions.h index 6b15b60ad..a3e50f045 100755 --- a/src/services/tt-rss/definitions.h +++ b/src/services/tt-rss/definitions.h @@ -1,5 +1,5 @@ -#ifndef DEFINITIONS_H -#define DEFINITIONS_H +#ifndef TTRSS_DEFINITIONS_H +#define TTRSS_DEFINITIONS_H #define MINIMAL_API_LEVEL 9 #define CONTENT_TYPE "application/json; charset=utf-8" @@ -44,4 +44,4 @@ #define UFF_FEED_NOT_FOUND "FEED_NOT_FOUND" #define UFF_OK "OK" -#endif // DEFINITIONS_H +#endif // TTRSS_DEFINITIONS_H