summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkowner.cpp1
-rw-r--r--src/bookmarks/bookmarkowner.h27
-rw-r--r--src/bookmarks/bookmarkprovider.cpp3
-rw-r--r--src/bookmarks/bookmarkprovider.h19
-rw-r--r--src/bookmarks/bookmarkspanel.cpp37
-rw-r--r--src/bookmarks/bookmarkspanel.h16
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp1
-rw-r--r--src/bookmarks/bookmarkstreemodel.h13
8 files changed, 64 insertions, 53 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index 2d840f56..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"
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index 5bc46e63..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,14 +112,7 @@ 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();
@@ -133,16 +127,23 @@ public slots:
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 6736f0d7..8089fb6d 100644
--- a/src/bookmarks/bookmarkprovider.cpp
+++ b/src/bookmarks/bookmarkprovider.cpp
@@ -29,13 +29,14 @@
// 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>
+#include "iconmanager.h"
// KDE Includes
#include <KActionCollection>
diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h
index 2f2b7abe..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
@@ -133,12 +127,17 @@ public slots:
void slotBookmarksChanged();
void fillBookmarkBar(BookmarkToolBar *toolBar);
-private slots:
+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/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/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 4e85c422..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"
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