ProjectItem *item;
while (*it) {
item = static_cast <ProjectItem *>(*it);
- if (item->numReferences() == 0) item->setSelected(true);
+ if (!item->isGroup() && item->numReferences() == 0) item->setSelected(true);
it++;
}
slotRemoveClip();
KUrl::List urls;
while (*it) {
item = static_cast <ProjectItem *>(*it);
- if (item->numReferences() == 0) {
+ if (!item->isGroup() && item->numReferences() == 0) {
ids << item->clipId();
KUrl url = item->clipUrl();
if (!url.isEmpty()) urls << url;
}
it++;
}
+ // Check that we don't use the URL in another clip
+ QTreeWidgetItemIterator it2(m_listView);
+ while (*it2) {
+ item = static_cast <ProjectItem *>(*it2);
+ if (item->numReferences() > 0) {
+ KUrl url = item->clipUrl();
+ if (!url.isEmpty() && urls.contains(url)) urls.removeAll(url);
+ }
+ it2++;
+ }
+
m_doc->deleteProjectClip(ids);
for (int i = 0; i < urls.count(); i++) {
KIO::NetAccess::del(urls.at(i), this);
if (!url.isEmpty()) toDelete << url.path();
}
}
+
+ // make sure our urls are not used in another clip
+ for (int i = 0; i < list.count(); i++) {
+ DocClipBase *clip = list.at(i);
+ if (clip->numReferences() > 0) {
+ KUrl url = clip->fileURL();
+ if (!url.isEmpty() && toDelete.contains(url.path())) toDelete.removeAll(url.path());
+ }
+ }
+
if (toDelete.count() == 0) {
KMessageBox::sorry(this, i18n("No clip to delete"));
return;