mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
TabManager: port foreach -> range-based for
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
parent
9330f8cc04
commit
def38a2da4
@ -189,7 +189,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte
|
|||||||
// Look for longer parts first
|
// Look for longer parts first
|
||||||
std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
|
std::sort(searchStrings.begin(), searchStrings.end(), sizeBiggerThan);
|
||||||
|
|
||||||
foreach (const QString &string, searchStrings) {
|
for (const QString &string : qAsConst(searchStrings)) {
|
||||||
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
|
int delimiter = text.indexOf(string, 0, Qt::CaseInsensitive);
|
||||||
|
|
||||||
while (delimiter != -1) {
|
while (delimiter != -1) {
|
||||||
|
@ -114,7 +114,8 @@ void TabManagerPlugin::insertManagerWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_initState) {
|
if (m_initState) {
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
const auto windows = mApp->windows();
|
||||||
|
for (BrowserWindow* window : windows) {
|
||||||
mainWindowCreated(window, false);
|
mainWindowCreated(window, false);
|
||||||
}
|
}
|
||||||
m_initState = false;
|
m_initState = false;
|
||||||
@ -141,7 +142,8 @@ void TabManagerPlugin::mainWindowCreated(BrowserWindow* window, bool refresh)
|
|||||||
|
|
||||||
void TabManagerPlugin::setTabBarVisible(bool visible)
|
void TabManagerPlugin::setTabBarVisible(bool visible)
|
||||||
{
|
{
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
const auto windows = mApp->windows();
|
||||||
|
for (BrowserWindow* window : windows) {
|
||||||
window->tabWidget()->tabBar()->setForceHidden(!visible);
|
window->tabWidget()->tabBar()->setForceHidden(!visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +155,8 @@ void TabManagerPlugin::removeManagerWidget()
|
|||||||
}
|
}
|
||||||
else if (viewType() == ShowAsWindow) {
|
else if (viewType() == ShowAsWindow) {
|
||||||
// remove statusbar icon
|
// remove statusbar icon
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
const auto windows = mApp->windows();
|
||||||
|
for (BrowserWindow* window : windows) {
|
||||||
m_controller->removeStatusBarIcon(window);
|
m_controller->removeStatusBarIcon(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +185,8 @@ void TabManagerPlugin::setViewType(ViewType type)
|
|||||||
}
|
}
|
||||||
else if (m_viewType == ShowAsWindow) {
|
else if (m_viewType == ShowAsWindow) {
|
||||||
// add statusbar icon
|
// add statusbar icon
|
||||||
foreach (BrowserWindow* window, mApp->windows()) {
|
const auto windows = mApp->windows();
|
||||||
|
for (BrowserWindow* window : windows) {
|
||||||
m_controller->addStatusBarIcon(window);
|
m_controller->addStatusBarIcon(window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -525,10 +525,10 @@ void TabManagerWidget::closeSelectedTabs(const QHash<BrowserWindow*, WebTab*> &t
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
||||||
foreach (BrowserWindow* mainWindow, windows) {
|
for (BrowserWindow* mainWindow : windows) {
|
||||||
QList<WebTab*> tabs = tabsHash.values(mainWindow);
|
const QList<WebTab*> tabs = tabsHash.values(mainWindow);
|
||||||
|
|
||||||
foreach (WebTab* webTab, tabs) {
|
for (WebTab* webTab : tabs) {
|
||||||
mainWindow->tabWidget()->requestCloseTab(webTab->tabIndex());
|
mainWindow->tabWidget()->requestCloseTab(webTab->tabIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,9 +537,9 @@ void TabManagerWidget::closeSelectedTabs(const QHash<BrowserWindow*, WebTab*> &t
|
|||||||
static void detachTabsTo(BrowserWindow* targetWindow, const QHash<BrowserWindow*, WebTab*> &tabsHash)
|
static void detachTabsTo(BrowserWindow* targetWindow, const QHash<BrowserWindow*, WebTab*> &tabsHash)
|
||||||
{
|
{
|
||||||
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
||||||
foreach (BrowserWindow* mainWindow, windows) {
|
for (BrowserWindow* mainWindow : windows) {
|
||||||
const QList<WebTab*> &tabs = tabsHash.values(mainWindow);
|
const QList<WebTab*> &tabs = tabsHash.values(mainWindow);
|
||||||
foreach (WebTab* webTab, tabs) {
|
for (WebTab* webTab : tabs) {
|
||||||
mainWindow->tabWidget()->detachTab(webTab);
|
mainWindow->tabWidget()->detachTab(webTab);
|
||||||
|
|
||||||
if (mainWindow && mainWindow->tabCount() == 0) {
|
if (mainWindow && mainWindow->tabCount() == 0) {
|
||||||
@ -595,7 +595,7 @@ bool TabManagerWidget::bookmarkSelectedTabs(const QHash<BrowserWindow*, WebTab*>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (WebTab* tab, tabsHash) {
|
for (WebTab* tab : tabsHash) {
|
||||||
if (!tab->url().isEmpty()) {
|
if (!tab->url().isEmpty()) {
|
||||||
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
|
||||||
bookmark->setTitle(tab->title());
|
bookmark->setTitle(tab->title());
|
||||||
@ -615,10 +615,10 @@ void TabManagerWidget::unloadSelectedTabs(const QHash<BrowserWindow*, WebTab*> &
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
|
||||||
foreach (BrowserWindow* mainWindow, windows) {
|
for (BrowserWindow* mainWindow : windows) {
|
||||||
QList<WebTab*> tabs = tabsHash.values(mainWindow);
|
const QList<WebTab*> tabs = tabsHash.values(mainWindow);
|
||||||
|
|
||||||
foreach (WebTab* webTab, tabs) {
|
for (WebTab* webTab : tabs) {
|
||||||
mainWindow->tabWidget()->unloadTab(webTab->tabIndex());
|
mainWindow->tabWidget()->unloadTab(webTab->tabIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user