]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/bookmarkssidebarpage.cpp
Step 1 of 2 to fix the issue that reloading of a directory resets the contents positi...
[dolphin.git] / src / bookmarkssidebarpage.cpp
index 59ff607f86e71856abe70d25962acc665065ec6c..aaef9b3d90b1688a7468964f29de433275b301c8 100644 (file)
@@ -14,7 +14,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
 #include "bookmarkssidebarpage.h"
 #include <klocale.h>
 
 #include "dolphinsettings.h"
-#include "dolphin.h"
-#include "dolphinview.h"
+#include "dolphinmainwindow.h"
 #include "editbookmarkdialog.h"
 
-BookmarksSidebarPage::BookmarksSidebarPage(QWidget* parent) :
-    SidebarPage(parent)
+BookmarksSidebarPage::BookmarksSidebarPage(DolphinMainWindow* mainWindow, QWidget* parent) :
+    SidebarPage(mainWindow, parent)
 {
     Q3VBoxLayout* layout = new Q3VBoxLayout(this);
     m_bookmarksList = new BookmarksListBox(this);
-    m_bookmarksList->setPaletteBackgroundColor(colorGroup().background());
+    m_bookmarksList->setPaletteBackgroundColor(palette().brush(QPalette::Background).color());
 
     layout->addWidget(m_bookmarksList);
     connect(m_bookmarksList, SIGNAL(mouseButtonClicked(int, Q3ListBoxItem*, const QPoint&)),
@@ -98,7 +97,7 @@ void BookmarksSidebarPage::slotMouseButtonClicked(int button, Q3ListBoxItem* ite
 
     const int index = m_bookmarksList->index(item);
     KBookmark bookmark = DolphinSettings::instance().bookmark(index);
-    Dolphin::mainWin().activeView()->setURL(bookmark.url());
+    mainWindow()->activeView()->setUrl(bookmark.url());
 }
 
 void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
@@ -111,12 +110,12 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
 
     Q3PopupMenu* popup = new Q3PopupMenu();
     if (item == 0) {
-        popup->insertItem(SmallIcon("filenew"), i18n("Add Bookmark..."), addID);
+        popup->insertItem(SmallIcon("document-new"), i18n("Add Bookmark..."), addID);
     }
     else {
-        popup->insertItem(SmallIcon("filenew"), i18n("Insert Bookmark..."), insertID);
+        popup->insertItem(SmallIcon("document-new"), i18n("Insert Bookmark..."), insertID);
         popup->insertItem(SmallIcon("edit"), i18n("Edit..."), editID);
-        popup->insertItem(SmallIcon("editdelete"), i18n("Delete"), deleteID);
+        popup->insertItem(SmallIcon("edit-delete"), i18n("Delete"), deleteID);
     }
 
     KBookmarkManager* manager = DolphinSettings::instance().bookmarkManager();
@@ -187,7 +186,7 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
     delete popup;
     popup = 0;
 
-    DolphinView* view = Dolphin::mainWin().activeView();
+    DolphinView* view = mainWindow()->activeView();
     adjustSelection(view->url());
 }
 
@@ -203,14 +202,14 @@ void BookmarksSidebarPage::adjustSelection(const KUrl& url)
     int maxLength = 0;
     int selectedIndex = -1;
 
-    // Search the bookmark which is equal to the URL or at least is a parent URL.
-    // If there are more than one possible parent URL candidates, choose the bookmark
-    // which covers the bigger range of the URL.
+    // Search the bookmark which is equal to the Url or at least is a parent Url.
+    // If there are more than one possible parent Url candidates, choose the bookmark
+    // which covers the bigger range of the Url.
     int i = 0;
     while (!bookmark.isNull()) {
-        const KUrl bookmarkURL = bookmark.url();
-        if (bookmarkURL.isParentOf(url)) {
-            const int length = bookmarkURL.prettyUrl().length();
+        const KUrl bookmarkUrl = bookmark.url();
+        if (bookmarkUrl.isParentOf(url)) {
+            const int length = bookmarkUrl.prettyUrl().length();
             if (length > maxLength) {
                 selectedIndex = i;
                 maxLength = length;
@@ -228,23 +227,23 @@ void BookmarksSidebarPage::adjustSelection(const KUrl& url)
         m_bookmarksList->setSelected(currentIndex, false);
     }
     else {
-        // select the bookmark which is part of the current URL
+        // select the bookmark which is part of the current Url
         m_bookmarksList->setSelected(selectedIndex, true);
     }
     m_bookmarksList->blockSignals(block);
 }
 
-void BookmarksSidebarPage::slotURLChanged(const KUrl& url)
+void BookmarksSidebarPage::slotUrlChanged(const KUrl& url)
 {
     adjustSelection(url);
 }
 
 void BookmarksSidebarPage::connectToActiveView()
 {
-    DolphinView* view = Dolphin::mainWin().activeView();
+    DolphinView* view = mainWindow()->activeView();
     adjustSelection(view->url());
-    connect(view, SIGNAL(signalURLChanged(const KUrl&)),
-            this, SLOT(slotURLChanged(const KUrl&)));
+    connect(view, SIGNAL(urlChanged(const KUrl&)),
+            this, SLOT(slotUrlChanged(const KUrl&)));
 }
 
 BookmarksListBox::BookmarksListBox(QWidget* parent) :