Commit edb44b1f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable clazy connect-3arg-lambda

parent 91bce4a0
......@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json
- CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot" ninja
- CLAZY_CHECKS="level0,incorrect-emit,qhash-namespace,detaching-temporary,range-loop,qdeleteall,inefficient-qlist-soft,qstring-left,const-signal-or-slot,connect-3arg-lambda" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later
- sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h
- "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\""
......@@ -56,7 +56,7 @@ void FormatTest::initTestCase()
const QMimeType mime = db.mimeTypeForFile( testFile );
QCOMPARE( m_document->openDocument( testFile, QUrl(), mime), Okular::Document::OpenSuccess );
connect( m_document, &Okular::Document::refreshFormWidget, [=]( Okular::FormField * form )
connect( m_document, &Okular::Document::refreshFormWidget, this, [this]( Okular::FormField * form )
{
Okular::FormFieldText *fft = reinterpret_cast< Okular::FormFieldText * >( form );
if( fft )
......
......@@ -515,7 +515,7 @@ void PartTest::testRClickWhileLinkTextIsSelected()
// the menu disappear
PageView *view = part.m_pageView;
bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() {
QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu);
......@@ -584,7 +584,7 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected()
// the menu disappear
PageView *view = part.m_pageView;
bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() {
QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu);
......@@ -641,7 +641,7 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu()
// the menu disappear
PageView *view = part.m_pageView;
bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() {
QTimer::singleShot(2000, view, [view, &menuClosed]() {
// check if popup menu is active and visible
QMenu *menu = qobject_cast<QMenu*>(view->findChild<QMenu*>(QStringLiteral("PopupMenu")));
QVERIFY(menu);
......@@ -745,7 +745,7 @@ void PartTest::testeRectSelectionStartingOnLinks()
// the menu disappear
PageView *view = part.m_pageView;
bool menuClosed = false;
QTimer::singleShot(2000, [view, &menuClosed]() {
QTimer::singleShot(2000, view, [view, &menuClosed]() {
QApplication::clipboard()->clear();
// check if popup menu is active and visible
......
......@@ -4599,7 +4599,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
{
QAction * actCopyLinkLocation = menu->addAction( QIcon::fromTheme( QStringLiteral("edit-copy") ), i18n( "Copy Link Address" ) );
actCopyLinkLocation->setObjectName(QStringLiteral("CopyLinkLocationAction"));
connect( actCopyLinkLocation, &QAction::triggered, [ link ]() {
connect( actCopyLinkLocation, &QAction::triggered, menu, [ link ]() {
const Okular::BrowseAction * browseLink = static_cast< const Okular::BrowseAction * >( link );
QClipboard *cb = QApplication::clipboard();
cb->setText( browseLink->url().toDisplayString(), QClipboard::Clipboard );
......@@ -4608,7 +4608,7 @@ QMenu* PageView::createProcessLinkMenu(PageViewItem *item, const QPoint &eventPo
} );
}
connect( processLink, &QAction::triggered, [this, link]() {
connect( processLink, &QAction::triggered, this, [this, link]() {
d->document->processAction( link );
});
return menu;
......@@ -4621,7 +4621,7 @@ void PageView::addSearchWithinDocumentAction(QMenu *menu, const QString &searchT
const QString squeezedText = KStringHandler::rsqueeze( searchText, searchTextPreviewLength );
QAction *action = new QAction(i18n("Search for '%1' in this document", squeezedText), menu);
action->setIcon( QIcon::fromTheme( QStringLiteral("document-preview") ) );
connect(action, &QAction::triggered, [this, searchText]{Q_EMIT triggerSearch(searchText);});
connect(action, &QAction::triggered, this, [this, searchText]{Q_EMIT triggerSearch(searchText);});
menu->addAction( action );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment