Commit 156172ca authored by Scott Wheeler's avatar Scott Wheeler

Implemented the JuK::deleteFile() slot so that JuK can delete files

(and lists of files).

svn path=/trunk/kdemultimedia/juk/; revision=158265
parent 2f3b76e5
......@@ -171,6 +171,12 @@ void JuK::saveFile()
tagger->save();
}
void JuK::deleteFile()
{
if(tagger && tagger->isVisible())
tagger->deleteFile();
}
void JuK::quit()
{
delete(this);
......
......@@ -78,6 +78,7 @@ private slots:
void openFile();
void openDirectory();
void saveFile();
void deleteFile();
void quit();
// function menu
......
......@@ -131,6 +131,41 @@ void TaggerWidget::save(QPtrList<FileListItem> items)
}
}
void TaggerWidget::deleteFile()
{
deleteFile(taggerList->selectedItems());
}
void TaggerWidget::deleteFile(QPtrList<FileListItem> items)
{
if(!items.isEmpty()) {
QString message = i18n("Are you sure that you want to delete:\n");
FileListItem *item = items.first();
while(item) {
message.append(item->fileName() + "\n");
item = items.next();
}
if(KMessageBox::warningYesNo(this, message, i18n("Delete Files")) == KMessageBox::Yes) {
item = items.first();
while(item) {
if(QFile::remove(item->filePath()))
delete(item);
else
KMessageBox::sorry(this, i18n("Could not save delete ") + item->fileName() + ".");
item = items.next();
}
}
}
}
void TaggerWidget::setChanged()
{
changed = true;
......
......@@ -48,6 +48,8 @@ public:
public slots:
void save();
void save(QPtrList<FileListItem> items);
void deleteFile();
void deleteFile(QPtrList<FileListItem> items);
void setChanged();
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment