summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bookmarks/bookmarkowner.cpp50
-rw-r--r--src/bookmarks/bookmarkowner.h34
-rw-r--r--src/bookmarks/bookmarkprovider.cpp18
-rw-r--r--src/bookmarks/bookmarkprovider.h22
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp48
-rw-r--r--src/bookmarks/bookmarkscontextmenu.h2
-rw-r--r--src/bookmarks/bookmarkspanel.cpp37
-rw-r--r--src/bookmarks/bookmarkspanel.h16
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp3
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp6
-rw-r--r--src/bookmarks/bookmarkstreemodel.h13
-rw-r--r--src/history/historypanel.cpp21
-rw-r--r--src/history/historypanel.h3
-rw-r--r--src/urlbar/urlbar.cpp5
-rw-r--r--src/urlbar/urlresolver.cpp1
-rw-r--r--src/urlbar/urlresolver.h18
-rw-r--r--src/urlfilterproxymodel.cpp1
-rw-r--r--src/urlfilterproxymodel.h6
-rw-r--r--src/urlpanel.cpp17
-rw-r--r--src/urlpanel.h16
20 files changed, 182 insertions, 155 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index 530ad199..f9e64d68 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -29,6 +29,7 @@
// Self Includes
#include "bookmarkowner.h"
+#include "bookmarkowner.moc"
// Local Includes
#include "application.h"
@@ -42,6 +43,7 @@
#include <KBookmarkDialog>
#include <KLocalizedString>
#include <KMessageBox>
+#include "iconmanager.h"
// Qt Includes
#include <QtGui/QClipboard>
@@ -126,30 +128,36 @@ void BookmarkOwner::setCurrentBookmark(const KBookmark &bookmark)
}
+void BookmarkOwner::unsetCurrentBookmark()
+{
+ m_currentBookmark = KBookmark();
+}
+
+
void BookmarkOwner::openBookmark(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
emit openUrl(selected.url(), Rekonq::CurrentTab);
}
void BookmarkOwner::openBookmarkInNewTab(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
emit openUrl(selected.url(), Rekonq::NewTab);
}
void BookmarkOwner::openBookmarkInNewWindow(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
emit openUrl(selected.url(), Rekonq::NewWindow);
}
void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
if (!selected.isGroup())
return;
@@ -172,9 +180,10 @@ void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
}
-void BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
+KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
+ KBookmark newBk;
KBookmarkGroup parent;
if (!selected.isNull())
@@ -184,22 +193,25 @@ void BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
else
parent = selected.parentGroup();
- KBookmark newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl()));
+ newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl()),
+ Application::iconManager()->iconForUrl(currentUrl()).name());
parent.moveBookmark(newBk, selected);
}
else
{
parent = Application::bookmarkProvider()->rootGroup();
- parent.addBookmark(currentTitle(), KUrl(currentUrl()));
+ newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl()));
}
m_manager->emitChanged(parent);
+ return newBk;
}
-void BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
+KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
+ KBookmarkGroup newBk;
KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow());
QString folderName = i18n("New folder");
@@ -207,11 +219,11 @@ void BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
{
if (selected.isGroup())
{
- dialog->createNewFolder(folderName, selected);
+ newBk = dialog->createNewFolder(folderName, selected);
}
else
{
- KBookmark newBk = dialog->createNewFolder(folderName, selected.parentGroup());
+ newBk = dialog->createNewFolder(folderName, selected.parentGroup());
if (!newBk.isNull())
{
KBookmarkGroup parent = newBk.parentGroup();
@@ -222,16 +234,17 @@ void BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
}
else
{
- dialog->createNewFolder(folderName);
+ newBk = dialog->createNewFolder(folderName);
}
delete dialog;
+ return newBk;
}
-void BookmarkOwner::newSeparator(const KBookmark &bookmark)
+KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
KBookmark newBk;
if (!selected.isNull())
@@ -254,12 +267,13 @@ void BookmarkOwner::newSeparator(const KBookmark &bookmark)
newBk.setIcon(("edit-clear"));
m_manager->emitChanged(newBk.parentGroup());
+ return newBk;
}
void BookmarkOwner::copyLink(const KBookmark &bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
if (selected.isNull())
return;
@@ -269,7 +283,7 @@ void BookmarkOwner::copyLink(const KBookmark &bookmark)
void BookmarkOwner::editBookmark(KBookmark bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
if (selected.isNull())
return;
@@ -285,7 +299,7 @@ void BookmarkOwner::editBookmark(KBookmark bookmark)
bool BookmarkOwner::deleteBookmark(KBookmark bookmark)
{
- KBookmark selected = bookmark.isNull() ? m_currentBookmark : bookmark;
+ KBookmark selected = (bookmark.isNull() && !m_currentBookmark.isNull()) ? m_currentBookmark : bookmark;
if (selected.isNull())
return false;
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index e0c2a8ad..febff3b0 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -40,6 +40,7 @@
// Forward Declarations
class KAction;
+
/**
* Reimplementation of KBookmarkOwner, this class allows to manage
* bookmarks as actions.
@@ -111,37 +112,38 @@ public:
*/
virtual void openFolderinTabs(const KBookmarkGroup &bookmark);
-signals:
- /**
- * This signal is emitted when an url has to be loaded
- * @param url the URL to load
- */
- void openUrl(const KUrl &, const Rekonq::OpenType &);
-
-public slots:
+public Q_SLOTS:
void setCurrentBookmark(const KBookmark &bookmark);
+ void unsetCurrentBookmark();
void openBookmark(const KBookmark &bookmark = KBookmark());
void openBookmarkInNewTab(const KBookmark &bookmark = KBookmark());
void openBookmarkInNewWindow(const KBookmark &bookmark = KBookmark());
void openBookmarkFolder(const KBookmark &bookmark = KBookmark());
- void bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
- void newBookmarkFolder(const KBookmark &bookmark = KBookmark());
- void newSeparator(const KBookmark &bookmark = KBookmark());
+ KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
+ KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark());
+ KBookmark newSeparator(const KBookmark &bookmark = KBookmark());
void copyLink(const KBookmark &bookmark = KBookmark());
void editBookmark(KBookmark bookmark = KBookmark());
bool deleteBookmark(KBookmark bookmark = KBookmark());
-private:
- KBookmarkManager *m_manager;
-
- QVector<KAction*> m_actions;
- KBookmark m_currentBookmark;
+Q_SIGNALS:
+ /**
+ * This signal is emitted when an url has to be loaded
+ * @param url the URL to load
+ */
+ void openUrl(const KUrl &, const Rekonq::OpenType &);
+private:
void setupActions();
void createAction(const BookmarkAction &action,
const QString &text, const QString &icon,
const QString &help, const char *slot);
+
+
+ KBookmarkManager *m_manager;
+ QVector<KAction*> m_actions;
+ KBookmark m_currentBookmark;
};
#endif // BOOKMARKOWNER_H
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp
index f5021916..8089fb6d 100644
--- a/src/bookmarks/bookmarkprovider.cpp
+++ b/src/bookmarks/bookmarkprovider.cpp
@@ -29,17 +29,18 @@
// Self Includes
#include "bookmarkprovider.h"
+#include "bookmarkprovider.moc"
// Local Includes
#include "application.h"
#include "bookmarkspanel.h"
#include "bookmarkstoolbar.h"
#include "bookmarkowner.h"
+#include "iconmanager.h"
// KDE Includes
#include <KActionCollection>
#include <KStandardDirs>
-#include <KMimeType>
// Qt Includes
#include <QtCore/QFile>
@@ -79,14 +80,14 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
m_manager = KBookmarkManager::managerForFile(bookfile.path(), "rekonq");
connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
- this, SLOT(slotBookmarksChanged(const QString &, const QString &)));
+ this, SLOT(slotBookmarksChanged()));
// setup menu
m_owner = new BookmarkOwner(m_manager, this);
connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)),
this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)));
- KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
+ KAction *a = KStandardAction::addBookmark(bookmarkOwner(), SLOT(bookmarkCurrentPage()), this);
m_actionCollection->addAction(QL1S("rekonq_add_bookmark"), a);
kDebug() << "Loading Bookmarks Manager... DONE!";
@@ -195,7 +196,7 @@ KBookmark BookmarkProvider::bookmarkForUrl(const KUrl &url)
}
-void BookmarkProvider::slotBookmarksChanged(const QString& /*groupAddress*/, const QString& /*caller*/)
+void BookmarkProvider::slotBookmarksChanged()
{
foreach(BookmarkToolBar *bookmarkToolBar, m_bookmarkToolBars)
{
@@ -235,6 +236,7 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar)
{
KBookmarkAction *action = new KBookmarkAction(bookmark, m_owner, this);
action->setIconText(action->iconText().replace('&', "&&"));
+ action->setIcon(Application::iconManager()->iconForUrl(bookmark.url()));
connect(action, SIGNAL(hovered()), toolBar, SLOT(actionHovered()));
toolBar->toolBar()->addAction(action);
toolBar->toolBar()->widgetForAction(action)->installEventFilter(toolBar);
@@ -243,14 +245,6 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar)
}
-void BookmarkProvider::slotAddBookmark()
-{
- QString url = bookmarkOwner()->currentUrl();
- rootGroup().addBookmark(bookmarkOwner()->currentTitle(), url, KMimeType::favIconForUrl( KUrl(url) ) );
- bookmarkManager()->emitChanged();
-}
-
-
void BookmarkProvider::slotPanelChanged()
{
foreach (BookmarksPanel *panel, m_bookmarkPanels)
diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h
index 36724d75..3f7a5c52 100644
--- a/src/bookmarks/bookmarkprovider.h
+++ b/src/bookmarks/bookmarkprovider.h
@@ -54,6 +54,7 @@ class KUrl;
class QAction;
class QPoint;
+
/**
* This class represent the interface to rekonq bookmarks system.
* All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided
@@ -114,14 +115,7 @@ public:
KBookmark bookmarkForUrl(const KUrl &url);
-signals:
- /**
- * @short This signal is emitted when an url has to be loaded
- */
- void openUrl(const KUrl &, const Rekonq::OpenType &);
-
-
-public slots:
+public Q_SLOTS:
/**
* @short Waits for signal that the group with the address has been modified by the caller.
* Waits for signal that the group (or any of its children) with the address
@@ -130,16 +124,20 @@ public slots:
* @param caller caller that modified the bookmarks
* @see KBookmarkManager::changed
*/
- void slotBookmarksChanged(const QString &groupAddress, const QString &caller);
+ void slotBookmarksChanged();
void fillBookmarkBar(BookmarkToolBar *toolBar);
-private slots:
- void slotAddBookmark();
+private Q_SLOTS:
void slotPanelChanged();
+
+Q_SIGNALS:
+ /**
+ * @short This signal is emitted when an url has to be loaded
+ */
+ void openUrl(const KUrl &, const Rekonq::OpenType &);
private:
void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text);
-
KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
KBookmarkManager *m_manager;
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index da986fd2..8f1a570c 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -33,37 +33,37 @@
BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent)
: KBookmarkContextMenu(bookmark, manager, owner, parent)
- , bmOwner(owner)
+ , m_bmOwner(owner)
{
- bmOwner->setCurrentBookmark(bookmark);
+ m_bmOwner->setCurrentBookmark(bookmark);
}
BookmarksContextMenu::~BookmarksContextMenu()
{
+ m_bmOwner->unsetCurrentBookmark();
}
void BookmarksContextMenu::addBookmarkActions()
{
- addAction(bmOwner->action(BookmarkOwner::OPEN));
- addAction(bmOwner->action(BookmarkOwner::OPEN_IN_TAB));
- addAction(bmOwner->action(BookmarkOwner::OPEN_IN_WINDOW));
+ addAction(m_bmOwner->action(BookmarkOwner::OPEN_IN_TAB));
+ addAction(m_bmOwner->action(BookmarkOwner::OPEN_IN_WINDOW));
addSeparator();
- addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(bmOwner->action(BookmarkOwner::COPY));
+ addAction(m_bmOwner->action(BookmarkOwner::COPY));
addSeparator();
- addAction(bmOwner->action(BookmarkOwner::EDIT));
- addAction(bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(BookmarkOwner::EDIT));
+ addAction(m_bmOwner->action(BookmarkOwner::DELETE));
}
@@ -82,39 +82,39 @@ void BookmarksContextMenu::addFolderActions()
if (!child.isNull())
{
- addAction(bmOwner->action(BookmarkOwner::OPEN_FOLDER));
+ addAction(m_bmOwner->action(BookmarkOwner::OPEN_FOLDER));
addSeparator();
}
}
- addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(bmOwner->action(BookmarkOwner::EDIT));
- addAction(bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(BookmarkOwner::EDIT));
+ addAction(m_bmOwner->action(BookmarkOwner::DELETE));
}
void BookmarksContextMenu::addSeparatorActions()
{
- addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(bmOwner->action(BookmarkOwner::DELETE));
+ addAction(m_bmOwner->action(BookmarkOwner::DELETE));
}
void BookmarksContextMenu::addNullActions()
{
- addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
- addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
- addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
+ addAction(m_bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(m_bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
}
diff --git a/src/bookmarks/bookmarkscontextmenu.h b/src/bookmarks/bookmarkscontextmenu.h
index a6691fdd..d669eef6 100644
--- a/src/bookmarks/bookmarkscontextmenu.h
+++ b/src/bookmarks/bookmarkscontextmenu.h
@@ -47,7 +47,7 @@ private:
void addSeparatorActions();
void addNullActions();
- BookmarkOwner *bmOwner;
+ BookmarkOwner *m_bmOwner;
};
#endif // BOOKMARKS_CONTEXT_MENU_H
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index e88d3060..27c60e46 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -27,6 +27,7 @@
// Self Includes
#include "bookmarkspanel.h"
+#include "bookmarkspanel.moc"
// Auto Includes
#include "rekonq.h"
@@ -43,10 +44,12 @@
BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
: UrlPanel(title, parent, flags)
- , m_loadingState(false)
+ , _bkTreeModel(new BookmarksTreeModel(this))
+ , _loadingState(false)
{
setObjectName("bookmarksPanel");
setVisible(ReKonfig::showBookmarksPanel());
+ connect(_bkTreeModel, SIGNAL(bookmarksUpdated()), this, SLOT(startLoadFoldedState()));
}
@@ -58,24 +61,24 @@ BookmarksPanel::~BookmarksPanel()
void BookmarksPanel::startLoadFoldedState()
{
- m_loadingState = true;
+ _loadingState = true;
loadFoldedState(QModelIndex());
- m_loadingState = false;
+ _loadingState = false;
}
void BookmarksPanel::contextMenu(const QPoint &pos)
{
- if (m_loadingState)
+ if (_loadingState)
return;
- BookmarksContextMenu menu(bookmarkForIndex( m_treeView->indexAt(pos) ),
+ BookmarksContextMenu menu(bookmarkForIndex( panelTreeView()->indexAt(pos) ),
Application::bookmarkProvider()->bookmarkManager(),
Application::bookmarkProvider()->bookmarkOwner(),
this
);
- menu.exec(m_treeView->mapToGlobal(pos));
+ menu.exec(panelTreeView()->mapToGlobal(pos));
}
@@ -99,8 +102,8 @@ void BookmarksPanel::contextMenuEmpty(const QPoint &pos)
void BookmarksPanel::deleteBookmark()
{
- QModelIndex index = m_treeView->currentIndex();
- if (m_loadingState || !index.isValid())
+ QModelIndex index = panelTreeView()->currentIndex();
+ if (_loadingState || !index.isValid())
return;
Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(bookmarkForIndex(index));
@@ -109,7 +112,7 @@ void BookmarksPanel::deleteBookmark()
void BookmarksPanel::onCollapse(const QModelIndex &index)
{
- if (m_loadingState)
+ if (_loadingState)
return;
bookmarkForIndex(index).internalElement().setAttribute("folded", "yes");
@@ -119,7 +122,7 @@ void BookmarksPanel::onCollapse(const QModelIndex &index)
void BookmarksPanel::onExpand(const QModelIndex &index)
{
- if (m_loadingState)
+ if (_loadingState)
return;
bookmarkForIndex(index).internalElement().setAttribute("folded", "no");
@@ -129,7 +132,7 @@ void BookmarksPanel::onExpand(const QModelIndex &index)
void BookmarksPanel::loadFoldedState(const QModelIndex &root)
{
- QAbstractItemModel *model = m_treeView->model();
+ QAbstractItemModel *model = panelTreeView()->model();
int count = model->rowCount(root);
QModelIndex index;
@@ -141,7 +144,7 @@ void BookmarksPanel::loadFoldedState(const QModelIndex &root)
KBookmark bm = bookmarkForIndex(index);
if (bm.isGroup())
{
- m_treeView->setExpanded(index, bm.toGroup().isOpen());
+ panelTreeView()->setExpanded(index, bm.toGroup().isOpen());
loadFoldedState(index);
}
}
@@ -154,9 +157,9 @@ void BookmarksPanel::setup()
UrlPanel::setup();
kDebug() << "Bookmarks panel...";
- connect(m_treeView, SIGNAL(delKeyPressed()), this, SLOT(deleteBookmark()));
- connect(m_treeView, SIGNAL(collapsed(const QModelIndex &)), this, SLOT(onCollapse(const QModelIndex &)));
- connect(m_treeView, SIGNAL(expanded(const QModelIndex &)), this, SLOT(onExpand(const QModelIndex &)));
+ connect(panelTreeView(), SIGNAL(delKeyPressed()), this, SLOT(deleteBookmark()));
+ connect(panelTreeView(), SIGNAL(collapsed(const QModelIndex &)), this, SLOT(onCollapse(const QModelIndex &)));
+ connect(panelTreeView(), SIGNAL(expanded(const QModelIndex &)), this, SLOT(onExpand(const QModelIndex &)));
startLoadFoldedState();
}
@@ -177,7 +180,5 @@ KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index)
QAbstractItemModel* BookmarksPanel::getModel()
{
- BookmarksTreeModel *model = new BookmarksTreeModel(this);
- connect(model, SIGNAL(bookmarksUpdated()), this, SLOT(startLoadFoldedState()));
- return model;
+ return _bkTreeModel;
}
diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h
index 2418ae81..f042d4c8 100644
--- a/src/bookmarks/bookmarkspanel.h
+++ b/src/bookmarks/bookmarkspanel.h
@@ -37,9 +37,12 @@
#include "urlpanel.h"
// Forward Declarations
+class BookmarksTreeModel;
+
class KBookmark;
class QModelIndex;
+
class REKONQ_TESTS_EXPORT BookmarksPanel : public UrlPanel
{
Q_OBJECT
@@ -48,13 +51,10 @@ public:
explicit BookmarksPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~BookmarksPanel();
-signals:
- void expansionChanged();
-
-public slots:
+public Q_SLOTS:
void startLoadFoldedState();
-private slots:
+private Q_SLOTS:
void contextMenu(const QPoint &pos);
virtual void contextMenuItem(const QPoint &pos);
virtual void contextMenuGroup(const QPoint &pos);
@@ -65,13 +65,17 @@ private slots:
void onExpand(const QModelIndex &index);
void loadFoldedState(const QModelIndex &root);
+Q_SIGNALS:
+ void expansionChanged();
+
private:
virtual void setup();
KBookmark bookmarkForIndex(const QModelIndex &index);
virtual QAbstractItemModel* getModel();
- bool m_loadingState;
+ BookmarksTreeModel *_bkTreeModel;
+ bool _loadingState;
};
#endif // BOOKMARKSPANEL_H
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index ddb70a65..77bff7e6 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -30,6 +30,7 @@
#include "bookmarkstoolbar.moc"
// Local Includes
+#include "iconmanager.h"
#include "bookmarkscontextmenu.h"
#include "mainwindow.h"
#include "application.h"
@@ -66,7 +67,6 @@ BookmarkMenu::~BookmarkMenu()
KMenu * BookmarkMenu::contextMenu(QAction *act)
{
-
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
if (!action)
return 0;
@@ -91,6 +91,7 @@ QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
else
{
KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this);
+ action->setIcon(Application::iconManager()->iconForUrl(bookmark.url()));
connect(action, SIGNAL(hovered()), this, SLOT(actionHovered()));
return action;
}
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 254a914f..796208a9 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -27,6 +27,7 @@
// Self Includes
#include "bookmarkstreemodel.h"
+#include "bookmarkstreemodel.moc"
// Local Includes
#include "application.h"
@@ -69,7 +70,10 @@ QVariant BtmItem::data(int role) const
// return KIcon(m_kbm.icon());
// but I cannot let it work :(
// I really cannot understand how let this work properly...
- return Application::iconManager()->iconForUrl(KUrl(m_kbm.url()));
+ if (m_kbm.isGroup() || m_kbm.isSeparator())
+ return KIcon(m_kbm.icon());
+ else
+ return Application::iconManager()->iconForUrl(KUrl(m_kbm.url()));
}
if (role == Qt::UserRole)
diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h
index 6b85365b..7bbce339 100644
--- a/src/bookmarks/bookmarkstreemodel.h
+++ b/src/bookmarks/bookmarkstreemodel.h
@@ -38,6 +38,7 @@
// Qt Includes
#include <QtCore/QAbstractItemModel>
+
class BtmItem
{
public:
@@ -60,10 +61,12 @@ private:
};
+// -------------------------------------------------------------------------------------------------
+
+
class REKONQ_TESTS_EXPORT BookmarksTreeModel : public QAbstractItemModel
{
Q_OBJECT
- Q_DISABLE_COPY(BookmarksTreeModel)
public:
explicit BookmarksTreeModel(QObject *parent = 0);
@@ -95,19 +98,19 @@ public:
virtual Qt::DropActions supportedDropActions() const;
virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
-private slots:
+private Q_SLOTS:
void bookmarksChanged(const QString &groupAddress);
-signals:
+Q_SIGNALS:
void bookmarksUpdated();
private:
- BtmItem *m_root;
-
void resetModel();
void setRoot(KBookmarkGroup bmg);
void populate(BtmItem *node, KBookmarkGroup bmg);
KBookmark bookmarkForIndex(const QModelIndex &index) const;
+
+ BtmItem *m_root;
};
#endif // BOOKMARKSTREEMODEL_H
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
index 84f2296e..28f7f4ee 100644
--- a/src/history/historypanel.cpp
+++ b/src/history/historypanel.cpp
@@ -27,6 +27,7 @@
// Self Includes
#include "historypanel.h"
+#include "historypanel.moc"
// Auto Includes
#include "rekonq.h"
@@ -67,22 +68,22 @@ void HistoryPanel::contextMenuItem(const QPoint &pos)
KAction* action;
action = new KAction(KIcon("tab-new"), i18n("Open"), this);
- connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInCurrentTab()));
+ connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInCurrentTab()));
menu.addAction(action);
action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this);
- connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInNewTab()));
+ connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewTab()));
menu.addAction(action);
action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this);
- connect(action, SIGNAL(triggered()), m_treeView, SLOT(openInNewWindow()));
+ connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewWindow()));
menu.addAction(action);
action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this);
- connect(action, SIGNAL(triggered()), m_treeView, SLOT(copyToClipboard()));
+ connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard()));
menu.addAction(action);
- menu.exec(m_treeView->mapToGlobal(pos));
+ menu.exec(panelTreeView()->mapToGlobal(pos));
}
@@ -95,7 +96,7 @@ void HistoryPanel::contextMenuGroup(const QPoint &pos)
connect(action, SIGNAL(triggered()), this, SLOT(openAll()));
menu.addAction(action);
- menu.exec(m_treeView->mapToGlobal(pos));
+ menu.exec(panelTreeView()->mapToGlobal(pos));
}
@@ -106,7 +107,7 @@ void HistoryPanel::contextMenuEmpty(const QPoint& /*pos*/)
void HistoryPanel::openAll()
{
- QModelIndex index = m_treeView->currentIndex();
+ QModelIndex index = panelTreeView()->currentIndex();
if (!index.isValid())
return;
@@ -136,10 +137,10 @@ void HistoryPanel::setup()
UrlPanel::setup();
kDebug() << "History panel...";
- m_treeView->header()->hideSection(1);
+ panelTreeView()->header()->hideSection(1);
- const UrlFilterProxyModel *proxy = static_cast<const UrlFilterProxyModel*>(m_treeView->model());
- m_treeView->expand(proxy->index(0, 0));
+ const UrlFilterProxyModel *proxy = static_cast<const UrlFilterProxyModel*>(panelTreeView()->model());
+ panelTreeView()->expand(proxy->index(0, 0));
}
diff --git a/src/history/historypanel.h b/src/history/historypanel.h
index 9c9d4a4e..0a5ae216 100644
--- a/src/history/historypanel.h
+++ b/src/history/historypanel.h
@@ -44,7 +44,7 @@ public:
explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~HistoryPanel();
-private slots:
+private Q_SLOTS:
virtual void contextMenuItem(const QPoint &pos);
virtual void contextMenuGroup(const QPoint &pos);
virtual void contextMenuEmpty(const QPoint &pos);
@@ -53,7 +53,6 @@ private slots:
private:
virtual void setup();
-
virtual QAbstractItemModel* getModel();
};
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index f1729d53..25c7b748 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -42,11 +42,11 @@
#include "webview.h"
#include "completionwidget.h"
#include "bookmarkprovider.h"
+#include "bookmarkowner.h"
#include "bookmarkwidget.h"
#include "iconmanager.h"
// KDE Includes
-#include <KBookmarkManager>
#include <KCompletionBox>
#include <KStandardDirs>
@@ -356,8 +356,7 @@ void UrlBar::showBookmarkInfo(const QPoint &pos)
if (bookmark.isNull())
{
- bookmark = Application::bookmarkProvider()->rootGroup().addBookmark(_tab->view()->title(), _tab->url());
- Application::bookmarkProvider()->bookmarkManager()->emitChanged();
+ bookmark = Application::bookmarkProvider()->bookmarkOwner()->bookmarkCurrentPage();
}
BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index dfb3289f..7f6a7f4f 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -26,6 +26,7 @@
// Self Includes
#include "urlresolver.h"
+#include "urlresolver.moc"
// Local Includes
#include "application.h"
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
index 700fd460..f16c44f8 100644
--- a/src/urlbar/urlresolver.h
+++ b/src/urlbar/urlresolver.h
@@ -40,6 +40,7 @@
#include <QList>
#include <QStringList>
+
class UrlSearchItem
{
public:
@@ -123,14 +124,6 @@ Q_SIGNALS:
void suggestionsReady(const UrlSearchList &, const QString &);
private:
- QString _typedString;
-
- UrlSearchList _webSearches;
- UrlSearchList _qurlFromUserInput;
- UrlSearchList _history;
- UrlSearchList _bookmarks;
- UrlSearchList _suggestions;
-
void computeWebSearches();
void computeHistory();
void computeQurlFromUserInput();
@@ -139,6 +132,15 @@ private:
UrlSearchItem privilegedItem(UrlSearchList* list);
UrlSearchList orderLists();
+
+ QString _typedString;
+
+ UrlSearchList _webSearches;
+ UrlSearchList _qurlFromUserInput;
+ UrlSearchList _history;
+ UrlSearchList _bookmarks;
+ UrlSearchList _suggestions;
+
static QRegExp _browseRegexp;
static QRegExp _searchEnginesRegexp;
diff --git a/src/urlfilterproxymodel.cpp b/src/urlfilterproxymodel.cpp
index b8e68342..f1d60002 100644
--- a/src/urlfilterproxymodel.cpp
+++ b/src/urlfilterproxymodel.cpp
@@ -27,6 +27,7 @@
// Self Includes
#include "urlfilterproxymodel.h"
+#include "urlfilterproxymodel.moc"
UrlFilterProxyModel::UrlFilterProxyModel(QObject *parent)
diff --git a/src/urlfilterproxymodel.h b/src/urlfilterproxymodel.h
index f4f15395..06592c27 100644
--- a/src/urlfilterproxymodel.h
+++ b/src/urlfilterproxymodel.h
@@ -35,15 +35,17 @@
// Qt Includes
#include <QtGui/QSortFilterProxyModel>
+
/**
* QSortFilterProxyModel hides all children which parent doesn't
* match the filter. This class is used to change this behavior.
- * If a url matches the filter it'll be shown, even if it's parent doesn't match it.
+ * If a url matches the filter it'll be shown,
+ * even if it's parent doesn't match it.
+ *
*/
class REKONQ_TESTS_EXPORT UrlFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
- Q_DISABLE_COPY(UrlFilterProxyModel)
public:
UrlFilterProxyModel(QObject *parent = 0);
diff --git a/src/urlpanel.cpp b/src/urlpanel.cpp
index 86246fd9..cf6aec7b 100644
--- a/src/urlpanel.cpp
+++ b/src/urlpanel.cpp
@@ -27,6 +27,7 @@
// Self Includes
#include "urlpanel.h"
+#include "urlpanel.moc"
// Auto Includes
#include "rekonq.h"
@@ -47,7 +48,7 @@
UrlPanel::UrlPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
: QDockWidget(title, parent, flags)
- , m_treeView(new PanelTreeView(this))
+ , _treeView(new PanelTreeView(this))
, _loaded(false)
{
setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
@@ -88,14 +89,14 @@ void UrlPanel::setup()
searchLabel->setBuddy(search);
// setup tree view
- m_treeView->setUniformRowHeights(true);
- m_treeView->header()->hide();
+ _treeView->setUniformRowHeights(true);
+ _treeView->header()->hide();
// put everything together
QVBoxLayout *vBoxLayout = new QVBoxLayout;
vBoxLayout->setContentsMargins(0, 0, 0, 0);
vBoxLayout->addLayout(searchLayout);
- vBoxLayout->addWidget(m_treeView);
+ vBoxLayout->addWidget(_treeView);
// add it to the UI
ui->setLayout(vBoxLayout);
@@ -104,11 +105,11 @@ void UrlPanel::setup()
QAbstractItemModel *model = getModel();
UrlFilterProxyModel *proxy = new UrlFilterProxyModel(this);
proxy->setSourceModel(model);
- m_treeView->setModel(proxy);
+ _treeView->setModel(proxy);
connect(search, SIGNAL(textChanged(QString)), proxy, SLOT(setFilterFixedString(QString)));
- connect(m_treeView, SIGNAL(contextMenuItemRequested(const QPoint &)), this, SLOT(contextMenuItem(const QPoint &)));
- connect(m_treeView, SIGNAL(contextMenuGroupRequested(const QPoint &)), this, SLOT(contextMenuGroup(const QPoint &)));
- connect(m_treeView, SIGNAL(contextMenuEmptyRequested(const QPoint &)), this, SLOT(contextMenuEmpty(const QPoint &)));
+ connect(_treeView, SIGNAL(contextMenuItemRequested(const QPoint &)), this, SLOT(contextMenuItem(const QPoint &)));
+ connect(_treeView, SIGNAL(contextMenuGroupRequested(const QPoint &)), this, SLOT(contextMenuGroup(const QPoint &)));
+ connect(_treeView, SIGNAL(contextMenuEmptyRequested(const QPoint &)), this, SLOT(contextMenuEmpty(const QPoint &)));
}
diff --git a/src/urlpanel.h b/src/urlpanel.h
index b4ca2aa5..2bf1c3fe 100644
--- a/src/urlpanel.h
+++ b/src/urlpanel.h
@@ -49,26 +49,26 @@ public:
explicit UrlPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
virtual ~UrlPanel();
-public slots:
+ inline PanelTreeView *panelTreeView() const { return _treeView; };
+
+public Q_SLOTS:
void showing(bool);
-signals:
- void openUrl(const KUrl &, const Rekonq::OpenType &);
- void itemHovered(const QString &);
-
-protected slots:
+protected Q_SLOTS:
virtual void contextMenuItem(const QPoint &pos) = 0;
virtual void contextMenuGroup(const QPoint &pos) = 0;
virtual void contextMenuEmpty(const QPoint &pos) = 0;
protected:
virtual void setup();
-
virtual QAbstractItemModel* getModel() = 0;
- PanelTreeView *m_treeView;
+Q_SIGNALS:
+ void openUrl(const KUrl &, const Rekonq::OpenType &);
+ void itemHovered(const QString &);
private:
+ PanelTreeView *_treeView;
bool _loaded;
};