Merge pull request #1025 from GD-fix/safety_menu_sequence

Safety menu sequence in dictionaries order window
This commit is contained in:
Abs62 2019-03-18 18:08:31 +03:00 committed by GitHub
commit 6efb52109c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -252,13 +252,8 @@ void OrderAndProps::describeDictionary( DictListWidget * lst, QModelIndex const
void OrderAndProps::contextMenuRequested( const QPoint & pos ) void OrderAndProps::contextMenuRequested( const QPoint & pos )
{ {
QMenu menu( this ); QMenu menu( this );
QAction * sortNameAction = new QAction( tr( "Sort by name" ), &menu );
menu.addAction( sortNameAction );
QAction * sortLangAction = new QAction( tr( "Sort by languages" ), &menu );
menu.addAction( sortLangAction );
QAction * showHeadwordsAction = NULL; QAction * showHeadwordsAction = NULL;
QModelIndex idx = ui.searchLine->mapToSource( ui.dictionaryOrder->indexAt( pos ) ); QModelIndex idx = ui.searchLine->mapToSource( ui.dictionaryOrder->indexAt( pos ) );
sptr< Dictionary::Class > dict; sptr< Dictionary::Class > dict;
if( idx.isValid() && (unsigned)idx.row() < ui.dictionaryOrder->getCurrentDictionaries().size() ) if( idx.isValid() && (unsigned)idx.row() < ui.dictionaryOrder->getCurrentDictionaries().size() )
@ -269,6 +264,11 @@ void OrderAndProps::contextMenuRequested( const QPoint & pos )
menu.addAction( showHeadwordsAction ); menu.addAction( showHeadwordsAction );
} }
QAction * sortNameAction = new QAction( tr( "Sort by name" ), &menu );
menu.addAction( sortNameAction );
QAction * sortLangAction = new QAction( tr( "Sort by languages" ), &menu );
menu.addAction( sortLangAction );
QAction * result = menu.exec( ui.dictionaryOrder->mapToGlobal( pos ) ); QAction * result = menu.exec( ui.dictionaryOrder->mapToGlobal( pos ) );
if( result == sortNameAction || result == sortLangAction ) if( result == sortNameAction || result == sortLangAction )