]> git.sesse.net Git - kdenlive/commitdiff
Fix "delete" key not working in project tree, allow deletion of several clips at...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 13 Oct 2008 08:27:35 +0000 (08:27 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 13 Oct 2008 08:27:35 +0000 (08:27 +0000)
svn path=/branches/KDE4/; revision=2456

src/mainwindow.cpp
src/projectlist.cpp
src/projectlist.h

index 93b4de4d6ca96b29ab77b6929831c122f07b441a..90a4d7cb4b9d08de01b58554d744b3569a7cfa85 100644 (file)
@@ -1321,7 +1321,8 @@ void MainWindow::slotSwitchSnap() {
 
 
 void MainWindow::slotDeleteTimelineClip() {
-    if (m_activeTimeline) {
+    if (projectListDock->isActiveWindow()) m_projectList->slotRemoveClip();
+    else if (m_activeTimeline) {
         m_activeTimeline->projectView()->deleteSelectedClips();
     }
 }
index af83769ab34b13ee820c9372e84af187b18ee0c5..4b2c345be8335ddb7132b702f27de5067e3d9c1d 100644 (file)
@@ -203,19 +203,23 @@ void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item) {
 
 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);
index 7a63cd9c0b38645e74961464ac721f98461d9f10..20b812ecc4e808a96d7d4687c8c6a3cf0c0ebebd 100644 (file)
@@ -121,6 +121,7 @@ public slots:
     void slotRefreshClipThumbnail(ProjectItem *item, bool update = true);
     void slotRemoveInvalidClip(const QString &id);
     void slotSelectClip(const QString &ix);
+    void slotRemoveClip();
 
 private:
     ProjectListView *listView;
@@ -142,7 +143,6 @@ private:
 
 private slots:
     void slotAddClip(QUrl givenUrl = QUrl(), QString group = QString());
-    void slotRemoveClip();
     void slotEditClip();
     void slotClipSelected();
     void slotAddColorClip();