1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

TabManager: port foreach -> range-based for

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-12-30 17:36:35 +01:00
parent 9330f8cc04
commit def38a2da4
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
3 changed files with 18 additions and 14 deletions

View File

@ -189,7 +189,7 @@ void TabManagerDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewIte
// Look for longer parts first
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);
while (delimiter != -1) {

View File

@ -114,7 +114,8 @@ void TabManagerPlugin::insertManagerWidget()
}
if (m_initState) {
foreach (BrowserWindow* window, mApp->windows()) {
const auto windows = mApp->windows();
for (BrowserWindow* window : windows) {
mainWindowCreated(window, false);
}
m_initState = false;
@ -141,7 +142,8 @@ void TabManagerPlugin::mainWindowCreated(BrowserWindow* window, bool refresh)
void TabManagerPlugin::setTabBarVisible(bool visible)
{
foreach (BrowserWindow* window, mApp->windows()) {
const auto windows = mApp->windows();
for (BrowserWindow* window : windows) {
window->tabWidget()->tabBar()->setForceHidden(!visible);
}
}
@ -153,7 +155,8 @@ void TabManagerPlugin::removeManagerWidget()
}
else if (viewType() == ShowAsWindow) {
// remove statusbar icon
foreach (BrowserWindow* window, mApp->windows()) {
const auto windows = mApp->windows();
for (BrowserWindow* window : windows) {
m_controller->removeStatusBarIcon(window);
}
@ -182,7 +185,8 @@ void TabManagerPlugin::setViewType(ViewType type)
}
else if (m_viewType == ShowAsWindow) {
// add statusbar icon
foreach (BrowserWindow* window, mApp->windows()) {
const auto windows = mApp->windows();
for (BrowserWindow* window : windows) {
m_controller->addStatusBarIcon(window);
}
}

View File

@ -525,10 +525,10 @@ void TabManagerWidget::closeSelectedTabs(const QHash<BrowserWindow*, WebTab*> &t
}
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
QList<WebTab*> tabs = tabsHash.values(mainWindow);
for (BrowserWindow* mainWindow : windows) {
const QList<WebTab*> tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
for (WebTab* webTab : tabs) {
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)
{
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
for (BrowserWindow* mainWindow : windows) {
const QList<WebTab*> &tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
for (WebTab* webTab : tabs) {
mainWindow->tabWidget()->detachTab(webTab);
if (mainWindow && mainWindow->tabCount() == 0) {
@ -595,7 +595,7 @@ bool TabManagerWidget::bookmarkSelectedTabs(const QHash<BrowserWindow*, WebTab*>
return false;
}
foreach (WebTab* tab, tabsHash) {
for (WebTab* tab : tabsHash) {
if (!tab->url().isEmpty()) {
BookmarkItem* bookmark = new BookmarkItem(BookmarkItem::Url);
bookmark->setTitle(tab->title());
@ -615,10 +615,10 @@ void TabManagerWidget::unloadSelectedTabs(const QHash<BrowserWindow*, WebTab*> &
}
const QList<BrowserWindow*> &windows = tabsHash.uniqueKeys();
foreach (BrowserWindow* mainWindow, windows) {
QList<WebTab*> tabs = tabsHash.values(mainWindow);
for (BrowserWindow* mainWindow : windows) {
const QList<WebTab*> tabs = tabsHash.values(mainWindow);
foreach (WebTab* webTab, tabs) {
for (WebTab* webTab : tabs) {
mainWindow->tabWidget()->unloadTab(webTab->tabIndex());
}
}