+ QToolButton *newButton = new QToolButton;
+ newButton->setIcon( QIcon( ":/new" ) );
+ QToolButton *deleteButton = new QToolButton;
+ deleteButton->setIcon( QIcon( ":/toolbar/clear" ) );
+ deleteButton->setToolTip( qtr( "Delete the current profile" ) );
+
+ profileBoxLayout->addWidget( profileLabel, 0, 0 );
+ profileBoxLayout->addWidget( profileCombo, 0, 1 );
+ profileBoxLayout->addWidget( newButton, 0, 2 );
+ profileBoxLayout->addWidget( deleteButton, 0, 3 );
+
+ mainLayout->addWidget( profileBox, 3, 1, 1, -1 );
+
+ /* Fill combos */
+ int i_size = getSettings()->beginReadArray( "ToolbarProfiles" );
+ for( int i = 0; i < i_size; i++ )
+ {
+ getSettings()->setArrayIndex(i);
+ profileCombo->addItem( getSettings()->value( "ProfileName" ).toString(),
+ getSettings()->value( "Value" ).toString() );
+ }
+ getSettings()->endArray();
+
+ /* Load defaults ones if we have no combos */
+ /* We could decide that we load defaults on first launch of the dialog
+ or when the combo is back to 0. I choose the second solution, because some clueless
+ user might hit on delete a bit too much, but discussion is opened. -- jb */
+ if( i_size == 0 )
+ {
+ profileCombo->addItem( PROFILE_NAME_1, QString( VALUE_1 ) );
+ profileCombo->addItem( PROFILE_NAME_2, QString( VALUE_2 ) );
+ profileCombo->addItem( PROFILE_NAME_3, QString( VALUE_3 ) );
+ profileCombo->addItem( PROFILE_NAME_4, QString( VALUE_4 ) );
+ profileCombo->addItem( PROFILE_NAME_5, QString( VALUE_5 ) );
+ }
+ profileCombo->setCurrentIndex( -1 );
+
+ /* Buttons */
+ QDialogButtonBox *okCancel = new QDialogButtonBox;
+ QPushButton *okButton = new QPushButton( qtr( "Cl&ose" ), this );
+ okButton->setDefault( true );
+ QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ), this );
+ okCancel->addButton( okButton, QDialogButtonBox::AcceptRole );
+ okCancel->addButton( cancelButton, QDialogButtonBox::RejectRole );
+
+ BUTTONACT( deleteButton, deleteProfile() );
+ BUTTONACT( newButton, newProfile() );
+ CONNECT( profileCombo, currentIndexChanged( int ), this, changeProfile( int ) );
+ BUTTONACT( okButton, close() );
+ BUTTONACT( cancelButton, cancel() );
+ mainLayout->addWidget( okCancel, 5, 2 );