From b6405171c6a74a5227555a9b75c03f88a5f21ed2 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Fri, 2 May 2014 17:30:05 +0200 Subject: Added remove all files action to filelist. --- dgedit/filelist.cc | 15 +++++++++++++++ dgedit/filelist.h | 3 +++ 2 files changed, 18 insertions(+) (limited to 'dgedit') diff --git a/dgedit/filelist.cc b/dgedit/filelist.cc index d956c9c..c4e5c4b 100644 --- a/dgedit/filelist.cc +++ b/dgedit/filelist.cc @@ -99,9 +99,15 @@ void FileList::createMenus() removeAction = new QAction("Remove", this); connect(removeAction, SIGNAL(triggered()), this, SLOT(removeFile())); + removeAllAction = new QAction("Remove all", this); + connect(removeAllAction, SIGNAL(triggered()), this, SLOT(removeAllFiles())); + menu->addAction(setMasterAction); menu->addAction(editAction); menu->addAction(removeAction); + menu->addSeparator(); + menu->addAction(removeAllAction); + } void FileList::popupMenu(const QPoint & pos) @@ -129,6 +135,15 @@ void FileList::removeFile() emit fileRemoved(file, name); } +void FileList::removeAllFiles() +{ + activeItem = NULL; + + clear(); + + emit allFilesRemoved(); +} + void FileList::editName() { ItemEditor *e = new ItemEditor(activeItem, itemName(activeItem)); diff --git a/dgedit/filelist.h b/dgedit/filelist.h index 60d1693..2ca277c 100644 --- a/dgedit/filelist.h +++ b/dgedit/filelist.h @@ -42,6 +42,7 @@ signals: void masterFileChanged(QString filename); void fileAdded(QString file, QString name); void fileRemoved(QString file, QString name); + void allFilesRemoved(); void nameChanged(QString file, QString name); public slots: @@ -52,6 +53,7 @@ private slots: void selectionChanged(QListWidgetItem *item); void setMaster(); void removeFile(); + void removeAllFiles(); void editName(); void setItemName(QListWidgetItem *i, QString name); @@ -68,6 +70,7 @@ private: QAction *setMasterAction; QAction *editAction; QAction *removeAction; + QAction *removeAllAction; QListWidgetItem *activeItem; }; -- cgit v1.2.3