mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
New tab button in toolbar opens tab with url from clipboard on middle click.
Closes #907
This commit is contained in:
parent
4a7e094956
commit
10bba39bd4
@ -182,6 +182,7 @@ NavigationBar::NavigationBar(QupZilla* mainClass)
|
||||
connect(m_buttonHome, SIGNAL(middleMouseClicked()), p_QupZilla, SLOT(goHomeInNewTab()));
|
||||
connect(m_buttonHome, SIGNAL(controlClicked()), p_QupZilla, SLOT(goHomeInNewTab()));
|
||||
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab()));
|
||||
connect(m_buttonAddTab, SIGNAL(middleMouseClicked()), p_QupZilla->tabWidget(), SLOT(addTabFromClipboard()));
|
||||
connect(m_exitFullscreen, SIGNAL(clicked(bool)), p_QupZilla, SLOT(toggleFullScreen(bool)));
|
||||
}
|
||||
|
||||
|
@ -63,12 +63,7 @@ void AddTabButton::wheelEvent(QWheelEvent* event)
|
||||
void AddTabButton::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::MiddleButton && rect().contains(event->pos())) {
|
||||
QString selectionClipboard = QApplication::clipboard()->text(QClipboard::Selection);
|
||||
QUrl guessedUrl = WebView::guessUrlFromString(selectionClipboard);
|
||||
|
||||
if (!guessedUrl.isEmpty()) {
|
||||
m_tabWidget->addView(guessedUrl, Qz::NT_SelectedNewEmptyTab);
|
||||
}
|
||||
m_tabWidget->addTabFromClipboard();
|
||||
}
|
||||
|
||||
ToolButton::mouseReleaseEvent(event);
|
||||
@ -388,6 +383,16 @@ int TabWidget::addView(WebTab* tab)
|
||||
return index;
|
||||
}
|
||||
|
||||
void TabWidget::addTabFromClipboard()
|
||||
{
|
||||
QString selectionClipboard = QApplication::clipboard()->text(QClipboard::Selection);
|
||||
QUrl guessedUrl = WebView::guessUrlFromString(selectionClipboard);
|
||||
|
||||
if (!guessedUrl.isEmpty()) {
|
||||
addView(guessedUrl, Qz::NT_SelectedNewEmptyTab);
|
||||
}
|
||||
}
|
||||
|
||||
void TabWidget::closeTab(int index, bool force)
|
||||
{
|
||||
if (index == -1) {
|
||||
|
@ -108,6 +108,7 @@ public slots:
|
||||
int addView(QNetworkRequest req, const QString &title = tr("New tab"), const Qz::NewTabPositionFlags &openFlags = Qz::NT_SelectedTab, bool selectLine = false, int position = -1);
|
||||
int addView(WebTab* tab);
|
||||
|
||||
void addTabFromClipboard();
|
||||
int duplicateTab(int index);
|
||||
|
||||
void closeTab(int index = -1, bool force = false);
|
||||
|
Loading…
Reference in New Issue
Block a user