diff -r c3943fbd0e74 -r 5115a9d93e86 file.cpp --- a/file.cpp Tue Mar 07 11:32:02 2006 +0000 +++ b/file.cpp Wed Mar 08 12:59:07 2006 +0000 @@ -257,8 +257,9 @@ } -ImagePreview::ImagePreview (QWidget *parent=0): QLabel (parent) +ImagePreview::ImagePreview (QWidget *par=0): QLabel (par) { + fdia=(QFileDialog*)par; } void ImagePreview::previewUrl( const QUrl &u ) @@ -266,7 +267,18 @@ QString path = u.path(); QPixmap pix( path ); if ( pix.isNull() ) - setText( QObject::tr("This is not an image.") ); + { + // Strange: If we have fd->setMode (QFileDialog::ExistingFiles) + // in the filedialog, then there are 3 calls to previewURL + // for each selection. And only the first is the actual selected file + // while the following 2 point to the directory above the current one. + // So here's my workaround: + + if (fdia && fdia->selectedFiles().count()==0) + setText( QObject::tr("This is not an image.") ); + if (fdia &&fdia->selectedFiles().count()>1) + setText( QObject::tr("Sorry, no preview for\nmultiple selected files.") ); + } else { float max_w=300;