]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Hide the HistoryElem class from the public API of UrlNavigator
authorDavid Faure <faure@kde.org>
Tue, 27 Mar 2007 20:41:57 +0000 (20:41 +0000)
committerDavid Faure <faure@kde.org>
Tue, 27 Mar 2007 20:41:57 +0000 (20:41 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=647276

src/dolphinview.cpp
src/urlbutton.h
src/urlnavigator.cpp
src/urlnavigator.h

index 88a2cff80ffad1c484ce86e2354c3ff0d5cd8091..519189e9ad26b1acf66874b7b88e3e49db1a949a 100644 (file)
@@ -781,12 +781,13 @@ void DolphinView::showPreview(const KFileItem* item, const QPixmap& pixmap)
 
 void DolphinView::restoreContentsPos()
 {
-    UrlNavigator::HistoryElem historyItem = m_urlNavigator->currentHistoryItem();
-    if (!historyItem.url().isEmpty()) {
+    KUrl currentUrl = m_urlNavigator->url();
+    if (!currentUrl.isEmpty()) {
         QAbstractItemView* view = itemView();
-        // TODO: view->setCurrentItem(historyItem.currentFileName());
-        view->horizontalScrollBar()->setValue(historyItem.contentsX());
-        view->verticalScrollBar()->setValue(historyItem.contentsY());
+        // TODO: view->setCurrentItem(m_urlNavigator->currentFileName());
+        QPoint pos = m_urlNavigator->savedPosition();
+        view->horizontalScrollBar()->setValue(pos.x());
+        view->verticalScrollBar()->setValue(pos.y());
     }
 }
 
index a922ea0cd365a09abe50ff38e57a4ea6dda069a9..9ec0375cd7efabe199287eb9219f3ce319ec923b 100644 (file)
 #ifndef URLBUTTON_H
 #define URLBUTTON_H
 
-#include <QEvent>
 #include <QPushButton>
 
 class KUrl;
+class QEvent;
 class UrlNavigator;
-class QPainter;
 
 /**
  * @brief Base class for buttons of the URL navigator.
index 8a0225e375051dbb64b3302a549f33e9d6439f1d..514e4b22b12806928ee76c4115d111c52addf5cc 100644 (file)
 #include <QMouseEvent>
 #include <QToolButton>
 
-UrlNavigator::HistoryElem::HistoryElem() :
+/**
+ * @brief Represents the history element of an URL.
+ *
+ * A history element contains the URL, the name of the current file
+ * (the 'current file' is the file where the cursor is located) and
+ * the x- and y-position of the content.
+ */
+class HistoryElem {
+public:
+    HistoryElem();
+    HistoryElem(const KUrl& url);
+    ~HistoryElem(); // non virtual
+
+    const KUrl& url() const { return m_url; }
+
+    void setCurrentFileName(const QString& name) { m_currentFileName = name; }
+    const QString& currentFileName() const { return m_currentFileName; }
+
+    void setContentsX(int x) { m_contentsX = x; }
+    int contentsX() const { return m_contentsX; }
+
+    void setContentsY(int y) { m_contentsY = y; }
+    int contentsY() const { return m_contentsY; }
+
+private:
+    KUrl m_url;
+    QString m_currentFileName;
+    int m_contentsX;
+    int m_contentsY;
+};
+
+HistoryElem::HistoryElem() :
     m_url(),
     m_currentFileName(),
     m_contentsX(0),
@@ -52,7 +83,7 @@ UrlNavigator::HistoryElem::HistoryElem() :
 {
 }
 
-UrlNavigator::HistoryElem::HistoryElem(const KUrl& url) :
+HistoryElem::HistoryElem(const KUrl& url) :
     m_url(url),
     m_currentFileName(),
     m_contentsX(0),
@@ -60,7 +91,7 @@ UrlNavigator::HistoryElem::HistoryElem(const KUrl& url) :
 {
 }
 
-UrlNavigator::HistoryElem::~HistoryElem()
+HistoryElem::~HistoryElem()
 {
 }
 
@@ -592,9 +623,10 @@ KUrl UrlNavigator::url(int index) const
     return newurl;
 }
 
-UrlNavigator::HistoryElem UrlNavigator::currentHistoryItem() const
+QPoint UrlNavigator::savedPosition() const
 {
-    return d->m_history[d->m_historyIndex];
+    const HistoryElem& histElem = d->m_history[d->m_historyIndex];
+    return QPoint( histElem.contentsX(), histElem.contentsY() );
 }
 
 int UrlNavigator::historySize() const
index 4b277d1b8a5472aa0639ddaa22946f030c3f92af..cec3a0a9d80cc661c0c70c3518bf80c819e1b823 100644 (file)
@@ -50,37 +50,6 @@ class UrlNavigator : public QWidget
     Q_OBJECT
 
 public:
-    /**
-     * @brief Represents the history element of an URL.
-     *
-     * A history element contains the URL, the name of the current file
-     * (the 'current file' is the file where the cursor is located) and
-     * the x- and y-position of the content.
-     */
-    class HistoryElem {
-    public:
-        HistoryElem();
-        HistoryElem(const KUrl& url);
-        ~HistoryElem(); // non virtual
-
-        const KUrl& url() const { return m_url; }
-
-        void setCurrentFileName(const QString& name) { m_currentFileName = name; }
-        const QString& currentFileName() const { return m_currentFileName; }
-
-        void setContentsX(int x) { m_contentsX = x; }
-        int contentsX() const { return m_contentsX; }
-
-        void setContentsY(int y) { m_contentsY = y; }
-        int contentsY() const { return m_contentsY; }
-
-    private:
-        KUrl m_url;
-        QString m_currentFileName;
-        int m_contentsX;
-        int m_contentsY;
-    };
-
     UrlNavigator(KBookmarkManager* bookmarkManager, const KUrl& url, QWidget* parent);
     virtual ~UrlNavigator();
 
@@ -93,13 +62,8 @@ public:
     /** Returns the amount of items in the history */
     int historySize() const;
 
-    /**
-     * Returns one item out of the history. The index 0 indicates the oldest
-     * history element.
-     * @param index     Output parameter which indicates the current
-     *                  index of the location.
-     */
-    HistoryElem currentHistoryItem() const;
+    /** Returns the saved position from the history */
+    QPoint savedPosition() const;
 
     /**
      * Goes back one step in the URL history. The signals