| 147 | } |
| 148 | |
| 149 | QToolBar *BrowserWindow::createToolBar(QWidget *parent) |
| 150 | { |
| 151 | QToolBar *navigationBar = new QToolBar(tr("Navigation")); |
| 152 | navigationBar->setMovable(false); |
| 153 | navigationBar->toggleViewAction()->setEnabled(false); |
| 154 | |
| 155 | m_urlLineEdit = new QLineEdit(parent); |
| 156 | m_favAction = new QAction(parent); |
| 157 | m_urlLineEdit->addAction(m_favAction, QLineEdit::LeadingPosition); |
| 158 | m_urlLineEdit->setClearButtonEnabled(true); |
| 159 | navigationBar->addWidget(m_urlLineEdit); |
| 160 | |
| 161 | // add QCompleter |
| 162 | WBHistoryCompletionModel *completionModel = new WBHistoryCompletionModel(this); |
| 163 | completionModel->setSourceModel(historyManager()->historyFilterModel()); |
| 164 | m_lineEditCompleter = new QCompleter(completionModel, this); |
| 165 | m_lineEditCompleter->setFilterMode(Qt::MatchContains); |
| 166 | // Should this be in Qt by default? |
| 167 | QAbstractItemView *popup = m_lineEditCompleter->popup(); |
| 168 | QListView *listView = qobject_cast<QListView*>(popup); |
| 169 | |
| 170 | if (listView) |
| 171 | { |
| 172 | listView->setUniformItemSizes(true); |
| 173 | } |
| 174 | |
| 175 | m_urlLineEdit->setCompleter(m_lineEditCompleter); |
| 176 | |
| 177 | auto downloadsAction = new QAction(parent); |
| 178 | downloadsAction->setIcon(QIcon(QStringLiteral(":webbrowser/go-bottom.png"))); |
| 179 | downloadsAction->setToolTip(tr("Show downloads")); |
| 180 | navigationBar->addAction(downloadsAction); |
| 181 | connect(downloadsAction, &QAction::triggered, this, [this]() { |
| 182 | DownloadManagerWidget* downloadManager = findChild<DownloadManagerWidget*>(); |
| 183 | |
| 184 | if (downloadManager) |
| 185 | { |
| 186 | downloadManager->show(); |
| 187 | } |
| 188 | }); |
| 189 | |
| 190 | return navigationBar; |
| 191 | } |
| 192 | |
| 193 | void BrowserWindow::handleWebViewTitleChanged(const QString &title) |
| 194 | { |
no test coverage detected