Show "Edit Dictionary" button only for supporting dictionary types (DSL, XDXF, StarDict)

For StarDict dictionaries we consider *.ifo as the main file to edit.
This commit is contained in:
Tvangeste 2013-06-11 20:55:29 +02:00
parent de2bf73e66
commit 06bc0acbe0
2 changed files with 8 additions and 1 deletions

View file

@ -24,7 +24,7 @@ void DictInfo::showInfo( sptr<Dictionary::Class> dict )
ui.dictionaryTranslatesTo->setText( Language::localizedStringForId( dict->getLangTo() ) ); ui.dictionaryTranslatesTo->setText( Language::localizedStringForId( dict->getLangTo() ) );
ui.openFolder->setVisible( dict->isLocalDictionary() ); ui.openFolder->setVisible( dict->isLocalDictionary() );
ui.editDictionary->setVisible( dict->isLocalDictionary() && !cfg.editDictionaryCommandLine.isEmpty()); ui.editDictionary->setVisible( dict->isLocalDictionary() && !dict->getMainFilename().isEmpty() && !cfg.editDictionaryCommandLine.isEmpty());
ui.editDictionary->setToolTip( ui.editDictionary->setToolTip(
tr( "Edit the dictionary via command:\n%1" ).arg( cfg.editDictionaryCommandLine ) ); tr( "Edit the dictionary via command:\n%1" ).arg( cfg.editDictionaryCommandLine ) );

View file

@ -170,6 +170,8 @@ public:
virtual QString const& getDescription(); virtual QString const& getDescription();
virtual QString getMainFilename();
protected: protected:
void loadIcon() throw(); void loadIcon() throw();
@ -548,6 +550,11 @@ QString const& StardictDictionary::getDescription()
return dictionaryDescription; return dictionaryDescription;
} }
QString StardictDictionary::getMainFilename()
{
return FsEncoding::decode( getDictionaryFilenames()[ 0 ].c_str() );
}
/// StardictDictionary::findHeadwordsForSynonym() /// StardictDictionary::findHeadwordsForSynonym()
class StardictHeadwordsRequest; class StardictHeadwordsRequest;