From 3d5a3c2df9806493d47e653500f5d13291b99cf5 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Mon, 5 Jul 2010 22:50:54 +0400 Subject: [PATCH] Fix some problems with the previous commit. --- groups_widgets.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/groups_widgets.cc b/groups_widgets.cc index e4536686..2a777c19 100644 --- a/groups_widgets.cc +++ b/groups_widgets.cc @@ -36,7 +36,7 @@ DictGroupWidget::DictGroupWidget( QWidget * parent, if ( !usesIconData ) ui.groupIcon->addItem( tr( "From file..." ), "" ); else - ui.groupIcon->addItem( Instances::iconFromData( group.iconData ), group.icon ); + ui.groupIcon->addItem( Instances::iconFromData( group.iconData ), group.icon, group.icon ); for( int x = 0; x < icons.size(); ++x ) { @@ -63,11 +63,21 @@ void DictGroupWidget::groupIconActivated( int index ) { if ( index == 1 ) { + QList< QByteArray > supImageFormats = QImageReader::supportedImageFormats(); + + QString formatList( " (" ); + + for( int x = 0; x < supImageFormats.size(); ++x ) + formatList += "*." + QString::fromAscii( supImageFormats[ x ] ) + " "; + + formatList.chop( 1 ); + formatList.append( ")" ); + QString chosenFile = QFileDialog::getOpenFileName( this, tr( "Choose a file to use as group icon" ), - tr( "Images" ) + - " (*.png *.xpm *.jpg *.jpeg *.bmp *.gif);;;" + - tr( "All files" ) + " (*)" ); + QString(), + tr( "Images" ) + formatList + ";;" + + tr( "All files" ) + " (*.*)" ); if ( !chosenFile.isEmpty() ) {