Add config file option for track clipboard changes

This commit is contained in:
Abs62 2014-01-09 18:17:50 +04:00
parent 2f8c0d3d80
commit 32a2cf55b9
4 changed files with 26 additions and 1 deletions

View file

@ -130,6 +130,9 @@ Preferences::Preferences():
, collapseBigArticles( false )
, articleSizeLimit( 2000 )
, maxDictionaryRefsInContextMenu ( 20 )
#ifndef Q_WS_X11
, trackClipboardChanges( false )
#endif
{
}
@ -755,6 +758,11 @@ Class load() throw( exError )
if ( !preferences.namedItem( "maxDictionaryRefsInContextMenu" ).isNull() )
c.preferences.maxDictionaryRefsInContextMenu = preferences.namedItem( "maxDictionaryRefsInContextMenu" ).toElement().text().toUShort();
#ifndef Q_WS_X11
if ( !preferences.namedItem( "trackClipboardChanges" ).isNull() )
c.preferences.trackClipboardChanges = ( preferences.namedItem( "trackClipboardChanges" ).toElement().text() == "1" );
#endif
}
c.lastMainGroupId = root.namedItem( "lastMainGroupId" ).toElement().text().toUInt();
@ -1500,7 +1508,14 @@ void save( Class const & c ) throw( exError )
opt = dd.createElement( "maxDictionaryRefsInContextMenu" );
opt.appendChild( dd.createTextNode( QString::number( c.preferences.maxDictionaryRefsInContextMenu ) ) );
preferences.appendChild( opt ); }
preferences.appendChild( opt );
#ifndef Q_WS_X11
opt = dd.createElement( "trackClipboardChanges" );
opt.appendChild( dd.createTextNode( c.preferences.trackClipboardChanges ? "1" : "0" ) );
preferences.appendChild( opt );
#endif
}
{
QDomElement opt = dd.createElement( "lastMainGroupId" );

View file

@ -211,6 +211,9 @@ struct Preferences
int articleSizeLimit;
unsigned short maxDictionaryRefsInContextMenu;
#ifndef Q_WS_X11
bool trackClipboardChanges;
#endif
QString addonStyle;

View file

@ -1781,6 +1781,9 @@ void MainWindow::editPreferences()
p.hideMenubar = cfg.preferences.hideMenubar;
p.searchInDock = cfg.preferences.searchInDock;
p.alwaysOnTop = cfg.preferences.alwaysOnTop;
#ifndef Q_WS_X11
p.trackClipboardChanges = cfg.preferences.trackClipboardChanges;
#endif
bool needReload = false;

View file

@ -213,6 +213,10 @@ ScanPopup::ScanPopup( QWidget * parent,
#ifdef Q_WS_X11
connect( QApplication::clipboard(), SIGNAL( changed( QClipboard::Mode ) ),
this, SLOT( clipboardChanged( QClipboard::Mode ) ) );
#else
if( cfg.preferences.trackClipboardChanges )
connect( QApplication::clipboard(), SIGNAL( changed( QClipboard::Mode ) ),
this, SLOT( clipboardChanged( QClipboard::Mode ) ) );
#endif
connect( &MouseOver::instance(), SIGNAL( hovered( QString const &, bool ) ),