diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index e9086e0f7..38a3c51fa 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -522,18 +522,16 @@ void EditProfileDialog::updateColorSchemeList(bool selectCurrentScheme) model->clear(); - QList schemeList = ColorSchemeManager::instance()->allColorSchemes(); - QListIterator schemeIter(schemeList); - QStandardItem* selectedItem = 0; - while (schemeIter.hasNext()) { - const ColorScheme* colors = schemeIter.next(); - QStandardItem* item = new QStandardItem(colors->description()); - item->setData(QVariant::fromValue(colors) , Qt::UserRole + 1); + QList schemeList = ColorSchemeManager::instance()->allColorSchemes(); + + foreach ( const ColorScheme* scheme, schemeList) { + QStandardItem* item = new QStandardItem(scheme->description()); + item->setData(QVariant::fromValue(scheme) , Qt::UserRole + 1); item->setFlags(item->flags()); - if (currentScheme == colors) + if (currentScheme == scheme) selectedItem = item; model->appendRow(item); diff --git a/src/KeyBindingEditor.cpp b/src/KeyBindingEditor.cpp index e4d1d9c8c..5e33f6e20 100644 --- a/src/KeyBindingEditor.cpp +++ b/src/KeyBindingEditor.cpp @@ -70,13 +70,9 @@ KeyBindingEditor::~KeyBindingEditor() void KeyBindingEditor::removeSelectedEntry() { - QList selectedList = _ui->keyBindingTable->selectedItems(); QList uniqueList; - //Filter unique items - QListIterator iter(selectedList); - while (iter.hasNext()) { - QTableWidgetItem* item = iter.next(); + foreach ( QTableWidgetItem* item, _ui->keyBindingTable->selectedItems() ) { if (item->column() == 1) //Select item at the first column item = _ui->keyBindingTable->item(item->row(), 0); @@ -84,10 +80,8 @@ void KeyBindingEditor::removeSelectedEntry() uniqueList.append(item); } - iter = QListIterator(uniqueList); - while (iter.hasNext()) { + foreach ( QTableWidgetItem* item, uniqueList ) { // get the first item in the row which has the entry - QTableWidgetItem* item = iter.next(); KeyboardTranslator::Entry existing = item->data(Qt::UserRole). value(); diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index 7f72f6d43..b41c46100 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -67,9 +67,7 @@ void KeyboardTranslatorManager::findTranslators() // add the name of each translator to the list and associated // the name with a null pointer to indicate that the translator // has not yet been loaded from disk - QStringListIterator listIter(list); - while (listIter.hasNext()) { - QString translatorPath = listIter.next(); + foreach ( const QString& translatorPath, list) { QString name = QFileInfo(translatorPath).baseName(); @@ -116,9 +114,8 @@ bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* transla KeyboardTranslatorWriter writer(&destination); writer.writeHeader(translator->description()); - QListIterator iter(translator->entries()); - while (iter.hasNext()) - writer.writeEntry(iter.next()); + foreach ( const KeyboardTranslator::Entry& entry, translator->entries() ) + writer.writeEntry(entry); } destination.close(); diff --git a/src/Session.cpp b/src/Session.cpp index 5bb046301..353eff7a6 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -659,8 +659,6 @@ void Session::onViewSizeChange(int /*height*/, int /*width*/) void Session::updateTerminalSize() { - QListIterator viewIter(_views); - int minLines = -1; int minColumns = -1; @@ -671,8 +669,7 @@ void Session::updateTerminalSize() const int VIEW_COLUMNS_THRESHOLD = 2; //select largest number of lines and columns that will fit in all visible views - while (viewIter.hasNext()) { - TerminalDisplay* view = viewIter.next(); + foreach ( TerminalDisplay* view, _views ) { if (view->isHidden() == false && view->lines() >= VIEW_LINES_THRESHOLD && view->columns() >= VIEW_COLUMNS_THRESHOLD) { @@ -1447,9 +1444,7 @@ void SessionGroup::forwardData(const char* data, int size) } _inForwardData = true; - QListIterator iter(_sessions.keys()); - while (iter.hasNext()) { - Session* other = iter.next(); + foreach ( Session* other, _sessions.keys() ) { if (!_sessions[other]) { other->emulation()->sendString(data, size); } diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 23b307c61..7f31d7fb1 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -711,9 +711,7 @@ static const KXmlGuiWindow* findWindow(const QObject* object) static bool hasTerminalDisplayInSameWindow(const Session* session, const KXmlGuiWindow* window) { // Iterate all TerminalDisplays of this Session ... - QListIterator terminalDisplayIterator(session->views()); - while (terminalDisplayIterator.hasNext()) { - const TerminalDisplay* terminalDisplay = terminalDisplayIterator.next(); + foreach ( const TerminalDisplay* terminalDisplay, session->views() ) { // ... and check whether a TerminalDisplay has the same // window as given in the parameter if (window == findWindow(terminalDisplay)) { @@ -1269,8 +1267,6 @@ SaveHistoryTask::~SaveHistoryTask() void SaveHistoryTask::execute() { - QListIterator iter(sessions()); - // TODO - think about the UI when saving multiple history sessions, if there are more than two or // three then providing a URL for each one will be tedious @@ -1290,8 +1286,7 @@ void SaveHistoryTask::execute() // iterate over each session in the task and display a dialog to allow the user to choose where // to save that session's history. // then start a KIO job to transfer the data from the history to the chosen URL - while (iter.hasNext()) { - SessionPtr session = iter.next(); + foreach ( const SessionPtr& session, sessions() ) { dialog->setCaption(i18n("Save Output From %1", session->title(Session::NameRole))); diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp index 0c0bae3c4..430fef64a 100644 --- a/src/SessionManager.cpp +++ b/src/SessionManager.cpp @@ -391,9 +391,7 @@ void SessionManager::changeProfile(Profile::Ptr profile, Q_ASSERT(profile); // insert the changes into the existing Profile instance - QListIterator iter(propertyMap.keys()); - while (iter.hasNext()) { - const Profile::Property property = iter.next(); + foreach ( const Profile::Property& property, propertyMap.keys() ) { profile->setProperty(property, propertyMap[property]); } diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 4c2c80fdb..2d7b0fe6d 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -1206,9 +1206,7 @@ void TerminalDisplay::paintFilters(QPainter& painter) // and draw appropriate visuals to indicate the presence of the hotspot QList spots = _filterChain->hotSpots(); - QListIterator iter(spots); - while (iter.hasNext()) { - Filter::HotSpot* spot = iter.next(); + foreach ( Filter::HotSpot* spot, spots ) { QRegion region; if (_underlineLinks && spot->type() == Filter::HotSpot::Link) { diff --git a/src/ViewSplitter.cpp b/src/ViewSplitter.cpp index d92b51efb..3fa62e779 100644 --- a/src/ViewSplitter.cpp +++ b/src/ViewSplitter.cpp @@ -235,12 +235,9 @@ ViewContainer* ViewSplitter::activeContainer() const ViewContainer* focusContainer = 0; while (focusW != 0) { - QListIterator containerIter(_containers); - while (containerIter.hasNext()) { - ViewContainer* nextContainer = containerIter.next(); - - if (nextContainer->containerWidget() == focusW) { - focusContainer = nextContainer; + foreach ( ViewContainer* container, _containers ) { + if (container->containerWidget() == focusW) { + focusContainer = container; break; } } diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index b98952ef1..164209617 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -434,9 +434,7 @@ void Vt102Emulation::processWindowAttributeChange() void Vt102Emulation::updateTitle() { - QListIterator iter( _pendingTitleUpdates.keys() ); - while (iter.hasNext()) { - int arg = iter.next(); + foreach ( const int& arg, _pendingTitleUpdates.keys() ) { emit titleChanged( arg , _pendingTitleUpdates[arg] ); } _pendingTitleUpdates.clear();