Changeset View
Changeset View
Standalone View
Standalone View
src/filesearch/filesearchtab.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Line(s) | 94 | { | |||
---|---|---|---|---|---|
109 | connect(action, &QAction::triggered, this, &SearchFileListView::clear); | 109 | connect(action, &QAction::triggered, this, &SearchFileListView::clear); | ||
110 | m_browser->addAction(action); | 110 | m_browser->addAction(action); | ||
111 | 111 | | |||
112 | connect(m_browser, &QTreeView::activated, this, &SearchFileListView::requestFileOpen); | 112 | connect(m_browser, &QTreeView::activated, this, &SearchFileListView::requestFileOpen); | ||
113 | } | 113 | } | ||
114 | 114 | | |||
115 | void SearchFileListView::requestFileOpen(const QModelIndex& item) | 115 | void SearchFileListView::requestFileOpen(const QModelIndex& item) | ||
116 | { | 116 | { | ||
117 | emit fileOpenRequested(item.data(Qt::UserRole).toString()); | 117 | emit fileOpenRequested(item.data(Qt::UserRole).toString(), true); | ||
118 | | ||||
119 | } | 118 | } | ||
120 | 119 | | |||
121 | void SearchFileListView::addFiles(const QStringList& files) | 120 | void SearchFileListView::addFiles(const QStringList& files) | ||
122 | { | 121 | { | ||
123 | if (files.isEmpty()) | 122 | if (files.isEmpty()) | ||
124 | return; | 123 | return; | ||
125 | 124 | | |||
126 | m_background->hide(); | 125 | m_background->hide(); | ||
▲ Show 20 Lines • Show All 395 Lines • ▼ Show 20 Line(s) | 520 | #endif | |||
522 | 521 | | |||
523 | KActionCollection* ac = actionCollection(); | 522 | KActionCollection* ac = actionCollection(); | ||
524 | KActionCategory* srf = new KActionCategory(i18nc("@title actions category", "Search and replace in files"), ac); | 523 | KActionCategory* srf = new KActionCategory(i18nc("@title actions category", "Search and replace in files"), ac); | ||
525 | 524 | | |||
526 | m_searchFileListView = new SearchFileListView(this); | 525 | m_searchFileListView = new SearchFileListView(this); | ||
527 | //m_searchFileListView->hide(); | 526 | //m_searchFileListView->hide(); | ||
528 | addDockWidget(Qt::RightDockWidgetArea, m_searchFileListView); | 527 | addDockWidget(Qt::RightDockWidgetArea, m_searchFileListView); | ||
529 | srf->addAction(QStringLiteral("showfilelist_action"), m_searchFileListView->toggleViewAction()); | 528 | srf->addAction(QStringLiteral("showfilelist_action"), m_searchFileListView->toggleViewAction()); | ||
530 | connect(m_searchFileListView, &SearchFileListView::fileOpenRequested, this, QOverload<const QString &>::of(&FileSearchTab::fileOpenRequested)); | 529 | connect(m_searchFileListView, &SearchFileListView::fileOpenRequested, this, QOverload<const QString &, const bool>::of(&FileSearchTab::fileOpenRequested)); | ||
531 | 530 | | |||
532 | m_massReplaceView = new MassReplaceView(this); | 531 | m_massReplaceView = new MassReplaceView(this); | ||
533 | addDockWidget(Qt::RightDockWidgetArea, m_massReplaceView); | 532 | addDockWidget(Qt::RightDockWidgetArea, m_massReplaceView); | ||
534 | srf->addAction(QStringLiteral("showmassreplace_action"), m_massReplaceView->toggleViewAction()); | 533 | srf->addAction(QStringLiteral("showmassreplace_action"), m_massReplaceView->toggleViewAction()); | ||
535 | connect(m_massReplaceView, &MassReplaceView::previewRequested, m_model, &FileSearchModel::setReplacePreview); | 534 | connect(m_massReplaceView, &MassReplaceView::previewRequested, m_model, &FileSearchModel::setReplacePreview); | ||
536 | connect(m_massReplaceView, &MassReplaceView::replaceRequested, this, &FileSearchTab::massReplace); | 535 | connect(m_massReplaceView, &MassReplaceView::replaceRequested, this, &FileSearchTab::massReplace); | ||
537 | //m_massReplaceView->hide(); | 536 | //m_massReplaceView->hide(); | ||
538 | 537 | | |||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 661 | { | |||
664 | SearchResult sr = m_model->searchResult(item); | 663 | SearchResult sr = m_model->searchResult(item); | ||
665 | DocPosition docPos = sr.docPos.toDocPosition(); | 664 | DocPosition docPos = sr.docPos.toDocPosition(); | ||
666 | int selection = 0; | 665 | int selection = 0; | ||
667 | if (sr.targetPositions.size()) { | 666 | if (sr.targetPositions.size()) { | ||
668 | docPos.offset = sr.targetPositions.first().start; | 667 | docPos.offset = sr.targetPositions.first().start; | ||
669 | selection = sr.targetPositions.first().len; | 668 | selection = sr.targetPositions.first().len; | ||
670 | } | 669 | } | ||
671 | qCDebug(LOKALIZE_LOG) << "fileOpenRequest" << docPos.offset << selection; | 670 | qCDebug(LOKALIZE_LOG) << "fileOpenRequest" << docPos.offset << selection; | ||
672 | emit fileOpenRequested(sr.filepath, docPos, selection); | 671 | emit fileOpenRequested(sr.filepath, docPos, selection, true); | ||
673 | } | 672 | } | ||
674 | 673 | | |||
675 | void FileSearchTab::fileSearchNext() | 674 | void FileSearchTab::fileSearchNext() | ||
676 | { | 675 | { | ||
677 | QModelIndex item = ui_fileSearchOptions->treeView->currentIndex(); | 676 | QModelIndex item = ui_fileSearchOptions->treeView->currentIndex(); | ||
678 | int row = item.row(); | 677 | int row = item.row(); | ||
679 | int rowCount = m_model->rowCount(); | 678 | int rowCount = m_model->rowCount(); | ||
680 | 679 | | |||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |