[KPhotoAlbum] Improvements to delete
Robert L Krawitz
rlk at alum.mit.edu
Fri Feb 10 03:16:13 GMT 2006
This speeds up delete dramatically (particularly if you cancel out of
the delete!)
--- mainview.cpp~ 2006-01-28 23:38:52.000000000 -0500
+++ mainview.cpp 2006-02-09 22:08:10.000000000 -0500
@@ -369,19 +369,21 @@
void MainView::slotDeleteSelected()
{
+ QStringList selectedList = selected();
if ( ! _deleteDialog )
_deleteDialog = new DeleteDialog( this );
- if ( _deleteDialog->exec( selected() ) == QDialog::Accepted )
+ if ( _deleteDialog->exec( selected() ) == QDialog::Accepted &&
+ selectedList.count() > 0) {
setDirty( true );
- QStringList images = _thumbnailView->imageList();
- QStringList allImages = ImageDB::instance()->images();
- QStringList newSet;
- for( QStringList::Iterator it = images.begin(); it != images.end(); ++it ) {
- if ( allImages.contains( *it ) )
- newSet.append(*it);
+ QStringList images = _thumbnailView->imageList();
+ QStringList newSet;
+ for( QStringList::Iterator it = images.begin(); it != images.end(); ++it ) {
+ if ( ! selectedList.contains( *it ) )
+ newSet.append(*it);
+ }
+ showThumbNails( newSet );
}
- showThumbNails( newSet );
}
This gets rid of the silly warning if you try to delete a file that
doesn't exist (there's no good reason for warning in that case -- if
the file does already exist and the delete fails, the user certainly
should be warned!)
--- deletedialog.cpp~ 2006-01-28 23:38:52.000000000 -0500
+++ deletedialog.cpp 2006-02-09 22:12:44.000000000 -0500
@@ -65,7 +65,7 @@
for( QStringList::ConstIterator it = _list.begin(); it != _list.end(); ++it ) {
Util::removeThumbNail( *it );
if ( ImageDB::instance()->info(*it)->imageOnDisk() ) { // PENDING(blackie) we don't need imageinfo for this
- bool ok = QFile( *it ).remove();
+ bool ok = !(QFile( *it ).exists()) || QFile( *it ).remove();
if ( !ok ) {
KMessageBox::error( this, i18n("Unable to delete file '%1'.").arg(*it),
i18n("Error Deleting Files") );
More information about the Kphotoalbum
mailing list