+void UrlNavigator::setActive(bool active)
+{
+ if (active != m_active) {
+ m_active = active;
+ update();
+ if (active) {
+ emit activated();
+ }
+ }
+}
+
+void UrlNavigator::dropUrls(const KUrl::List& urls,
+ const KUrl& destination)
+{
+ kDebug() << "------------------- URLS dropped" << endl;
+ emit urlsDropped(urls, destination);
+}
+
+void UrlNavigator::setUrl(const KUrl& url)
+{
+ QString urlStr(url.pathOrUrl());
+ //kDebug() << "setUrl(" << url << ")" << endl;
+ if ( urlStr.length() > 0 && urlStr.at(0) == '~') {
+ // replace '~' by the home directory
+ urlStr.remove(0, 1);
+ urlStr.insert(0, QDir::home().path());
+ }
+
+ const KUrl transformedUrl(urlStr);
+
+ if (m_historyIndex > 0) {
+ // 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();
+ if (transformedUrl == nextUrl) {
+ goForward();
+// kDebug() << "goin' forward in history" << endl;
+ return;
+ }
+ }
+
+ const KUrl& currUrl = m_history[m_historyIndex].url();
+ if (currUrl == transformedUrl) {
+ // don't insert duplicate history elements
+// kDebug() << "currUrl == transformedUrl" << endl;
+ return;
+ }
+
+ updateHistoryElem();
+
+ const Q3ValueListIterator<UrlNavigator::HistoryElem> it = m_history.at(m_historyIndex);
+ m_history.insert(it, HistoryElem(transformedUrl));
+
+ updateContent();
+
+ emit urlChanged(transformedUrl);
+ emit historyChanged();
+
+ // Prevent an endless growing of the history: remembering
+ // the last 100 Urls should be enough...
+ if (m_historyIndex > 100) {
+ m_history.erase(m_history.begin());
+ --m_historyIndex;
+ }
+
+/* kDebug() << "history starting ====================" << endl;
+ int i = 0;
+ for (QValueListIterator<UrlNavigator::HistoryElem> it = m_history.begin();
+ it != m_history.end();
+ ++it, ++i)
+ {
+ kDebug() << i << ": " << (*it).url() << endl;
+ }
+ kDebug() << "history done ========================" << endl;*/
+
+ requestActivation();
+}
+
+void UrlNavigator::requestActivation()
+{
+ kDebug() << "--------------------------- request activation" << endl;
+ setActive(true);
+}
+
+void UrlNavigator::storeContentsPosition(int x, int y)