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

parent 987cea97
......@@ -73,8 +73,8 @@ public:
{
if( job == this->job )
{
foreach( const QVariant& v, job->fetchResults().toList() )
{
const auto results = job->fetchResults().toList();
for (const QVariant& v : results) {
if( v.canConvert<KDevelop::VcsAnnotationLine>() )
{
VcsAnnotationLine l = v.value<KDevelop::VcsAnnotationLine>();
......
......@@ -123,7 +123,7 @@ public:
QMenu* createMenu(QWidget* parent)
{
bool allVersioned=true;
foreach(const QUrl &url, ctxUrls) {
for (const QUrl& url : qAsConst(ctxUrls)) {
allVersioned=allVersioned && vcs->isVersionControlled(url);
if(!allVersioned)
......@@ -226,7 +226,7 @@ void VcsPluginHelper::revert()
VcsJob* job=d->vcs->revert(d->ctxUrls);
connect(job, &VcsJob::finished, this, &VcsPluginHelper::revertDone);
foreach(const QUrl &url, d->ctxUrls) {
for (const QUrl& url : qAsConst(d->ctxUrls)) {
IDocument* doc=ICore::self()->documentController()->documentForUrl(url);
if(doc && doc->textDocument()) {
......@@ -509,7 +509,7 @@ void VcsPluginHelper::commit()
void VcsPluginHelper::push()
{
foreach(const QUrl &url, d->ctxUrls) {
for (const QUrl& url : qAsConst(d->ctxUrls)) {
VcsJob* job = d->plugin->extension<IDistributedVersionControl>()->push(url, VcsLocation());
ICore::self()->runController()->registerJob(job);
}
......@@ -517,7 +517,7 @@ void VcsPluginHelper::push()
void VcsPluginHelper::pull()
{
foreach(const QUrl &url, d->ctxUrls) {
for (const QUrl& url : qAsConst(d->ctxUrls)) {
VcsJob* job = d->plugin->extension<IDistributedVersionControl>()->pull(VcsLocation(), url);
ICore::self()->runController()->registerJob(job);
}
......
......@@ -63,8 +63,10 @@ VCSCommitDiffPatchSource::VCSCommitDiffPatchSource(VCSDiffUpdater* updater)
m_oldMessages = new KComboBox(m_commitMessageWidget.data());
m_oldMessages->addItem(i18n("Old Messages"));
foreach(const QString& message, oldMessages())
const auto oldMessages = this->oldMessages();
for (const QString& message : oldMessages) {
m_oldMessages->addItem(message, message);
}
m_oldMessages->setMaximumWidth(200);
connect(m_oldMessages, QOverload<const QString&>::of(&KComboBox::currentIndexChanged),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment