generic: remove build-time compat options

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-10-21 19:57:19 +03:00
parent 73d767817d
commit 93c35e4c15
14 changed files with 69 additions and 208 deletions

View file

@ -6,15 +6,6 @@ endif()
include_directories(${KDE4_KIO_INCLUDES})
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
set(KBUILDSYCOCA_NO_KCRASH TRUE)
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config-kded.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-kded.h
)
########### next target ###############
set(kded_SRCS

View file

@ -1 +0,0 @@
#cmakedefine KBUILDSYCOCA_NO_KCRASH

View file

@ -24,7 +24,6 @@
#include "vfolder_menu.h"
#include <config.h>
#include <config-kded.h>
#include <kservice.h>
#include <kmimetype.h>
@ -43,10 +42,8 @@
#include <klocale.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#ifndef KBUILDSYCOCA_NO_KCRASH
#include <kde_file.h>
#include <kcrash.h>
#endif
#include <QDir>
#include <QFileInfo>
@ -658,9 +655,7 @@ int main(int argc, char **argv)
QCoreApplication k(argc, argv);
KComponentData mainComponent(d);
#ifndef KBUILDSYCOCA_NO_KCRASH
KCrash::setCrashHandler(crashHandler);
#endif
// force generating of KLocale object. if not, the database will get
// be translated

View file

@ -1,35 +1,13 @@
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
set(PLASMA_NO_SOLID TRUE)
set(PLASMA_NO_KIO TRUE)
set(PLASMA_NO_KUTILS TRUE)
set(PLASMA_NO_GLOBAL_SHORTCUTS TRUE)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${KDE4_KDECORE_INCLUDES}
${KDE4_KDEUI_INCLUDES}
${KDE4_KIO_INCLUDES}
${CMAKE_SOURCE_DIR}/plasma/extenders
# for the export headers
${CMAKE_BINARY_DIR}/kutils
)
if(NOT PLASMA_NO_KIO)
include_directories(${KDE4_KIO_INCLUDES})
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} kio)
endif()
if(NOT PLASMA_NO_SOLID)
include_directories(${CMAKE_BINARY_DIR}/solid/)
include_directories(${CMAKE_SOURCE_DIR}/solid/)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} solid)
endif()
configure_file(
config-plasma.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-plasma.h
)
if(ENABLE_TESTING)
add_subdirectory(tests)
endif()
@ -143,9 +121,9 @@ add_library(plasma SHARED ${plasma_LIB_SRCS})
target_link_libraries(plasma PUBLIC
${QT_QTNETWORK_LIBRARY}
${QT_QTSVG_LIBRARY}
${PLASMA_EXTRA_LIBS}
kdecore
kdeui
kio
)
target_link_libraries(plasma PRIVATE ${X11_LIBRARIES})

View file

@ -21,14 +21,40 @@
*/
#include "applet.h"
#include "abstracttoolbox.h"
#include "containment.h"
#include "corona.h"
#include "dataenginemanager.h"
#include "dialog.h"
#include "extenders/extender.h"
#include "extenders/extenderitem.h"
#include "package.h"
#include "plasma.h"
#include "svg.h"
#include "framesvg.h"
#include "popupapplet.h"
#include "theme.h"
#include "view.h"
#include "widgets/iconwidget.h"
#include "widgets/label.h"
#include "widgets/pushbutton.h"
#include "widgets/busywidget.h"
#include "tooltipmanager.h"
#include "wallpaper.h"
#include "paintutils.h"
#include "pluginloader.h"
#include "animations/animation.h"
#include "private/applet_p.h"
#include "config-plasma.h"
#include <plasma/animations/animation.h>
#include <cmath>
#include <limits>
#include "private/applethandle_p.h"
#include "private/extenderitem_p.h"
#include "private/framesvg_p.h"
#include "private/associatedapplicationmanager_p.h"
#include "private/containment_p.h"
#include "private/extenderapplet_p.h"
#include "private/package_p.h"
#include "private/packages_p.h"
#include "private/popupapplet_p.h"
#include "private/service_p.h"
#include <QApplication>
#include <QEvent>
@ -65,44 +91,8 @@
#include <krandom.h>
#include <kconfigskeleton.h>
#ifndef PLASMA_NO_SOLID
#include <solid/powermanagement.h>
#endif
#include "abstracttoolbox.h"
#include "containment.h"
#include "corona.h"
#include "dataenginemanager.h"
#include "dialog.h"
#include "extenders/extender.h"
#include "extenders/extenderitem.h"
#include "package.h"
#include "plasma.h"
#include "svg.h"
#include "framesvg.h"
#include "popupapplet.h"
#include "theme.h"
#include "view.h"
#include "widgets/iconwidget.h"
#include "widgets/label.h"
#include "widgets/pushbutton.h"
#include "widgets/busywidget.h"
#include "tooltipmanager.h"
#include "wallpaper.h"
#include "paintutils.h"
#include "pluginloader.h"
#include "private/applethandle_p.h"
#include "private/extenderitem_p.h"
#include "private/framesvg_p.h"
#include "private/associatedapplicationmanager_p.h"
#include "private/containment_p.h"
#include "private/extenderapplet_p.h"
#include "private/package_p.h"
#include "private/packages_p.h"
#include "private/popupapplet_p.h"
#include "private/service_p.h"
#include <cmath>
#include <limits>
namespace Plasma
{
@ -766,16 +756,6 @@ QString Applet::pluginName() const
return d->appletDescription.pluginName();
}
bool Applet::shouldConserveResources() const
{
#warning TODO: remove this method, applets should use the solid method
#ifndef PLASMA_NO_SOLID
return Solid::PowerManagement::appShouldConserveResources();
#else
return true;
#endif
}
QString Applet::category() const
{
if (!d->appletDescription.isValid()) {
@ -1836,7 +1816,6 @@ void AppletPrivate::addStandardConfigurationPages(KConfigDialog *dialog)
void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
{
#ifndef PLASMA_NO_GLOBAL_SHORTCUTS
if (isContainment) {
return;
}
@ -1856,7 +1835,6 @@ void AppletPrivate::addGlobalShortcutsPage(KConfigDialog *dialog)
QObject::connect(dialog, SIGNAL(applyClicked()), q, SLOT(configDialogFinished()), Qt::UniqueConnection);
QObject::connect(dialog, SIGNAL(okClicked()), q, SLOT(configDialogFinished()), Qt::UniqueConnection);
#endif
}
void AppletPrivate::configDialogFinished()

View file

@ -79,7 +79,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
Q_PROPERTY(bool busy READ isBusy WRITE setBusy)
Q_PROPERTY(bool configurationRequired READ configurationRequired WRITE setConfigurationRequired)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
Q_PROPERTY(bool shouldConserveResources READ shouldConserveResources)
Q_PROPERTY(uint id READ id CONSTANT)
Q_PROPERTY(bool userConfiguring READ isUserConfiguring)
Q_PROPERTY(BackgroundHints backgroundHints READ backgroundHints WRITE setBackgroundHints)
@ -376,14 +375,6 @@ class PLASMA_EXPORT Applet : public QGraphicsWidget
*/
QString pluginName() const;
/**
* Whether the applet should conserve resources. If true, try to avoid doing stuff which
* is computationally heavy. Try to conserve power and resources.
*
* @return true if it should conserve resources, false if it does not.
*/
bool shouldConserveResources() const;
/**
* Returns the icon related to this applet
**/

View file

@ -1,4 +0,0 @@
#cmakedefine PLASMA_NO_SOLID
#cmakedefine PLASMA_NO_KIO
#cmakedefine PLASMA_NO_GLOBAL_SHORTCUTS

View file

@ -21,8 +21,22 @@
#include "containment.h"
#include "private/containment_p.h"
#include "config-plasma.h"
#include "abstracttoolbox.h"
#include "animator.h"
#include "containmentactions.h"
#include "containmentactionspluginsconfig.h"
#include "corona.h"
#include "extender.h"
#include "extenderitem.h"
#include "svg.h"
#include "wallpaper.h"
#include "private/applet_p.h"
#include "private/containmentactionspluginsconfig_p.h"
#include "private/extenderitemmimedata_p.h"
#include "private/extenderapplet_p.h"
#include "private/wallpaper_p.h"
#include "plasma/plasma.h"
#include "animations/animation.h"
#include <QApplication>
#include <QClipboard>
@ -45,31 +59,9 @@
#include <ktemporaryfile.h>
#include <kwindowsystem.h>
#include <kdebug.h>
#ifndef PLASMA_NO_KIO
#include "kio/jobclasses.h" // for KIO::JobFlags
#include "kio/job.h"
#include "kio/scheduler.h"
#endif
#include "abstracttoolbox.h"
#include "animator.h"
#include "containmentactions.h"
#include "containmentactionspluginsconfig.h"
#include "corona.h"
#include "extender.h"
#include "extenderitem.h"
#include "svg.h"
#include "wallpaper.h"
#include "private/applet_p.h"
#include "private/containmentactionspluginsconfig_p.h"
#include "private/extenderitemmimedata_p.h"
#include "private/extenderapplet_p.h"
#include "private/wallpaper_p.h"
#include "plasma/plasma.h"
#include "animations/animation.h"
namespace Plasma
{
@ -1253,7 +1245,6 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
}
} else if (KUrl::List::canDecode(mimeData)) {
foreach (const KUrl &url, KUrl::List::fromMimeData(mimeData)) {
#ifndef PLASMA_NO_KIO
KMimeType::Ptr mime = KMimeType::findByUrl(url);
QString mimeName = mime->name();
QRectF geom(pos, QSize());
@ -1282,7 +1273,6 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
}
dropMenus[job] = choices;
#endif
}
if (dropEvent) {
@ -1368,18 +1358,15 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
void ContainmentPrivate::clearDataForMimeJob(KIO::Job *job)
{
#ifndef PLASMA_NO_KIO
QObject::disconnect(job, 0, q, 0);
dropPoints.remove(job);
KMenu *choices = dropMenus.take(job);
delete choices;
job->kill();
#endif // PLASMA_NO_KIO
}
void ContainmentPrivate::dropJobResult(KJob *job)
{
#ifndef PLASMA_NO_KIO
KIO::TransferJob* tjob = qobject_cast<KIO::TransferJob*>(job);
if (!tjob) {
kDebug() << "job is not a KIO::TransferJob, won't handle the drop...";
@ -1392,12 +1379,10 @@ void ContainmentPrivate::dropJobResult(KJob *job)
// We call mimetypeRetrieved since there might be other mechanisms
// for finding suitable applets. Cleanup happens there as well.
mimeTypeRetrieved(qobject_cast<KIO::Job *>(job), QString());
#endif // PLASMA_NO_KIO
}
void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimetype)
{
#ifndef PLASMA_NO_KIO
kDebug() << "Mimetype Job returns." << mimetype;
KIO::TransferJob* tjob = qobject_cast<KIO::TransferJob*>(job);
if (!tjob) {
@ -1518,7 +1503,6 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimetyp
}
clearDataForMimeJob(job);
#endif // PLASMA_NO_KIO
}

View file

@ -19,7 +19,9 @@
*******************************************************************************/
#include "package.h"
#include "config-plasma.h"
#include "packagemetadata.h"
#include "private/package_p.h"
#include "private/service_p.h"
#include <QDir>
#include <QFile>
@ -32,10 +34,6 @@
#include <kstandarddirs.h>
#include <kdebug.h>
#include "packagemetadata.h"
#include "private/package_p.h"
#include "private/service_p.h"
namespace Plasma
{

View file

@ -18,8 +18,9 @@
*******************************************************************************/
#include "packagestructure.h"
#include "config-plasma.h"
#include "package.h"
#include "private/packages_p.h"
#include "theme.h"
#include <QDirIterator>
#include <QDir>
@ -29,19 +30,13 @@
#include <kconfiggroup.h>
#include <kdebug.h>
#ifndef PLASMA_NO_KIO
#include <kio/job.h>
#endif
#include <kmimetype.h>
#include <kstandarddirs.h>
#include <kservicetypetrader.h>
#include <ktemporaryfile.h>
#include <kurl.h>
#include "package.h"
#include "private/packages_p.h"
#include "theme.h"
namespace Plasma
{
@ -157,9 +152,7 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat)
if (url.isLocalFile()) {
KConfig config(url.toLocalFile(), KConfig::SimpleConfig);
structure->read(&config);
}
#ifndef PLASMA_NO_KIO
else {
} else {
KTemporaryFile tmp;
if (tmp.open()) {
KIO::Job *job = KIO::file_copy(url, KUrl(tmp.fileName()),
@ -170,7 +163,6 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat)
}
}
}
#endif
return structure;
}

View file

@ -18,23 +18,14 @@
*/
#include "associatedapplicationmanager_p.h"
#include "config-plasma.h"
#include "plasma/applet.h"
#include <QHash>
#include <QFile>
#include <kstandarddirs.h>
#include <kicon.h>
#ifndef PLASMA_NO_KIO
#include <krun.h>
#else
#include <QProcess>
#include <QStandardPaths>
#endif
#include "plasma/applet.h"
namespace Plasma
{
@ -115,30 +106,14 @@ KUrl::List AssociatedApplicationManager::urls(const Plasma::Applet *applet) cons
void AssociatedApplicationManager::run(Plasma::Applet *applet)
{
if (d->applicationNames.contains(applet)) {
#ifndef PLASMA_NO_KIO
bool success = KRun::run(d->applicationNames.value(applet), d->urlLists.value(applet), 0);
#else
QString execCommand = d->applicationNames.value(applet);
// Clean-up the %u and friends from the exec command (KRun expect them, not QProcess)
execCommand = execCommand.replace(QRegExp("%[a-z]"), QString());
execCommand = execCommand.trimmed();
QStringList parameters = d->urlLists.value(applet).toStringList();
bool success = QProcess::startDetached(execCommand, parameters);
#endif
if (!success) {
applet->showMessage(KIcon("application-exit"), i18n("There was an error attempting to exec the associated application with this widget."), ButtonOk);
}
} else if (d->urlLists.contains(applet) && !d->urlLists.value(applet).isEmpty()) {
#ifndef PLASMA_NO_KIO
KRun *krun = new KRun(d->urlLists.value(applet).first(), 0);
krun->setAutoDelete(true);
#else
QStandardPaths::openUrl(d->urlLists.value(applet).first());
#endif
}
}

View file

@ -24,9 +24,6 @@
#include "plasma/wallpaper.h"
#include "plasma/plasma.h"
#include "config-plasma.h"
namespace Plasma
{

View file

@ -20,8 +20,9 @@
*/
#include "runnermanager.h"
#include "config-plasma.h"
#include "private/runnerjobs_p.h"
#include "pluginloader.h"
#include "querymatch.h"
#include <QMutex>
#include <QTimer>
@ -33,10 +34,6 @@
#include <kservicetypetrader.h>
#include <kstandarddirs.h>
#include "private/runnerjobs_p.h"
#include "pluginloader.h"
#include "querymatch.h"
//#define MEASURE_PREPTIME
namespace Plasma

View file

@ -19,8 +19,11 @@
*/
#include "wallpaper.h"
#include "config-plasma.h"
#include "plasma/plasma.h"
#include "plasma/package.h"
#include "plasma/private/dataengineconsumer_p.h"
#include "plasma/private/packages_p.h"
#include "plasma/private/wallpaper_p.h"
#include <QColor>
#include <QFile>
@ -37,16 +40,7 @@
#include <kglobal.h>
#include <kservicetypetrader.h>
#include <kstandarddirs.h>
#ifndef PLASMA_NO_KIO
#include <kio/job.h>
#endif
#include "plasma/plasma.h"
#include "plasma/package.h"
#include "plasma/private/dataengineconsumer_p.h"
#include "plasma/private/packages_p.h"
#include "plasma/private/wallpaper_p.h"
static const QByteArray imageFormat = QImageWriter::defaultImageFormat();
@ -598,11 +592,7 @@ void Wallpaper::insertIntoCache(const QString& key, const QImage &image)
if (d->cacheRendering) {
if (image.isNull()) {
#ifndef PLASMA_NO_KIO
KIO::file_delete(d->cachePath(key));
#else
QFile::remove(d->cachePath(key));
#endif
} else {
image.save(d->cachePath(key), imageFormat, 100);
}