+ Add a 'Rescan now' button in Sources.

This commit is contained in:
Konstantin Isakov 2009-05-05 08:57:37 +00:00
parent 3c390523d8
commit 743258b438
5 changed files with 37 additions and 10 deletions

View file

@ -27,12 +27,15 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
ui.tabs->addTab( &sources, QIcon(":/icons/book.png"), tr( "&Sources" ) );
ui.tabs->addTab( groups.get(), QIcon(":/icons/bookcase.png"), tr( "&Groups" ) );
connect( &sources, SIGNAL( rescan() ), this, SLOT( rescanSources() ) );
}
void EditDictionaries::accept()
{
acceptChangedSources();
if ( isSourcesChanged() )
acceptChangedSources();
Config::Groups newGroups = groups->getGroups();
@ -99,6 +102,11 @@ void EditDictionaries::on_tabs_currentChanged( int index )
lastCurrentTab = index;
}
void EditDictionaries::rescanSources()
{
acceptChangedSources();
}
bool EditDictionaries::isSourcesChanged() const
{
return sources.getPaths() != cfg.paths ||
@ -109,15 +117,12 @@ bool EditDictionaries::isSourcesChanged() const
void EditDictionaries::acceptChangedSources()
{
if ( isSourcesChanged() )
{
dictionariesChanged = true;
dictionariesChanged = true;
cfg.paths = sources.getPaths();
cfg.soundDirs = sources.getSoundDirs();
cfg.hunspell = sources.getHunspell();
cfg.mediawikis = sources.getMediaWikis();
cfg.paths = sources.getPaths();
cfg.soundDirs = sources.getSoundDirs();
cfg.hunspell = sources.getHunspell();
cfg.mediawikis = sources.getMediaWikis();
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
}
loadDictionaries( this, true, cfg, dictionaries, dictNetMgr );
}

View file

@ -37,6 +37,8 @@ private slots:
void on_tabs_currentChanged( int index );
void rescanSources();
private:
bool isSourcesChanged() const;

View file

@ -648,3 +648,9 @@ bool HunspellDictsModel::setData( QModelIndex const & index, const QVariant & /*
return false;
}
void Sources::on_rescan_clicked()
{
emit rescan();
}

View file

@ -151,6 +151,11 @@ public:
Config::Hunspell getHunspell() const;
signals:
/// Emitted when a 'Rescan' button is clicked.
void rescan();
private:
Ui::Sources ui;
MediaWikisModel mediawikisModel;
@ -174,6 +179,8 @@ private slots:
void on_addMediaWiki_clicked();
void on_removeMediaWiki_clicked();
void on_rescan_clicked();
};
#endif

View file

@ -75,6 +75,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="rescan">
<property name="text">
<string>Re&amp;scan now</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>