| 56 | } |
| 57 | |
| 58 | GrepOutputView::GrepOutputView(QWidget* parent, GrepViewPlugin* plugin) |
| 59 | : QWidget(parent) |
| 60 | , m_next(nullptr) |
| 61 | , m_prev(nullptr) |
| 62 | , m_collapseAll(nullptr) |
| 63 | , m_expandAll(nullptr) |
| 64 | , m_refresh(nullptr) |
| 65 | , m_clearSearchHistory(nullptr) |
| 66 | , m_statusLabel(nullptr) |
| 67 | , m_plugin(plugin) |
| 68 | { |
| 69 | Ui::GrepOutputView::setupUi(this); |
| 70 | |
| 71 | setWindowTitle(i18nc("@title:window", "Find/Replace Output View")); |
| 72 | setWindowIcon(QIcon::fromTheme(QStringLiteral("edit-find"), windowIcon())); |
| 73 | |
| 74 | m_prev = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), i18nc("@action", "&Previous Item"), this); |
| 75 | m_next = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), i18nc("@action", "&Next Item"), this); |
| 76 | /* Expand-all and collapse-all icons were added to breeze with version 5.57. We use a fallback |
| 77 | * icon here because we support older frameworks versions and oxygen doesn't have such an icon |
| 78 | */ |
| 79 | m_collapseAll = new QAction(QIcon::fromTheme(QStringLiteral("collapse-all"), |
| 80 | QIcon::fromTheme(QStringLiteral("arrow-left-double"))), i18nc("@action", "C&ollapse All"), this); |
| 81 | m_expandAll = new QAction(QIcon::fromTheme(QStringLiteral("expand-all"), |
| 82 | QIcon::fromTheme(QStringLiteral("arrow-right-double"))), i18nc("@action", "&Expand All"), this); |
| 83 | updateButtonState(false); |
| 84 | auto *separator = new QAction(this); |
| 85 | separator->setSeparator(true); |
| 86 | auto* newSearchAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18nc("@action", "New &Search"), this); |
| 87 | m_refresh = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), i18nc("@action", "Refresh"), this); |
| 88 | m_refresh->setEnabled(false); |
| 89 | m_clearSearchHistory = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear-list")), i18nc("@action", "Clear Search History"), this); |
| 90 | m_clearSearchHistory->setEnabled(false); |
| 91 | |
| 92 | addAction(m_prev); |
| 93 | addAction(m_next); |
| 94 | addAction(m_collapseAll); |
| 95 | addAction(m_expandAll); |
| 96 | addAction(separator); |
| 97 | addAction(newSearchAction); |
| 98 | addAction(m_refresh); |
| 99 | addAction(m_clearSearchHistory); |
| 100 | |
| 101 | separator = new QAction(this); |
| 102 | separator->setSeparator(true); |
| 103 | addAction(separator); |
| 104 | |
| 105 | auto *statusWidget = new QWidgetAction(this); |
| 106 | m_statusLabel = new QLabel(this); |
| 107 | statusWidget->setDefaultWidget(m_statusLabel); |
| 108 | addAction(statusWidget); |
| 109 | |
| 110 | modelSelector->setEditable(false); |
| 111 | modelSelector->setContextMenuPolicy(Qt::CustomContextMenu); |
| 112 | connect(modelSelector, &KComboBox::customContextMenuRequested, |
| 113 | this, &GrepOutputView::modelSelectorContextMenu); |
| 114 | connect(modelSelector, QOverload<int>::of(&KComboBox::currentIndexChanged), |
| 115 | this, &GrepOutputView::changeModel); |
nothing calls this directly
no test coverage detected