mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
TabWidget: Add insertView method for WebTab
This commit is contained in:
parent
0e25eb2e92
commit
f5ad4424aa
|
@ -1,6 +1,6 @@
|
|||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -205,7 +205,7 @@ void BrowserWindow::postLaunch()
|
|||
|
||||
if (m_startTab) {
|
||||
addTab = false;
|
||||
m_tabWidget->addView(m_startTab);
|
||||
m_tabWidget->addView(m_startTab, Qz::NT_SelectedTab);
|
||||
}
|
||||
|
||||
if (m_startPage) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -378,17 +378,34 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
|
|||
return index;
|
||||
}
|
||||
|
||||
int TabWidget::addView(WebTab* tab)
|
||||
int TabWidget::addView(WebTab *tab, const Qz::NewTabPositionFlags &openFlags)
|
||||
{
|
||||
return insertView(count() + 1, tab, openFlags);
|
||||
}
|
||||
|
||||
int TabWidget::insertView(int index, WebTab *tab, const Qz::NewTabPositionFlags &openFlags)
|
||||
{
|
||||
m_locationBars->addWidget(tab->locationBar());
|
||||
int index = addTab(tab, QString());
|
||||
int newIndex = insertTab(index, tab, QString());
|
||||
tab->attach(m_window);
|
||||
|
||||
if (openFlags.testFlag(Qz::NT_SelectedTab)) {
|
||||
setCurrentIndex(newIndex);
|
||||
} else {
|
||||
m_lastBackgroundTabIndex = index;
|
||||
}
|
||||
|
||||
connect(tab->webView(), SIGNAL(wantsCloseTab(int)), this, SLOT(closeTab(int)));
|
||||
connect(tab->webView(), SIGNAL(urlChanged(QUrl)), this, SIGNAL(changed()));
|
||||
connect(tab->webView(), SIGNAL(ipChanged(QString)), m_window->ipLabel(), SLOT(setText(QString)));
|
||||
|
||||
return index;
|
||||
// Make sure user notice opening new background tabs
|
||||
if (!(openFlags & Qz::NT_SelectedTab)) {
|
||||
m_tabBar->ensureVisible(index);
|
||||
}
|
||||
|
||||
emit changed();
|
||||
return newIndex;
|
||||
}
|
||||
|
||||
void TabWidget::addTabFromClipboard()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* ============================================================
|
||||
* Falkon - Qt web browser
|
||||
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -100,7 +100,8 @@ public:
|
|||
public slots:
|
||||
int addView(const LoadRequest &req, const Qz::NewTabPositionFlags &openFlags, bool selectLine = false, bool pinned = false);
|
||||
int addView(const LoadRequest &req, const QString &title = tr("New tab"), const Qz::NewTabPositionFlags &openFlags = Qz::NT_SelectedTab, bool selectLine = false, int position = -1, bool pinned = false);
|
||||
int addView(WebTab* tab);
|
||||
int addView(WebTab *tab, const Qz::NewTabPositionFlags &openFlags);
|
||||
int insertView(int index, WebTab *tab, const Qz::NewTabPositionFlags &openFlags);
|
||||
|
||||
void addTabFromClipboard();
|
||||
int duplicateTab(int index);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* ============================================================
|
||||
* TabManager plugin for Falkon
|
||||
* Copyright (C) 2013-2017 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
|
||||
* Copyright (C) 2018 David Rosca <nowrep@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -546,7 +547,7 @@ static void detachTabsTo(BrowserWindow* targetWindow, const QHash<BrowserWindow*
|
|||
mainWindow = 0;
|
||||
}
|
||||
|
||||
targetWindow->tabWidget()->addView(webTab);
|
||||
targetWindow->tabWidget()->addView(webTab, Qz::NT_NotSelectedTab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user