Added Apply button to the Dictionaries configuration dialog.

This commit is contained in:
Tvangeste 2011-06-13 14:30:49 +02:00
parent f12a8e6761
commit a30a13323b
3 changed files with 23 additions and 2 deletions

View file

@ -42,6 +42,9 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
ui.tabs->addTab( orderAndProps.get(), QIcon(":/icons/book.png"), tr( "&Dictionaries" ) );
ui.tabs->addTab( groups.get(), QIcon(":/icons/bookcase.png"), tr( "&Groups" ) );
connect( ui.buttons, SIGNAL( clicked( QAbstractButton * ) ),
this, SLOT( buttonBoxClicked( QAbstractButton * ) ) );
connect( &sources, SIGNAL( rescan() ), this, SLOT( rescanSources() ) );
}
@ -56,7 +59,7 @@ void EditDictionaries::editGroup( unsigned id )
}
}
void EditDictionaries::accept()
void EditDictionaries::save()
{
Config::Groups newGroups = groups->getGroups();
Config::Group newOrder = orderAndProps->getCurrentDictionaryOrder();
@ -73,7 +76,11 @@ void EditDictionaries::accept()
cfg.dictionaryOrder = newOrder;
cfg.inactiveDictionaries = newInactive;
}
}
void EditDictionaries::accept()
{
save();
QDialog::accept();
}
@ -132,6 +139,16 @@ void EditDictionaries::rescanSources()
acceptChangedSources( true );
}
void EditDictionaries::buttonBoxClicked( QAbstractButton * button )
{
if (ui.buttons->buttonRole(button) == QDialogButtonBox::ApplyRole) {
if ( isSourcesChanged() ) {
acceptChangedSources( true );
}
save();
}
}
bool EditDictionaries::isSourcesChanged() const
{
return sources.getPaths() != cfg.paths ||

View file

@ -43,6 +43,8 @@ private slots:
void on_tabs_currentChanged( int index );
void buttonBoxClicked( QAbstractButton * button );
void rescanSources();
private:
@ -51,6 +53,8 @@ private:
void acceptChangedSources( bool rebuildGroups );
void save();
private:
Config::Class & cfg;

View file

@ -32,7 +32,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>