mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 07:24:07 +00:00
Send word to input line via context menu
This commit is contained in:
parent
1bbcc29523
commit
0dcbfd849f
|
@ -999,6 +999,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
QAction * maxDictionaryRefsAction = 0;
|
QAction * maxDictionaryRefsAction = 0;
|
||||||
QAction * addWordToHistoryAction = 0;
|
QAction * addWordToHistoryAction = 0;
|
||||||
QAction * addHeaderToHistoryAction = 0;
|
QAction * addHeaderToHistoryAction = 0;
|
||||||
|
QAction * sendWordToInputLineAction = 0;
|
||||||
|
|
||||||
QUrl targetUrl( r.linkUrl() );
|
QUrl targetUrl( r.linkUrl() );
|
||||||
Contexts contexts;
|
Contexts contexts;
|
||||||
|
@ -1047,6 +1048,11 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
arg( ui.definition->selectedText() ),
|
arg( ui.definition->selectedText() ),
|
||||||
&menu );
|
&menu );
|
||||||
menu.addAction( lookupSelectionNewTab );
|
menu.addAction( lookupSelectionNewTab );
|
||||||
|
|
||||||
|
sendWordToInputLineAction = new QAction( tr( "Send \"%1\" to input line" ).
|
||||||
|
arg( ui.definition->selectedText() ),
|
||||||
|
&menu );
|
||||||
|
menu.addAction( sendWordToInputLineAction );
|
||||||
}
|
}
|
||||||
|
|
||||||
addWordToHistoryAction = new QAction( tr( "&Add \"%1\" to history" ).
|
addWordToHistoryAction = new QAction( tr( "&Add \"%1\" to history" ).
|
||||||
|
@ -1165,6 +1171,9 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
||||||
if ( result == addHeaderToHistoryAction )
|
if ( result == addHeaderToHistoryAction )
|
||||||
emit forceAddWordToHistory( ui.definition->title() );
|
emit forceAddWordToHistory( ui.definition->title() );
|
||||||
else
|
else
|
||||||
|
if( result == sendWordToInputLineAction )
|
||||||
|
emit sendWordToInputLine( selectedText );
|
||||||
|
else
|
||||||
if ( !popupView && result == followLinkNewTab )
|
if ( !popupView && result == followLinkNewTab )
|
||||||
emit openLinkInNewTab( targetUrl, ui.definition->url(), getCurrentArticle(), contexts );
|
emit openLinkInNewTab( targetUrl, ui.definition->url(), getCurrentArticle(), contexts );
|
||||||
else
|
else
|
||||||
|
|
|
@ -205,6 +205,8 @@ signals:
|
||||||
/// Signal to set optional parts expand mode
|
/// Signal to set optional parts expand mode
|
||||||
void setExpandMode ( bool expand );
|
void setExpandMode ( bool expand );
|
||||||
|
|
||||||
|
void sendWordToInputLine( QString const & word );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void on_searchPrevious_clicked();
|
void on_searchPrevious_clicked();
|
||||||
|
|
|
@ -1063,6 +1063,9 @@ ArticleView * MainWindow::createNewTab( bool switchToIt,
|
||||||
connect( view, SIGNAL( sendWordToHistory( QString ) ),
|
connect( view, SIGNAL( sendWordToHistory( QString ) ),
|
||||||
this, SLOT( addWordToHistory( QString ) ) );
|
this, SLOT( addWordToHistory( QString ) ) );
|
||||||
|
|
||||||
|
connect( view, SIGNAL( sendWordToInputLine( QString const & ) ),
|
||||||
|
this, SLOT(sendWordToInputLine( QString const & ) ) );
|
||||||
|
|
||||||
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
|
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
|
||||||
|
|
||||||
int index = cfg.preferences.newTabsOpenAfterCurrentOne ?
|
int index = cfg.preferences.newTabsOpenAfterCurrentOne ?
|
||||||
|
@ -3052,6 +3055,12 @@ void MainWindow::foundDictsContextMenuRequested( const QPoint &pos )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::sendWordToInputLine( const QString & word )
|
||||||
|
{
|
||||||
|
ui.translateLine->clear();
|
||||||
|
ui.translateLine->setText( word );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
|
|
||||||
bool MainWindow::winEvent( MSG * message, long * result )
|
bool MainWindow::winEvent( MSG * message, long * result )
|
||||||
|
|
|
@ -348,6 +348,8 @@ private slots:
|
||||||
/// Add word to history even if history is disabled in options
|
/// Add word to history even if history is disabled in options
|
||||||
void forceAddWordToHistory( const QString & word);
|
void forceAddWordToHistory( const QString & word);
|
||||||
|
|
||||||
|
void sendWordToInputLine( QString const & word );
|
||||||
|
|
||||||
signals:
|
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 );
|
||||||
|
|
Loading…
Reference in a new issue