drop icons to desktop support : experimental

svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=672031
This commit is contained in:
Siraj Razick 2007-06-06 03:25:04 +00:00
parent 013fae0a0d
commit de1a88b056
2 changed files with 21 additions and 1 deletions

View File

@ -23,6 +23,7 @@
#include <QDesktopWidget>
#include <QGraphicsSceneDragDropEvent>
#include <QMimeData>
#include <QUrl>
#include <QGraphicsView>
#include <KLocale>
@ -30,10 +31,13 @@
#include <KRun>
#include <KWindowSystem>
#include <KDebug>
#include <kmimetypetrader.h>
#include <kdesktopfile.h>
#include "applet.h"
#include "dataengine.h"
#include "widgets/vboxlayout.h"
#include "widgets/icon.h"
#include "karambamanager.h"
#include "corona.h"
@ -240,6 +244,22 @@ void Corona::dropEvent(QGraphicsSceneDragDropEvent *event)
event->acceptProposedAction();
}
else if (event->mimeData()->hasFormat("text/plain"))
{
QList<QUrl> list;
list = event->mimeData()->urls();
KDesktopFile * desktop = new KDesktopFile(list[0].path());
QStringList data = event->mimeData()->formats();
for (int i = 0; i < data.size(); ++i)
Plasma::Icon * icon = new Plasma::Icon(0);
icon->setIcon(desktop->readIcon());
icon->setSize(128,128);
icon->show();
addItem(icon);
delete desktop;
event->acceptProposedAction();
}
}
void Corona::contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent)

View File

@ -20,7 +20,7 @@
#define CORONA_H
#include <QGraphicsScene>
#include <QMessageBox>
#include "applet.h"
#include "plasma.h"
#include "plasma/plasma_export.h"