Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

kdevplastform/shell: port foreach -> range-based for

parent 9ca7946b
......@@ -129,7 +129,8 @@ void ConfigDialog::removeConfigPage(ConfigPage* page)
void ConfigDialog::removePagesForPlugin(IPlugin* plugin)
{
Q_ASSERT(plugin);
foreach (auto&& item, m_pages) {
const auto oldPages = m_pages;
for (auto&& item : oldPages) {
if (!item) {
continue;
}
......
......@@ -136,8 +136,10 @@ void DebugController::initializeUi()
this, QStringLiteral("org.kdevelop.debugger.VariablesView"),
Qt::LeftDockWidgetArea));
foreach(KParts::Part* p, KDevelop::ICore::self()->partController()->parts())
const auto parts = KDevelop::ICore::self()->partController()->parts();
for (KParts::Part* p : parts) {
partAdded(p);
}
connect(KDevelop::ICore::self()->partController(),
&IPartController::partAdded,
this,
......@@ -318,7 +320,8 @@ void DebugController::addSession(IDebugSession* session)
void DebugController::clearExecutionPoint()
{
qCDebug(SHELL);
foreach (KDevelop::IDocument* document, KDevelop::ICore::self()->documentController()->openDocuments()) {
const auto documents = KDevelop::ICore::self()->documentController()->openDocuments();
for (KDevelop::IDocument* document : documents) {
auto *iface = dynamic_cast<KTextEditor::MarkInterface*>(document->textDocument());
if (!iface)
continue;
......
......@@ -177,7 +177,8 @@ IDocumentation::Ptr DocumentationController::documentationForDeclaration(Declara
if (!decl)
return {};
foreach (IDocumentationProvider* doc, documentationProviders()) {
const auto documentationProviders = this->documentationProviders();
for (IDocumentationProvider* doc : documentationProviders) {
qCDebug(SHELL) << "Documentation provider found:" << doc;
auto ret = doc->documentationForDeclaration(decl);
......
......@@ -147,7 +147,7 @@ public:
const auto res = showOpenFile();
if( !res.urls.isEmpty() ) {
QString encoding = res.encoding;
foreach( const QUrl& u, res.urls ) {
for (const QUrl& u : res.urls) {
openDocumentInternal(u, QString(), KTextEditor::Range::invalid(), encoding );
}
}
......@@ -376,17 +376,13 @@ public:
if (!activationParams.testFlag(IDocumentController::DoNotCreateView))
{
//find a view if there's one already opened in this area
Sublime::View *partView = nullptr;
Sublime::AreaIndex* activeViewIdx = area->indexOf(uiController->activeSublimeWindow()->activeView());
foreach (Sublime::View *view, sdoc->views())
{
const auto& views = sdoc->views();
auto it = std::find_if(views.begin(), views.end(), [&](Sublime::View* view) {
Sublime::AreaIndex* areaIdx = area->indexOf(view);
if (areaIdx && areaIdx == activeViewIdx)
{
partView = view;
break;
}
}
return (areaIdx && areaIdx == activeViewIdx);
});
Sublime::View* partView = (it != views.end()) ? *it : nullptr;
bool addView = false;
if (!partView)
{
......@@ -421,11 +417,13 @@ public:
Sublime::AreaIndex *pActiveViewIndex = area->indexOf(uiController->activeSublimeWindow()->activeView());
if(pActiveViewIndex) {
// try to find existing View of buddy document in current active view's tab
foreach (Sublime::View *pView, pActiveViewIndex->views()) {
if(sublimeDocBuddy->views().contains(pView)) {
buddyView = pView;
break;
}
const auto& activeAreaViews = pActiveViewIndex->views();
const auto& buddyViews = sublimeDocBuddy->views();
auto it = std::find_if(activeAreaViews.begin(), activeAreaViews.end(), [&](Sublime::View* view) {
return buddyViews.contains(view);
});
if (it != activeAreaViews.end()) {
buddyView = *it;
}
}
}
......@@ -577,8 +575,10 @@ void DocumentController::cleanup()
// Close all documents without checking if they should be saved.
// This is because the user gets a chance to save them during MainWindow::queryClose.
foreach (IDocument* doc, openDocuments())
const auto documents = openDocuments();
for (IDocument* doc : documents) {
doc->close(IDocument::Discard);
}
}
DocumentController::~DocumentController() = default;
......@@ -760,8 +760,7 @@ IDocument * DocumentController::documentForUrl( const QUrl & dirtyUrl ) const
QList<IDocument*> DocumentController::openDocuments() const
{
QList<IDocument*> opened;
foreach (IDocument *doc, d->documents)
{
for (IDocument* doc : qAsConst(d->documents)) {
auto *sdoc = dynamic_cast<Sublime::Document*>(doc);
if( !sdoc )
{
......@@ -793,7 +792,8 @@ bool DocumentController::saveAllDocuments(IDocument::DocumentSaveMode mode)
bool KDevelop::DocumentController::saveSomeDocuments(const QList< IDocument * > & list, IDocument::DocumentSaveMode mode)
{
if (mode & IDocument::Silent) {
foreach (IDocument* doc, modifiedDocuments(list)) {
const auto documents = modifiedDocuments(list);
for (IDocument* doc : documents) {
if( !DocumentController::isEmptyDocumentUrl(doc->url()) && !doc->save(mode) )
{
if( doc )
......@@ -822,13 +822,15 @@ QList< IDocument * > KDevelop::DocumentController::visibleDocumentsInWindow(Main
// Gather a list of all documents which do have a view in the given main window
// Does not find documents which are open in inactive areas
QList<IDocument*> list;
foreach (IDocument* doc, openDocuments()) {
const auto documents = openDocuments();
for (IDocument* doc : documents) {
if (auto* sdoc = dynamic_cast<Sublime::Document*>(doc)) {
foreach (Sublime::View* view, sdoc->views()) {
if (view->hasWidget() && view->widget()->window() == mw) {
list.append(doc);
break;
}
const auto views = sdoc->views();
auto hasViewInWindow = std::any_of(views.begin(), views.end(), [&](Sublime::View* view) {
return (view->hasWidget() && view->widget()->window() == mw);
});
if (hasViewInWindow) {
list.append(doc);
}
}
}
......@@ -840,14 +842,23 @@ QList< IDocument * > KDevelop::DocumentController::documentsExclusivelyInWindow(
// Gather a list of all documents which have views only in the given main window
QList<IDocument*> checkSave;
foreach (IDocument* doc, openDocuments()) {
const auto documents = openDocuments();
for (IDocument* doc : documents) {
if (auto* sdoc = dynamic_cast<Sublime::Document*>(doc)) {
bool inOtherWindow = false;
foreach (Sublime::View* view, sdoc->views()) {
foreach(Sublime::MainWindow* window, Core::self()->uiControllerInternal()->mainWindows())
if(window->containsView(view) && (window != mw || (currentAreaOnly && window == mw && !mw->area()->views().contains(view))))
const auto views = sdoc->views();
for (Sublime::View* view : views) {
const auto windows = Core::self()->uiControllerInternal()->mainWindows();
for (Sublime::MainWindow* window : windows) {
if(window->containsView(view) && (window != mw || (currentAreaOnly && window == mw && !mw->area()->views().contains(view)))) {
inOtherWindow = true;
break;
}
}
if (inOtherWindow) {
break;
}
}
if (!inOtherWindow)
......@@ -924,7 +935,8 @@ void DocumentController::closeAllOtherDocuments()
// User cancelled or other error
return;
foreach (Sublime::View* view, mw->area()->views()) {
const auto views = mw->area()->views();
for (Sublime::View* view : views) {
if (view != activeView)
mw->area()->closeView(view);
}
......@@ -956,7 +968,8 @@ KTextEditor::View* DocumentController::activeTextDocumentView() const
QString DocumentController::activeDocumentPath( const QString& target ) const
{
if(!target.isEmpty()) {
foreach(IProject* project, Core::self()->projectController()->projects()) {
const auto projects = Core::self()->projectController()->projects();
for (IProject* project : projects) {
if(project->name().startsWith(target, Qt::CaseInsensitive)) {
return project->path().pathOrUrl() + QLatin1String("/.");
}
......@@ -984,8 +997,10 @@ QStringList DocumentController::activeDocumentPaths() const
if( !uiController->activeSublimeWindow() ) return QStringList();
QSet<QString> documents;
foreach(Sublime::View* view, uiController->activeSublimeWindow()->area()->views())
const auto views = uiController->activeSublimeWindow()->area()->views();
for (Sublime::View* view : views) {
documents.insert(view->document()->documentSpecifier());
}
return documents.toList();
}
......@@ -1017,7 +1032,8 @@ QUrl DocumentController::nextEmptyDocumentUrl()
{
int nextEmptyDocNumber = 0;
const auto& pattern = emptyDocumentPattern();
foreach (IDocument *doc, Core::self()->documentControllerInternal()->openDocuments()) {
const auto openDocuments = Core::self()->documentControllerInternal()->openDocuments();
for (IDocument* doc : openDocuments) {
if (DocumentController::isEmptyDocumentUrl(doc->url())) {
const auto match = pattern.match(doc->url().toDisplayString(QUrl::PreferLocalFile));
if (match.hasMatch()) {
......@@ -1128,8 +1144,9 @@ bool DocumentController::openDocumentsWithSplitSeparators( Sublime::AreaIndex* i
{
if(urlsWithSeparators.size() > 1)
{
foreach(const QStringList& group, groups)
for (const QStringList& group : qAsConst(groups)) {
ret &= openDocumentsWithSplitSeparators( index, group, isFirstView );
}
}else{
while(index->isSplit())
index = index->first();
......
......@@ -129,13 +129,11 @@ public:
QString path = problem->finalLocation().document.str();
/// See if we already have this path
ProblemStoreNode *parent = nullptr;
foreach (ProblemStoreNode *node, m_groupedRootNode->children()) {
if (node->label() == path) {
parent = node;
break;
}
}
const auto childrenNodes = m_groupedRootNode->children();
auto it = std::find_if(childrenNodes.begin(), childrenNodes.end(), [&](ProblemStoreNode* node) {
return (node->label() == path);
});
ProblemStoreNode* parent = (it != childrenNodes.end()) ? *it : nullptr;
/// If not add it!
if (parent == nullptr) {
......@@ -261,7 +259,8 @@ void FilteredProblemStore::rebuild()
d->m_strategy->clear();
foreach (ProblemStoreNode *node, rootNode()->children()) {
const auto childrenNodes = rootNode()->children();
for (ProblemStoreNode* node : childrenNodes) {
IProblem::Ptr problem = node->problem();
if (d->match(problem)) {
d->m_strategy->addProblem(problem);
......
......@@ -276,15 +276,17 @@ QWidget *MainWindow::window() const
QList<KTextEditor::View *> MainWindow::views() const
{
QList<KTextEditor::View *> views;
foreach (auto area, m_mainWindow->areas()) {
foreach (auto view, area->views()) {
QList<KTextEditor::View *> kteViews;
const auto areas = m_mainWindow->areas();
for (auto* area : areas) {
const auto views = area->views();
for (auto* view : views) {
if (auto kteView = toKteView(view)) {
views << kteView;
kteViews << kteView;
}
}
}
return views;
return kteViews;
}
KTextEditor::View *MainWindow::activeView() const
......@@ -294,8 +296,10 @@ KTextEditor::View *MainWindow::activeView() const
KTextEditor::View *MainWindow::activateView(KTextEditor::Document *doc)
{
foreach (auto area, m_mainWindow->areas()) {
foreach (auto view, area->views()) {
const auto areas = m_mainWindow->areas();
for (auto* area : areas) {
const auto views = area->views();
for (auto* view : views) {
if (auto kteView = toKteView(view)) {
if (kteView->document() == doc) {
m_mainWindow->activateView(view);
......
......@@ -189,8 +189,9 @@ QList<ILanguageSupport*> LanguageController::loadedLanguages() const
return ret;
ret.reserve(d->languages.size());
foreach(ILanguageSupport* lang, d->languages)
for (ILanguageSupport* lang : qAsConst(d->languages)) {
ret << lang;
}
return ret;
}
......@@ -264,7 +265,8 @@ QList<ILanguageSupport*> LanguageController::languagesForUrl(const QUrl &url)
for(LanguageControllerPrivate::MimeTypeCache::const_iterator it = d->mimeTypeCache.constBegin();
it != d->mimeTypeCache.constEnd(); ++it)
{
foreach(const QString& pattern, it.key().globPatterns()) {
const auto globPatterns = it.key().globPatterns();
for (const QString& pattern : globPatterns) {
if(pattern.startsWith(QLatin1Char('*'))) {
const QStringRef subPattern = pattern.midRef(1);
if (!subPattern.contains(QLatin1Char('*'))) {
......@@ -350,11 +352,11 @@ QList<QString> LanguageController::mimetypesForLanguageName(const QString& langu
QList<QString> mimetypes;
for (LanguageCache::ConstIterator iter = d->languageCache.constBegin(); iter != d->languageCache.constEnd(); ++iter) {
foreach (ILanguageSupport* language, iter.value()) {
if (language->name() == languageName) {
mimetypes << iter.key();
break;
}
bool isFromLanguage = std::any_of(iter.value().begin(), iter.value().end(), [&] (ILanguageSupport* language ) {
return (language->name() == languageName);
});
if (isFromLanguage) {
mimetypes << iter.key();
}
}
return mimetypes;
......
......@@ -129,14 +129,13 @@ QString LaunchConfiguration::launcherForMode(const QString& mode) const
int idx = modes.indexOf( mode );
if( idx != -1 )
{
QStringList launchers = d->baseGroup.readEntry("Configured Launchers", QStringList());
if( launchers.count() > idx )
{
foreach( ILauncher* l, type()->launchers() )
{
if( l->id() == launchers.at( idx ) )
{
return launchers.at( idx );
const QStringList launcherIds = d->baseGroup.readEntry("Configured Launchers", QStringList());
if (launcherIds.count() > idx ) {
const auto& id = launcherIds.at(idx);
const auto typeLaunchers = type()->launchers();
for (ILauncher* l : typeLaunchers) {
if (l->id() == id) {
return id;
}
}
}
......@@ -145,8 +144,8 @@ QString LaunchConfiguration::launcherForMode(const QString& mode) const
// No launcher configured, if it's debug mode, prefer GDB if available.
if( mode == QLatin1String("debug") )
{
foreach( ILauncher* l, type()->launchers() )
{
const auto launchers = type()->launchers();
for (ILauncher* l : launchers) {
if( l->supportedModes().contains( mode ) && l->id() == QLatin1String("gdb") )
{
return l->id();
......@@ -154,8 +153,8 @@ QString LaunchConfiguration::launcherForMode(const QString& mode) const
}
}
// Otherwise, lets just try with the first one in the list and hope it works
foreach( ILauncher* l, type()->launchers() )
{
const auto launchers = type()->launchers();
for (ILauncher* l : launchers) {
if( l->supportedModes().contains( mode ) )
{
return l->id();
......
......@@ -143,8 +143,7 @@ LaunchConfigurationDialog::LaunchConfigurationDialog(QWidget* parent)
auto* m = new QMenu(this);
QList<LaunchConfigurationType*> types = Core::self()->runController()->launchConfigurationTypes();
std::sort(types.begin(), types.end(), launchConfigGreaterThan); //we want it in reverse order
foreach(LaunchConfigurationType* type, types)
{
for (LaunchConfigurationType* type : qAsConst(types)) {
connect(type, &LaunchConfigurationType::signalAddLaunchConfiguration, this, &LaunchConfigurationDialog::addConfiguration);
QMenu* suggestionsMenu = type->launcherSuggestions();
......@@ -169,7 +168,7 @@ LaunchConfigurationDialog::LaunchConfigurationDialog(QWidget* parent)
m->insertAction(m->actions().at(0), separator);
}
foreach(LaunchConfigurationType* type, types) {
for (LaunchConfigurationType* type : qAsConst(types)) {
QAction* action = new QAction(type->icon(), type->name(), m);
action->setProperty("configtype", qVariantFromValue<QObject*>(type));
connect(action, &QAction::triggered, this, &LaunchConfigurationDialog::createEmptyLauncher);
......@@ -501,8 +500,8 @@ LaunchConfigurationsModel::LaunchConfigurationsModel(QObject* parent): QAbstract
t->row = topItems.count();
topItems << t;
}
foreach( LaunchConfiguration* l, Core::self()->runControllerInternal()->launchConfigurationsInternal() )
{
const auto launchConfigurations = Core::self()->runControllerInternal()->launchConfigurationsInternal();
for (LaunchConfiguration* l : launchConfigurations) {
addItemForLaunchConfig( l );
}
}
......@@ -527,10 +526,10 @@ void LaunchConfigurationsModel::addLaunchModeItemsForLaunchConfig ( LaunchItem*
{
QList<TreeItem*> items;
QSet<QString> modes;
foreach( ILauncher* launcher, t->launch->type()->launchers() )
{
foreach( const QString& mode, launcher->supportedModes() )
{
const auto launchers = t->launch->type()->launchers();
for (ILauncher* launcher : launchers) {
const auto supportedModes = launcher->supportedModes();
for (const QString& mode : supportedModes) {
if( !modes.contains( mode ) && launcher->configPages().count() > 0 )
{
modes.insert( mode );
......@@ -551,10 +550,9 @@ void LaunchConfigurationsModel::addLaunchModeItemsForLaunchConfig ( LaunchItem*
}
}
LaunchConfigurationsModel::ProjectItem* LaunchConfigurationsModel::findItemForProject( IProject* p )
LaunchConfigurationsModel::ProjectItem* LaunchConfigurationsModel::findItemForProject(IProject* p) const
{
foreach( TreeItem* t, topItems )
{
for (TreeItem* t : topItems) {
auto* pi = dynamic_cast<ProjectItem*>( t );
if( pi && pi->project == p )
{
......@@ -840,8 +838,7 @@ QModelIndex LaunchConfigurationsModel::indexForConfig( LaunchConfiguration* l )
if( tparent )
{
foreach( TreeItem* c, tparent->children )
{
for (TreeItem* c : qAsConst(tparent->children)) {
auto* li = dynamic_cast<LaunchItem*>( c );
if( li->launch && li->launch == l )
{
......@@ -940,16 +937,14 @@ LaunchConfigPagesContainer::LaunchConfigPagesContainer( const QList<LaunchConfig
void LaunchConfigPagesContainer::setLaunchConfiguration( KDevelop::LaunchConfiguration* l )
{
config = l;
foreach( LaunchConfigurationPage* p, pages )
{
for (LaunchConfigurationPage* p : qAsConst(pages)) {
p->loadFromConfiguration( config->config(), config->project() );
}
}
void LaunchConfigPagesContainer::save()
{
foreach( LaunchConfigurationPage* p, pages )
{
for (LaunchConfigurationPage* p : qAsConst(pages)) {
p->saveToConfiguration( config->config() );
}
config->config().sync();
......
......@@ -115,7 +115,7 @@ private:
QList<TreeItem*> topItems;
public:
ProjectItem* findItemForProject( IProject* );
ProjectItem* findItemForProject(IProject* p) const;
};
class LaunchConfigPagesContainer : public QWidget
......
......@@ -278,8 +278,9 @@ void MainWindow::configureShortcuts()
// so we can connect to the saved() signal to propagate changes in the editor shortcuts
KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
foreach (KXMLGUIClient *client, Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients())
{
const auto firstMainWindowClientsBefore = Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients();
for (KXMLGUIClient* client : firstMainWindowClientsBefore) {
if(client && !client->xmlFile().isEmpty())
dlg.addCollection( client->actionCollection() );
}
......@@ -288,8 +289,11 @@ void MainWindow::configureShortcuts()
dlg.configure(true);
QMap<QString, QKeySequence> shortcuts;
foreach(KXMLGUIClient* client, Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients()) {
foreach(QAction* action, client->actionCollection()->actions()) {
// querying again just in case something changed behind our back
const auto firstMainWindowClientsAfter = Core::self()->uiControllerInternal()->mainWindows()[0]->guiFactory()->clients();
for (KXMLGUIClient* client : firstMainWindowClientsAfter) {
const auto actions = client->actionCollection()->actions();
for (QAction* action : actions) {
if(!action->objectName().isEmpty()) {
shortcuts[action->objectName()] = action->shortcut();
}
......@@ -297,8 +301,10 @@ void MainWindow::configureShortcuts()
}
for(int a = 1; a < Core::self()->uiControllerInternal()->mainWindows().size(); ++a) {
foreach(KXMLGUIClient* client, Core::self()->uiControllerInternal()->mainWindows()[a]->guiFactory()->clients()) {
foreach(QAction* action, client->actionCollection()->actions()) {
const auto clients = Core::self()->uiControllerInternal()->mainWindows()[a]->guiFactory()->clients();
for (KXMLGUIClient* client : clients) {
const auto actions = client->actionCollection()->actions();
for (QAction* action : actions) {
qCDebug(SHELL) << "transferring setting shortcut for" << action->objectName();
const auto shortcutIt = shortcuts.constFind(action->objectName());
if (shortcutIt != shortcuts.constEnd()) {
......@@ -316,10 +322,12 @@ void MainWindow::shortcutsChanged()
if(!activeClient)
return;
foreach(IDocument * doc, Core::self()->documentController()->openDocuments()) {
const auto documents = Core::self()->documentController()->openDocuments();
for (IDocument* doc : documents) {
KTextEditor::Document *textDocument = doc->textDocument();
if (textDocument) {
foreach(KTextEditor::View *client, textDocument->views()) {
const auto views = textDocument->views();
for (KTextEditor::View* client : views) {
if (client != activeClient) {
client->reloadXML();
}
......@@ -348,8 +356,10 @@ void MainWindow::initialize()
connect(Core::self()->sourceFormatterControllerInternal(), &SourceFormatterController::hasFormattersChanged,
d, &MainWindowPrivate::updateSourceFormatterGuiClient);
foreach(IPlugin* plugin, Core::self()->pluginController()->loadedPlugins())
const auto plugins = Core::self()->pluginController()->loadedPlugins();
for (IPlugin* plugin : plugins) {
d->addPlugin(plugin);
}
guiFactory()->addClient(Core::self()->sessionController());
if (Core::self()->sourceFormatterControllerInternal()->hasFormatters()) {
......@@ -460,7 +470,8 @@ void MainWindow::updateAllTabColors()
const auto defaultColor = ::defaultColor(palette());
if (UiConfig::colorizeByProject()) {
QHash<const Sublime::View*, QColor> viewColors;
foreach (auto container, containers()) {
const auto containers = this->containers();
for (auto* container : containers) {
const auto views = container->views();
viewColors.reserve(views.size());
viewColors.clear();
......@@ -473,7 +484,8 @@ void MainWindow::updateAllTabColors()
container->setTabColors(viewColors);
}
} else {
foreach (auto container, containers()) {
const auto containers = this->containers();
for (auto* container : containers) {
container->resetTabColors(defaultColor);
}
}
......@@ -485,8 +497,10 @@ void MainWindow::updateTabColor(IDocument* doc)
return;
const auto color = colorForDocument(doc->url(), palette(), defaultColor(palette()));
foreach (auto container, containers()) {
foreach (auto view, container->views()) {
const auto containers = this->containers();
for (auto* container : containers) {
const auto views = container->views();
for (auto* view : views) {
const auto urlDoc = qobject_cast<Sublime::UrlDocument*>(view->document());
if (urlDoc && urlDoc->url() == doc->url()) {
container->setTabColor(view, color);
......
......@@ -237,7 +237,8 @@ void MainWindowPrivate::contextMenuSplitVertical()
void MainWindowPrivate::reloadAll()
{
foreach ( IDocument* doc, Core::self()->documentController()->openDocuments() ) {
const auto documents = Core::self()->documentController()->openDocuments() ;
for (IDocument* doc : documents) {
doc->reload();
}
}
......
......@@ -251,21 +251,21 @@ void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
}
// Now find a manager for the file(s) in our filelist.
QVector<ProjectFileChoice> choices;
Q_FOREACH ( const auto& file, m_fileList ) {
for (const auto& file : qAsConst(m_fileList)) {
auto plugins = projectManagerForFile(file);
if ( plugins.contains(QStringLiteral("<built-in>")) ) {
plugins.removeAll(QStringLiteral("<built-in>"));
choices.append({i18n("Open existing file \"%1\"", file), QStringLiteral("<built-in>"), QString()});
}
choices.reserve(choices.size() + plugins.size());
Q_FOREACH ( const auto& plugin, plugins ) {
for (const auto& plugin : qAsConst(plugins)) {
auto meta = m_projectPlugins.value(plugin);
choices.append({file + QLatin1String(" (") + plugin + QLatin1Char(')'), meta.pluginId(), meta.iconName(), file});
}
}
// add managers that work in any case (e.g. KDevGenericManager)
choices.reserve(choices.size() + m_genericProjectPlugins.size());
Q_FOREACH ( const auto& plugin, m_genericProjectPlugins ) {
for (const auto& plugin : qAsConst(m_genericProjectPlugins)) {
qCDebug(SHELL) << plugin;
auto meta = m_projectPlugins.value(plugin);
choices.append({plugin, meta.pluginId(), meta.iconName()});
......@@ -285,10 +285,9 @@ void OpenProjectDialog::validateOpenUrl( const QUrl& url_ )
QStringList OpenProjectDialog::projectManagerForFile(const QString& file) const
{
QStringList ret;
foreach( const QString& manager, m_projectFilters.keys() )
{
foreach( const QString& filterexp, m_projectFilters.value(manager) )
{
for (auto it = m_projectFilters.begin(), end = m_projectFilters.end(); it != end; ++it) {
const QString& manager = it.key();
for (const QString& filterexp : it.value()) {
QRegExp exp( filterexp, Qt::CaseSensitive, QRegExp::Wildcard );
if ( exp.exactMatch(file) ) {
ret.append(manager);
......
......@@ -101,8 +101,10 @@ void PartController::setShowTextEditorStatusBar(bool show)
d->m_showTextEditorStatusBar = show;
// update
foreach (Sublime::Area* area, Core::self()->uiControllerInternal()->allAreas()) {
foreach (Sublime::View* view, area->views()) {
const auto areas = Core::self<