diff --git a/CMakeLists.txt b/CMakeLists.txt index 0656b394b..f78945ddd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) set(PLASMA_NO_KDEWEBKIT TRUE) set(PLASMA_NO_KNEWSTUFF TRUE) set(PLASMA_NO_SOLID TRUE) - # set(PLASMA_NO_KIO TRUE) + set(PLASMA_NO_KIO TRUE) endif(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION) include_directories(${CMAKE_CURRENT_SOURCE_DIR} diff --git a/config-plasma.h.cmake b/config-plasma.h.cmake index 2f544a80b..5edfe18a3 100644 --- a/config-plasma.h.cmake +++ b/config-plasma.h.cmake @@ -4,4 +4,5 @@ #cmakedefine PLASMA_NO_KDEWEBKIT #cmakedefine PLASMA_NO_KNEWSTUFF #cmakedefine PLASMA_NO_SOLID +#cmakedefine PLASMA_NO_KIO diff --git a/containment.cpp b/containment.cpp index 7e3ae9bbf..3e82d6f05 100644 --- a/containment.cpp +++ b/containment.cpp @@ -22,6 +22,8 @@ #include "containment.h" #include "private/containment_p.h" +#include "config-plasma.h" + #include #include #include @@ -44,9 +46,12 @@ #include #include #include + +#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" @@ -1287,7 +1292,9 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS } QObject::connect(AccessManager::self(), SIGNAL(finished(Plasma::AccessAppletJob*)), q, SLOT(remoteAppletReady(Plasma::AccessAppletJob*))); - } else { + } +#ifndef PLASMA_NO_KIO + else { KMimeType::Ptr mime = KMimeType::findByUrl(url); QString mimeName = mime->name(); QRectF geom(pos, QSize()); @@ -1318,6 +1325,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS dropMenus[job] = choices; } +#endif } if (dropEvent) { @@ -1403,11 +1411,13 @@ 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::remoteAppletReady(Plasma::AccessAppletJob *job) @@ -1429,6 +1439,7 @@ void ContainmentPrivate::remoteAppletReady(Plasma::AccessAppletJob *job) void ContainmentPrivate::dropJobResult(KJob *job) { +#ifndef PLASMA_NO_KIO KIO::TransferJob* tjob = dynamic_cast(job); if (!tjob) { kDebug() << "job is not a KIO::TransferJob, won't handle the drop..."; @@ -1441,10 +1452,12 @@ 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(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 = dynamic_cast(job); if (!tjob) { @@ -1562,6 +1575,7 @@ void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimetyp } clearDataForMimeJob(job); +#endif // PLASMA_NO_KIO } const QGraphicsItem *Containment::toolBoxItem() const diff --git a/containment.h b/containment.h index f4e6f8df6..4ffc8f3ee 100644 --- a/containment.h +++ b/containment.h @@ -33,10 +33,6 @@ #include #include -namespace KIO -{ - class Job; -} namespace Plasma { diff --git a/package.cpp b/package.cpp index 66642f21f..59f303cd7 100644 --- a/package.cpp +++ b/package.cpp @@ -33,10 +33,12 @@ #include #include #include +#ifndef PLASMA_NO_KIO #include #include #include #include +#endif #include #include #include @@ -440,17 +442,30 @@ bool Package::installPackage(const QString &package, if (archivedPackage) { // it's in a temp dir, so just move it over. +#ifndef PLASMA_NO_KIO KIO::CopyJob *job = KIO::move(KUrl(path), KUrl(targetName), KIO::HideProgressInfo); - if (!job->exec()) { - kWarning() << "Could not move package to destination:" << targetName << " : " << job->errorString(); + bool ok = job->exec(); + QString errorString = job->errorString(); +#else + bool ok = QFile::rename(path, targetName); + QString errorString("unknown"); +#endif + if (!ok) { + kWarning() << "Could not move package to destination:" << targetName << " : " << errorString; return false; } } else { // it's a directory containing the stuff, so copy the contents rather // than move them +#ifndef PLASMA_NO_KIO KIO::CopyJob *job = KIO::copy(KUrl(path), KUrl(targetName), KIO::HideProgressInfo); - if (!job->exec()) { - kWarning() << "Could not copy package to destination:" << targetName << " : " << job->errorString(); + bool ok = job->exec(); +#else + bool ok = false; // Qt dunno how to recursively copy directories, so don't bother + QString errorString("unknown"); +#endif + if (!ok) { + kWarning() << "Could not copy package to destination:" << targetName << " : " << errorString; return false; } } @@ -476,8 +491,15 @@ bool Package::installPackage(const QString &package, QString serviceName = servicePrefix + meta.pluginName(); QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop"); +#ifndef PLASMA_NO_KIO KIO::FileCopyJob *job = KIO::file_copy(metaPath, service, -1, KIO::HideProgressInfo); - if (job->exec()) { + bool ok = job->exec(); + QString errorString = job->errorString(); +#else + bool ok = QFile::copy(metaPath, service); + QString errorString("unknown"); +#endif + if (ok) { // the icon in the installed file needs to point to the icon in the // installation dir! QString iconPath = targetName + '/' + cg.readEntry("Icon"); @@ -488,7 +510,7 @@ bool Package::installPackage(const QString &package, cg.writeEntry("Icon", iconPath); } } else { - kWarning() << "Could not register package as service (this is not necessarily fatal):" << serviceName << " : " << job->errorString(); + kWarning() << "Could not register package as service (this is not necessarily fatal):" << serviceName << " : " << errorString; } } @@ -518,9 +540,16 @@ bool Package::uninstallPackage(const QString &pluginName, kWarning() << "Unable to remove " << service; } +#ifndef PLASMA_NO_KIO KIO::DeleteJob *job = KIO::del(KUrl(targetName)); - if (!job->exec()) { - kWarning() << "Could not delete package from:" << targetName << " : " << job->errorString(); + ok = job->exec(); + QString errorString = job->errorString(); +#else + ok = QFile::remove(targetName); + QString errorString("unknown"); +#endif + if (!ok) { + kWarning() << "Could not delete package from:" << targetName << " : " << errorString; return false; } @@ -553,8 +582,12 @@ bool Package::registerPackage(const PackageMetadata &data, const QString &iconPa iconPath.right(iconPath.length() - iconPath.lastIndexOf("/"))); cg.writeEntry("Icon", installedIcon); installedIcon = KStandardDirs::locateLocal("icon", installedIcon); +#ifndef PLASMA_NO_KIO KIO::FileCopyJob *job = KIO::file_copy(iconPath, installedIcon, -1, KIO::HideProgressInfo); job->exec(); +#else + QFile::copy(iconPath, installedIcon); +#endif } return true; diff --git a/packagestructure.cpp b/packagestructure.cpp index 42aef9a4a..f049ae885 100644 --- a/packagestructure.cpp +++ b/packagestructure.cpp @@ -19,12 +19,16 @@ #include "packagestructure.h" +#include "config-plasma.h" + #include #include #include #include +#ifndef PLASMA_NO_KIO #include +#endif #include #include #include @@ -183,7 +187,9 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat) KConfig config(url.toLocalFile(), KConfig::SimpleConfig); structure->read(&config); PackageStructurePrivate::structures[structure->type()] = structure; - } else { + } +#ifndef PLASMA_NO_KIO + else { KTemporaryFile tmp; if (tmp.open()) { KIO::Job *job = KIO::file_copy(url, KUrl(tmp.fileName()), @@ -195,6 +201,7 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat) } } } +#endif return structure; } diff --git a/private/applet_p.h b/private/applet_p.h index 41a8745bc..4ddef3e57 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -34,11 +34,6 @@ class KKeySequenceWidget; -namespace KIO -{ - class Job; -} - namespace Plasma { diff --git a/private/associatedapplicationmanager.cpp b/private/associatedapplicationmanager.cpp index 2ef263314..cf8bbe5fc 100644 --- a/private/associatedapplicationmanager.cpp +++ b/private/associatedapplicationmanager.cpp @@ -19,13 +19,21 @@ #include "associatedapplicationmanager_p.h" +#include "config-plasma.h" + #include #include #include -#include #include +#ifndef PLASMA_NO_KIO +#include +#else +#include +#include +#endif + #include "plasma/applet.h" namespace Plasma @@ -110,13 +118,30 @@ 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 + QDesktopServices::openUrl(d->urlLists.value(applet).first()); +#endif } } diff --git a/private/containment_p.h b/private/containment_p.h index 864961b65..b116f38c9 100644 --- a/private/containment_p.h +++ b/private/containment_p.h @@ -30,6 +30,11 @@ static const int VERTICAL_STACKING_OFFSET = 10000; class KJob; +namespace KIO +{ + class Job; +} + namespace Plasma { diff --git a/wallpaper.cpp b/wallpaper.cpp index e7076dac1..3eb4f845e 100644 --- a/wallpaper.cpp +++ b/wallpaper.cpp @@ -73,7 +73,7 @@ class SaveImageThread : public QRunnable m_image.save(m_filePath); } }; - + LoadImageThread::LoadImageThread(const QString &filePath) { m_filePath = filePath; @@ -638,7 +638,7 @@ void Wallpaper::insertIntoCache(const QString& key, const QImage &image) KIO::file_delete(d->cachePath(key)); #else QFile f(d->cachePath(key)); - f.remove(): + f.remove(); #endif } else { QThreadPool::globalInstance()->start(new SaveImageThread(image, d->cachePath(key))); diff --git a/widgets/videowidget.cpp b/widgets/videowidget.cpp index fab169e16..2ad5c75d4 100644 --- a/widgets/videowidget.cpp +++ b/widgets/videowidget.cpp @@ -19,13 +19,21 @@ #include "videowidget.h" +#include "config-plasma.h" + #include #include #include #include #include +#include + +#ifndef PLASMA_NO_KIO #include +#else +#include +#endif #include #include @@ -150,7 +158,11 @@ void VideoWidgetPrivate::volumeChanged(qreal value) void VideoWidgetPrivate::showOpenFileDialog() { +#ifndef PLASMA_NO_KIO openFile(KFileDialog::getOpenFileName()); +#else + openFile(QFileDialog::getOpenFileName()); +#endif } void VideoWidgetPrivate::openFile(const QString &path)