From bd32f05dab4832528e0c2304d722e5140ffd74e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Fri, 15 Oct 2010 21:03:42 +0200 Subject: BookmarkOwner clean-up and minor bug fixed --- src/bookmarks/bookmarkowner.cpp | 61 ++++++++++++++--------------------------- src/bookmarks/bookmarkowner.h | 53 ++++++++++++----------------------- 2 files changed, 38 insertions(+), 76 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 77af9b1f..820e01b5 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -34,16 +34,14 @@ // Local Includes #include "application.h" #include "bookmarkprovider.h" +#include "mainview.h" #include "mainwindow.h" #include "webtab.h" -#include "mainview.h" // KDE Includes -#include #include #include #include -#include "iconmanager.h" // Qt Includes #include @@ -109,12 +107,6 @@ QString BookmarkOwner::currentUrl() const } -bool BookmarkOwner::supportsTabs() const -{ - return true; -} - - QList< QPair > BookmarkOwner::currentBookmarkList() const { QList< QPair > bkList; @@ -138,13 +130,9 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark, Qt::KeyboardModifiers keyboardModifiers) { if (keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton) - { openBookmarkInNewTab(bookmark); - } else - { openBookmark(bookmark); - } } @@ -171,13 +159,6 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) } -void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark) -{ - if (bookmark.isGroup()) - openFolderinTabs(bookmark.toGroup()); -} - - void BookmarkOwner::openBookmark(const KBookmark &bookmark) { emit openUrl(bookmark.url(), Rekonq::CurrentTab); @@ -196,9 +177,14 @@ void BookmarkOwner::openBookmarkInNewWindow(const KBookmark &bookmark) } +void BookmarkOwner::openBookmarkFolder(const KBookmarkGroup &bookmark) +{ + openFolderinTabs(bookmark); +} + + KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark) { - KBookmark newBk; KBookmarkGroup parent; if (!bookmark.isNull()) @@ -207,16 +193,16 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark) parent = bookmark.toGroup(); else parent = bookmark.parentGroup(); - - newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl()) ); - parent.moveBookmark(newBk, bookmark); } else { parent = Application::bookmarkProvider()->rootGroup(); - newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl())); } + KBookmark newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl())); + if (!bookmark.isNull()) + parent.moveBookmark(newBk, bookmark); + m_manager->emitChanged(parent); return newBk; } @@ -225,7 +211,7 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark) KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark) { KBookmarkGroup newBk; - KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow()); + KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0); QString folderName = i18n("New folder"); if (!bookmark.isNull()) @@ -276,7 +262,7 @@ KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark) newBk = Application::bookmarkProvider()->rootGroup().createNewSeparator(); } - newBk.setIcon(("edit-clear")); + newBk.setIcon("edit-clear"); m_manager->emitChanged(newBk.parentGroup()); return newBk; @@ -298,8 +284,7 @@ void BookmarkOwner::editBookmark(KBookmark bookmark) return; bookmark.setFullText(bookmark.fullText().replace("&&", "&")); - KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow()); - + KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0); dialog->editBookmark(bookmark); bookmark.setFullText(bookmark.fullText().replace('&', "&&")); @@ -307,7 +292,7 @@ void BookmarkOwner::editBookmark(KBookmark bookmark) } -bool BookmarkOwner::deleteBookmark(KBookmark bookmark) +bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark) { if (bookmark.isNull()) return false; @@ -333,7 +318,7 @@ bool BookmarkOwner::deleteBookmark(KBookmark bookmark) } if (KMessageBox::warningContinueCancel( - QApplication::activeWindow(), + 0, dialogText, dialogCaption, KStandardGuiItem::del(), @@ -349,9 +334,9 @@ bool BookmarkOwner::deleteBookmark(KBookmark bookmark) } -KAction* BookmarkOwner::createAction(const QString &text, - const QString &icon, const QString &help, const char *slot, - const KBookmark & bookmark) +KAction* BookmarkOwner::createAction(const QString &text, const QString &icon, + const QString &help, const char *slot, + const KBookmark &bookmark) { CustomBookmarkAction *act = new CustomBookmarkAction(bookmark, KIcon(icon), text, this); act->setHelpText(help); @@ -364,16 +349,12 @@ KAction* BookmarkOwner::createAction(const QString &text, CustomBookmarkAction::CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent) - : KAction(icon, text, parent) - , m_bookmark(bookmark) + : KAction(icon, text, parent) + , m_bookmark(bookmark) { connect(this, SIGNAL(triggered()), this, SLOT(onActionTriggered())); } -CustomBookmarkAction::~CustomBookmarkAction() -{ -} - void CustomBookmarkAction::onActionTriggered() { emit triggered(m_bookmark); diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h index 573e4ee0..cbd4bd0e 100644 --- a/src/bookmarks/bookmarkowner.h +++ b/src/bookmarks/bookmarkowner.h @@ -35,14 +35,12 @@ #include "rekonq_defines.h" // KDE Includes -#include -#include #include +#include /** - * Reimplementation of KBookmarkOwner, this class allows to manage - * bookmarks as actions. + * This class allows to manage bookmarks as actions. */ class REKONQ_TESTS_EXPORT BookmarkOwner : public QObject, public KBookmarkOwner { @@ -72,56 +70,40 @@ public: */ KAction* action(const KBookmark &bookmark, const BookmarkAction &bmAction); + // @{ /** - * @return the current page's title. + * Funtions to get current information. */ virtual QString currentTitle() const; - /** - * @return the current page's URL. - */ virtual QString currentUrl() const; - - /** - * @return whether the owner supports tabs. - */ - virtual bool supportsTabs() const; - - /** - * @return list of title, URL pairs of the open tabs. - */ virtual QList< QPair > currentBookmarkList() const; + // @} + + virtual bool supportsTabs() const {return true;} + // @{ /** - * This function is called when a bookmark is selected and belongs to - * the ancestor class. - * This method actually emits signal to load bookmark's url. - * - * @param bookmark the bookmark to open - * @param mouseButtons the mouse buttons clicked to select the bookmark - * @param keyboardModifiers the keyboard modifiers pushed when the bookmark was selected + * This functions emit signals that open the selected URLs */ virtual void openBookmark(const KBookmark &bookmark, Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers); - - /** - * Called if the user wants to open every bookmark in this folder in a new tab. - * The default implementation does nothing. - * This is only called if supportsTabs() returns true - */ virtual void openFolderinTabs(const KBookmarkGroup &bookmark); + // @} public Q_SLOTS: void openBookmark(const KBookmark &bookmark); void openBookmarkInNewTab(const KBookmark &bookmark); void openBookmarkInNewWindow(const KBookmark &bookmark); - void openBookmarkFolder(const KBookmark &bookmark); + void openBookmarkFolder(const KBookmarkGroup &bookmark); + KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark()); KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark()); KBookmark newSeparator(const KBookmark &bookmark = KBookmark()); + void copyLink(const KBookmark &bookmark); void editBookmark(KBookmark bookmark); - bool deleteBookmark(KBookmark bookmark); + bool deleteBookmark(const KBookmark &bookmark); Q_SIGNALS: /** @@ -132,10 +114,9 @@ Q_SIGNALS: private: KAction* createAction(const QString &text, const QString &icon, - const QString &help, const char *slot, - const KBookmark &bookmark); + const QString &help, const char *slot, + const KBookmark &bookmark); - KBookmarkManager *m_manager; }; @@ -149,7 +130,7 @@ class CustomBookmarkAction : public KAction public: CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent); - ~CustomBookmarkAction(); + virtual ~CustomBookmarkAction() {} Q_SIGNALS: void triggered(const KBookmark &); -- cgit v1.2.1 From a385a9c1d6c91c5c3fbf8615934952df985d3c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Sat, 16 Oct 2010 15:40:17 +0200 Subject: Function renamed --- src/bookmarks/bookmarkowner.cpp | 2 +- src/bookmarks/bookmarkowner.h | 4 ++-- src/bookmarks/bookmarkscontextmenu.cpp | 42 +++++++++++++++++----------------- src/bookmarks/bookmarkstoolbar.cpp | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 820e01b5..962d1c84 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -55,7 +55,7 @@ BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent) } -KAction* BookmarkOwner::action(const KBookmark &bookmark, const BookmarkAction &bmAction) +KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAction &bmAction) { switch (bmAction) { diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h index cbd4bd0e..c291bf2a 100644 --- a/src/bookmarks/bookmarkowner.h +++ b/src/bookmarks/bookmarkowner.h @@ -66,9 +66,9 @@ public: }; /** - * @return the action connected to the bookmark or 0 if it doesn't exist. + * @return A new action for the given bookmark. */ - KAction* action(const KBookmark &bookmark, const BookmarkAction &bmAction); + KAction* createAction(const KBookmark &bookmark, const BookmarkAction &bmAction); // @{ /** diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp index 93df6ce3..6e6fa830 100644 --- a/src/bookmarks/bookmarkscontextmenu.cpp +++ b/src/bookmarks/bookmarkscontextmenu.cpp @@ -45,23 +45,23 @@ BookmarksContextMenu::~BookmarksContextMenu() void BookmarksContextMenu::addBookmarkActions() { - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_IN_TAB)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_IN_WINDOW)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_IN_TAB)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_IN_WINDOW)); addSeparator(); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR)); addSeparator(); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::COPY)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::COPY)); addSeparator(); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::EDIT)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE)); } @@ -80,39 +80,39 @@ void BookmarksContextMenu::addFolderActions() if (!child.isNull()) { - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::OPEN_FOLDER)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_FOLDER)); addSeparator(); } } - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR)); addSeparator(); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::EDIT)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE)); } void BookmarksContextMenu::addSeparatorActions() { - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR)); addSeparator(); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::DELETE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE)); } void BookmarksContextMenu::addNullActions() { - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_FOLDER)); - addAction(m_bmOwner->action(bookmark(), BookmarkOwner::NEW_SEPARATOR)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER)); + addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR)); } diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 4449d926..c5ece026 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -139,7 +139,7 @@ void BookmarkMenu::addOpenFolderInTabs() if (!bookmark.isNull()) { - parentMenu()->addAction(Application::bookmarkProvider()->bookmarkOwner()->action(group, BookmarkOwner::OPEN_FOLDER)); + parentMenu()->addAction(Application::bookmarkProvider()->bookmarkOwner()->createAction(group, BookmarkOwner::OPEN_FOLDER)); } } } -- cgit v1.2.1 From 4ba9903ccb5982d7d49b37850fffd47dc3e5da40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Fri, 22 Oct 2010 19:21:11 +0200 Subject: BookmarksPanel API improved --- src/bookmarks/bookmarkprovider.cpp | 12 ++++----- src/bookmarks/bookmarkspanel.cpp | 55 +++++++++++++------------------------- src/bookmarks/bookmarkspanel.h | 21 ++++++++------- 3 files changed, 36 insertions(+), 52 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index ccdc3269..0924ae30 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -55,13 +55,13 @@ BookmarkProvider::BookmarkProvider(QObject *parent) kDebug() << "Loading Bookmarks Manager..."; // NOTE - // This hackish code is needed to continue sharing bookmarks with konqueror, + // This hackish code is needed to continue sharing bookmarks with konqueror, // until we can (hopefully) start using an akonadi resource. // // The cleanest code has a subdole bug inside does not allowing people to start // using rekonq and then using konqueror. So if konqueror bk file has not just been created, // bk are stored in rekonq dir and then they will be lost when you start using konqi - + KUrl bookfile = KUrl("~/.kde/share/apps/konqueror/bookmarks.xml"); // share konqueror bookmarks if (!QFile::exists(bookfile.path())) { @@ -79,7 +79,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent) m_manager = KBookmarkManager::managerForFile(bookfile.path(), "rekonq"); m_manager->setEditorOptions("", true); - + connect(m_manager, SIGNAL(changed(const QString &, const QString &)), this, SLOT(slotBookmarksChanged())); @@ -112,7 +112,7 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent) bookmarkActionMenu->setText(i18n("&Bookmarks")); BookmarkMenu *bMenu = new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); m_bookmarkMenus.append(bMenu); - + kDebug() << "new Bookmarks menu... DONE"; return bookmarkActionMenu; @@ -226,7 +226,7 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar) menuAction->setDelayed(false); BookmarkMenu *bMenu = new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address()); m_bookmarkMenus.append(bMenu); - + connect(menuAction->menu(), SIGNAL(aboutToShow()), toolBar, SLOT(menuDisplayed())); connect(menuAction->menu(), SIGNAL(aboutToHide()), toolBar, SLOT(menuHidden())); @@ -254,7 +254,7 @@ void BookmarkProvider::slotPanelChanged() foreach (BookmarksPanel *panel, m_bookmarkPanels) { if (panel && panel != sender()) - panel->startLoadFoldedState(); + panel->loadFoldedState(); } } diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index f732cb22..1763a1e5 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -51,7 +51,7 @@ BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::Window setVisible(ReKonfig::showBookmarksPanel()); panelTreeView()->setDragEnabled(true); panelTreeView()->setAcceptDrops(true); - connect(_bkTreeModel, SIGNAL(bookmarksUpdated()), this, SLOT(startLoadFoldedState())); + connect(_bkTreeModel, SIGNAL(bookmarksUpdated()), this, SLOT(loadFoldedState())); } @@ -61,7 +61,7 @@ BookmarksPanel::~BookmarksPanel() } -void BookmarksPanel::startLoadFoldedState() +void BookmarksPanel::loadFoldedState() { _loadingState = true; loadFoldedState(QModelIndex()); @@ -76,32 +76,13 @@ void BookmarksPanel::contextMenu(const QPoint &pos) BookmarksContextMenu menu(bookmarkForIndex( panelTreeView()->indexAt(pos) ), Application::bookmarkProvider()->bookmarkManager(), - Application::bookmarkProvider()->bookmarkOwner(), - this + Application::bookmarkProvider()->bookmarkOwner() ); menu.exec(panelTreeView()->mapToGlobal(pos)); } -void BookmarksPanel::contextMenuItem(const QPoint &pos) -{ - contextMenu(pos); -} - - -void BookmarksPanel::contextMenuGroup(const QPoint &pos) -{ - contextMenu(pos); -} - - -void BookmarksPanel::contextMenuEmpty(const QPoint &pos) -{ - contextMenu(pos); -} - - void BookmarksPanel::deleteBookmark() { QModelIndex index = panelTreeView()->currentIndex(); @@ -132,12 +113,25 @@ void BookmarksPanel::onExpand(const QModelIndex &index) } +void BookmarksPanel::setup() +{ + UrlPanel::setup(); + kDebug() << "Bookmarks panel..."; + + 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 &))); + + loadFoldedState(); +} + + void BookmarksPanel::loadFoldedState(const QModelIndex &root) { QAbstractItemModel *model = panelTreeView()->model(); if(!model) return; - + int count = model->rowCount(root); QModelIndex index; @@ -157,19 +151,6 @@ void BookmarksPanel::loadFoldedState(const QModelIndex &root) } -void BookmarksPanel::setup() -{ - UrlPanel::setup(); - kDebug() << "Bookmarks panel..."; - - 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(); -} - - KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index) { if (!index.isValid()) @@ -183,7 +164,7 @@ KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index) } -QAbstractItemModel* BookmarksPanel::getModel() +QAbstractItemModel* BookmarksPanel::model() { return _bkTreeModel; } diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h index f042d4c8..be797502 100644 --- a/src/bookmarks/bookmarkspanel.h +++ b/src/bookmarks/bookmarkspanel.h @@ -52,27 +52,30 @@ public: virtual ~BookmarksPanel(); public Q_SLOTS: - void startLoadFoldedState(); + void loadFoldedState(); + +Q_SIGNALS: + void expansionChanged(); private Q_SLOTS: void contextMenu(const QPoint &pos); - virtual void contextMenuItem(const QPoint &pos); - virtual void contextMenuGroup(const QPoint &pos); - virtual void contextMenuEmpty(const QPoint &pos); + + virtual void contextMenuItem (const QPoint &pos) {contextMenu(pos);} + virtual void contextMenuGroup (const QPoint &pos) {contextMenu(pos);} + virtual void contextMenuEmpty (const QPoint &pos) {contextMenu(pos);} void deleteBookmark(); void onCollapse(const QModelIndex &index); void onExpand(const QModelIndex &index); - void loadFoldedState(const QModelIndex &root); - -Q_SIGNALS: - void expansionChanged(); private: virtual void setup(); + + void loadFoldedState(const QModelIndex &root); + KBookmark bookmarkForIndex(const QModelIndex &index); - virtual QAbstractItemModel* getModel(); + virtual QAbstractItemModel* model(); BookmarksTreeModel *_bkTreeModel; bool _loadingState; -- cgit v1.2.1 From 02e34bd07cb049638ac3900056c891faca2ebccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Fri, 22 Oct 2010 19:23:41 +0200 Subject: BookmarksContextMenu's destructor moved to the header file --- src/bookmarks/bookmarkscontextmenu.cpp | 5 ----- src/bookmarks/bookmarkscontextmenu.h | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp index 6e6fa830..a55f7777 100644 --- a/src/bookmarks/bookmarkscontextmenu.cpp +++ b/src/bookmarks/bookmarkscontextmenu.cpp @@ -38,11 +38,6 @@ BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkM } -BookmarksContextMenu::~BookmarksContextMenu() -{ -} - - void BookmarksContextMenu::addBookmarkActions() { addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_IN_TAB)); diff --git a/src/bookmarks/bookmarkscontextmenu.h b/src/bookmarks/bookmarkscontextmenu.h index d669eef6..f2b7c502 100644 --- a/src/bookmarks/bookmarkscontextmenu.h +++ b/src/bookmarks/bookmarkscontextmenu.h @@ -37,7 +37,7 @@ class BookmarksContextMenu : public KBookmarkContextMenu { public: BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent = 0); - virtual ~BookmarksContextMenu(); + virtual ~BookmarksContextMenu() {} virtual void addActions(); -- cgit v1.2.1 From 4323f070444d0d0bcdb96ea1c21e77a921db63e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Sun, 7 Nov 2010 11:33:54 +0100 Subject: Variable renamed --- src/bookmarks/bookmarkowner.cpp | 4 ++-- src/bookmarks/bookmarkowner.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 962d1c84..038a2bba 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -136,9 +136,9 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark, } -void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) +void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup) { - QList urlList = bookmark.groupUrlList(); + QList urlList = bkGoup.groupUrlList(); if (urlList.length() > 8) { diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h index c291bf2a..4d377191 100644 --- a/src/bookmarks/bookmarkowner.h +++ b/src/bookmarks/bookmarkowner.h @@ -88,7 +88,7 @@ public: virtual void openBookmark(const KBookmark &bookmark, Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers); - virtual void openFolderinTabs(const KBookmarkGroup &bookmark); + virtual void openFolderinTabs(const KBookmarkGroup &bkGoup); // @} public Q_SLOTS: -- cgit v1.2.1 From f55423c33944002c16a57c05d5be520c465ed4cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Sun, 7 Nov 2010 11:36:11 +0100 Subject: Bug when a bookmark contains a '&' fixed in some cases --- src/bookmarks/bookmarkowner.cpp | 9 +++------ src/bookmarks/bookmarkprovider.cpp | 3 ++- src/bookmarks/bookmarkstoolbar.cpp | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 038a2bba..c684897e 100644 --- a/src/bookmarks/bookmarkowner.cpp +++ b/src/bookmarks/bookmarkowner.cpp @@ -199,7 +199,7 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark) parent = Application::bookmarkProvider()->rootGroup(); } - KBookmark newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl())); + KBookmark newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl())); if (!bookmark.isNull()) parent.moveBookmark(newBk, bookmark); @@ -283,10 +283,8 @@ void BookmarkOwner::editBookmark(KBookmark bookmark) if (bookmark.isNull()) return; - bookmark.setFullText(bookmark.fullText().replace("&&", "&")); KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0); dialog->editBookmark(bookmark); - bookmark.setFullText(bookmark.fullText().replace('&', "&&")); delete dialog; } @@ -298,13 +296,12 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark) return false; KBookmarkGroup bmg = bookmark.parentGroup(); - QString name = QString(bookmark.fullText()).replace("&&", "&"); QString dialogCaption, dialogText; if (bookmark.isGroup()) { dialogCaption = i18n("Bookmark Folder Deletion"); - dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name); + dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bookmark.fullText()); } else if (bookmark.isSeparator()) { @@ -314,7 +311,7 @@ bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark) else { dialogCaption = i18n("Bookmark Deletion"); - dialogText = i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name); + dialogText = i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bookmark.fullText()); } if (KMessageBox::warningContinueCancel( diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index 0924ae30..fe038b2a 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -239,7 +239,8 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar) else { KBookmarkAction *action = new KBookmarkAction(bookmark, m_owner, this); - action->setIconText(action->iconText().replace('&', "&&")); + //action->s + //action->setIconText(action->iconText().replace('&', "&&&")); action->setIcon(Application::iconManager()->iconForUrl( KUrl(bookmark.url()) )); connect(action, SIGNAL(hovered()), toolBar, SLOT(actionHovered())); toolBar->toolBar()->addAction(action); diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index c5ece026..ae5c9d6e 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -169,6 +169,7 @@ BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent) connect(Application::bookmarkProvider()->bookmarkManager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu())); toolBar->setAcceptDrops(true); toolBar->installEventFilter(this); + toolBar->setShortcutEnabled(false); if (toolBar->isVisible()) { -- cgit v1.2.1