1.1 --- a/file.cpp Tue Feb 21 16:18:23 2006 +0000
1.2 +++ b/file.cpp Tue Mar 14 14:27:04 2006 +0000
1.3 @@ -257,8 +257,9 @@
1.4 }
1.5
1.6
1.7 -ImagePreview::ImagePreview (QWidget *parent=0): QLabel (parent)
1.8 +ImagePreview::ImagePreview (QWidget *par=0): QLabel (par)
1.9 {
1.10 + fdia=(QFileDialog*)par;
1.11 }
1.12
1.13 void ImagePreview::previewUrl( const QUrl &u )
1.14 @@ -266,7 +267,18 @@
1.15 QString path = u.path();
1.16 QPixmap pix( path );
1.17 if ( pix.isNull() )
1.18 - setText( QObject::tr("This is not an image.") );
1.19 + {
1.20 + // Strange: If we have fd->setMode (QFileDialog::ExistingFiles)
1.21 + // in the filedialog, then there are 3 calls to previewURL
1.22 + // for each selection. And only the first is the actual selected file
1.23 + // while the following 2 point to the directory above the current one.
1.24 + // So here's my workaround:
1.25 +
1.26 + if (fdia && fdia->selectedFiles().count()==0)
1.27 + setText( QObject::tr("This is not an image.") );
1.28 + if (fdia &&fdia->selectedFiles().count()>1)
1.29 + setText( QObject::tr("Sorry, no preview for\nmultiple selected files.") );
1.30 + }
1.31 else
1.32 {
1.33 float max_w=300;