summaryrefslogtreecommitdiff
path: root/src/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/bookmarkowner.cpp2
-rw-r--r--src/bookmarks/bookmarkprovider.cpp14
-rw-r--r--src/bookmarks/bookmarkprovider.h56
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp23
4 files changed, 52 insertions, 43 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index 7861f0ac..862a7de4 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -38,7 +38,9 @@
#include "mainview.h"
// KDE Includes
+#include <KAction>
#include <KBookmarkDialog>
+#include <KLocalizedString>
#include <KMessageBox>
// Qt Includes
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp
index 03a3cc70..133cd4b8 100644
--- a/src/bookmarks/bookmarkprovider.cpp
+++ b/src/bookmarks/bookmarkprovider.cpp
@@ -50,7 +50,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
, m_manager(0)
, m_owner(0)
, m_actionCollection(new KActionCollection(this))
- , _bookmarkActionMenu(0)
+ , m_bookmarkActionMenu(0)
{
kDebug() << "Loading Bookmarks Manager...";
@@ -164,13 +164,13 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
kDebug() << "new Bookmarks Menu...";
KMenu *menu = new KMenu(parent);
- _bookmarkActionMenu = new KActionMenu(parent);
- _bookmarkActionMenu->setMenu(menu);
- _bookmarkActionMenu->setText(i18n("&Bookmarks"));
+ m_bookmarkActionMenu = new KActionMenu(parent);
+ m_bookmarkActionMenu->setMenu(menu);
+ m_bookmarkActionMenu->setText(i18n("&Bookmarks"));
new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection);
kDebug() << "new Bookmarks Menu...DONE";
- return _bookmarkActionMenu;
+ return m_bookmarkActionMenu;
}
@@ -215,7 +215,7 @@ KBookmarkGroup BookmarkProvider::rootGroup()
}
-QList<KBookmark> BookmarkProvider::find(QString text)
+QList<KBookmark> BookmarkProvider::find(const QString &text)
{
QList<KBookmark> list;
KBookmarkGroup bookGroup = Application::bookmarkProvider()->rootGroup();
@@ -235,7 +235,7 @@ QList<KBookmark> BookmarkProvider::find(QString text)
}
-QList<KBookmark> BookmarkProvider::find(QList<KBookmark> list, const KBookmark &bookmark, QString text)
+QList<KBookmark> BookmarkProvider::find(QList<KBookmark> list, const KBookmark &bookmark, const QString &text)
{
if (bookmark.isGroup())
{
diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h
index 0c2b9ee2..2630910c 100644
--- a/src/bookmarks/bookmarkprovider.h
+++ b/src/bookmarks/bookmarkprovider.h
@@ -27,30 +27,38 @@
* ============================================================ */
-#ifndef BOOKMARKS_H
-#define BOOKMARKS_H
+#ifndef BOOKMARKPROVIDER_H
+#define BOOKMARKPROVIDER_H
// Rekonq Includes
#include "rekonq_defines.h"
-// KDE Includes
-#include <KBookmarkMenu>
-#include <KToolBar>
+// Qt Includes
+#include <QObject>
// Forward Declarations
class BookmarksPanel;
class BookmarkToolBar;
class BookmarkOwner;
+class KAction;
+class KActionCollection;
+class KActionMenu;
+class KBookmark;
+class KBookmarkGroup;
+class KBookmarkManager;
+class KToolBar;
+class KUrl;
+
+class QAction;
+class QPoint;
/**
* This class represent the interface to rekonq bookmarks system.
* All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided
* from this class.
- * So it implements code to have each one
- *
- *
+ * So it implements code to have each one.
*/
class BookmarkProvider : public QObject
{
@@ -60,11 +68,10 @@ public:
/**
* @short Class constructor.
* Connect BookmarksProvider with bookmarks source
- * (actually konqueror's bookmarks)
- * @param parent The MainWindow to provide bookmarks objects
- *
+ * (actually konqueror's bookmarks).
+ * @param parent The MainWindow to provide bookmarks objects.
*/
- BookmarkProvider(QObject* parent = 0);
+ BookmarkProvider(QObject *parent = 0);
~BookmarkProvider();
/**
@@ -72,14 +79,13 @@ public:
* @param the parent widget
* @return the Bookmarks Menu
*/
- KActionMenu *bookmarkActionMenu(QWidget *parent);
+ KActionMenu* bookmarkActionMenu(QWidget *parent);
/**
* @short set the Bookmarks Toolbar Action
*/
- void registerBookmarkBar(BookmarkToolBar *);
-
- void removeToolBar(BookmarkToolBar *);
+ void registerBookmarkBar(BookmarkToolBar *toolbar);
+ void removeToolBar(BookmarkToolBar *toolbar);
/**
* @short Get action by name
@@ -88,7 +94,7 @@ public:
* @param name Name of action you want to get
* @return It returns actions if one exists or empty object
*/
- QAction *actionByName(const QString &name);
+ QAction* actionByName(const QString &name);
/**
* returns Bookmark Manager root group
@@ -97,11 +103,11 @@ public:
*/
KBookmarkGroup rootGroup();
- inline KBookmarkManager *bookmarkManager() { return m_manager; }
+ inline KBookmarkManager* bookmarkManager() { return m_manager; }
- inline BookmarkOwner *bookmarkOwner() { return m_owner; }
+ inline BookmarkOwner* bookmarkOwner() { return m_owner; }
- QList<KBookmark> find(QString text);
+ QList<KBookmark> find(const QString &text);
void registerBookmarkPanel(BookmarksPanel *panel);
void removeBookmarkPanel(BookmarksPanel *panel);
@@ -111,8 +117,6 @@ public:
signals:
/**
* @short This signal is emitted when an url has to be loaded
- *
- * @param url the URL to load
*/
void openUrl(const KUrl &, const Rekonq::OpenType &);
@@ -140,7 +144,7 @@ private slots:
void slotPanelChanged();
private:
- QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
+ QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, const QString &text);
QString titleForBookmarkUrl(const KBookmark &bookmark, const QString &url);
KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
@@ -148,11 +152,11 @@ private:
KBookmarkManager *m_manager;
BookmarkOwner *m_owner;
KActionCollection *m_actionCollection;
- QList<BookmarkToolBar *> m_bookmarkToolBars;
+ QList<BookmarkToolBar*> m_bookmarkToolBars;
QList<BookmarksPanel*> m_bookmarkPanels;
- KActionMenu *_bookmarkActionMenu;
+ KActionMenu *m_bookmarkActionMenu;
};
-#endif
+#endif // BOOKMARKPROVIDER_H
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
index 14b9c734..ee19daf1 100644
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ b/src/bookmarks/bookmarkstreemodel.cpp
@@ -32,6 +32,10 @@
#include "application.h"
#include "bookmarkprovider.h"
+// KDE Includes
+#include <KBookmarkManager>
+#include <KLocalizedString>
+
// Qt Includes
#include <QtCore/QMimeData>
@@ -56,28 +60,27 @@ QVariant BtmItem::data(int role) const
if (role == Qt::DisplayRole)
return m_kbm.text();
+
if (role == Qt::DecorationRole)
return KIcon(m_kbm.icon());
+
if (role == Qt::UserRole)
return m_kbm.url();
+
if (role == Qt::ToolTipRole)
{
- QString tooltip = "";
-
- if (!m_kbm.fullText().isEmpty())
- {
- tooltip += m_kbm.fullText();
- }
+ QString tooltip = m_kbm.fullText();
if (m_kbm.isGroup())
- {
tooltip += i18ncp("%1=Number of items in bookmark folder", " (1 item)", " (%1 items)", childCount());
- }
- if (!m_kbm.url().url().isEmpty())
+
+ QString url = m_kbm.url().url();
+ if (!url.isEmpty())
{
if (!tooltip.isEmpty())
tooltip += '\n';
- tooltip += m_kbm.url().url();
+ tooltip += url;
}
+
return tooltip;
}