summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarksmanager.cpp180
-rw-r--r--src/bookmarks/bookmarksmanager.h36
-rw-r--r--src/data/rekonq.desktop2
-rw-r--r--src/mainview.cpp2
-rw-r--r--src/mainwindow.cpp1
-rw-r--r--src/urlbar/urlbar.cpp1
-rw-r--r--src/webtab.cpp16
7 files changed, 132 insertions, 106 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 7e933599..df6bc54b 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -94,9 +94,9 @@ QString BookmarkOwner::currentTitle() const
}
-void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm)
+void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark)
{
- QList<KUrl> urlList = bm.groupUrlList();
+ QList<KUrl> urlList = bookmark.groupUrlList();
if(urlList.length() > 8)
{
@@ -107,7 +107,7 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bm)
QList<KUrl>::iterator url;
for (url = urlList.begin(); url != urlList.end(); ++url)
{
- Application::instance()->loadUrl(*url, Rekonq::NewCurrentTab);
+ emit openUrl(*url, Rekonq::NewCurrentTab);
}
}
@@ -136,23 +136,35 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
KMenu *menu,
KActionCollection* actionCollection)
: KBookmarkMenu(manager, owner, menu, actionCollection)
-
{
KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
actionCollection->addAction(QLatin1String("rekonq_add_bookmark"),a);
+ refill();
+}
+
+
+BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
+ KBookmarkOwner *owner,
+ KMenu *parentMenu,
+ const QString &parentAddress)
+ : KBookmarkMenu(manager, owner, parentMenu, parentAddress)
+{
+ refill();
}
+
BookmarkMenu::~BookmarkMenu()
{
}
-KMenu *BookmarkMenu::viewContextMenu(QAction *action)
+KMenu * BookmarkMenu::contextMenu(QAction *act)
{
- KBookmarkActionInterface* act = dynamic_cast<KBookmarkActionInterface *>(action);
- if (!act)
+
+ KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
+ if (!action)
return 0;
- return new BookmarkContextMenu(act->bookmark(), manager(), owner());
+ return new BookmarkContextMenu(action->bookmark(), manager(), owner());
}
@@ -172,6 +184,76 @@ void BookmarkMenu::slotAddBookmark()
}
+QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
+{
+ if(bookmark.isGroup())
+ {
+ KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this);
+ new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address());
+ return actionMenu;
+ }
+ else if(bookmark.isSeparator())
+ {
+ return KBookmarkMenu::actionForBookmark(bookmark);
+ }
+ else
+ {
+ Application::bookmarkProvider()->completionObject()->addItem(bookmark.url().url());
+ return new KBookmarkAction( bookmark, owner(), this );
+ }
+}
+
+
+void BookmarkMenu::refill()
+{
+ fillBookmarks();
+
+ if(parentMenu()->actions().count() > 0)
+ parentMenu()->addSeparator();
+
+ if(isRoot())
+ {
+ addAddBookmark();
+ addAddBookmarksList();
+ addNewFolder();
+ addEditBookmarks();
+
+ }
+ else
+ {
+ addOpenFolderInTabs();
+ addAddBookmark();
+ addAddBookmarksList();
+ addNewFolder();
+ }
+}
+
+
+void BookmarkMenu::addOpenFolderInTabs()
+{
+ KAction *action;
+ KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();
+
+ if(!group.first().isNull())
+ {
+ KBookmark bookmark = group.first();
+
+ while(bookmark.isGroup() || bookmark.isSeparator())
+ {
+ bookmark = group.next(bookmark);
+ }
+
+ if(!bookmark.isNull())
+ {
+ action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
+ action->setHelpText( i18n( "Open all bookmarks in this folder as a new tab." ) );
+ connect(action, SIGNAL(triggered(bool)), this, SLOT(slotOpenFolderInTabs()));
+ parentMenu()->addAction(action);
+ }
+ }
+}
+
+
// ------------------------------------------------------------------------------------------------------
@@ -203,7 +285,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
bookfile = KUrl(bookmarksPath);
}
}
- // A workaround to avoid a long delay between the two changed signals of the bookmark manager
+
m_manager = KBookmarkManager::managerForFile(bookfile.path(), "rekonq");
connect(m_manager, SIGNAL(changed(const QString &, const QString &)),
@@ -227,7 +309,8 @@ BookmarkProvider::~BookmarkProvider()
void BookmarkProvider::setupBookmarkBar(KToolBar *toolbar)
{
KToolBar *bookmarkToolBar = toolbar;
- m_bookmarkToolBars.append(toolbar);
+ m_bookmarkToolBars.append(bookmarkToolBar);
+ bookmarkToolBar->setContextMenuPolicy(Qt::CustomContextMenu);
connect(bookmarkToolBar, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(contextMenu(const QPoint &)));
@@ -246,6 +329,8 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
Q_UNUSED(group)
Q_UNUSED(caller)
+ m_completion->clear();
+
foreach(KToolBar *bookmarkToolBar, m_bookmarkToolBars)
{
if (bookmarkToolBar)
@@ -255,7 +340,6 @@ void BookmarkProvider::slotBookmarksChanged(const QString &group, const QString
return;
bookmarkToolBar->clear();
- m_completion->clear();
KBookmark bookmark = toolBarGroup.first();
while (!bookmark.isNull())
@@ -286,11 +370,11 @@ void BookmarkProvider::contextMenu(const QPoint &point)
if(!bookmarkToolBar)
return;
- KAction* action = dynamic_cast<KAction*>(bookmarkToolBar->actionAt(point));
+ KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(bookmarkToolBar->actionAt(point));
if (!action)
return;
- KMenu *menu = m_bookmarkMenu->viewContextMenu(action);
+ KMenu *menu = new BookmarkContextMenu(action->bookmark(), bookmarkManager(), bookmarkOwner());
if (!menu)
return;
@@ -313,17 +397,10 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark)
{
if (bookmark.isGroup())
{
- KBookmarkGroup group = bookmark.toGroup();
- KBookmark bm = group.first();
- BookmarkActionMenu *menuAction = new BookmarkActionMenu(group, this);
-
- while (!bm.isNull())
- {
- menuAction->addAction(fillBookmarkBar(bm));
- bm = group.next(bm);
- }
+ KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this);
+ menuAction->setDelayed(false);
+ new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address());
- menuAction->addFolderActions();
return menuAction;
}
@@ -336,8 +413,7 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark)
return a;
}
else
- {
- m_completion->addItem(bookmark.url().url());
+ {
return new KBookmarkAction(bookmark, m_owner, this);
}
}
@@ -400,57 +476,3 @@ QString BookmarkProvider::titleForBookmarkUrl(const KBookmark &bookmark, QString
return title;
}
-
-
-// ----------------------------------------------------------------------------------------------
-
-
-BookmarkActionMenu::BookmarkActionMenu(const KBookmarkGroup &bm, QObject *parent)
- : KBookmarkActionMenu(bm, bm.text(), parent)
- , m_group(bm)
-{
- setIcon(KIcon(bm.icon()));
- setDelayed(false);
-}
-
-
-void BookmarkActionMenu::addFolderActions()
-{
- addSeparator();
- KAction *action;
-
- if(!m_group.first().isNull())
- {
- KBookmark bookmark = m_group.first();
-
- while(bookmark.isGroup() || bookmark.isSeparator())
- {
- bookmark = m_group.next(bookmark);
- }
-
- if(!bookmark.isNull())
- {
- action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(openActionInTabs()));
- addAction(action);
- }
- }
-
- action = new KAction(KIcon("bookmark-new"), i18n("Add Bookmark Here"), this);
- connect(action, SIGNAL(triggered(bool)), this, SLOT(bookmarkCurrentPage()));
- addAction(action);
-}
-
-
-void BookmarkActionMenu::bookmarkCurrentPage()
-{
- m_group.addBookmark(Application::bookmarkProvider()->bookmarkOwner()->currentTitle(), KUrl(Application::bookmarkProvider()->bookmarkOwner()->currentUrl()));
- Application::bookmarkProvider()->bookmarkManager()->emitChanged();
-}
-
-
-void BookmarkActionMenu::openActionInTabs()
-{
- if(!m_group.isNull())
- Application::bookmarkProvider()->bookmarkOwner()->openFolderinTabs(m_group);
-}
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 7fb02970..8d09e122 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -113,7 +113,7 @@ public:
* The default implementation does nothing.
* This is only called if supportsTabs() returns true
*/
- virtual void openFolderinTabs(const KBookmarkGroup &bm);
+ virtual void openFolderinTabs(const KBookmarkGroup &bookmark);
virtual QList< QPair<QString, QString> > currentBookmarkList() const;
@@ -133,7 +133,6 @@ signals:
// KDE Includes
#include <KBookmarkMenu>
-
/**
* This class represent the rekonq bookmarks menu.
* It's just a simple class inherited from KBookmarkMenu
@@ -148,13 +147,23 @@ public:
KBookmarkOwner* owner,
KMenu* menu,
KActionCollection* actionCollection);
+ BookmarkMenu(KBookmarkManager *manager,
+ KBookmarkOwner *owner,
+ KMenu *parentMenu,
+ const QString &parentAddress);
~BookmarkMenu();
- virtual KMenu *viewContextMenu(QAction* action);
+protected:
+ virtual KMenu * contextMenu(QAction * act);
+ virtual void refill();
+ virtual QAction* actionForBookmark(const KBookmark &bookmark);
protected slots:
void slotAddBookmark();
+private:
+ void addOpenFolderInTabs();
+
};
@@ -265,25 +274,4 @@ private:
};
-// ------------------------------------------------------------------------------------------
-
-
-class BookmarkActionMenu : public KBookmarkActionMenu
-{
- Q_OBJECT
-
-public:
- BookmarkActionMenu (const KBookmarkGroup &bm, QObject *parent);
- void addFolderActions();
-
-private slots:
- void openActionInTabs();
- void bookmarkCurrentPage();
-
-private:
- KBookmarkGroup m_group;
-
-};
-
-
#endif
diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop
index df564c47..b0f8f2e3 100644
--- a/src/data/rekonq.desktop
+++ b/src/data/rekonq.desktop
@@ -5,6 +5,7 @@ Name[da]=rekonq
Name[de]=rekonq
Name[en_GB]=rekonq
Name[es]=rekonq
+Name[fr]=rekonq
Name[ga]=rekonq
Name[lt]=rekonq
Name[nds]=Rekonq
@@ -20,6 +21,7 @@ GenericName[da]=KDE-browser baseret på Webkit
GenericName[de]=WebKit-basierter Webbrowser für KDE
GenericName[en_GB]=Webkit KDE Browser
GenericName[es]=Navegador Webkit para KDE
+GenericName[fr]=Navigateur Webkit pour KDE
GenericName[ga]=Brabhsálaí Webkit KDE
GenericName[lt]=Webkit KDE naršyklė
GenericName[nds]=Webkit-KDE-Kieker
diff --git a/src/mainview.cpp b/src/mainview.cpp
index a5eaa748..cb2e3b11 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -467,7 +467,7 @@ void MainView::closeTab(int index)
case 0: // new tab page
case 1: // blank page
w->load( KUrl("about:home") );
- urlBarWidget()->setFocus();
+ urlBar()->setFocus();
break;
case 2: // homepage
w->load( KUrl(ReKonfig::homePage()) );
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 898aa842..3c8874e1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -187,7 +187,6 @@ void MainWindow::setupToolbars()
// =========== Bookmarks ToolBar ================================
m_bmBar->setAcceptDrops(true);
- m_bmBar->setContextMenuPolicy(Qt::CustomContextMenu);
Application::bookmarkProvider()->setupBookmarkBar(m_bmBar);
if(ReKonfig::firstExecution())
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index a4c7a0e0..8c6c0749 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -95,6 +95,7 @@ void UrlBar::setQUrl(const QUrl& url)
}
else
{
+ clearFocus();
LineEdit::setUrl(url);
setCursorPosition(0);
iconButton()->setIcon( Application::icon(url) );
diff --git a/src/webtab.cpp b/src/webtab.cpp
index fd44cc10..6bafd04a 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -184,7 +184,21 @@ bool WebTab::hasRSSInfo()
foreach(QWebElement el, col)
{
if( el.attribute("type") == QL1S("application/rss+xml") || el.attribute("type") == QL1S("application/rss+xml") )
- _rssList << KUrl( el.attribute("href") );
+ {
+ if( el.attribute("href").startsWith( QL1S("http") ) )
+ {
+ _rssList << KUrl( el.attribute("href") );
+ }
+ else
+ {
+ KUrl u = url();
+ // NOTE
+ // cd() is probably better than setPath() here,
+ // for all those url sites just having a path
+ if(u.cd( el.attribute("href") ))
+ _rssList << u;
+ }
+ }
}
return !_rssList.isEmpty();