summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-11-23 07:09:39 (GMT)
committerTobias Markmann <tm@ayena.de>2016-11-23 11:30:02 (GMT)
commite405ff3561be3d3c0bd79d7d5173923a8828cf02 (patch)
tree9118ef838ebfaec1df90ec24761944b5d833774c /Swift/QtUI/Roster
parent8a71b91be885652f37c5aab5e1ecf25af4599fbc (diff)
downloadswift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.zip
swift-e405ff3561be3d3c0bd79d7d5173923a8828cf02.tar.bz2
Migrate remaining Swiften/Base/foreach.h use to range-based for loop
Test-Information: Build on macOS 10.12.1 and all tests pass. Change-Id: Iedaa3fa7e7672c77909fd0568bf30e9393cb87e0
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/QtFilterWidget.cpp4
-rw-r--r--Swift/QtUI/Roster/QtOccupantListWidget.cpp2
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp2
-rw-r--r--Swift/QtUI/Roster/RosterTooltip.cpp8
4 files changed, 8 insertions, 8 deletions
diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp
index d2e4d09..2e1ead9 100644
--- a/Swift/QtUI/Roster/QtFilterWidget.cpp
+++ b/Swift/QtUI/Roster/QtFilterWidget.cpp
@@ -100,7 +100,7 @@ bool QtFilterWidget::eventFilter(QObject*, QEvent* event) {
void QtFilterWidget::popAllFilters() {
std::vector<RosterFilter*> filters = treeView_->getRoster()->getFilters();
- foreach(RosterFilter* filter, filters) {
+ for (auto filter : filters) {
filters_.push_back(filter);
treeView_->getRoster()->removeFilter(filter);
}
@@ -111,7 +111,7 @@ void QtFilterWidget::popAllFilters() {
void QtFilterWidget::pushAllFilters() {
treeView_->getRoster()->onFilterAdded.disconnect(boost::bind(&QtFilterWidget::handleFilterAdded, this, _1));
treeView_->getRoster()->onFilterRemoved.disconnect(boost::bind(&QtFilterWidget::handleFilterRemoved, this, _1));
- foreach(RosterFilter* filter, filters_) {
+ for (auto filter : filters_) {
treeView_->getRoster()->addFilter(filter);
}
filters_.clear();
diff --git a/Swift/QtUI/Roster/QtOccupantListWidget.cpp b/Swift/QtUI/Roster/QtOccupantListWidget.cpp
index 03c14fd..a12863d 100644
--- a/Swift/QtUI/Roster/QtOccupantListWidget.cpp
+++ b/Swift/QtUI/Roster/QtOccupantListWidget.cpp
@@ -50,7 +50,7 @@ void QtOccupantListWidget::contextMenuEvent(QContextMenuEvent* event) {
}
else {
std::map<QAction*, ChatWindow::OccupantAction> actions;
- foreach (ChatWindow::OccupantAction availableAction, availableOccupantActions_) {
+ for (const auto& availableAction : availableOccupantActions_) {
QString text = "Error: missing string";
switch (availableAction) {
case ChatWindow::Kick: text = tr("Kick user"); break;
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp
index 3f77c86..ef4d778 100644
--- a/Swift/QtUI/Roster/RosterModel.cpp
+++ b/Swift/QtUI/Roster/RosterModel.cpp
@@ -53,7 +53,7 @@ void RosterModel::reLayout() {
if (!roster_) {
return;
}
- foreach (RosterItem* item, roster_->getRoot()->getDisplayedChildren()) {
+ for (auto item : roster_->getRoot()->getDisplayedChildren()) {
GroupRosterItem* child = dynamic_cast<GroupRosterItem*>(item);
if (!child) continue;
emit itemExpanded(index(child), child->isExpanded());
diff --git a/Swift/QtUI/Roster/RosterTooltip.cpp b/Swift/QtUI/Roster/RosterTooltip.cpp
index 8d467fd..ea4c9cd 100644
--- a/Swift/QtUI/Roster/RosterTooltip.cpp
+++ b/Swift/QtUI/Roster/RosterTooltip.cpp
@@ -122,7 +122,7 @@ QString RosterTooltip::buildVCardSummary(VCard::ref vcard) {
// star | name | content
QString currentBlock;
- foreach (const VCard::Telephone& tel, vcard->getTelephones()) {
+ for (const auto& tel : vcard->getTelephones()) {
QString type = tel.isFax ? QObject::tr("Fax") : QObject::tr("Telephone");
QString field = buildVCardField(tel.isPreferred, type, htmlEscape(P2QSTRING(tel.number)));
if (tel.isPreferred) {
@@ -134,7 +134,7 @@ QString RosterTooltip::buildVCardSummary(VCard::ref vcard) {
summary += currentBlock;
currentBlock = "";
- foreach (const VCard::EMailAddress& mail, vcard->getEMailAddresses()) {
+ for (const auto& mail : vcard->getEMailAddresses()) {
QString field = buildVCardField(mail.isPreferred, QObject::tr("E-Mail"), htmlEscape(P2QSTRING(mail.address)));
if (mail.isPreferred) {
currentBlock = field;
@@ -145,14 +145,14 @@ QString RosterTooltip::buildVCardSummary(VCard::ref vcard) {
summary += currentBlock;
currentBlock = "";
- foreach (const VCard::Organization& org, vcard->getOrganizations()) {
+ for (const auto& org : vcard->getOrganizations()) {
QString field = buildVCardField(false, QObject::tr("Organization"), htmlEscape(P2QSTRING(org.name)));
currentBlock += field;
}
summary += currentBlock;
currentBlock = "";
- foreach(const std::string& title, vcard->getTitles()) {
+ for (const auto& title : vcard->getTitles()) {
QString field = buildVCardField(false, QObject::tr("Title"), htmlEscape(P2QSTRING(title)));
currentBlock += field;
}