void ProjectList::slotRemoveClip() {
if (!listView->currentItem()) return;
- ProjectItem *item = static_cast <ProjectItem *>(listView->currentItem());
QList <QString> ids;
QMap <QString, QString> folderids;
- if (item->clipType() == FOLDER) folderids[item->groupName()] = item->clipId();
- else ids << item->clipId();
- if (item->numReferences() > 0) {
- if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b> ?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b> ?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
- } else if (item->clipType() == FOLDER && item->childCount() > 0) {
- int children = item->childCount();
- if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b> ?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
- for (int i = 0; i < children; ++i) {
- ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
- ids << child->clipId();
+ QList<QTreeWidgetItem *> selected = listView->selectedItems();
+ ProjectItem *item;
+ for (int i = 0; i < selected.count(); i++) {
+ item = static_cast <ProjectItem *>(selected.at(i));
+ if (item->isGroup()) folderids[item->groupName()] = item->clipId();
+ else ids << item->clipId();
+ if (item->numReferences() > 0) {
+ if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b> ?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b> ?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
+ } else if (item->clipType() == FOLDER && item->childCount() > 0) {
+ int children = item->childCount();
+ if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b> ?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
+ for (int i = 0; i < children; ++i) {
+ ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
+ ids << child->clipId();
+ }
}
}
if (!ids.isEmpty()) m_doc->deleteProjectClip(ids);
}
void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties) {
- const QString parent = clip->toXML().attribute("groupid");
+ const QString parent = clip->getProperty("groupid");
ProjectItem *item = NULL;
- if (parent != 0) {
+ if (!parent.isEmpty()) {
ProjectItem *parentitem = getItemById(parent);
+ if (!parentitem) {
+ QStringList text;
+ QString groupName = clip->getProperty("groupname");
+ if (groupName.isEmpty()) groupName = i18n("Folder");
+ text << QString() << groupName;
+ listView->blockSignals(true);
+ parentitem = new ProjectItem(listView, text, parent);
+ listView->blockSignals(false);
+ }
if (parentitem) item = new ProjectItem(parentitem, clip);
}
if (item == NULL) item = new ProjectItem(listView, clip);