diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-11-07 22:33:11 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-11-07 22:33:11 +0100 |
commit | 4bb3ca9452cb165d8ca8da5e3fc5bcfe1b9cfd1a (patch) | |
tree | 151d078b89a94ea10142c0979db8306119ad6865 /src | |
parent | Let suggestions work also without search engines ones. (diff) | |
parent | Bug when a bookmark contains a '&' fixed in some cases (diff) | |
download | rekonq-4bb3ca9452cb165d8ca8da5e3fc5bcfe1b9cfd1a.tar.xz |
Merge branch 'master' of git.kde.org:rekonq
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/bookmarkowner.cpp | 74 | ||||
-rw-r--r-- | src/bookmarks/bookmarkowner.h | 59 | ||||
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 15 | ||||
-rw-r--r-- | src/bookmarks/bookmarkscontextmenu.cpp | 47 | ||||
-rw-r--r-- | src/bookmarks/bookmarkscontextmenu.h | 2 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 55 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.h | 21 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstoolbar.cpp | 3 | ||||
-rw-r--r-- | src/history/historypanel.cpp | 2 | ||||
-rw-r--r-- | src/history/historypanel.h | 2 | ||||
-rw-r--r-- | src/urlpanel.cpp | 3 | ||||
-rw-r--r-- | src/urlpanel.h | 2 |
12 files changed, 112 insertions, 173 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp index 77af9b1f..c684897e 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 <KAction> #include <KBookmarkDialog> #include <KLocalizedString> #include <KMessageBox> -#include "iconmanager.h" // Qt Includes #include <QtGui/QClipboard> @@ -57,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) { @@ -109,12 +107,6 @@ QString BookmarkOwner::currentUrl() const } -bool BookmarkOwner::supportsTabs() const -{ - return true; -} - - QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const { QList< QPair<QString, QString> > bkList; @@ -138,19 +130,15 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark, Qt::KeyboardModifiers keyboardModifiers) { if (keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton) - { openBookmarkInNewTab(bookmark); - } else - { openBookmark(bookmark); - } } -void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) +void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup) { - QList<KUrl> urlList = bookmark.groupUrlList(); + QList<KUrl> urlList = bkGoup.groupUrlList(); if (urlList.length() > 8) { @@ -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(), 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; @@ -297,29 +283,25 @@ void BookmarkOwner::editBookmark(KBookmark bookmark) if (bookmark.isNull()) 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('&', "&&")); delete dialog; } -bool BookmarkOwner::deleteBookmark(KBookmark bookmark) +bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark) { if (bookmark.isNull()) 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()) { @@ -329,11 +311,11 @@ bool BookmarkOwner::deleteBookmark(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( - QApplication::activeWindow(), + 0, dialogText, dialogCaption, KStandardGuiItem::del(), @@ -349,9 +331,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 +346,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..4d377191 100644 --- a/src/bookmarks/bookmarkowner.h +++ b/src/bookmarks/bookmarkowner.h @@ -35,14 +35,12 @@ #include "rekonq_defines.h" // KDE Includes -#include <KBookmarkOwner> -#include <KIcon> #include <KAction> +#include <KBookmarkOwner> /** - * 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 { @@ -68,60 +66,44 @@ 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); + // @{ /** - * @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<QString, QString> > 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); + virtual void openFolderinTabs(const KBookmarkGroup &bkGoup); + // @} 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 &); diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index ccdc3269..fe038b2a 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())); @@ -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); @@ -254,7 +255,7 @@ void BookmarkProvider::slotPanelChanged() foreach (BookmarksPanel *panel, m_bookmarkPanels) { if (panel && panel != sender()) - panel->startLoadFoldedState(); + panel->loadFoldedState(); } } diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp index 93df6ce3..a55f7777 100644 --- a/src/bookmarks/bookmarkscontextmenu.cpp +++ b/src/bookmarks/bookmarkscontextmenu.cpp @@ -38,30 +38,25 @@ BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkM } -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 +75,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/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(); 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; diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 4449d926..ae5c9d6e 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)); } } } @@ -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()) { diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index 28f7f4ee..d1b02c42 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -144,7 +144,7 @@ void HistoryPanel::setup() } -QAbstractItemModel* HistoryPanel::getModel() +QAbstractItemModel* HistoryPanel::model() { return Application::historyManager()->historyTreeModel(); } diff --git a/src/history/historypanel.h b/src/history/historypanel.h index 0a5ae216..00aca4a9 100644 --- a/src/history/historypanel.h +++ b/src/history/historypanel.h @@ -53,7 +53,7 @@ private Q_SLOTS: private: virtual void setup(); - virtual QAbstractItemModel* getModel(); + virtual QAbstractItemModel* model(); }; #endif // HISTORYPANEL_H diff --git a/src/urlpanel.cpp b/src/urlpanel.cpp index b3e8b2f3..d7ddd896 100644 --- a/src/urlpanel.cpp +++ b/src/urlpanel.cpp @@ -94,9 +94,8 @@ void UrlPanel::setup() ui->setLayout(vBoxLayout); setWidget(ui); - QAbstractItemModel *model = getModel(); UrlFilterProxyModel *proxy = new UrlFilterProxyModel(this); - proxy->setSourceModel(model); + proxy->setSourceModel(model()); _treeView->setModel(proxy); connect(search, SIGNAL(textChanged(QString)), proxy, SLOT(setFilterFixedString(QString))); diff --git a/src/urlpanel.h b/src/urlpanel.h index 722eeae0..42ff85fa 100644 --- a/src/urlpanel.h +++ b/src/urlpanel.h @@ -58,7 +58,7 @@ public Q_SLOTS: protected: virtual void setup(); - virtual QAbstractItemModel* getModel() = 0; + virtual QAbstractItemModel* model() = 0; PanelTreeView* panelTreeView() const {return _treeView;} |