From 7cbd7aafd65b19102d1c81d9ed3955304f272ecd Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 17 Feb 2007 13:43:47 +0000 Subject: Cleanup: don't use deprecated Qt3 classes or methods, removed unnecessary includes svn path=/trunk/KDE/kdebase/apps/; revision=634516 --- src/urlnavigator.cpp | 73 ++++++++++++++++++++++------------------------------ 1 file changed, 31 insertions(+), 42 deletions(-) (limited to 'src/urlnavigator.cpp') diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp index 93de43e67..965e3f3d5 100644 --- a/src/urlnavigator.cpp +++ b/src/urlnavigator.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) * + * Copyright (C) 2006 by Peter Penz () * * Copyright (C) 2006 by Aaron J. Seigo () * * Copyright (C) 2006 by Patrice Tremblay * * * @@ -21,42 +21,24 @@ #include "urlnavigator.h" -#include +#include "bookmarkselector.h" +#include "dolphinsettings.h" +#include "generalsettings.h" +#include "protocolcombo.h" +#include "urlnavigatorbutton.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//Added by qt3to4: -#include -#include -#include -#include +#include -#include -#include -#include -#include #include #include #include -#include #include #include -#include -#include -#include "bookmarkselector.h" -#include "dolphinsettings.h" -#include "generalsettings.h" -#include "protocolcombo.h" -#include "urlnavigatorbutton.h" +#include +#include +#include +#include UrlNavigator::HistoryElem::HistoryElem() : m_url(), @@ -130,7 +112,9 @@ UrlNavigator::~UrlNavigator() const KUrl& UrlNavigator::url() const { assert(!m_history.empty()); - return m_history[m_historyIndex].url(); + QLinkedList::const_iterator it = m_history.begin(); + it += m_historyIndex; + return (*it).url(); } KUrl UrlNavigator::url(int index) const @@ -147,7 +131,7 @@ KUrl UrlNavigator::url(int index) const return path; } -const Q3ValueList& UrlNavigator::history(int& index) const +const QLinkedList& UrlNavigator::history(int& index) const { index = m_historyIndex; return m_history; @@ -243,7 +227,9 @@ void UrlNavigator::setUrl(const KUrl& url) // Check whether the previous element of the history has the same Url. // If yes, just go forward instead of inserting a duplicate history // element. - const KUrl& nextUrl = m_history[m_historyIndex - 1].url(); + QLinkedList::const_iterator it = m_history.begin(); + it += m_historyIndex - 1; + const KUrl& nextUrl = (*it).url(); if (transformedUrl == nextUrl) { goForward(); // kDebug() << "goin' forward in history" << endl; @@ -251,7 +237,8 @@ void UrlNavigator::setUrl(const KUrl& url) } } - const KUrl& currUrl = m_history[m_historyIndex].url(); + QLinkedList::iterator it = m_history.begin() + m_historyIndex; + const KUrl& currUrl = (*it).url(); if (currUrl == transformedUrl) { // don't insert duplicate history elements // kDebug() << "currUrl == transformedUrl" << endl; @@ -259,8 +246,6 @@ void UrlNavigator::setUrl(const KUrl& url) } updateHistoryElem(); - - const Q3ValueListIterator it = m_history.at(m_historyIndex); m_history.insert(it, HistoryElem(transformedUrl)); updateContent(); @@ -296,8 +281,9 @@ void UrlNavigator::requestActivation() void UrlNavigator::storeContentsPosition(int x, int y) { - m_history[m_historyIndex].setContentsX(x); - m_history[m_historyIndex].setContentsY(y); + QLinkedList::iterator it = m_history.begin() + m_historyIndex; + (*it).setContentsX(x); + (*it).setContentsY(y); } void UrlNavigator::keyReleaseEvent(QKeyEvent* event) @@ -391,8 +377,9 @@ void UrlNavigator::slotProtocolChanged(const QString& protocol) url.setProtocol(protocol); //url.setPath(KProtocolInfo::protocolClass(protocol) == ":local" ? "/" : ""); url.setPath("/"); - Q3ValueList::const_iterator it = m_navButtons.constBegin(); - while (it != m_navButtons.constEnd()) { + QLinkedList::const_iterator it = m_navButtons.begin(); + const QLinkedList::const_iterator itEnd = m_navButtons.end(); + while (it != itEnd) { (*it)->close(); (*it)->deleteLater(); ++it; @@ -451,15 +438,17 @@ void UrlNavigator::updateHistoryElem() assert(m_historyIndex >= 0); const KFileItem* item = 0; // TODO: m_dolphinView->currentFileItem(); if (item != 0) { - m_history[m_historyIndex].setCurrentFileName(item->name()); + QLinkedList::iterator it = m_history.begin() + m_historyIndex; + (*it).setCurrentFileName(item->name()); } } void UrlNavigator::updateContent() { // delete all existing Url navigator buttons - Q3ValueList::const_iterator it = m_navButtons.constBegin(); - while (it != m_navButtons.constEnd()) { + QLinkedList::const_iterator it = m_navButtons.begin(); + const QLinkedList::const_iterator itEnd = m_navButtons.end(); + while (it != itEnd) { (*it)->close(); (*it)->deleteLater(); ++it; -- cgit v1.3