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
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')
-rw-r--r--Swift/QtUI/ChatList/ChatListGroupItem.h5
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.cpp5
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.cpp2
-rw-r--r--Swift/QtUI/ChatSnippet.cpp2
-rw-r--r--Swift/QtUI/ChatSnippet.h2
-rw-r--r--Swift/QtUI/CocoaUIHelpers.mm6
-rw-r--r--Swift/QtUI/EventViewer/EventModel.cpp4
-rw-r--r--Swift/QtUI/QtAdHocCommandWindow.cpp4
-rw-r--r--Swift/QtUI/QtAffiliationEditor.cpp2
-rw-r--r--Swift/QtUI/QtBlockListEditorWindow.cpp3
-rw-r--r--Swift/QtUI/QtCertificateViewerDialog.cpp8
-rw-r--r--Swift/QtUI/QtChatTabs.cpp2
-rw-r--r--Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp3
-rw-r--r--Swift/QtUI/QtChatWindow.cpp5
-rw-r--r--Swift/QtUI/QtContactEditWidget.cpp12
-rw-r--r--Swift/QtUI/QtContactEditWidget.h4
-rw-r--r--Swift/QtUI/QtEmoticonsGrid.cpp10
-rw-r--r--Swift/QtUI/QtFormResultItemModel.cpp4
-rw-r--r--Swift/QtUI/QtFormWidget.cpp16
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp2
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp2
-rw-r--r--Swift/QtUI/QtPlainChatView.cpp3
-rw-r--r--Swift/QtUI/QtProfileWindow.cpp2
-rw-r--r--Swift/QtUI/QtSettingsProvider.cpp4
-rw-r--r--Swift/QtUI/QtSingleWindow.cpp6
-rw-r--r--Swift/QtUI/QtSpellCheckHighlighter.cpp4
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp8
-rw-r--r--Swift/QtUI/QtSubscriptionRequestWindow.cpp2
-rw-r--r--Swift/QtUI/QtTabbable.cpp1
-rw-r--r--Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp6
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp4
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp2
-rw-r--r--Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp4
-rw-r--r--Swift/QtUI/QtWebKitChatView.cpp2
-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
-rw-r--r--Swift/QtUI/UserSearch/ContactListModel.cpp1
-rw-r--r--Swift/QtUI/UserSearch/QtContactListWidget.cpp4
-rw-r--r--Swift/QtUI/WinUIHelpers.cpp2
41 files changed, 74 insertions, 100 deletions
diff --git a/Swift/QtUI/ChatList/ChatListGroupItem.h b/Swift/QtUI/ChatList/ChatListGroupItem.h
index 427f00b..a9bb9b1 100644
--- a/Swift/QtUI/ChatList/ChatListGroupItem.h
+++ b/Swift/QtUI/ChatList/ChatListGroupItem.h
@@ -8,8 +8,6 @@
#include <QList>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/QtUI/ChatList/ChatListItem.h>
namespace Swift {
@@ -24,13 +22,12 @@ namespace Swift {
int row(ChatListItem* item) {return items_.indexOf(item);}
QVariant data(int role) const {return (role == Qt::DisplayRole) ? name_ : QVariant();}
void clear() {
- foreach (ChatListItem* item, items_) {
+ for (auto item : items_) {
delete item;
}
items_.clear();
}
-
private:
static bool pointerItemLessThan(const ChatListItem* first, const ChatListItem* second) {
QString myName = first->data(Qt::DisplayRole).toString().toLower();
diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp
index e5e8963..416b786 100644
--- a/Swift/QtUI/ChatList/ChatListModel.cpp
+++ b/Swift/QtUI/ChatList/ChatListModel.cpp
@@ -96,7 +96,7 @@ void ChatListModel::setRecents(const std::list<ChatListWindow::Chat>& recents) {
recents_->clear();
endRemoveRows();
beginInsertRows(recentsIndex_, 0, recents.size());
- foreach (const ChatListWindow::Chat chat, recents) {
+ for (const auto& chat : recents) {
recents_->addItem(new ChatListRecentItem(chat, recents_));
//whiteboards_->addItem(new ChatListRecentItem(chat, whiteboards_));
}
@@ -121,8 +121,7 @@ QMimeData* ChatListModel::mimeData(const QModelIndexList& indexes) const {
}
dataStream << P2QSTRING(chat.jid.toString());
} else {
- typedef std::map<std::string, JID> JIDMap;
- foreach (const JIDMap::value_type& jid, chat.impromptuJIDs) {
+ for (const auto& jid : chat.impromptuJIDs) {
dataStream << P2QSTRING(jid.second.toString());
}
}
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp
index 3fe462a..3caed57 100644
--- a/Swift/QtUI/ChatList/QtChatListWindow.cpp
+++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp
@@ -180,7 +180,7 @@ void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) {
ChatListItem* baseItem = index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : nullptr;
contextMenuItem_ = baseItem;
- foreach(QAction* action, onlineOnlyActions_) {
+ for (auto action : onlineOnlyActions_) {
action->setEnabled(isOnline_);
}
diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp
index 0369d0a..87dfac2 100644
--- a/Swift/QtUI/ChatSnippet.cpp
+++ b/Swift/QtUI/ChatSnippet.cpp
@@ -48,7 +48,7 @@ QString ChatSnippet::directionToCSS(Direction direction) {
ChatSnippet::Direction ChatSnippet::getDirection(const ChatWindow::ChatMessage& message) {
std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart;
std::string text = "";
- foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) {
+ for (auto&& part : message.getParts()) {
if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) {
text = textPart->text;
break;
diff --git a/Swift/QtUI/ChatSnippet.h b/Swift/QtUI/ChatSnippet.h
index f715cbf..d8bc209 100644
--- a/Swift/QtUI/ChatSnippet.h
+++ b/Swift/QtUI/ChatSnippet.h
@@ -11,8 +11,6 @@
#include <QDateTime>
#include <QString>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/Controllers/UIInterfaces/ChatWindow.h>
#include <Swift/QtUI/QtChatTheme.h>
diff --git a/Swift/QtUI/CocoaUIHelpers.mm b/Swift/QtUI/CocoaUIHelpers.mm
index 3ffa72c..1f4ffc1 100644
--- a/Swift/QtUI/CocoaUIHelpers.mm
+++ b/Swift/QtUI/CocoaUIHelpers.mm
@@ -13,6 +13,7 @@
#include "CocoaUIHelpers.h"
#include <memory>
+
#include <boost/type_traits.hpp>
#include <Cocoa/Cocoa.h>
@@ -20,8 +21,6 @@
#include <Security/Security.h>
#include <SecurityInterface/SFCertificatePanel.h>
-#include <Swiften/Base/foreach.h>
-
#pragma GCC diagnostic ignored "-Wold-style-cast"
namespace Swift {
@@ -29,7 +28,7 @@ namespace Swift {
void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::vector<Certificate::ref>& chain) {
NSWindow* parentWindow = [((NSView*)parent->winId()) window];
NSMutableArray* certificates = [[NSMutableArray alloc] init];
- foreach(Certificate::ref cert, chain) {
+ for (auto&& cert : chain) {
// convert chain to SecCertificateRef
ByteArray certAsDER = cert->toDER();
std::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease);
@@ -39,7 +38,6 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::
[certificates addObject: (id)macCert.get()];
}
-
SFCertificatePanel* panel = [[SFCertificatePanel alloc] init];
//[panel setPolicies:(id)policies.get()];
[panel beginSheetForWindow:parentWindow modalDelegate:nil didEndSelector:nullptr contextInfo:nullptr certificates:certificates showGroup:YES];
diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp
index e242003..5b97b3e 100644
--- a/Swift/QtUI/EventViewer/EventModel.cpp
+++ b/Swift/QtUI/EventViewer/EventModel.cpp
@@ -19,10 +19,10 @@ EventModel::EventModel() {
}
EventModel::~EventModel() {
- foreach (QtEvent* event, activeEvents_) {
+ for (auto event : activeEvents_) {
delete event;
}
- foreach (QtEvent* event, inactiveEvents_) {
+ for (auto event : inactiveEvents_) {
delete event;
}
}
diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp
index 6b982b1..65dac91 100644
--- a/Swift/QtUI/QtAdHocCommandWindow.cpp
+++ b/Swift/QtUI/QtAdHocCommandWindow.cpp
@@ -104,7 +104,7 @@ void QtAdHocCommandWindow::handleCompleteClicked() {
void QtAdHocCommandWindow::handleNextStageReceived(Command::ref command) {
QString notes;
- foreach (Command::Note note, command->getNotes()) {
+ for (const auto& note : command->getNotes()) {
if (!notes.isEmpty()) {
notes += "\n";
}
@@ -152,7 +152,7 @@ typedef std::pair<Command::Action, QPushButton*> ActionButton;
void QtAdHocCommandWindow::setAvailableActions(Command::ref /*commandResult*/) {
okButton_->show();
okButton_->setEnabled(true);
- foreach (ActionButton pair, actions_) {
+ for (auto&& pair : actions_) {
OutgoingAdHocCommandSession::ActionState state = command_->getActionState(pair.first);
if (state & OutgoingAdHocCommandSession::Present) {
okButton_->hide();
diff --git a/Swift/QtUI/QtAffiliationEditor.cpp b/Swift/QtUI/QtAffiliationEditor.cpp
index 980b26a..92b6aff 100644
--- a/Swift/QtUI/QtAffiliationEditor.cpp
+++ b/Swift/QtUI/QtAffiliationEditor.cpp
@@ -37,7 +37,7 @@ const std::vector<std::pair<MUCOccupant::Affiliation, JID> >& QtAffiliationEdito
void QtAffiliationEditor::handleCurrentIndexChanged(int index) {
ui_.list->clear();
- foreach (const JID& jid, affiliations_[affiliationFromIndex(index)]) {
+ for (const auto& jid : affiliations_[affiliationFromIndex(index)]) {
ui_.list->addItem(P2QSTRING(jid.toString()));
}
}
diff --git a/Swift/QtUI/QtBlockListEditorWindow.cpp b/Swift/QtUI/QtBlockListEditorWindow.cpp
index 9e13943..30c939f 100644
--- a/Swift/QtUI/QtBlockListEditorWindow.cpp
+++ b/Swift/QtUI/QtBlockListEditorWindow.cpp
@@ -20,7 +20,6 @@
#include <QStyledItemDelegate>
#include <QValidator>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Client/ClientBlockListManager.h>
#include <Swiften/JID/JID.h>
@@ -158,7 +157,7 @@ void QtBlockListEditorWindow::applyChanges() {
void QtBlockListEditorWindow::setCurrentBlockList(const std::vector<JID> &blockedJIDs) {
ui->blockListTreeWidget->clear();
- foreach(const JID& jid, blockedJIDs) {
+ for (const auto& jid : blockedJIDs) {
QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(P2QSTRING(jid.toString())) << "");
item->setFlags(item->flags() | Qt::ItemIsEditable);
ui->blockListTreeWidget->addTopLevelItem(item);
diff --git a/Swift/QtUI/QtCertificateViewerDialog.cpp b/Swift/QtUI/QtCertificateViewerDialog.cpp
index a99c29a..6454d82 100644
--- a/Swift/QtUI/QtCertificateViewerDialog.cpp
+++ b/Swift/QtUI/QtCertificateViewerDialog.cpp
@@ -18,8 +18,6 @@
#include <QStringList>
#include <QTreeWidgetItem>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/QtUI/ui_QtCertificateViewerDialog.h>
namespace Swift {
@@ -43,7 +41,7 @@ void QtCertificateViewerDialog::setCertificateChain(const std::vector<Certificat
// convert Swift certificate chain to qt certificate chain (root goes first)
currentChain.clear();
- foreach(Certificate::ref cert, chain) {
+ for (auto&& cert : chain) {
ByteArray certAsDer = cert->toDER();
QByteArray dataArray(reinterpret_cast<const char*>(certAsDer.data()), certAsDer.size());
currentChain.push_front(QSslCertificate(dataArray, QSsl::Der));
@@ -125,8 +123,8 @@ void QtCertificateViewerDialog::setCertificateDetails(const QSslCertificate& cer
#endif
if (!altNames.empty()) {
ADD_SECTION(tr("Alternate Subject Names"));
- foreach (const SANTYPE &type, altNames.uniqueKeys()) {
- foreach (QString name, altNames.values(type)) {
+ for (const auto& type : altNames.uniqueKeys()) {
+ for (auto&& name : altNames.values(type)) {
if (type == QSsl::EmailEntry) {
ADD_FIELD(tr("E-mail Address"), name);
} else {
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index bb9c005..3241858 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -80,7 +80,7 @@ QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bo
}
QtChatTabs::~QtChatTabs() {
- foreach (QShortcut* shortcut, shortcuts_) {
+ for (auto shortcut : shortcuts_) {
delete shortcut;
}
diff --git a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
index fb41446..40ab17f 100644
--- a/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
+++ b/Swift/QtUI/QtChatTabsShortcutOnlySubstitute.cpp
@@ -12,7 +12,6 @@
#include <QShortcut>
#include <Swiften/Base/Log.h>
-#include <Swiften/Base/foreach.h>
#include <Swift/QtUI/QtTabbable.h>
@@ -95,7 +94,7 @@ QList<QtTabbable*> QtChatTabsShortcutOnlySubstitute::tabbableWindows() const {
QList<QWidget*> windows = qApp->topLevelWidgets();
QList<QtTabbable*> tabbables;
- foreach(QWidget* topLevelWidget, windows) {
+ for (auto topLevelWidget : windows) {
QtTabbable* tabbable = dynamic_cast<QtTabbable*>(topLevelWidget);
if (tabbable) {
tabbables << tabbable;
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index bda6b3e..d799e19 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -386,7 +386,7 @@ void QtChatWindow::setAvailableSecurityLabels(const std::vector<SecurityLabelsCa
int i = 0;
int defaultIndex = 0;
labelsWidget_->setModel(labelModel_);
- foreach (SecurityLabelsCatalog::Item label, labels) {
+ for (const auto& label : labels) {
if (label.getIsDefault()) {
defaultIndex = i;
break;
@@ -712,8 +712,7 @@ void QtChatWindow::handleActionButtonClicked() {
}
else {
- foreach(ChatWindow::RoomAction availableAction, availableRoomActions_)
- {
+ for (auto&& availableAction : availableRoomActions_) {
if (impromptu_) {
// hide options we don't need in impromptu chats
if (availableAction == ChatWindow::ChangeSubject ||
diff --git a/Swift/QtUI/QtContactEditWidget.cpp b/Swift/QtUI/QtContactEditWidget.cpp
index 4e9a7fe..17f5ccf 100644
--- a/Swift/QtUI/QtContactEditWidget.cpp
+++ b/Swift/QtUI/QtContactEditWidget.cpp
@@ -51,7 +51,7 @@ QtContactEditWidget::QtContactEditWidget(const std::set<std::string>& allGroups,
groupsArea->setWidget(groups);
QVBoxLayout* scrollLayout = new QVBoxLayout(groups);
- foreach (std::string group, allGroups) {
+ for (const auto& group : allGroups) {
QString groupName = doubleAmpersand(group);
QCheckBox* check = new QCheckBox(groups);
check->setText(groupName);
@@ -79,7 +79,7 @@ void QtContactEditWidget::setName(const std::string& name) {
std::string QtContactEditWidget::getName() const {
std::string name = Q2PSTRING(name_->text());
QList<QRadioButton*> buttons = findChildren<QRadioButton*>();
- foreach(const QRadioButton* button, buttons) {
+ for (const auto button : buttons) {
if (button->isChecked()) {
if (button == nameRadioButton_) {
name = Q2PSTRING(name_->text());
@@ -93,14 +93,14 @@ std::string QtContactEditWidget::getName() const {
}
void QtContactEditWidget::setSelectedGroups(const std::vector<std::string>& groups) {
- foreach (std::string group, groups) {
+ for (auto&& group : groups) {
checkBoxes_[group]->setCheckState(Qt::Checked);
}
}
std::set<std::string> QtContactEditWidget::getSelectedGroups() const {
std::set<std::string> groups;
- foreach(const CheckBoxMap::value_type& group, checkBoxes_) {
+ for (const auto& group : checkBoxes_) {
if (group.second->checkState() == Qt::Checked) {
groups.insert(group.first);
}
@@ -124,7 +124,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug
}
// populate new suggestions
- foreach(const std::string& name, suggestions) {
+ for (const auto& name : suggestions) {
suggestionsLayout_->insertWidget(nameLayout_->count() - 2, new QRadioButton(doubleAmpersand(name), this));
}
@@ -133,7 +133,7 @@ void QtContactEditWidget::setNameSuggestions(const std::vector<std::string>& sug
QRadioButton* suggestedRadioButton = nullptr;
QList<QRadioButton*> radioButtons = findChildren<QRadioButton*>();
- foreach (QRadioButton* candidate, radioButtons) {
+ for (auto candidate : radioButtons) {
if (candidate->text() == name_->text()) {
suggestedRadioButton = candidate;
break;
diff --git a/Swift/QtUI/QtContactEditWidget.h b/Swift/QtUI/QtContactEditWidget.h
index d4ea609..0718fee 100644
--- a/Swift/QtUI/QtContactEditWidget.h
+++ b/Swift/QtUI/QtContactEditWidget.h
@@ -41,9 +41,9 @@ namespace Swift {
private:
QString doubleAmpersand(const std::string& name) const;
std::string singleAmpersand(const QString& name) const;
+
private:
- typedef std::map<std::string, QCheckBox*> CheckBoxMap;
- CheckBoxMap checkBoxes_;
+ std::map<std::string, QCheckBox*> checkBoxes_;
QHBoxLayout* nameLayout_;
QHBoxLayout* suggestionsLayout_;
QRadioButton* nameRadioButton_;
diff --git a/Swift/QtUI/QtEmoticonsGrid.cpp b/Swift/QtUI/QtEmoticonsGrid.cpp
index a81f516..4c8c024 100644
--- a/Swift/QtUI/QtEmoticonsGrid.cpp
+++ b/Swift/QtUI/QtEmoticonsGrid.cpp
@@ -14,16 +14,14 @@
#include <set>
-#include <QPushButton>
+#include <boost/range/adaptor/reversed.hpp>
-#include <Swiften/Base/foreach.h>
+#include <QPushButton>
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
-typedef std::map<std::string, std::string> EmoticonsMap; // Without this typedef compiler complains when using foreach
-
QtEmoticonsGrid::QtEmoticonsGrid(const std::map<std::string, std::string>& emoticons, QWidget* parent) : QGridLayout(parent) {
makeUniqueEmoticonsMap(emoticons);
@@ -31,7 +29,7 @@ QtEmoticonsGrid::QtEmoticonsGrid(const std::map<std::string, std::string>& emoti
int row = 0;
int column = 0;
- foreach(EmoticonsMap::value_type emoticon, uniqueEmoticons_) {
+ for (auto&& emoticon : uniqueEmoticons_) {
QtEmoticonCell* newCell = new QtEmoticonCell(P2QSTRING(emoticon.first), P2QSTRING(emoticon.second));
addWidget(newCell, row, column);
connect(newCell, SIGNAL(emoticonClicked(QString)), this, SLOT(emoticonClickedSlot(QString)));
@@ -50,7 +48,7 @@ QtEmoticonsGrid::~QtEmoticonsGrid() {
void QtEmoticonsGrid::makeUniqueEmoticonsMap(const std::map<std::string, std::string>& emoticons) {
std::set<std::string> paths;
- reverse_foreach(EmoticonsMap::value_type emoticon, emoticons) {
+ for (auto&& emoticon : boost::adaptors::reverse(emoticons)) {
if (paths.find(emoticon.second) == paths.end()) {
uniqueEmoticons_.insert(emoticon);
paths.insert(emoticon.second);
diff --git a/Swift/QtUI/QtFormResultItemModel.cpp b/Swift/QtUI/QtFormResultItemModel.cpp
index 60cf0c0..b35bb4f 100644
--- a/Swift/QtUI/QtFormResultItemModel.cpp
+++ b/Swift/QtUI/QtFormResultItemModel.cpp
@@ -14,8 +14,6 @@
#include <boost/algorithm/string/join.hpp>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
@@ -73,7 +71,7 @@ const std::string QtFormResultItemModel::getFieldValue(const Form::FormItem& ite
// determine field name
std::string name = formResult_->getReportedFields().at(column)->getName();
- foreach(FormField::ref field, item) {
+ for (auto&& field : item) {
if (field->getName() == name) {
std::string delimiter = "";
if (field->getType() == FormField::TextMultiType) {
diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp
index 1d26815..96c2da0 100644
--- a/Swift/QtUI/QtFormWidget.cpp
+++ b/Swift/QtUI/QtFormWidget.cpp
@@ -20,8 +20,6 @@
#include <qdebug.h>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/QtUI/QtSwiftUtil.h>
namespace Swift {
@@ -43,7 +41,7 @@ QtFormWidget::QtFormWidget(Form::ref form, QWidget* parent) : QWidget(parent), f
QGridLayout* layout = new QGridLayout(scroll);
const std::vector<Form::FormItem> items = form->getItems();
if (items.empty()) { /* single item forms */
- foreach (FormField::ref field, form->getFields()) {
+ for (auto&& field : form->getFields()) {
QWidget* widget = createWidget(field, field->getType(), 0);
if (widget) {
layout->addWidget(new QLabel(field->getLabel().c_str(), this), row, 0);
@@ -80,12 +78,12 @@ QListWidget* QtFormWidget::createList(FormField::ref field) {
std::vector<bool> selected;
/* if this is an editable form, use the 'options' list, otherwise use the 'values' list */
if (form_->getType() != Form::FormType) {
- foreach (const std::string& value, field->getValues()) {
+ for (const auto& value : field->getValues()) {
listWidget->addItem(P2QSTRING(value));
selected.push_back(false);
}
} else {
- foreach (FormField::Option option, field->getOptions()) {
+ for (auto&& option : field->getOptions()) {
listWidget->addItem(option.label.c_str());
if (field->getType() == FormField::ListSingleType) {
selected.push_back(!field->getValues().empty() && option.value == field->getValues()[0]);
@@ -157,7 +155,7 @@ QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type
Form::ref QtFormWidget::getCompletedForm() {
Form::ref result(new Form(Form::SubmitType));
- foreach (std::shared_ptr<FormField> field, form_->getFields()) {
+ for (auto&& field : form_->getFields()) {
std::shared_ptr<FormField> resultField = std::make_shared<FormField>(field->getType());
if (field->getType() == FormField::BooleanType) {
resultField->setBoolValue(qobject_cast<QCheckBox*>(fields_[field->getName()])->checkState() == Qt::Checked);
@@ -191,14 +189,14 @@ Form::ref QtFormWidget::getCompletedForm() {
QString string = widget->toPlainText();
if (!string.isEmpty()) {
QStringList lines = string.split("\n");
- foreach (QString line, lines) {
+ for (auto&& line : lines) {
resultField->addValue(Q2PSTRING(line));
}
}
}
if (field->getType() == FormField::ListMultiType) {
QListWidget* listWidget = qobject_cast<QListWidget*>(fields_[field->getName()]);
- foreach (QListWidgetItem* item, listWidget->selectedItems()) {
+ for (auto item : listWidget->selectedItems()) {
resultField->addValue(field->getOptions()[listWidget->row(item)].value);
}
}
@@ -226,7 +224,7 @@ void QtFormWidget::setEditable(bool editable) {
if (!form_) {
return;
}
- foreach (std::shared_ptr<FormField> field, form_->getFields()) {
+ for (auto&& field : form_->getFields()) {
QWidget* widget = nullptr;
if (field) {
widget = fields_[field->getName()];
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 53e7ffe..77a7f12 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -176,7 +176,7 @@ void QtHistoryWindow::handleScrollRequested(int pos) {
}
QDate currentDate;
- foreach (const QDate& date, dates_) {
+ for (const auto& date : dates_) {
int snippetPosition = conversation_->getSnippetPositionByDate(date);
if (snippetPosition <= pos) {
currentDate = date;
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index d91f694..865d8b5 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -499,7 +499,7 @@ void QtLoginWindow::morphInto(MainWindow *mainWindow) {
setInitialMenus();
std::vector<QMenu*> mainWindowMenus = qtMainWindow->getMenus();
viewMenu_ = mainWindowMenus[0];
- foreach (QMenu* menu, mainWindowMenus) {
+ for (auto menu : mainWindowMenus) {
menuBar_->addMenu(menu);
}
setFocus();
diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp
index d682cfa..05a2eb0 100644
--- a/Swift/QtUI/QtPlainChatView.cpp
+++ b/Swift/QtUI/QtPlainChatView.cpp
@@ -18,7 +18,6 @@
#include <QVBoxLayout>
#include <Swiften/Base/FileSize.h>
-#include <Swiften/Base/foreach.h>
#include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
@@ -45,7 +44,7 @@ QtPlainChatView::~QtPlainChatView() {
QString chatMessageToString(const ChatWindow::ChatMessage& message) {
QString result;
- foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) {
+ for (auto&& part : message.getParts()) {
std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart;
std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart;
std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart;
diff --git a/Swift/QtUI/QtProfileWindow.cpp b/Swift/QtUI/QtProfileWindow.cpp
index 461ea38..80e275b 100644
--- a/Swift/QtUI/QtProfileWindow.cpp
+++ b/Swift/QtUI/QtProfileWindow.cpp
@@ -156,7 +156,7 @@ void QtProfileWindow::handleAdjustSizeTimeout() {
// Force recaluclation of all layout geometry in children widgets.
// This is required on Windows to have the correct size even on first show.
QList<QWidget *> children = findChildren<QWidget*>();
- foreach(QWidget* child, children) {
+ for (auto child : children) {
child->updateGeometry();
}
diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp
index 3c32dc8..42ac22d 100644
--- a/Swift/QtUI/QtSettingsProvider.cpp
+++ b/Swift/QtUI/QtSettingsProvider.cpp
@@ -77,7 +77,7 @@ void QtSettingsProvider::storeSetting(const Setting<int>& setting, const int& se
std::vector<std::string> QtSettingsProvider::getAvailableProfiles() {
std::vector<std::string> profiles;
QVariant profilesVariant = settings_.value("profileList");
- foreach(QString profileQString, profilesVariant.toStringList()) {
+ for (const auto& profileQString : profilesVariant.toStringList()) {
profiles.push_back(std::string(profileQString.toUtf8()));
}
return profiles;
@@ -92,7 +92,7 @@ void QtSettingsProvider::createProfile(const std::string& profile) {
void QtSettingsProvider::removeProfile(const std::string& profile) {
QString profileStart(QString(profile.c_str()) + ":");
- foreach (QString key, settings_.allKeys()) {
+ for (auto&& key : settings_.allKeys()) {
if (key.startsWith(profileStart)) {
settings_.remove(key);
}
diff --git a/Swift/QtUI/QtSingleWindow.cpp b/Swift/QtUI/QtSingleWindow.cpp
index ab7e81e..1fba497 100644
--- a/Swift/QtUI/QtSingleWindow.cpp
+++ b/Swift/QtUI/QtSingleWindow.cpp
@@ -6,8 +6,6 @@
#include <Swift/QtUI/QtSingleWindow.h>
-#include <Swiften/Base/foreach.h>
-
#include <Swift/QtUI/QtChatTabs.h>
#include <Swift/QtUI/QtSettingsProvider.h>
@@ -45,7 +43,7 @@ void QtSingleWindow::handleTabsTitleChanged(const QString& title) {
void QtSingleWindow::handleSplitterMoved(int, int) {
QList<QVariant> variantValues;
QList<int> intValues = sizes();
- foreach (int value, intValues) {
+ for (const auto& value : intValues) {
variantValues.append(QVariant(value));
}
settings_->getQSettings()->setValue(SINGLE_WINDOW_SPLITS, QVariant(variantValues));
@@ -54,7 +52,7 @@ void QtSingleWindow::handleSplitterMoved(int, int) {
void QtSingleWindow::restoreSplitters() {
QList<QVariant> variantValues = settings_->getQSettings()->value(SINGLE_WINDOW_SPLITS).toList();
QList<int> intValues;
- foreach (QVariant value, variantValues) {
+ for (auto&& value : variantValues) {
intValues.append(value.toInt());
}
setSizes(intValues);
diff --git a/Swift/QtUI/QtSpellCheckHighlighter.cpp b/Swift/QtUI/QtSpellCheckHighlighter.cpp
index 6565b06..cb467e2 100644
--- a/Swift/QtUI/QtSpellCheckHighlighter.cpp
+++ b/Swift/QtUI/QtSpellCheckHighlighter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -29,7 +29,7 @@ void QtSpellCheckHighlighter::highlightBlock(const QString& text) {
spellingErrorFormat.setUnderlineColor(QColor(Qt::red));
spellingErrorFormat.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
- foreach (PositionPair position, misspelledPositions_) {
+ for (auto&& position : misspelledPositions_) {
setFormat(boost::get<0>(position), boost::get<1>(position) - boost::get<0>(position), spellingErrorFormat);
};
}
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 2e9e4cc..b175e5c 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -144,7 +144,7 @@ void QtStatusWidget::generateList() {
QString text = statusEdit_->text();
newStatusText_ = text;
menu_->clear();
- foreach (StatusShow::Type type, icons_.keys()) {
+ for (const auto& type : icons_.keys()) {
QListWidgetItem* item = new QListWidgetItem(text == "" ? getNoMessage() : text, menu_);
item->setIcon(icons_[type]);
item->setToolTip(P2QSTRING(statusShowTypeToFriendlyName(type)) + ": " + item->text());
@@ -152,7 +152,7 @@ void QtStatusWidget::generateList() {
item->setData(Qt::UserRole, QVariant(type));
}
std::vector<StatusCache::PreviousStatus> previousStatuses = statusCache_->getMatches(Q2PSTRING(text), 8);
- foreach (StatusCache::PreviousStatus savedStatus, previousStatuses) {
+ for (const auto& savedStatus : previousStatuses) {
if (savedStatus.first.empty() || std::find_if(allTypes_.begin(), allTypes_.end(),
savedStatus.second == lambda::_1 && savedStatus.first == lambda::bind(&statusShowTypeToFriendlyName, lambda::_1)) != allTypes_.end()) {
continue;
@@ -163,7 +163,7 @@ void QtStatusWidget::generateList() {
item->setStatusTip(item->toolTip());
item->setData(Qt::UserRole, QVariant(savedStatus.second));
}
- foreach (StatusShow::Type type, icons_.keys()) {
+ for (const auto& type : icons_.keys()) {
if (Q2PSTRING(text) == statusShowTypeToFriendlyName(type)) {
continue;
}
@@ -203,7 +203,7 @@ void QtStatusWidget::handleClicked() {
if (x + width > screenWidth) {
x = screenWidth - width;
}
- //foreach (StatusShow::Type type, allTypes_) {
+ //for (StatusShow::Type type : allTypes_) {
// if (statusEdit_->text() == P2QSTRING(statusShowTypeToFriendlyName(type))) {
statusEdit_->setText("");
// }
diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.cpp b/Swift/QtUI/QtSubscriptionRequestWindow.cpp
index eea13f2..c8c4178 100644
--- a/Swift/QtUI/QtSubscriptionRequestWindow.cpp
+++ b/Swift/QtUI/QtSubscriptionRequestWindow.cpp
@@ -73,7 +73,7 @@ QtSubscriptionRequestWindow::~QtSubscriptionRequestWindow() {
}
QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) {
- foreach (QtSubscriptionRequestWindow* window, windows_) {
+ for (auto window : windows_) {
if (window->getEvent() == event) {
return window;
}
diff --git a/Swift/QtUI/QtTabbable.cpp b/Swift/QtUI/QtTabbable.cpp
index bad6315..ed0963b 100644
--- a/Swift/QtUI/QtTabbable.cpp
+++ b/Swift/QtUI/QtTabbable.cpp
@@ -11,7 +11,6 @@
#include <QShortcut>
#include <Swiften/Base/Platform.h>
-#include <Swiften/Base/foreach.h>
#include <Swift/QtUI/QtChatTabs.h>
#include <Swift/QtUI/QtUtilities.h>
diff --git a/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp b/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp
index ed36580..02ceb0a 100644
--- a/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtTagComboBox.cpp
@@ -50,7 +50,7 @@ void QtTagComboBox::addTag(const QString &id, const QString &label) {
void QtTagComboBox::setTag(const QString &id, bool value) {
QList<QAction*> tagActions = editMenu->actions();
- foreach(QAction* action, tagActions) {
+ for (auto action : tagActions) {
if (action->data() == id) {
action->setChecked(value);
updateDisplayItem();
@@ -61,7 +61,7 @@ void QtTagComboBox::setTag(const QString &id, bool value) {
bool QtTagComboBox::isTagSet(const QString &id) const {
QList<QAction*> tagActions = editMenu->actions();
- foreach(QAction* action, tagActions) {
+ for (auto action : tagActions) {
if (action->data() == id) {
return action->isChecked();
}
@@ -94,7 +94,7 @@ bool QtTagComboBox::event(QEvent* event) {
void QtTagComboBox::updateDisplayItem() {
QList<QAction*> tagActions = editMenu->actions();
QString text = "";
- foreach(QAction* action, tagActions) {
+ for (auto action : tagActions) {
if (action->isChecked()) {
if (text != "") {
text += ", ";
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
index 4043dbc..596006a 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardAddressField.cpp
@@ -90,7 +90,7 @@ void QtVCardAddressField::setupContentWidgets() {
}
void QtVCardAddressField::customCleanup() {
- foreach(QWidget* widget, textFields) {
+ for (auto widget : textFields) {
widget->hide();
textFieldGridLayout->removeWidget(widget);
}
@@ -170,7 +170,7 @@ void QtVCardAddressField::handleEditibleChanged(bool isEditable) {
domesticRadioButton->setVisible(isEditable);
internationalRadioButton->setVisible(isEditable);
- foreach (QWidget* widget, textFields) {
+ for (auto widget : textFields) {
QtResizableLineEdit* lineEdit;
if ((lineEdit = dynamic_cast<QtResizableLineEdit*>(widget))) {
lineEdit->setVisible(isEditable ? true : !lineEdit->text().isEmpty());
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
index ab69cba..9bb6a35 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp
@@ -121,7 +121,7 @@ QGridLayout* QtVCardGeneralField::getGridLayout() const {
void QtVCardGeneralField::handleCloseButtonClicked() {
customCleanup();
- foreach(QWidget* widget, childWidgets) {
+ for (auto widget : childWidgets) {
widget->hide();
layout->removeWidget(widget);
}
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp
index 9e303b7..5162c73 100644
--- a/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtVCardOrganizationField.cpp
@@ -78,7 +78,7 @@ bool QtVCardOrganizationField::isEmpty() const {
void QtVCardOrganizationField::setOrganization(const VCard::Organization& organization) {
organizationLineEdit->setText(P2QSTRING(organization.name));
unitsTreeWidget->clear();
- foreach(std::string unit, organization.units) {
+ for (const auto& unit : organization.units) {
QTreeWidgetItem* item = new QTreeWidgetItem(QStringList(P2QSTRING(unit)) << "");
item->setFlags(item->flags() | Qt::ItemIsEditable);
unitsTreeWidget->addTopLevelItem(item);
@@ -134,7 +134,7 @@ void QtVCardOrganizationField::handleRowsRemoved(const QModelIndex&, int, int) {
void QtVCardOrganizationField::guaranteeEmptyRow() {
bool hasEmptyRow = false;
QList<QTreeWidgetItem*> rows = unitsTreeWidget->findItems("", Qt::MatchFixedString);
- foreach(QTreeWidgetItem* row, rows) {
+ for (auto row : rows) {
if (row->text(0).isEmpty()) {
hasEmptyRow = true;
}
diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp
index c0ce3dc..6fe9397 100644
--- a/Swift/QtUI/QtWebKitChatView.cpp
+++ b/Swift/QtUI/QtWebKitChatView.cpp
@@ -499,7 +499,7 @@ QString QtWebKitChatView::getHighlightSpanStart(const HighlightAction& highlight
QString QtWebKitChatView::chatMessageToHTML(const ChatWindow::ChatMessage& message) {
QString result;
- foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) {
+ for (const auto& part : message.getParts()) {
std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart;
std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart;
std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart;
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;
}
diff --git a/Swift/QtUI/UserSearch/ContactListModel.cpp b/Swift/QtUI/UserSearch/ContactListModel.cpp
index 376d3b1..6ef85d7 100644
--- a/Swift/QtUI/UserSearch/ContactListModel.cpp
+++ b/Swift/QtUI/UserSearch/ContactListModel.cpp
@@ -15,7 +15,6 @@
#include <QMimeData>
#include <Swiften/Base/Path.h>
-#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/StatusShow.h>
#include <Swift/QtUI/QtResourceHelper.h>
diff --git a/Swift/QtUI/UserSearch/QtContactListWidget.cpp b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
index 1dbfc1f..73a8482 100644
--- a/Swift/QtUI/UserSearch/QtContactListWidget.cpp
+++ b/Swift/QtUI/UserSearch/QtContactListWidget.cpp
@@ -85,8 +85,8 @@ bool QtContactListWidget::isFull() const {
void QtContactListWidget::updateContacts(const std::vector<Contact::ref>& contactUpdates) {
std::vector<Contact::ref> contacts = contactListModel_->getList();
- foreach(const Contact::ref& contactUpdate, contactUpdates) {
- for(auto& contact : contacts) {
+ for (const auto& contactUpdate : contactUpdates) {
+ for (auto&& contact : contacts) {
if (contactUpdate->jid == contact->jid) {
contact = contactUpdate;
break;
diff --git a/Swift/QtUI/WinUIHelpers.cpp b/Swift/QtUI/WinUIHelpers.cpp
index 4898916..ec39c38 100644
--- a/Swift/QtUI/WinUIHelpers.cpp
+++ b/Swift/QtUI/WinUIHelpers.cpp
@@ -19,8 +19,6 @@
#include <memory>
-#include <Swiften/Base/foreach.h>
-
namespace Swift {
void WinUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::vector<Certificate::ref>& chain) {