Allow to build libplasma without KIO. Only issue is that the
copying/moving/removal of folders is defunct (so is the package install/uninstall). svn path=/trunk/KDE/kdelibs/; revision=1185865
This commit is contained in:
parent
1c77587903
commit
c0f66faad7
@ -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}
|
||||
|
@ -4,4 +4,5 @@
|
||||
#cmakedefine PLASMA_NO_KDEWEBKIT
|
||||
#cmakedefine PLASMA_NO_KNEWSTUFF
|
||||
#cmakedefine PLASMA_NO_SOLID
|
||||
#cmakedefine PLASMA_NO_KIO
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "containment.h"
|
||||
#include "private/containment_p.h"
|
||||
|
||||
#include "config-plasma.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QFile>
|
||||
@ -44,9 +46,12 @@
|
||||
#include <kstandarddirs.h>
|
||||
#include <ktemporaryfile.h>
|
||||
#include <kwindowsystem.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"
|
||||
@ -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<KIO::TransferJob*>(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<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 = dynamic_cast<KIO::TransferJob*>(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
|
||||
|
@ -33,10 +33,6 @@
|
||||
#include <plasma/applet.h>
|
||||
#include <plasma/animator.h>
|
||||
|
||||
namespace KIO
|
||||
{
|
||||
class Job;
|
||||
}
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
49
package.cpp
49
package.cpp
@ -33,10 +33,12 @@
|
||||
#include <karchive.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kdesktopfile.h>
|
||||
#ifndef PLASMA_NO_KIO
|
||||
#include <kio/copyjob.h>
|
||||
#include <kio/deletejob.h>
|
||||
#include <kio/jobclasses.h>
|
||||
#include <kio/job.h>
|
||||
#endif
|
||||
#include <kmimetype.h>
|
||||
#include <kplugininfo.h>
|
||||
#include <kstandarddirs.h>
|
||||
@ -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;
|
||||
|
@ -19,12 +19,16 @@
|
||||
|
||||
#include "packagestructure.h"
|
||||
|
||||
#include "config-plasma.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QMap>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
#ifndef PLASMA_NO_KIO
|
||||
#include <kio/job.h>
|
||||
#endif
|
||||
#include <kmimetype.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kservicetypetrader.h>
|
||||
@ -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;
|
||||
}
|
||||
|
@ -34,11 +34,6 @@
|
||||
|
||||
class KKeySequenceWidget;
|
||||
|
||||
namespace KIO
|
||||
{
|
||||
class Job;
|
||||
}
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
|
@ -19,13 +19,21 @@
|
||||
|
||||
#include "associatedapplicationmanager_p.h"
|
||||
|
||||
#include "config-plasma.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QFile>
|
||||
|
||||
#include <kstandarddirs.h>
|
||||
#include <krun.h>
|
||||
#include <kicon.h>
|
||||
|
||||
#ifndef PLASMA_NO_KIO
|
||||
#include <krun.h>
|
||||
#else
|
||||
#include <QProcess>
|
||||
#include <QDesktopServices>
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,11 @@ static const int VERTICAL_STACKING_OFFSET = 10000;
|
||||
|
||||
class KJob;
|
||||
|
||||
namespace KIO
|
||||
{
|
||||
class Job;
|
||||
}
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
|
@ -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)));
|
||||
|
@ -19,13 +19,21 @@
|
||||
|
||||
#include "videowidget.h"
|
||||
|
||||
#include "config-plasma.h"
|
||||
|
||||
#include <QUrl>
|
||||
#include <QTimer>
|
||||
#include <QGraphicsLinearLayout>
|
||||
#include <QGraphicsSceneResizeEvent>
|
||||
|
||||
#include <kicon.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
#ifndef PLASMA_NO_KIO
|
||||
#include <kfiledialog.h>
|
||||
#else
|
||||
#include <QFileDialog>
|
||||
#endif
|
||||
|
||||
#include <phonon/videowidget.h>
|
||||
#include <phonon/mediaobject.h>
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user