****
***/
+namespace
+{
+ QString removeTrailingSlash (const QString& path)
+ {
+ // QFileDialog may return path ending with slash if that path refers to
+ // directory. QFileInfo::fileName() applied to such path would then return
+ // an empty string which is not what we want, so we strip the slash here.
+
+ if (!path.endsWith (QDir::separator ()))
+ return path;
+
+ return path.left (path.length () - 1);
+ }
+}
+
void
MakeDialog :: onNewDialogDestroyed( QObject * o )
{
void
MakeDialog :: onFileSelected( const QString& filename )
{
- myFile = filename;
+ myFile = removeTrailingSlash (filename);
myFileButton->setText( QFileInfo(myFile).fileName() );
onSourceChanged( );
}
void
MakeDialog :: onFolderSelected( const QString& filename )
{
- myFolder = filename;
+ myFolder = removeTrailingSlash (filename);
myFolderButton->setText( QFileInfo(myFolder).fileName() );
onSourceChanged( );
}
void
MakeDialog :: onDestinationSelected( const QString& filename )
{
- myDestination = filename;
+ myDestination = removeTrailingSlash (filename);
myDestinationButton->setText( QFileInfo(myDestination).fileName() );
}