diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ include(KDECMakeSettings) include(KReportMacros) +include(KReportAddIconsRccFile) # Dependencies set(REQUIRED_QT_VERSION "5.3.0") diff --git a/cmake/modules/KReportAddIconsRccFile.cmake b/cmake/modules/KReportAddIconsRccFile.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/KReportAddIconsRccFile.cmake @@ -0,0 +1,87 @@ +# Copyright (C) 2016 Jarosław Staniek +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +add_custom_target(update_all_rcc + COMMENT "Updating all file lists for rcc icons files" +) + +# Builds and install an rcc file with icons. +# - resource subdirectory in the current build subdir is created +# - ${_target}.qrc is created based on icons/${_theme}/files.cmake +# - ${_target}.rcc is generated using rcc-qt5 +# - if _prefix is not empty, icons are placed in icons/${_prefix}/${_theme} path (useful for plugins) +# - dependency for the parent target ${_parent_target} is added +# - the .rcc file is installed to ${ICONS_INSTALL_DIR} +# - update_${_target} target is added for requesting update of icons/${_theme}/files.cmake +# - adds a update_all_rcc target that executes commands for all targets created with kreport_add_icons_rcc_file() +macro(kreport_add_icons_rcc_file _target _parent_target _theme _prefix) + set(_RESOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/resource) + set(_QRC_FILE "${_RESOURCE_DIR}/${_target}.qrc") + set(_RCC_FILE "${CMAKE_CURRENT_BINARY_DIR}/${_target}.rcc") + include(icons/${_theme}/files.cmake) + + add_custom_target(${_target}_copy_icons + COMMAND ${CMAKE_COMMAND} -E remove_directory ${_RESOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${_RESOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E copy_directory icons/${_theme} ${_RESOURCE_DIR}/icons/${_prefix}/${_theme} + COMMAND ${CMAKE_COMMAND} -E remove -f ${_RESOURCE_DIR}/CMakeLists.txt + COMMAND ${CMAKE_COMMAND} -E remove -f ${_RESOURCE_DIR}/icons/${_prefix}/${_theme}/files.cmake + DEPENDS "${_FILES}" + SOURCES "${_FILES}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Copying icon files to ${_RESOURCE_DIR}" + VERBATIM + ) + + add_custom_target(${_target}_build_qrc + COMMAND ${Qt5Core_RCC_EXECUTABLE} --project -o "${CMAKE_CURRENT_BINARY_DIR}/${_target}.qrc" + # avoid adding the .qrc file to rcc due to rcc misfeature + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/${_target}.qrc" "${_QRC_FILE}" + DEPENDS "${_FILES}" + SOURCES "${_FILES}" + WORKING_DIRECTORY "${_RESOURCE_DIR}" + COMMENT "Building Qt resource file ${_QRC_FILE}" + VERBATIM + ) + add_dependencies(${_target}_build_qrc ${_target}_copy_icons) + + add_custom_target(${_target}_build_rcc + COMMAND ${Qt5Core_RCC_EXECUTABLE} --compress 9 --threshold 0 --binary + --output "${_RCC_FILE}" "${_QRC_FILE}" + #COMMAND ${CMAKE_COMMAND} -E remove -f ${_QRC_FILE} + DEPENDS "${_QRC_FILE}" "${_FILES}" + WORKING_DIRECTORY "${_RESOURCE_DIR}" + COMMENT "Building external Qt resource ${_RCC_FILE}" + VERBATIM + ) + add_dependencies(${_target}_build_rcc ${_target}_build_qrc) + + add_dependencies(${_parent_target} ${_target}_build_rcc) + + install(FILES + ${_RCC_FILE} + DESTINATION "${ICONS_INSTALL_DIR}" + ) + + add_update_file_target( + TARGET update_${_target} + COMMAND "${PROJECT_SOURCE_DIR}/cmake/modules/update_icon_list.sh" + ${_theme} icons/${_theme}/files.cmake + FILE ${_target}_files.cmake + SOURCES "${PROJECT_SOURCE_DIR}/cmake/modules/update_icon_list.sh" + ) + add_dependencies(update_all_rcc update_${_target}) + + unset(_RESOURCE_DIR) + unset(_QRC_FILE) + unset(_RCC_FILE) +endmacro() + +# Convenience macro for plugin icons. Icons are places in a path that contains _plugin_target. +# For example, icons/org.kde.kreport.barcode/breeze/actions/16/kreport-barcode-element.svg. +# This helps to make plugins not conflicting. +macro(kreport_add_plugin_icons_rcc_file _plugin_target _theme) + kreport_add_icons_rcc_file(${_plugin_target}_${_theme} ${_plugin_target} ${_theme} ${_plugin_target}) +endmacro() diff --git a/cmake/modules/KReportMacros.cmake b/cmake/modules/KReportMacros.cmake --- a/cmake/modules/KReportMacros.cmake +++ b/cmake/modules/KReportMacros.cmake @@ -24,6 +24,22 @@ set(PROJECT_STABLE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) endif() +if(WIN32) + set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS} + ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} ) + set(DATA_INSTALL_DIR "$ENV{APPDATA}") + STRING(REGEX REPLACE "\\\\" "/" DATA_INSTALL_DIR ${DATA_INSTALL_DIR}) + # Install own icons to CMAKE_INSTALL_FULL_ICONDIR (relative to bin/data/ on Windows) on Windows. + # We're consistent because icons from breeze-icons.git are installed there as well. + set(ICONS_INSTALL_DIR ${CMAKE_INSTALL_FULL_ICONDIR}) +else() + # On other OSes install own icons in app's data dir + set(ICONS_INSTALL_DIR + "${DATA_INSTALL_DIR}/${PROJECT_NAME_LOWER}${PROJECT_STABLE_VERSION_MAJOR}/icons") +endif() + # Adds a feature info using add_feature_info() with _NAME and _DESCRIPTION. # If _NAME is equal to _DEFAULT, shows this fact. macro(add_simple_feature_info _NAME _DESCRIPTION _DEFAULT) @@ -150,3 +166,21 @@ unset(_target_upper) unset(_var) endmacro() + +# Adds custom target ${_target} that updates file ${_file} in the current working dir +# using command ${_command} and add sources ${_sources} to the project files. +# The command is run as a part of the project. +function(add_update_file_target) + set(options) + set(oneValueArgs TARGET FILE) + set(multiValueArgs COMMAND SOURCES) + cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + add_custom_target(${ARG_TARGET} + COMMAND ${ARG_COMMAND} + SOURCES ${ARG_SOURCES} + DEPENDS ${ARG_SOURCES} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Updating ${ARG_FILE}" + VERBATIM + ) +endfunction() diff --git a/cmake/modules/update_icon_list.sh b/cmake/modules/update_icon_list.sh new file mode 100755 --- /dev/null +++ b/cmake/modules/update_icon_list.sh @@ -0,0 +1,51 @@ +#!/bin/sh +# +# This file is part of the KDE project +# Copyright (C) 2016 Jarosław Staniek +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library 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 +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# Updates list of icon files in icons/$1/ and outputs to $2. +# Used by kreport_add_icons_rcc_file() cmake macro. +# +set -e + +theme=$1 +output=$2 +if [ -z "$theme" ] ; then echo "Theme name required as first argument"; exit 1; fi +if [ -z "$output" ] ; then echo "Output .cmake file required as second argument"; exit 1; fi +script=$(basename $0) + +function content() +{ + echo "# List of project's own icon files" + echo "# This file is generated by $script" + echo "# WARNING! All changes made in this file will be lost!" + echo + echo "set(_PNG_FILES" + find icons/$theme/ -name \*png | sed "s/\.\///g" | sort + echo ")" + echo + + echo "set(_SVG_FILES" + find icons/$theme/ -name \*svg | sed "s/\.\///g" | sort + echo ")" + echo + + echo "set(_FILES \${_PNG_FILES} \${_SVG_FILES})" +} + +content > $output diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -16,4 +16,4 @@ KReportExampleData.cpp ) add_executable(kreportexample ${kreportexample_SRCS}) -target_link_libraries(kreportexample Qt5::Widgets KReport) +target_link_libraries(kreportexample KF5::ConfigGui KReport) diff --git a/examples/main.cpp b/examples/main.cpp --- a/examples/main.cpp +++ b/examples/main.cpp @@ -21,6 +21,7 @@ #include "window.h" #include +#include //static const char description[] = "An example application for the KReport library"; @@ -31,7 +32,7 @@ QCoreApplication::setApplicationName("KReportExample"); QCoreApplication::setApplicationVersion(KREPORT_VERSION_STRING); QCoreApplication::setOrganizationDomain("kde.org"); - + (void)KReportPrivate::setupGlobalIconTheme(); Window window; window.show(); diff --git a/src/common/KReportPluginManager.cpp b/src/common/KReportPluginManager.cpp --- a/src/common/KReportPluginManager.cpp +++ b/src/common/KReportPluginManager.cpp @@ -1,6 +1,6 @@ /* This file is part of the KDE project Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) - Copyright (C) 2015 Jarosław Staniek + Copyright (C) 2015-2016 Jarosław Staniek This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -22,6 +22,7 @@ #include "KReportPluginManagerPrivate.h" #include "KReportPluginMetaData.h" #include "KReportJsonTrader_p.h" +#include "KReportUtils_p.h" #include "kreport_debug.h" #include @@ -219,9 +220,20 @@ //! @todo check version KReportPluginEntry *entry = new KReportPluginEntry; entry->setMetaData(loader); + if (!KReportPrivate::setupPrivateIconsResourceWithMessage( + QLatin1String(KREPORT_BASE_NAME_LOWER), + QString::fromLatin1("icons/%1_%2.rcc") + .arg(entry->metaData()->id()).arg(KReportPrivate::supportedIconTheme), + QtWarningMsg, + QString::fromLatin1(":/icons/%1").arg(entry->metaData()->id()))) + { + delete entry; + continue; + } m_plugins.insert(entry->metaData()->id(), entry); - if (entry->metaData()->id().startsWith(QLatin1String("org.kde.kreport"))) { - m_pluginsByLegacyName.insert(entry->metaData()->value(QLatin1String("X-KDE-PluginInfo-LegacyName"), entry->metaData()->id()), entry); + const QString legacyName(entry->metaData()->value(QLatin1String("X-KDE-PluginInfo-LegacyName"), entry->metaData()->id())); + if (!legacyName.isEmpty() && entry->metaData()->id().startsWith(QLatin1String("org.kde.kreport"))) { + m_pluginsByLegacyName.insert(legacyName, entry); } } m_findPlugins = false; @@ -240,6 +252,9 @@ KReportPluginManager::KReportPluginManager() : d(new Private(this)) { + KReportPrivate::setupPrivateIconsResourceWithMessage( + QLatin1String(KREPORT_BASE_NAME_LOWER), + QString::fromLatin1("icons/kreport_%1.rcc").arg(KReportPrivate::supportedIconTheme), QtFatalMsg); } KReportPluginManager::~KReportPluginManager() diff --git a/src/common/KReportSectionData.cpp b/src/common/KReportSectionData.cpp --- a/src/common/KReportSectionData.cpp +++ b/src/common/KReportSectionData.cpp @@ -105,7 +105,7 @@ { m_set = new KPropertySet(this); KReportDesigner::addMetaProperties(m_set, - tr("Section", "Report section"), QLatin1String("kreport_section_element")); + tr("Section", "Report section"), QLatin1String("kreport-section-element")); m_height = new KProperty("height", KReportUnit(KReportUnit::Centimeter).fromUserValue(2.0), tr("Height")); m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); diff --git a/src/common/KReportUtils_p.h b/src/common/KReportUtils_p.h new file mode 100644 --- /dev/null +++ b/src/common/KReportUtils_p.h @@ -0,0 +1,346 @@ +/* This file is part of the KDE project + Copyright (C) 2015-2016 Jarosław Staniek + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KREPORTUTILS_P_H +#define KREPORTUTILS_P_H + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// This is a private code made inline for use in the lib and examples. +//! @todo Move to a shared lib to use in other Kexi libraries as well. + +namespace KReportPrivate { + +//! @todo Support other themes +const QString supportedIconTheme = QLatin1String("breeze"); + +//! @brief @return true if @a path is readable +bool fileReadable(const QString &path) +{ + return !path.isEmpty() && QFileInfo(path).isReadable(); +} + +//! @brief Used for a workaround: locations for QStandardPaths::AppDataLocation end with app name. +//! If this is not an expected app but for example a test app, replace +//! the subdir name with app name so we can find resource file(s). +QStringList correctStandardLocations(const QString &privateName, + QStandardPaths::StandardLocation location, + const QString &extraLocation) +{ + QStringList result; + if (!privateName.isEmpty()) { + QRegularExpression re(QLatin1Char('/') + QCoreApplication::applicationName() + QLatin1Char('$')); + QStringList standardLocations(QStandardPaths::standardLocations(location)); + if (!extraLocation.isEmpty()) { + standardLocations.append(extraLocation); + } + for(const QString &dir : standardLocations) { + if (dir.indexOf(re) != -1) { + QString realDir(dir); + realDir.replace(re, QLatin1Char('/') + privateName); + result.append(realDir); + } + } + } + return result; +} + +/*! @brief Locates a file path for specified parameters + * @param privateName Name to be used instead of application name for resource lookup + * @param path Relative path to the resource file + * @param location Standard file location to use for file lookup + * @param extraLocation Extra directory path for file lookup + * @return Empty string on failure + */ +QString locateFile(const QString &privateName, + const QString& path, QStandardPaths::StandardLocation location, + const QString &extraLocation) +{ + // let QStandardPaths handle this, it will look for app local stuff + QString fullPath = QFileInfo( + QStandardPaths::locate(location, path)).canonicalFilePath(); + if (fileReadable(fullPath)) { + return fullPath; + } + + // Try extra location + fullPath = QFileInfo(extraLocation + QLatin1Char('/') + path).canonicalFilePath(); + if (fileReadable(fullPath)) { + return fullPath; + } + + const QStringList correctedStandardLocations(correctStandardLocations(privateName, location, extraLocation)); + for(const QString &dir : correctedStandardLocations) { + fullPath = QFileInfo(dir + QLatin1Char('/') + path).canonicalFilePath(); + if (fileReadable(fullPath)) { + return fullPath; + } + } + return QString(); +} + +/*! @brief Registers icons resource file + * @param privateName Name to be used instead of application name for resource lookup + * @param path Relative path to the resource file + * @param location Standard file location to use for file lookup + * @param resourceRoot A resource root for QResource::registerResource() + * @param errorMessage On failure it is set to a brief error message. + * @param errorDescription On failure it is set to a detailed error message. + * other for warning + */ +bool registerIconsResource(const QString &privateName, const QString& path, + QStandardPaths::StandardLocation location, + const QString &resourceRoot, const QString &extraLocation, + QString *errorMessage, QString *detailedErrorMessage) +{ + const QString fullPath = locateFile(privateName, path, location, extraLocation); + if (fullPath.isEmpty() || !QFileInfo(fullPath).isReadable() + || !QResource::registerResource(fullPath, resourceRoot)) + { + QStringList triedLocations(QStandardPaths::standardLocations(location)); + if (!extraLocation.isEmpty()) { + triedLocations.append(extraLocation); + } + triedLocations.append(correctStandardLocations(privateName, location, extraLocation)); + const QString triedLocationsString = QLocale().createSeparatedList(triedLocations); +#ifdef QT_ONLY + *errorMessage = QString("Could not open icon resource file %1.").arg(path); + *detailedErrorMessage = QString("Tried to find in %1.").arg(triedLocationsString); +#else + //! @todo 3.1 Re-add translation + *errorMessage = /*QObject::tr*/ QString::fromLatin1( + "Could not open icon resource file \"%1\". " + "Application will not start. " + "Please check if it is properly installed.") + .arg(QFileInfo(path).fileName()); + //! @todo 3.1 Re-add translation + *detailedErrorMessage = QString::fromLatin1("Tried to find in %1.").arg(triedLocationsString); +#endif + return false; + } + *errorMessage = QString(); + *detailedErrorMessage = QString(); + return true; +} + +/*! @brief Registers a global icon resource file + * @param themeName A name of icon theme to use. + * @param errorMessage On failure it is set to a brief error message. + * @param errorDescription On failure it is set to a detailed error message. + * other for warning + */ +bool registerGlobalIconsResource(const QString &themeName, + QString *errorMessage, + QString *detailedErrorMessage) +{ + QString extraLocation; +#ifdef CMAKE_INSTALL_FULL_ICONDIR + extraLocation = QDir::fromNativeSeparators(QFile::decodeName(CMAKE_INSTALL_FULL_ICONDIR)); + if (extraLocation.endsWith("/icons")) { + extraLocation.chop(QLatin1String("/icons").size()); + } +#elif defined(Q_OS_WIN) + extraLocation = QCoreApplication::applicationDirPath() + QStringLiteral("/data"); +#endif + return registerIconsResource(QString(), QString::fromLatin1("icons/%1/%1-icons.rcc").arg(themeName), + QStandardPaths::GenericDataLocation, + QStringLiteral("/icons/") + themeName, + extraLocation, errorMessage, + detailedErrorMessage); +} + +/*! @brief Registers a global icon resource file + * @param themeName A name of icon theme to use. + */ +bool registerGlobalIconsResource(const QString &themeName) +{ + QString errorMessage; + QString detailedErrorMessage; + if (!registerGlobalIconsResource(themeName, &errorMessage, &detailedErrorMessage)) { + if (detailedErrorMessage.isEmpty()) { + KMessageBox::error(nullptr, errorMessage); + } else { + KMessageBox::detailedError(nullptr, errorMessage, detailedErrorMessage); + } + qWarning() << qPrintable(errorMessage); + return false; + } + return true; +} + +/*! @brief Registers a global icon resource file for default theme name. + */ +bool registerGlobalIconsResource() +{ + return registerGlobalIconsResource(supportedIconTheme); +} + +/*! @brief Sets up a private icon resource file + * @return @c false on failure and sets error message. Does not warn or exit on failure. + * @param privateName Name to be used instead of application name for resource lookup + * @param path Relative path to the resource file + * @param themeName Icon theme to use. It affects filename. + * @param errorMessage On failure it is set to a brief error message + * @param errorDescription On failure it is set to a detailed error message + * other for warning + * @param prefix Resource path prefix. The default is useful for library-global resource, + * other values is useful for plugins. + */ +bool setupPrivateIconsResource(const QString &privateName, const QString& path, + const QString &themeName, + QString *errorMessage, QString *detailedErrorMessage, + const QString &prefix = QLatin1String(":/icons")) +{ + // Register application's resource first to have priority over the theme. + // Some icons may exists in both resources. + if (!registerIconsResource(privateName, path, + QStandardPaths::AppDataLocation, + QString(), QString(), errorMessage, detailedErrorMessage)) + { + return false; + } + bool changeTheme = false; +#ifdef QT_GUI_LIB + QIcon::setThemeSearchPaths(QStringList() << prefix << QIcon::themeSearchPaths()); + changeTheme = 0 != QIcon::themeName().compare(themeName, Qt::CaseInsensitive); + if (changeTheme) { + QIcon::setThemeName(themeName); + } +#endif + + KConfigGroup cg(KSharedConfig::openConfig(), "Icons"); + changeTheme = changeTheme || 0 != cg.readEntry("Theme", QString()).compare(themeName, Qt::CaseInsensitive); + // tell KIconLoader an co. about the theme + if (changeTheme) { + cg.writeEntry("Theme", themeName); + cg.sync(); + } + return true; +} + +/*! @brief Sets up a private icon resource file + * @return @c false on failure and sets error message. + * @param privateName Name to be used instead of application name for resource lookup + * @param path Relative path to the resource file + * @param themeName Icon theme to use. It affects filename. + * @param errorMessage On failure it is set to a brief error message. + * @param errorDescription On failure it is set to a detailed error message. + * other for warning + * @param prefix Resource path prefix. The default is useful for library-global resource, + * other values is useful for plugins. + */ +bool setupPrivateIconsResourceWithMessage(const QString &privateName, const QString& path, + const QString &themeName, + QString *errorMessage, QString *detailedErrorMessage, + const QString &prefix = QLatin1String(":/icons")) +{ + if (!setupPrivateIconsResource(privateName, path, themeName, + errorMessage, detailedErrorMessage, prefix)) + { + if (detailedErrorMessage->isEmpty()) { + KMessageBox::error(nullptr, *errorMessage); + } else { + KMessageBox::detailedError(nullptr, *errorMessage, *detailedErrorMessage); + } + return false; + } + return true; +} + +/*! @overload setupPrivateIconsResourceWithMessage(QString &privateName, const QString& path, + const QString &themeName, + QString *errorMessage, QString *detailedErrorMessage, + const QString &prefix = QLatin1String(":/icons")) + Uses default theme name. + */ +bool setupPrivateIconsResourceWithMessage(const QString &privateName, const QString& path, + QString *errorMessage, QString *detailedErrorMessage, + const QString &prefix = QLatin1String(":/icons")) +{ + return setupPrivateIconsResourceWithMessage(privateName, path, supportedIconTheme, + errorMessage, detailedErrorMessage, prefix); +} + +/*! @brief Sets up a private icon resource file + * Warns on failure and returns @c false. + * @param privateName Name to be used instead of application name for resource lookup + * @param path Relative path to the resource file + * @param messageType Type of message to use on error, QtFatalMsg for fatal exit and any + * other for warning + * @param prefix Resource path prefix. The default is useful for library-global resource, + * other values is useful for plugins. + */ +bool setupPrivateIconsResourceWithMessage(const QString &privateName, const QString& path, + QtMsgType messageType, + const QString &prefix = QLatin1String(":/icons")) +{ + QString errorMessage; + QString detailedErrorMessage; + if (!setupPrivateIconsResourceWithMessage(privateName, path, + &errorMessage, &detailedErrorMessage, prefix)) { + if (messageType == QtFatalMsg) { + qFatal("%s %s", qPrintable(errorMessage), qPrintable(detailedErrorMessage)); + } else { + qWarning() << qPrintable(errorMessage) << qPrintable(detailedErrorMessage); + } + return false; + } + return true; +} + +//! Sets up a global icon theme if it is different from supported. +//! Warns on failure and returns @c false. +bool setupGlobalIconTheme() +{ + if (0 != QIcon::themeName().compare(supportedIconTheme, Qt::CaseInsensitive)) { + const QString message = QString::fromLatin1( + "\"%1\" supports only \"%2\" icon theme but current system theme is \"%3\". " + "Application's icon theme will be changed to \"%2\". " + "Please consider adding support for other themes to %4.") + .arg(QLatin1String(KREPORT_BASE_NAME)).arg(supportedIconTheme).arg(QIcon::themeName()) + .arg(QCoreApplication::applicationName()); + qDebug() << qPrintable(message); + if (!registerGlobalIconsResource()) { + // don't fail, just warn + const QString message = QString::fromLatin1( + "Failed to set icon theme to \"%1\". Icons in the application will be inconsistent. " + "Please install .rcc file(s) for the system theme.") + .arg(supportedIconTheme); + qDebug() << qPrintable(message); + return false; + } + } + return true; +} + +} // KReportPrivate + +#endif diff --git a/src/items/check/check.json b/src/items/check/check.json --- a/src/items/check/check.json +++ b/src/items/check/check.json @@ -43,7 +43,7 @@ "Description[uk]": "Елемент пункту позначки для звітів", "Description[x-test]": "xxCheck box element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_checkbox_element", + "Icon": "kreport-checkbox-element", "Id": "org.kde.kreport.checkbox", "License": "LGPL", "Name": "Check box", @@ -72,4 +72,4 @@ }, "X-KDE-PluginInfo-LegacyName": "check", "X-KReport-Priority": "5" -} \ No newline at end of file +} diff --git a/src/items/field/field.json b/src/items/field/field.json --- a/src/items/field/field.json +++ b/src/items/field/field.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент поля для звітів", "Description[x-test]": "xxField element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_field_element", + "Icon": "kreport-field-element", "Id": "org.kde.kreport.field", "License": "LGPL", "Name": "Field", @@ -71,4 +71,4 @@ }, "X-KDE-PluginInfo-LegacyName": "field", "X-KReport-Priority": "1" -} \ No newline at end of file +} diff --git a/src/items/image/image.json b/src/items/image/image.json --- a/src/items/image/image.json +++ b/src/items/image/image.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент зображення для звітів", "Description[x-test]": "xxImage element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_image_element", + "Icon": "kreport-image-element", "Id": "org.kde.kreport.image", "License": "LGPL", "Name": "Image", @@ -71,4 +71,4 @@ }, "X-KDE-PluginInfo-LegacyName": "image", "X-KReport-Priority": "1" -} \ No newline at end of file +} diff --git a/src/items/label/label.json b/src/items/label/label.json --- a/src/items/label/label.json +++ b/src/items/label/label.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент мітки для звітів", "Description[x-test]": "xxLabel element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_label_element", + "Icon": "kreport-label-element", "Id": "org.kde.kreport.label", "License": "LGPL", "Name": "Label", @@ -70,4 +70,4 @@ }, "X-KDE-PluginInfo-LegacyName": "label", "X-KReport-Priority": "1" -} \ No newline at end of file +} diff --git a/src/items/text/text.json b/src/items/text/text.json --- a/src/items/text/text.json +++ b/src/items/text/text.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент тексту для звітів", "Description[x-test]": "xxText element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_text_element", + "Icon": "kreport-text-element", "Id": "org.kde.kreport.text", "License": "LGPL", "Name": "Text", @@ -65,4 +65,4 @@ }, "X-KDE-PluginInfo-LegacyName": "text", "X-KReport-Priority": "1" -} \ No newline at end of file +} diff --git a/src/pics/CMakeLists.txt b/src/pics/CMakeLists.txt --- a/src/pics/CMakeLists.txt +++ b/src/pics/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(hicolor) +kreport_add_icons_rcc_file(kreport_breeze KReport breeze "") diff --git a/src/pics/hicolor/CMakeLists.txt b/src/pics/hicolor/CMakeLists.txt deleted file mode 100644 --- a/src/pics/hicolor/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -ecm_install_icons(ICONS - 16-actions-kreport_checkbox_element.svg 22-actions-kreport_checkbox_element.svg - 16-actions-kreport_field_element.svg 22-actions-kreport_field_element.svg - 16-actions-kreport_image_element.svg 22-actions-kreport_image_element.svg - 16-actions-kreport_label_element.svg 22-actions-kreport_label_element.svg - 16-actions-kreport_line_element.svg 22-actions-kreport_line_element.svg - 16-actions-kreport_text_element.svg 22-actions-kreport_text_element.svg - - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/src/pics/hicolor/16-actions-kreport_checkbox_element.svg b/src/pics/icons/breeze/actions/16/kreport-checkbox-element.svg rename from src/pics/hicolor/16-actions-kreport_checkbox_element.svg rename to src/pics/icons/breeze/actions/16/kreport-checkbox-element.svg diff --git a/src/pics/hicolor/16-actions-kreport_field_element.svg b/src/pics/icons/breeze/actions/16/kreport-field-element.svg rename from src/pics/hicolor/16-actions-kreport_field_element.svg rename to src/pics/icons/breeze/actions/16/kreport-field-element.svg diff --git a/src/pics/hicolor/16-actions-kreport_image_element.svg b/src/pics/icons/breeze/actions/16/kreport-image-element.svg rename from src/pics/hicolor/16-actions-kreport_image_element.svg rename to src/pics/icons/breeze/actions/16/kreport-image-element.svg diff --git a/src/pics/hicolor/16-actions-kreport_label_element.svg b/src/pics/icons/breeze/actions/16/kreport-label-element.svg rename from src/pics/hicolor/16-actions-kreport_label_element.svg rename to src/pics/icons/breeze/actions/16/kreport-label-element.svg diff --git a/src/pics/hicolor/16-actions-kreport_line_element.svg b/src/pics/icons/breeze/actions/16/kreport-line-element.svg rename from src/pics/hicolor/16-actions-kreport_line_element.svg rename to src/pics/icons/breeze/actions/16/kreport-line-element.svg diff --git a/src/pics/hicolor/16-actions-kreport_text_element.svg b/src/pics/icons/breeze/actions/16/kreport-text-element.svg rename from src/pics/hicolor/16-actions-kreport_text_element.svg rename to src/pics/icons/breeze/actions/16/kreport-text-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_checkbox_element.svg b/src/pics/icons/breeze/actions/22/kreport-checkbox-element.svg rename from src/pics/hicolor/22-actions-kreport_checkbox_element.svg rename to src/pics/icons/breeze/actions/22/kreport-checkbox-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_field_element.svg b/src/pics/icons/breeze/actions/22/kreport-field-element.svg rename from src/pics/hicolor/22-actions-kreport_field_element.svg rename to src/pics/icons/breeze/actions/22/kreport-field-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_image_element.svg b/src/pics/icons/breeze/actions/22/kreport-image-element.svg rename from src/pics/hicolor/22-actions-kreport_image_element.svg rename to src/pics/icons/breeze/actions/22/kreport-image-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_label_element.svg b/src/pics/icons/breeze/actions/22/kreport-label-element.svg rename from src/pics/hicolor/22-actions-kreport_label_element.svg rename to src/pics/icons/breeze/actions/22/kreport-label-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_line_element.svg b/src/pics/icons/breeze/actions/22/kreport-line-element.svg rename from src/pics/hicolor/22-actions-kreport_line_element.svg rename to src/pics/icons/breeze/actions/22/kreport-line-element.svg diff --git a/src/pics/hicolor/22-actions-kreport_text_element.svg b/src/pics/icons/breeze/actions/22/kreport-text-element.svg rename from src/pics/hicolor/22-actions-kreport_text_element.svg rename to src/pics/icons/breeze/actions/22/kreport-text-element.svg diff --git a/src/pics/icons/breeze/files.cmake b/src/pics/icons/breeze/files.cmake new file mode 100644 --- /dev/null +++ b/src/pics/icons/breeze/files.cmake @@ -0,0 +1,23 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kreport-checkbox-element.svg +icons/breeze/actions/16/kreport-field-element.svg +icons/breeze/actions/16/kreport-image-element.svg +icons/breeze/actions/16/kreport-label-element.svg +icons/breeze/actions/16/kreport-line-element.svg +icons/breeze/actions/16/kreport-text-element.svg +icons/breeze/actions/22/kreport-checkbox-element.svg +icons/breeze/actions/22/kreport-field-element.svg +icons/breeze/actions/22/kreport-image-element.svg +icons/breeze/actions/22/kreport-label-element.svg +icons/breeze/actions/22/kreport-line-element.svg +icons/breeze/actions/22/kreport-text-element.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/plugins/barcode/CMakeLists.txt b/src/plugins/barcode/CMakeLists.txt --- a/src/plugins/barcode/CMakeLists.txt +++ b/src/plugins/barcode/CMakeLists.txt @@ -16,21 +16,22 @@ code128paint.cpp KReportBarcodePlugin.cpp ${kreport_barcodeplugin_QM_LOADER} + kreport_barcodeplugin.json ) if(KREPORT_SCRIPTING) list(APPEND kreport_barcodeplugin_LIB_SRCS KReportScriptBarcode.cpp ) endif() -add_library(kreport_barcodeplugin MODULE ${kreport_barcodeplugin_LIB_SRCS}) +add_library(org.kde.kreport.barcode MODULE ${kreport_barcodeplugin_LIB_SRCS}) -target_link_libraries(kreport_barcodeplugin +target_link_libraries(org.kde.kreport.barcode PUBLIC KReport ) -install(TARGETS kreport_barcodeplugin DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) +install(TARGETS org.kde.kreport.barcode DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) add_subdirectory(pics) diff --git a/src/plugins/barcode/kreport_barcodeplugin.json b/src/plugins/barcode/kreport_barcodeplugin.json --- a/src/plugins/barcode/kreport_barcodeplugin.json +++ b/src/plugins/barcode/kreport_barcodeplugin.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент штрихкоду для звітів", "Description[x-test]": "xxBarcode element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_barcode_element", + "Icon": "kreport-barcode-element", "Id": "org.kde.kreport.barcode", "License": "LGPL", "Name": "Barcode", @@ -71,4 +71,4 @@ }, "X-KDE-PluginInfo-LegacyName": "barcode", "X-KReport-Priority": "50" -} \ No newline at end of file +} diff --git a/src/plugins/barcode/pics/CMakeLists.txt b/src/plugins/barcode/pics/CMakeLists.txt --- a/src/plugins/barcode/pics/CMakeLists.txt +++ b/src/plugins/barcode/pics/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(hicolor) +kreport_add_plugin_icons_rcc_file(org.kde.kreport.barcode breeze) diff --git a/src/plugins/barcode/pics/hicolor/CMakeLists.txt b/src/plugins/barcode/pics/hicolor/CMakeLists.txt deleted file mode 100644 --- a/src/plugins/barcode/pics/hicolor/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -ecm_install_icons(ICONS - 16-actions-kreport_barcode_element.svg 22-actions-kreport_barcode_element.svg - - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/src/plugins/barcode/pics/hicolor/16-actions-kreport_barcode_element.svg b/src/plugins/barcode/pics/icons/breeze/actions/16/kreport-barcode-element.svg rename from src/plugins/barcode/pics/hicolor/16-actions-kreport_barcode_element.svg rename to src/plugins/barcode/pics/icons/breeze/actions/16/kreport-barcode-element.svg diff --git a/src/plugins/barcode/pics/hicolor/22-actions-kreport_barcode_element.svg b/src/plugins/barcode/pics/icons/breeze/actions/22/kreport-barcode-element.svg rename from src/plugins/barcode/pics/hicolor/22-actions-kreport_barcode_element.svg rename to src/plugins/barcode/pics/icons/breeze/actions/22/kreport-barcode-element.svg diff --git a/src/plugins/barcode/pics/icons/breeze/files.cmake b/src/plugins/barcode/pics/icons/breeze/files.cmake new file mode 100644 --- /dev/null +++ b/src/plugins/barcode/pics/icons/breeze/files.cmake @@ -0,0 +1,13 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kreport-barcode-element.svg +icons/breeze/actions/22/kreport-barcode-element.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/plugins/chart/CMakeLists.txt b/src/plugins/chart/CMakeLists.txt --- a/src/plugins/chart/CMakeLists.txt +++ b/src/plugins/chart/CMakeLists.txt @@ -14,15 +14,15 @@ ) endif() -add_library(kreport_chartplugin MODULE ${kreport_chartplugin_LIB_SRCS}) +add_library(org.kde.kreport.chart MODULE ${kreport_chartplugin_LIB_SRCS}) -target_link_libraries(kreport_chartplugin +target_link_libraries(org.kde.kreport.chart PUBLIC KReport PRIVATE KChart ) -install(TARGETS kreport_chartplugin DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) +install(TARGETS org.kde.kreport.chart DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) add_subdirectory(pics) diff --git a/src/plugins/chart/kreport_chartplugin.json b/src/plugins/chart/kreport_chartplugin.json --- a/src/plugins/chart/kreport_chartplugin.json +++ b/src/plugins/chart/kreport_chartplugin.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент діаграми для звітів", "Description[x-test]": "xxChart element for Reportsxx", "EnabledByDefault": true, - "Icon": "report_chart_element", + "Icon": "report-chart-element", "Id": "org.kde.kreport.chart", "License": "LGPL", "Name": "Chart", @@ -70,4 +70,4 @@ }, "X-KDE-PluginInfo-LegacyName": "chart", "X-KReport-Priority": "50" -} \ No newline at end of file +} diff --git a/src/plugins/chart/pics/CMakeLists.txt b/src/plugins/chart/pics/CMakeLists.txt --- a/src/plugins/chart/pics/CMakeLists.txt +++ b/src/plugins/chart/pics/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(hicolor) +kreport_add_plugin_icons_rcc_file(org.kde.kreport.chart breeze) diff --git a/src/plugins/chart/pics/hicolor/CMakeLists.txt b/src/plugins/chart/pics/hicolor/CMakeLists.txt deleted file mode 100644 --- a/src/plugins/chart/pics/hicolor/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -ecm_install_icons(ICONS - 16-actions-kreport_chart_element.svg 22-actions-kreport_chart_element.svg - - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/src/plugins/chart/pics/hicolor/16-actions-kreport_chart_element.svg b/src/plugins/chart/pics/icons/breeze/actions/16/kreport-chart-element.svg rename from src/plugins/chart/pics/hicolor/16-actions-kreport_chart_element.svg rename to src/plugins/chart/pics/icons/breeze/actions/16/kreport-chart-element.svg diff --git a/src/plugins/chart/pics/hicolor/22-actions-kreport_chart_element.svg b/src/plugins/chart/pics/icons/breeze/actions/22/kreport-chart-element.svg rename from src/plugins/chart/pics/hicolor/22-actions-kreport_chart_element.svg rename to src/plugins/chart/pics/icons/breeze/actions/22/kreport-chart-element.svg diff --git a/src/plugins/chart/pics/icons/breeze/files.cmake b/src/plugins/chart/pics/icons/breeze/files.cmake new file mode 100644 --- /dev/null +++ b/src/plugins/chart/pics/icons/breeze/files.cmake @@ -0,0 +1,13 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kreport-charts-element.svg +icons/breeze/actions/22/kreport-charts-element.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/plugins/maps/CMakeLists.txt b/src/plugins/maps/CMakeLists.txt --- a/src/plugins/maps/CMakeLists.txt +++ b/src/plugins/maps/CMakeLists.txt @@ -8,25 +8,26 @@ KReportMapsPlugin.cpp KReportMapRenderer.cpp ${kreport_mapsplugin_QM_LOADER} + kreport_mapsplugin.json ) if(KREPORT_SCRIPTING) list(APPEND kreport_mapsplugin_LIB_SRCS KReportScriptMaps.cpp ) endif() -add_library(kreport_mapsplugin MODULE ${kreport_mapsplugin_LIB_SRCS}) +add_library(org.kde.kreport.maps MODULE ${kreport_mapsplugin_LIB_SRCS}) -target_link_libraries(kreport_mapsplugin +target_link_libraries(org.kde.kreport.maps PUBLIC KReport PRIVATE Marble ) ########### install files ############### -install(TARGETS kreport_mapsplugin DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) +install(TARGETS org.kde.kreport.maps DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) add_subdirectory(pics) diff --git a/src/plugins/maps/kreport_mapsplugin.json b/src/plugins/maps/kreport_mapsplugin.json --- a/src/plugins/maps/kreport_mapsplugin.json +++ b/src/plugins/maps/kreport_mapsplugin.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент карти для звітів", "Description[x-test]": "xxMaps element for Reportsxx", "EnabledByDefault": true, - "Icon": "kreport_maps_element", + "Icon": "kreport-maps-element", "Id": "org.kde.kreport.maps", "License": "LGPL", "Name": "Maps", @@ -71,4 +71,4 @@ }, "X-KDE-PluginInfo-LegacyName": "maps", "X-KReport-Priority": "50" -} \ No newline at end of file +} diff --git a/src/plugins/maps/pics/CMakeLists.txt b/src/plugins/maps/pics/CMakeLists.txt --- a/src/plugins/maps/pics/CMakeLists.txt +++ b/src/plugins/maps/pics/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(hicolor) +kreport_add_plugin_icons_rcc_file(org.kde.kreport.maps breeze) diff --git a/src/plugins/maps/pics/hicolor/CMakeLists.txt b/src/plugins/maps/pics/hicolor/CMakeLists.txt deleted file mode 100644 --- a/src/plugins/maps/pics/hicolor/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -ecm_install_icons(ICONS - 16-actions-kreport_maps_element.svg 22-actions-kreport_maps_element.svg - - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/src/plugins/maps/pics/hicolor/16-actions-kreport_maps_element.svg b/src/plugins/maps/pics/icons/breeze/actions/16/kreport-maps-element.svg rename from src/plugins/maps/pics/hicolor/16-actions-kreport_maps_element.svg rename to src/plugins/maps/pics/icons/breeze/actions/16/kreport-maps-element.svg diff --git a/src/plugins/maps/pics/hicolor/22-actions-kreport_maps_element.svg b/src/plugins/maps/pics/icons/breeze/actions/22/kreport-maps-element.svg rename from src/plugins/maps/pics/hicolor/22-actions-kreport_maps_element.svg rename to src/plugins/maps/pics/icons/breeze/actions/22/kreport-maps-element.svg diff --git a/src/plugins/maps/pics/icons/breeze/files.cmake b/src/plugins/maps/pics/icons/breeze/files.cmake new file mode 100644 --- /dev/null +++ b/src/plugins/maps/pics/icons/breeze/files.cmake @@ -0,0 +1,13 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kreport-maps-element.svg +icons/breeze/actions/22/kreport-maps-element.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/plugins/web/CMakeLists.txt b/src/plugins/web/CMakeLists.txt --- a/src/plugins/web/CMakeLists.txt +++ b/src/plugins/web/CMakeLists.txt @@ -9,17 +9,17 @@ ${kreport_webplugin_QM_LOADER} ) -add_library(kreport_webplugin MODULE ${kreport_webplugin_LIB_SRCS}) +add_library(org.kde.kreport.web MODULE ${kreport_webplugin_LIB_SRCS}) -target_link_libraries(kreport_webplugin +target_link_libraries(org.kde.kreport.web PUBLIC KReport PRIVATE Qt5::WebKitWidgets # TODO WebEngineWidgets? ) ########### install files ############### -install(TARGETS kreport_webplugin DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) +install(TARGETS org.kde.kreport.web DESTINATION ${KREPORT_PLUGIN_INSTALL_DIR}) add_subdirectory(pics) diff --git a/src/plugins/web/kreport_webplugin.json b/src/plugins/web/kreport_webplugin.json --- a/src/plugins/web/kreport_webplugin.json +++ b/src/plugins/web/kreport_webplugin.json @@ -42,7 +42,7 @@ "Description[uk]": "Елемент засобу для перегляду інтернету для звітів", "Description[x-test]": "xxWeb browser element for Reportsxx", "EnabledByDefault": true, - "Icon": "report_web_element", + "Icon": "report-web-element", "Id": "org.kde.kreport.web", "License": "LGPL", "Name": "Web browser", @@ -66,4 +66,4 @@ }, "X-KDE-PluginInfo-LegacyName": "web", "X-KReport-Priority": "50" -} \ No newline at end of file +} diff --git a/src/plugins/web/pics/CMakeLists.txt b/src/plugins/web/pics/CMakeLists.txt --- a/src/plugins/web/pics/CMakeLists.txt +++ b/src/plugins/web/pics/CMakeLists.txt @@ -1 +1 @@ -add_subdirectory(hicolor) +kreport_add_plugin_icons_rcc_file(org.kde.kreport.web breeze) diff --git a/src/plugins/web/pics/hicolor/CMakeLists.txt b/src/plugins/web/pics/hicolor/CMakeLists.txt deleted file mode 100644 --- a/src/plugins/web/pics/hicolor/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -ecm_install_icons(ICONS - 16-actions-kreport_web_element.svg 22-actions-kreport_web_element.svg - - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor -) diff --git a/src/plugins/web/pics/hicolor/16-actions-kreport_web_element.svg b/src/plugins/web/pics/icons/breeze/actions/16/kreport-web-element.svg rename from src/plugins/web/pics/hicolor/16-actions-kreport_web_element.svg rename to src/plugins/web/pics/icons/breeze/actions/16/kreport-web-element.svg diff --git a/src/plugins/web/pics/hicolor/22-actions-kreport_web_element.svg b/src/plugins/web/pics/icons/breeze/actions/22/kreport-web-element.svg rename from src/plugins/web/pics/hicolor/22-actions-kreport_web_element.svg rename to src/plugins/web/pics/icons/breeze/actions/22/kreport-web-element.svg diff --git a/src/plugins/web/pics/icons/breeze/files.cmake b/src/plugins/web/pics/icons/breeze/files.cmake new file mode 100644 --- /dev/null +++ b/src/plugins/web/pics/icons/breeze/files.cmake @@ -0,0 +1,13 @@ +# List of project's own icon files +# This file is generated by update_icon_list.sh +# WARNING! All changes made in this file will be lost! + +set(_PNG_FILES +) + +set(_SVG_FILES +icons/breeze/actions/16/kreport-web-element.svg +icons/breeze/actions/22/kreport-web-element.svg +) + +set(_FILES ${_PNG_FILES} ${_SVG_FILES}) diff --git a/src/wrtembed/KReportDesigner.h b/src/wrtembed/KReportDesigner.h --- a/src/wrtembed/KReportDesigner.h +++ b/src/wrtembed/KReportDesigner.h @@ -274,7 +274,7 @@ /** * @brief Adds meta-properties to the property set @a set for consumption by property editor * - "this:classString" - user-visible translated name of element type, e.g. tr("Label") - * - "this:iconName" - name of user-visible icon, e.g. "kreport_label_element" + * - "this:iconName" - name of user-visible icon, e.g. "kreport-label-element" * * All the properties are set to invisible. * @see propertySet() diff --git a/src/wrtembed/KReportDesigner.cpp b/src/wrtembed/KReportDesigner.cpp --- a/src/wrtembed/KReportDesigner.cpp +++ b/src/wrtembed/KReportDesigner.cpp @@ -214,6 +214,8 @@ void KReportDesigner::init() { + KReportPluginManager::self(); // this loads icons early enough + d->sectionData = new ReportWriterSectionData(); createProperties(); createActions(); @@ -721,7 +723,7 @@ QStringList keys, strings; d->set = new KPropertySet; KReportDesigner::addMetaProperties(d->set, - tr("Report", "Main report element"), QLatin1String("kreport_report_element")); + tr("Report", "Main report element"), QLatin1String("kreport-report-element")); connect(d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); @@ -997,7 +999,7 @@ if (d->sectionData->insertItem == QLatin1String("org.kde.kreport.line")) { item = new KReportDesignerItemLine(v->designer(), v->scene(), pos, end); classString = tr("Line", "Report line element"); - iconName = QLatin1String("kreport_line_element"); + iconName = QLatin1String("kreport-line-element"); } else { KReportPluginManager* pluginManager = KReportPluginManager::self(); @@ -1338,7 +1340,7 @@ QList actList = manager->createActions(group); //! @todo make line a real plugin so this isn't needed: - QAction *act = new QAction(QIcon::fromTheme(QLatin1String("kreport_line_element")), tr("Line"), group); + QAction *act = new QAction(QIcon::fromTheme(QLatin1String("kreport-line-element")), tr("Line"), group); act->setObjectName(QLatin1String("org.kde.kreport.line")); act->setData(9); act->setCheckable(true);