Ctrl(Shift)+Click on "Found in dictionaries" pane do same action as on dictionary toolbar

This commit is contained in:
Abs62 2012-09-19 16:44:36 +04:00
parent 21c9723567
commit 83bdb1db6f
4 changed files with 37 additions and 0 deletions

View file

@ -217,3 +217,16 @@ void DictionaryBar::actionWasTriggered( QAction * action )
} }
} }
void DictionaryBar::dictsPaneClicked( const QString & id )
{
for( QList< QAction * >::iterator i = dictActions.begin();
i != dictActions.end(); ++i )
{
QString dictId = (*i)->data().toString();
if ( dictId == id )
{
(*i)->activate( QAction::Trigger );
break;
}
}
}

View file

@ -47,6 +47,8 @@ private slots:
void mutedDictionariesChanged(); void mutedDictionariesChanged();
void actionWasTriggered( QAction * ); void actionWasTriggered( QAction * );
void dictsPaneClicked( QString const & );
}; };
#endif #endif

View file

@ -104,6 +104,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
connect( ui.dictsPane, SIGNAL( visibilityChanged( bool ) ), connect( ui.dictsPane, SIGNAL( visibilityChanged( bool ) ),
this, SLOT( dictsPaneVisibilityChanged ( bool ) ) ); this, SLOT( dictsPaneVisibilityChanged ( bool ) ) );
connect( ui.dictsList, SIGNAL( itemClicked( QListWidgetItem * ) ),
this, SLOT( dictsPaneClicked( QListWidgetItem * ) ) );
// Make the toolbar // Make the toolbar
navToolbar = addToolBar( tr( "Navigation" ) ); navToolbar = addToolBar( tr( "Navigation" ) );
navToolbar->setObjectName( "navToolbar" ); navToolbar->setObjectName( "navToolbar" );
@ -329,6 +332,9 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
useSmallIconsInToolbarsTriggered(); useSmallIconsInToolbarsTriggered();
connect( this, SIGNAL( clickOnDictPane( QString const & ) ),
&dictionaryBar, SLOT( dictsPaneClicked( QString const & ) ) );
addToolBar( &dictionaryBar ); addToolBar( &dictionaryBar );
connect( dictionaryBar.toggleViewAction(), SIGNAL(triggered(bool)), connect( dictionaryBar.toggleViewAction(), SIGNAL(triggered(bool)),
@ -2962,6 +2968,16 @@ void MainWindow::switchExpandOptionalPartsMode()
view->switchExpandOptionalParts(); view->switchExpandOptionalParts();
} }
void MainWindow::dictsPaneClicked( QListWidgetItem * item )
{
if ( QApplication::keyboardModifiers() &
( Qt::ControlModifier | Qt::ShiftModifier ) )
{
QString id = item->data( Qt::UserRole ).toString();
emit clickOnDictPane( id );
}
}
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
bool MainWindow::winEvent( MSG * message, long * result ) bool MainWindow::winEvent( MSG * message, long * result )

View file

@ -193,6 +193,9 @@ private slots:
/// Signalled when the lastestReleaseReply is finished() /// Signalled when the lastestReleaseReply is finished()
void latestReleaseReplyReady(); void latestReleaseReplyReady();
/// Receive click on "Found in:" pane
void dictsPaneClicked( QListWidgetItem * item );
private slots: private slots:
// Executed in response to a user click on an 'add tab' tool button // Executed in response to a user click on an 'add tab' tool button
@ -342,6 +345,9 @@ signals:
/// Set optional parts expand mode for all tabs /// Set optional parts expand mode for all tabs
void setExpandOptionalParts( bool expand ); void setExpandOptionalParts( bool expand );
/// Retranslate Ctrl(Shift) + Click on dictionary pane to dictionary toolbar
void clickOnDictPane( QString const & id );
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
/// For receiving message from scan libraries /// For receiving message from scan libraries
protected: protected: