]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/bookmarkssidebarpage.cpp
Changes to Undo/Redo in regard to ProgressIndicator
[dolphin.git] / src / bookmarkssidebarpage.cpp
index deb311914589f250abaa8e9fb512f17c52043955..7eced5a010f93bb20a8a605c8351f7c3bf4a83c2 100644 (file)
 #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);
@@ -79,8 +78,8 @@ void BookmarksSidebarPage::updateBookmarks()
     KBookmark bookmark = root.first();
     while (!bookmark.isNull()) {
         QPixmap icon(iconLoader.loadIcon(bookmark.icon(),
-                                         KIcon::NoGroup,
-                                         KIcon::SizeMedium));
+                                         K3Icon::NoGroup,
+                                         K3Icon::SizeMedium));
         BookmarkItem* item = new BookmarkItem(icon, bookmark.text());
         m_bookmarksList->insertItem(item);
 
@@ -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,
@@ -128,7 +127,7 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
         case insertID: {
             KBookmark newBookmark = EditBookmarkDialog::getBookmark(i18n("Insert Bookmark"),
                                                                     "New bookmark",
-                                                                    KURL(),
+                                                                    KUrl(),
                                                                     "bookmark");
             if (!newBookmark.isNull()) {
                 root.addBookmark(manager, newBookmark);
@@ -173,7 +172,7 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
         case addID: {
             KBookmark bookmark = EditBookmarkDialog::getBookmark(i18n("Add Bookmark"),
                                                                  "New bookmark",
-                                                                 KURL(),
+                                                                 KUrl(),
                                                                  "bookmark");
             if (!bookmark.isNull()) {
                 root.addBookmark(manager, bookmark);
@@ -187,12 +186,12 @@ void BookmarksSidebarPage::slotContextMenuRequested(Q3ListBoxItem* item,
     delete popup;
     popup = 0;
 
-    DolphinView* view = Dolphin::mainWin().activeView();
+    DolphinView* view = mainWindow()->activeView();
     adjustSelection(view->url());
 }
 
 
-void BookmarksSidebarPage::adjustSelection(const KURL& url)
+void BookmarksSidebarPage::adjustSelection(const KUrl& url)
 {
     // TODO (remarked in dolphin/TODO): the following code is quite equal
     // to BookmarkSelector::updateSelection().
@@ -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(signalUrlChanged(const KUrl&)),
+            this, SLOT(slotUrlChanged(const KUrl&)));
 }
 
 BookmarksListBox::BookmarksListBox(QWidget* parent) :
@@ -275,3 +274,4 @@ int BookmarkItem::height(const Q3ListBox* listBox) const
     return Q3ListBoxPixmap::height(listBox) + 8;
 }
 
+#include "bookmarkssidebarpage.moc"