in case of job failure, be sure we don't leave the context menu just hanging around there

svn path=/trunk/KDE/kdelibs/; revision=1029846
This commit is contained in:
Aaron J. Seigo 2009-09-30 21:42:05 +00:00
parent 2d2c2ea22f
commit 4cd5189513
3 changed files with 13 additions and 1 deletions

View File

@ -1233,6 +1233,7 @@ void ContainmentPrivate::dropData(QPointF scenePos, QPoint screenPos, QGraphicsS
KIO::JobFlags flags = KIO::HideProgressInfo; KIO::JobFlags flags = KIO::HideProgressInfo;
KIO::TransferJob *job = KIO::get(url, KIO::NoReload, flags); KIO::TransferJob *job = KIO::get(url, KIO::NoReload, flags);
dropPoints[job] = dropEvent->scenePos(); dropPoints[job] = dropEvent->scenePos();
QObject::connect(job, SIGNAL(result(KJob*)), q, SLOT(dropJobResult(KJob*)));
QObject::connect(job, SIGNAL(mimetype(KIO::Job *, const QString&)), QObject::connect(job, SIGNAL(mimetype(KIO::Job *, const QString&)),
q, SLOT(mimeTypeRetrieved(KIO::Job *, const QString&))); q, SLOT(mimeTypeRetrieved(KIO::Job *, const QString&)));
@ -1342,6 +1343,15 @@ void ContainmentPrivate::remoteAppletReady(Plasma::AccessAppletJob *job)
q->addApplet(job->applet(), pos); q->addApplet(job->applet(), pos);
} }
void ContainmentPrivate::dropJobResult(KJob *job)
{
if (job->error()) {
// TODO: error feedback
clearDataForMimeJob(qobject_cast<KIO::Job *>(job));
kDebug() << "ERROR" << job->error() << ' ' << job->errorString();
}
}
void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimetype) void ContainmentPrivate::mimeTypeRetrieved(KIO::Job *job, const QString &mimetype)
{ {
kDebug() << "Mimetype Job returns." << mimetype; kDebug() << "Mimetype Job returns." << mimetype;

View File

@ -586,6 +586,7 @@ class PLASMA_EXPORT Containment : public Applet
* This slot is called when the 'stat' after a job event has finished. * This slot is called when the 'stat' after a job event has finished.
*/ */
Q_PRIVATE_SLOT(d, void mimeTypeRetrieved(KIO::Job *, const QString &)) Q_PRIVATE_SLOT(d, void mimeTypeRetrieved(KIO::Job *, const QString &))
Q_PRIVATE_SLOT(d, void dropJobResult(KJob *))
friend class Applet; friend class Applet;
friend class AppletPrivate; friend class AppletPrivate;

View File

@ -88,6 +88,7 @@ public:
void clearDataForMimeJob(KIO::Job *job); void clearDataForMimeJob(KIO::Job *job);
void remoteAppletReady(Plasma::AccessAppletJob *job); void remoteAppletReady(Plasma::AccessAppletJob *job);
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype); void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
void dropJobResult(KJob *);
void containmentActions(KMenu &desktopMenu); void containmentActions(KMenu &desktopMenu);
void appletActions(KMenu &desktopMenu, Applet *applet, bool includeApplet); void appletActions(KMenu &desktopMenu, Applet *applet, bool includeApplet);
bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet, bool isMouseEvent); bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet, bool isMouseEvent);