diff --git a/CMakeLists.txt b/CMakeLists.txt index 21710020..f147d068 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,96 +1,96 @@ cmake_minimum_required(VERSION 3.5) set(KDEPIM_VERSION_NUMBER "5.11.40") project(akregator VERSION ${KDEPIM_VERSION_NUMBER}) set(KF5_MIN_VERSION "5.57.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMAddTests) include(GenerateExportHeader) include(ECMGenerateHeaders) include(FeatureSummary) include(CheckFunctionExists) include(ECMGeneratePriFile) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMAddAppIcon) include(ECMQtDeclareLoggingCategory) # Do NOT add quote set(KDEPIM_DEV_VERSION alpha) # add an extra space if(DEFINED KDEPIM_DEV_VERSION) set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}") endif() set(KDEPIM_VERSION "${KDEPIM_VERSION_NUMBER}${KDEPIM_DEV_VERSION}") set(KDEPIM_LIB_VERSION "${KDEPIM_VERSION_NUMBER}") set(KDEPIM_LIB_SOVERSION "5") set(QT_REQUIRED_VERSION "5.10.0") set(KONTACTINTERFACE_LIB_VERSION "5.11.40") set(KPIMTEXTEDIT_LIB_VERSION "5.11.40") -set(LIBGRANTLEETHEME_LIB_VERSION_LIB "5.11.40") +set(LIBGRANTLEETHEME_LIB_VERSION_LIB "5.11.41") set(LIBKDEPIM_LIB_VERSION_LIB "5.11.40") set(LIBKLEO_LIB_VERSION_LIB "5.11.40") set(MESSAGELIB_LIB_VERSION_LIB "5.11.40") set(PIMCOMMON_LIB_VERSION_LIB "5.11.40") find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test WebEngine WebEngineWidgets PrintSupport) find_package(Grantlee5 "5.1" CONFIG REQUIRED) # Find KF5 package find_package(KF5Crash ${KF5_MIN_VERSION} REQUIRED) find_package(KF5DocTools ${KF5_MIN_VERSION} REQUIRED) find_package(KF5KCMUtils ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5NotifyConfig ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Parts ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5TextEditor ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Notifications ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Syndication ${KF5_MIN_VERSION} CONFIG REQUIRED) # Find KdepimLibs Package find_package(KF5GrantleeTheme ${LIBGRANTLEETHEME_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5KontactInterface ${KONTACTINTERFACE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION_LIB} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION_LIB} CONFIG REQUIRED) # Fix plugin support for removing theses dependancies find_package(KF5AkonadiMime ${AKONADI_MIMELIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION_LIB} CONFIG REQUIRED) include_directories(${akregator_SOURCE_DIR} ${akregator_BINARY_DIR}) add_definitions(-DTRANSLATION_DOMAIN=\"akregator\") set(CMAKE_CXX_STANDARD 14) #add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) add_subdirectory(export) add_subdirectory(interfaces) add_subdirectory(plugins) add_subdirectory(configuration) add_subdirectory(src) add_subdirectory(kontactplugin) add_subdirectory(kconf_update) install(FILES akregator.renamecategories akregator.categories DESTINATION ${KDE_INSTALL_CONFDIR}) add_subdirectory(doc) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/formatter/grantleeviewformatter.cpp b/src/formatter/grantleeviewformatter.cpp index 31aab9ff..5357177a 100644 --- a/src/formatter/grantleeviewformatter.cpp +++ b/src/formatter/grantleeviewformatter.cpp @@ -1,165 +1,165 @@ /* Copyright (C) 2016-2019 Montel Laurent 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "grantleeviewformatter.h" #include "articlegrantleeobject.h" #include "utils.h" #include "akregatorconfig.h" #include #include #include #include #include #include #include using namespace Akregator; -GrantleeViewFormatter::GrantleeViewFormatter(const QString &htmlFileName, const QString &themePath, const QUrl &imageDir, int deviceDpiY, QObject *parent) - : PimCommon::GenericGrantleeFormatter(htmlFileName, themePath, parent) +GrantleeViewFormatter::GrantleeViewFormatter(const QString &htmlFileName, const QString &themePath, const QUrl &imageDir, int deviceDpiY) + : GrantleeTheme::GenericFormatter(htmlFileName, themePath) , mImageDir(imageDir) , mHtmlArticleFileName(htmlFileName) , mGrantleeThemePath(QStringLiteral("file://") + themePath + QLatin1Char('/')) , mDeviceDpiY(deviceDpiY) { mDirectionString = QApplication::isRightToLeft() ? QStringLiteral("rtl") : QStringLiteral("ltr"); } GrantleeViewFormatter::~GrantleeViewFormatter() { } int GrantleeViewFormatter::pointsToPixel(int pointSize) const { return (pointSize * mDeviceDpiY + 36) / 72; } void GrantleeViewFormatter::addStandardObject(QVariantHash &grantleeObject) { grantleeObject.insert(QStringLiteral("absoluteThemePath"), mGrantleeThemePath); grantleeObject.insert(QStringLiteral("applicationDir"), mDirectionString); grantleeObject.insert(QStringLiteral("standardFamilyFont"), Settings::standardFont()); grantleeObject.insert(QStringLiteral("mediumFontSize"), pointsToPixel(Settings::mediumFontSize())); } QString GrantleeViewFormatter::formatFeed(Akregator::Feed *feed) { setDefaultHtmlMainFile(QStringLiteral("defaultnormalvisitfeed.html")); if (!errorMessage().isEmpty()) { return errorMessage(); } QVariantHash feedObject; addStandardObject(feedObject); feedObject.insert(QStringLiteral("strippedTitle"), Utils::stripTags(feed->title())); QString numberOfArticle; if (feed->unread() == 0) { numberOfArticle = i18n(" (no unread articles)"); } else { numberOfArticle = i18np(" (1 unread article)", " (%1 unread articles)", feed->unread()); } feedObject.insert(QStringLiteral("feedCount"), numberOfArticle); QString feedImage; if (!feed->image().isNull()) { // image QString file = Utils::fileNameForUrl(feed->xmlUrl()); QUrl u(mImageDir); u = u.adjusted(QUrl::RemoveFilename); u.setPath(u.path() + file); feedImage = QStringLiteral("\n").arg(feed->htmlUrl(), u.url()); } else { feedImage = QStringLiteral("
"); } feedObject.insert(QStringLiteral("feedImage"), feedImage); if (!feed->description().isEmpty()) { QString feedDescription; feedDescription = QStringLiteral("
").arg(mDirectionString); feedDescription += i18n("Description: %1
", feed->description()); feedDescription += QStringLiteral("
"); // /description feedObject.insert(QStringLiteral("feedDescription"), feedDescription); } if (!feed->htmlUrl().isEmpty()) { QString feedHomePage; feedHomePage = QStringLiteral("
").arg(mDirectionString); feedHomePage += i18n("Homepage: %2", feed->htmlUrl(), feed->htmlUrl()); feedHomePage += QStringLiteral("
"); // / link feedObject.insert(QStringLiteral("feedHomePage"), feedHomePage); } return render(feedObject); } QString GrantleeViewFormatter::formatFolder(Akregator::Folder *node) { setDefaultHtmlMainFile(QStringLiteral("defaultnormalvisitfolder.html")); if (!errorMessage().isEmpty()) { return errorMessage(); } QVariantHash folderObject; addStandardObject(folderObject); folderObject.insert(QStringLiteral("nodeTitle"), node->title()); QString numberOfArticle; if (node->unread() == 0) { numberOfArticle = i18n(" (no unread articles)"); } else { numberOfArticle = i18np(" (1 unread article)", " (%1 unread articles)", node->unread()); } folderObject.insert(QStringLiteral("nodeCount"), numberOfArticle); return render(folderObject); } QString GrantleeViewFormatter::formatArticles(const QVector
&article, ArticleFormatter::IconOption icon) { setDefaultHtmlMainFile(mHtmlArticleFileName); if (!errorMessage().isEmpty()) { return errorMessage(); } QVariantHash articleObject; QVariantList articlesList; const int nbArticles(article.count()); articlesList.reserve(nbArticles); QList lstObj; lstObj.reserve(nbArticles); for (int i = 0; i < nbArticles; ++i) { ArticleGrantleeObject *articleObj = new ArticleGrantleeObject(mImageDir, article.at(i), icon); articlesList << QVariant::fromValue(static_cast(articleObj)); lstObj.append(articleObj); } articleObject.insert(QStringLiteral("articles"), articlesList); addStandardObject(articleObject); articleObject.insert(QStringLiteral("dateI18n"), i18n("Date")); articleObject.insert(QStringLiteral("commentI18n"), i18n("Comment")); articleObject.insert(QStringLiteral("completeStoryI18n"), i18n("Complete Story")); articleObject.insert(QStringLiteral("authorI18n"), i18n("Author")); articleObject.insert(QStringLiteral("enclosureI18n"), i18n("Enclosure")); const QString str = render(articleObject); qDeleteAll(lstObj); return str; } diff --git a/src/formatter/grantleeviewformatter.h b/src/formatter/grantleeviewformatter.h index b0310f3f..3e55ca92 100644 --- a/src/formatter/grantleeviewformatter.h +++ b/src/formatter/grantleeviewformatter.h @@ -1,50 +1,49 @@ /* Copyright (C) 2016-2019 Montel Laurent 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; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef GRANTLEEVIEWFORMATTER_H #define GRANTLEEVIEWFORMATTER_H -#include "PimCommon/GenericGrantleeFormatter" +#include #include "article.h" #include "articleformatter.h" #include namespace Akregator { class Folder; -class GrantleeViewFormatter : public PimCommon::GenericGrantleeFormatter +class GrantleeViewFormatter : public GrantleeTheme::GenericFormatter { - Q_OBJECT public: - explicit GrantleeViewFormatter(const QString &htmlFileName, const QString &themePath, const QUrl &imageDir, int deviceDpiY, QObject *parent = nullptr); + explicit GrantleeViewFormatter(const QString &htmlFileName, const QString &themePath, const QUrl &imageDir, int deviceDpiY); ~GrantleeViewFormatter(); QString formatArticles(const QVector
&article, ArticleFormatter::IconOption icon); QString formatFolder(Akregator::Folder *node); QString formatFeed(Akregator::Feed *feed); private: void addStandardObject(QVariantHash &grantleeObject); int pointsToPixel(int pointSize) const; QUrl mImageDir; QString mHtmlArticleFileName; QString mDirectionString; QString mGrantleeThemePath; int mDeviceDpiY; }; } #endif // GRANTLEEVIEWFORMATTER_H