diff options
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 1 | ||||
-rw-r--r-- | src/bookmarks/bookmarkowner.h | 27 | ||||
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 1 | ||||
-rw-r--r-- | src/bookmarks/bookmarkprovider.h | 18 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 37 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.h | 15 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 1 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.h | 13 |
8 files changed, 60 insertions, 53 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 530ad199..f1d4df1f 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 e0c2a8ad..795ccbf0 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 openBookmark(const KBookmark &bookmark = KBookmark()); @@ -132,16 +126,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 f5021916..ccf60641 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -29,6 +29,7 @@ // Self Includes #include "bookmarkprovider.h" +#include "bookmarkprovider.moc" // Local Includes #include "application.h" diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h index 36724d75..6f2d8b8e 100644 --- a/src/bookmarks/bookmarkprovider.h +++ b/src/bookmarks/bookmarkprovider.h @@ -114,14 +114,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,13 +126,18 @@ public slots: void slotBookmarksChanged(const QString &groupAddress, const QString &caller); void fillBookmarkBar(BookmarkToolBar *toolBar); -private slots: +private Q_SLOTS: void slotAddBookmark(); 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 d082b557..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,12 +44,12 @@ BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags) : UrlPanel(title, parent, flags) - , model(new BookmarksTreeModel(this)) - , m_loadingState(false) + , _bkTreeModel(new BookmarksTreeModel(this)) + , _loadingState(false) { setObjectName("bookmarksPanel"); setVisible(ReKonfig::showBookmarksPanel()); - connect(model, SIGNAL(bookmarksUpdated()), this, SLOT(startLoadFoldedState())); + connect(_bkTreeModel, SIGNAL(bookmarksUpdated()), this, SLOT(startLoadFoldedState())); } @@ -60,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)); } @@ -101,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)); @@ -111,7 +112,7 @@ void BookmarksPanel::deleteBookmark() void BookmarksPanel::onCollapse(const QModelIndex &index) { - if (m_loadingState) + if (_loadingState) return; bookmarkForIndex(index).internalElement().setAttribute("folded", "yes"); @@ -121,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"); @@ -131,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; @@ -143,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); } } @@ -156,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(); } @@ -179,5 +180,5 @@ KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index) QAbstractItemModel* BookmarksPanel::getModel() { - return model; + return _bkTreeModel; } diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h index 6ee2dc85..f042d4c8 100644 --- a/src/bookmarks/bookmarkspanel.h +++ b/src/bookmarks/bookmarkspanel.h @@ -42,6 +42,7 @@ class BookmarksTreeModel; class KBookmark; class QModelIndex; + class REKONQ_TESTS_EXPORT BookmarksPanel : public UrlPanel { Q_OBJECT @@ -50,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); @@ -67,14 +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(); - BookmarksTreeModel *model; - bool m_loadingState; + BookmarksTreeModel *_bkTreeModel; + bool _loadingState; }; #endif // BOOKMARKSPANEL_H diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 254a914f..7a1193e4 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 |