Add maxDictionaryRefsInContextMenu to config file to allow to change number of dictionaries in the context menu (Right-click on the definitions frame). Default to 20.

This commit is contained in:
Julian Depetris Chauvin 2011-06-09 16:45:04 -03:00
parent d9450efd57
commit 207b780304
3 changed files with 12 additions and 2 deletions

View file

@ -971,7 +971,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
for( QStringList::const_iterator i = ids.constBegin(); i != ids.constEnd(); for( QStringList::const_iterator i = ids.constBegin(); i != ids.constEnd();
++i, ++refsAdded ) ++i, ++refsAdded )
{ {
if ( refsAdded == 20 ) if ( refsAdded == cfg.maxDictionaryRefsInContextMenu )
{ {
// Enough! Or the menu would become too large. // Enough! Or the menu would become too large.
menu.addAction( new QAction( ".........", &menu ) ); menu.addAction( new QAction( ".........", &menu ) );

View file

@ -666,6 +666,9 @@ Class load() throw( exError )
c.usingSmallIconsInToolbars = ( root.namedItem( "usingSmallIconsInToolbars" ).toElement().text() == "1" ); c.usingSmallIconsInToolbars = ( root.namedItem( "usingSmallIconsInToolbars" ).toElement().text() == "1" );
if ( !root.namedItem( "maxDictionaryRefsInContextMenu" ).isNull() )
c.maxDictionaryRefsInContextMenu = root.namedItem( "maxDictionaryRefsInContextMenu" ).toElement().text().toUShort();
return c; return c;
} }
@ -1196,6 +1199,10 @@ void save( Class const & c ) throw( exError )
opt = dd.createElement( "usingSmallIconsInToolbars" ); opt = dd.createElement( "usingSmallIconsInToolbars" );
opt.appendChild( dd.createTextNode( c.usingSmallIconsInToolbars ? "1" : "0" ) ); opt.appendChild( dd.createTextNode( c.usingSmallIconsInToolbars ? "1" : "0" ) );
root.appendChild( opt ); root.appendChild( opt );
opt = dd.createElement( "maxDictionaryRefsInContextMenu" );
opt.appendChild( dd.createTextNode( QString::number( c.maxDictionaryRefsInContextMenu ) ) );
root.appendChild( opt );
} }
QByteArray result( dd.toByteArray() ); QByteArray result( dd.toByteArray() );

View file

@ -377,8 +377,11 @@ struct Class
bool usingSmallIconsInToolbars; bool usingSmallIconsInToolbars;
unsigned short maxDictionaryRefsInContextMenu;
Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 ), Class(): lastMainGroupId( 0 ), lastPopupGroupId( 0 ),
pinPopupWindow( false ), showingDictBarNames( false ), usingSmallIconsInToolbars( false ) pinPopupWindow( false ), showingDictBarNames( false ),
usingSmallIconsInToolbars( false ), maxDictionaryRefsInContextMenu( 20 )
{} {}
}; };