- if (!item) {
- kDebug()<<"//////////////// DROPPED ONÂ EMPTY ZONE";
- // item dropped in empty zone, move it to top level
- QList <QTreeWidgetItem *> list;
- list = selectedItems();
- ProjectItem *clone;
- foreach (QTreeWidgetItem *it, list) {
- QTreeWidgetItem *parent = it->parent();
- if (parent && ((ProjectItem *) it)->clipId() < 10000) {
- kDebug()<<"++ item parent: "<<parent->text(1);
- clone = (ProjectItem* ) parent->takeChild(parent->indexOfChild(it));
- if (clone) addTopLevelItem(clone);
- }
- }
- }
- }
- event->acceptProposedAction();
+ emit showProperties(item->referencedClip());
+}
+
+
+// virtual
+void ProjectListView::dropEvent(QDropEvent *event)
+{
+ FolderProjectItem *item = NULL;
+ QTreeWidgetItem *it = itemAt(event->pos());
+ while (it && it->type() != PROJECTFOLDERTYPE) {
+ it = it->parent();
+ }
+ if (it) item = static_cast <FolderProjectItem *>(it);
+ if (event->mimeData()->hasUrls()) {
+ QString groupName;
+ QString groupId;
+ if (item) {
+ groupName = item->groupName();
+ groupId = item->clipId();
+ }
+ emit addClip(event->mimeData()->urls(), groupName, groupId);
+ event->setDropAction(Qt::CopyAction);
+ event->accept();
+ QTreeWidget::dropEvent(event);
+ return;
+ } else if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
+ if (item) {
+ //emit addClip(event->mimeData->text());
+ const QList <QTreeWidgetItem *> list = selectedItems();
+ ProjectItem *clone;
+ QString parentId = item->clipId();
+ foreach(QTreeWidgetItem *it, list) {
+ // TODO allow dragging of folders ?
+ if (it->type() == PROJECTCLIPTYPE) {
+ if (it->parent()) clone = (ProjectItem*) it->parent()->takeChild(it->parent()->indexOfChild(it));
+ else clone = (ProjectItem*) takeTopLevelItem(indexOfTopLevelItem(it));
+ if (clone) {
+ item->addChild(clone);
+ QMap <QString, QString> props;
+ props.insert("groupname", item->groupName());
+ props.insert("groupid", parentId);
+ clone->setProperties(props);
+ }
+ } else item = NULL;
+ }
+ } else {
+ // item dropped in empty zone, move it to top level
+ const QList <QTreeWidgetItem *> list = selectedItems();
+ ProjectItem *clone;
+ foreach(QTreeWidgetItem *it, list) {
+ QTreeWidgetItem *parent = it->parent();
+ if (parent/* && ((ProjectItem *) it)->clipId() < 10000*/) {
+ kDebug() << "++ item parent: " << parent->text(1);
+ clone = static_cast <ProjectItem*>(parent->takeChild(parent->indexOfChild(it)));
+ if (clone) {
+ addTopLevelItem(clone);
+ clone->clearProperty("groupname");
+ clone->clearProperty("groupid");
+ }
+ }
+ }
+ }
+ emit projectModified();
+ } else if (event->mimeData()->hasFormat("kdenlive/clip")) {
+ QStringList list = QString(event->mimeData()->data("kdenlive/clip")).split(';');
+ emit addClipCut(list.at(0), list.at(1).toInt(), list.at(2).toInt());
+ }
+ event->acceptProposedAction();
+ QTreeWidget::dropEvent(event);