mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Fixed #164: Add an option to copy the entire article (Ctrl+A)
This commit is contained in:
parent
160db20a04
commit
3784ac18d7
|
@ -106,6 +106,11 @@ ArticleView::ArticleView( QWidget * parent, ArticleNetworkAccessManager & nm,
|
|||
ui.definition->pageAction( QWebPage::Copy )->setShortcut( QKeySequence::Copy );
|
||||
ui.definition->addAction( ui.definition->pageAction( QWebPage::Copy ) );
|
||||
|
||||
QAction * selectAll = ui.definition->pageAction( QWebPage::SelectAll );
|
||||
selectAll->setShortcut( QKeySequence::SelectAll );
|
||||
selectAll->setShortcutContext( Qt::WidgetWithChildrenShortcut );
|
||||
ui.definition->addAction( selectAll );
|
||||
|
||||
ui.definition->setContextMenuPolicy( Qt::CustomContextMenu );
|
||||
|
||||
ui.definition->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
|
||||
|
@ -1109,10 +1114,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
}
|
||||
}
|
||||
|
||||
if ( selectedText.size() )
|
||||
menu.addAction( ui.definition->pageAction( QWebPage::Copy ) );
|
||||
|
||||
if( menu.isEmpty() && !cfg.preferences.storeHistory)
|
||||
if( selectedText.isEmpty() && !cfg.preferences.storeHistory)
|
||||
{
|
||||
addHeaderToHistoryAction = new QAction( tr( "&Add \"%1\" to history" ).
|
||||
arg( ui.definition->title() ),
|
||||
|
@ -1120,6 +1122,15 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
menu.addAction( addHeaderToHistoryAction );
|
||||
}
|
||||
|
||||
if ( selectedText.size() )
|
||||
{
|
||||
menu.addAction( ui.definition->pageAction( QWebPage::Copy ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.addAction( ui.definition->pageAction( QWebPage::SelectAll ) );
|
||||
}
|
||||
|
||||
map< QAction *, QString > tableOfContents;
|
||||
|
||||
// Add table of contents
|
||||
|
|
|
@ -192,7 +192,7 @@ void HistoryPaneWidget::onSelectionChanged( QItemSelection const & selection )
|
|||
return;
|
||||
|
||||
itemSelectionChanged = true;
|
||||
emitHistoryItemRequested( selection.front().bottomRight() );
|
||||
emitHistoryItemRequested( selection.front().topLeft() );
|
||||
}
|
||||
|
||||
void HistoryPaneWidget::onItemClicked( QModelIndex const & idx )
|
||||
|
|
Loading…
Reference in a new issue