summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-11-11 09:40:36 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-12-10 02:48:06 +0100
commit4f1dae7834becb7d7105a0cc9945d9a0c04383b8 (patch)
treebe823d81fe7ab1cc199b11bc5b32823d3cc9bdf7
parentClean up previous commit about adblock and fix enable/disable feature (diff)
downloadrekonq-4f1dae7834becb7d7105a0cc9945d9a0c04383b8.tar.xz
WARNING: BIG COMMIT
This commit reviews and partially fix the Q/K action mess in rekonq code. We now store actions in different actioncollections (one for each tab && one for each window). Related to this code review, you can find also fixes for some triggered actions NOT working (well) before: - fullscreen - bookmark all tabs - new (clean) tab
-rw-r--r--src/application.cpp8
-rw-r--r--src/application.h2
-rw-r--r--src/bookmarks/bookmarkmanager.cpp6
-rw-r--r--src/bookmarks/bookmarkmanager.h2
-rw-r--r--src/bookmarks/bookmarkowner.cpp9
-rw-r--r--src/bookmarks/bookmarkowner.h2
-rw-r--r--src/tabwindow/rekonqwindow.cpp3
-rw-r--r--src/tabwindow/tabbar.cpp49
-rw-r--r--src/tabwindow/tabbar.h1
-rw-r--r--src/tabwindow/tabwindow.cpp91
-rw-r--r--src/tabwindow/tabwindow.h10
-rw-r--r--src/urlbar/urlbar.cpp3
-rw-r--r--src/webwindow/rekonqfactory.cpp41
-rw-r--r--src/webwindow/rekonqfactory.h8
-rw-r--r--src/webwindow/webwindow.cpp34
15 files changed, 165 insertions, 104 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 4ce8b121..e8b63756 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -274,7 +274,7 @@ int Application::newInstance()
break;
}
default:
- newTabWindow()->newCleanTab();
+ newTabWindow()->newTab();
break;
}
}
@@ -815,12 +815,6 @@ void Application::bookmarksToolbarToggled(bool b)
}
-void Application::newTab()
-{
- tabWindow()->newCleanTab();
-}
-
-
void Application::newPrivateBrowsingWindow()
{
// NOTE: what about an "about:incognito" page?
diff --git a/src/application.h b/src/application.h
index 679c3aad..5e1be2e4 100644
--- a/src/application.h
+++ b/src/application.h
@@ -111,8 +111,6 @@ private Q_SLOTS:
void createWebAppShortcut();
- void newTab();
-
void newPrivateBrowsingWindow();
private:
diff --git a/src/bookmarks/bookmarkmanager.cpp b/src/bookmarks/bookmarkmanager.cpp
index 57464846..42ae4c33 100644
--- a/src/bookmarks/bookmarkmanager.cpp
+++ b/src/bookmarks/bookmarkmanager.cpp
@@ -171,6 +171,12 @@ void BookmarkManager::slotBookmarksChanged()
}
+KBookmark BookmarkManager::bookmarkCurrentPage(const KBookmark &bookmark)
+{
+ return m_owner->bookmarkCurrentPage(bookmark);
+}
+
+
void BookmarkManager::fillBookmarkBar(BookmarkToolBar *toolBar)
{
KBookmarkGroup root = m_manager->toolbar();
diff --git a/src/bookmarks/bookmarkmanager.h b/src/bookmarks/bookmarkmanager.h
index 3538bcb8..0e86fcca 100644
--- a/src/bookmarks/bookmarkmanager.h
+++ b/src/bookmarks/bookmarkmanager.h
@@ -145,6 +145,8 @@ public Q_SLOTS:
void slotEditBookmarks();
+ KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
+
Q_SIGNALS:
/**
* @short This signal is emitted when an url has to be loaded
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index aba4ec69..54a34b36 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -239,12 +239,17 @@ KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
}
-KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
+KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark, const QString &name)
{
KBookmarkGroup newBk;
KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0);
- QString folderName = i18n("New folder");
+ QString folderName;
+ if (name.isEmpty())
+ folderName = i18n("New folder");
+ else
+ folderName = name;
+
if (!bookmark.isNull())
{
if (bookmark.isGroup())
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index f0b238b9..aca338dd 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -108,7 +108,7 @@ public Q_SLOTS:
void openBookmarkFolder(const KBookmark &bookmark);
KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
- KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark());
+ KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark(), const QString &name = QString());
KBookmark newSeparator(const KBookmark &bookmark = KBookmark());
void copyLink(const KBookmark &bookmark);
diff --git a/src/tabwindow/rekonqwindow.cpp b/src/tabwindow/rekonqwindow.cpp
index 8bc96d87..05608954 100644
--- a/src/tabwindow/rekonqwindow.cpp
+++ b/src/tabwindow/rekonqwindow.cpp
@@ -311,7 +311,8 @@ void RekonqWindow::parseGeometry()
void RekonqWindow::resizeEvent(QResizeEvent *event)
{
- saveAutoSaveSettings();
+ if (!isFullScreen())
+ saveAutoSaveSettings();
KTabWidget::resizeEvent(event);
}
diff --git a/src/tabwindow/tabbar.cpp b/src/tabwindow/tabbar.cpp
index 725d1372..70dcd3b1 100644
--- a/src/tabwindow/tabbar.cpp
+++ b/src/tabwindow/tabbar.cpp
@@ -177,56 +177,55 @@ void TabBar::detachTab()
}
-void TabBar::contextMenu(int tab, const QPoint &pos)
+void TabBar::contextMenu(int tabIndex, const QPoint &pos)
{
TabWindow *w = qobject_cast<TabWindow *>(parent());
- KAction *a;
+ QAction *a;
KMenu menu;
- a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
- connect(a, SIGNAL(triggered(bool)), w, SLOT(newCleanTab()));
+ a = w->actionByName(QL1S("new_tab"));
menu.addAction(a);
menu.addSeparator(); // ----------------------------------------------------------------
a = new KAction(KIcon("tab-duplicate"), i18n("Clone"), this);
- a->setData(tab);
+ a->setData(tabIndex);
connect(a, SIGNAL(triggered(bool)), this, SLOT(cloneTab()));
menu.addAction(a);
a = new KAction(KIcon("view-refresh"), i18n("Reload"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(reloadTab()));
- a->setData(tab);
+ a->setData(tabIndex);
menu.addAction(a);
if (count() > 1)
{
a = new KAction(KIcon("tab-detach"), i18n("Detach"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(detachTab()));
- a->setData(tab);
+ a->setData(tabIndex);
menu.addAction(a);
}
- if (tabData(tab).toBool())
+ if (tabData(tabIndex).toBool())
{
a = new KAction(i18n("Unpin Tab"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(unpinTab()));
- a->setData(tab);
+ a->setData(tabIndex);
menu.addAction(a);
}
else
{
a = new KAction(i18n("Pin Tab"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(pinTab()));
- a->setData(tab);
+ a->setData(tabIndex);
menu.addAction(a);
}
menu.addSeparator(); // ----------------------------------------------------------------
a = new KAction(KIcon("tab-close"), i18n("&Close"), this);
- a->setData(tab);
+ a->setData(tabIndex);
connect(a, SIGNAL(triggered(bool)), this, SLOT(closeTab()));
menu.addAction(a);
@@ -234,26 +233,19 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
{
a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this);
connect(a, SIGNAL(triggered(bool)), this, SLOT(closeOtherTabs()));
- a->setData(tab);
+ a->setData(tabIndex);
menu.addAction(a);
}
menu.addSeparator();
- a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
- a->setData(0); // last closed tab has index 0!
- connect(a, SIGNAL(triggered(bool)), this, SIGNAL(restoreLastClosedTab()));
+ a = w->actionByName(QL1S("open_last_closed_tab"));
menu.addAction(a);
if (count() > 1)
{
- a = new KAction(KIcon("bookmark-new"), i18n("Bookmarks all tabs"), this);
- menu.addAction(a);
- }
- else
- {
- a = new KAction(KIcon("bookmark-new"), i18n("Bookmark"), this);
+ a = w->actionByName(QL1S("bookmark_all_tabs"));
menu.addAction(a);
}
@@ -265,26 +257,19 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos)
{
TabWindow *w = qobject_cast<TabWindow *>(parent());
- KAction *a;
+ QAction *a;
KMenu menu;
- a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
- connect(a, SIGNAL(triggered(bool)), w, SLOT(newCleanTab()));
+ a = w->actionByName(QL1S("new_tab"));
menu.addAction(a);
- a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
- a->setData(0); // last closed tab has index 0!
+ a = w->actionByName(QL1S("open_last_closed_tab"));
menu.addAction(a);
if (count() > 1)
{
- a = new KAction(KIcon("bookmark-new"), i18n("Bookmarks all tabs"), this);
- menu.addAction(a);
- }
- else
- {
- a = new KAction(KIcon("bookmark-new"), i18n("Bookmark"), this);
+ a = w->actionByName(QL1S("bookmark_all_tabs"));
menu.addAction(a);
}
diff --git a/src/tabwindow/tabbar.h b/src/tabwindow/tabbar.h
index 64fed413..292f3d6d 100644
--- a/src/tabwindow/tabbar.h
+++ b/src/tabwindow/tabbar.h
@@ -70,7 +70,6 @@ Q_SIGNALS:
void closeOtherTabs(int);
void reloadTab(int);
void detachTab(int);
- void restoreLastClosedTab();
void tabLayoutChanged();
private Q_SLOTS:
diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp
index 6e64d7e4..84797f85 100644
--- a/src/tabwindow/tabwindow.cpp
+++ b/src/tabwindow/tabwindow.cpp
@@ -36,6 +36,7 @@
#include "tabhistory.h"
+#include "bookmarkmanager.h"
#include "iconmanager.h"
// KDE Includes
@@ -48,6 +49,9 @@
#include <KUrl>
#include <KToggleFullScreenAction>
+#include <KBookmark>
+#include <KBookmarkGroup>
+
#include <KWindowInfo>
#include <KWindowSystem>
@@ -67,6 +71,7 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
, _addTabButton(new QToolButton(this))
, _openedTabsCounter(0)
, _isPrivateBrowsing(PrivateBrowsingMode)
+ , _ac(new KActionCollection(this))
{
setContentsMargins(0, 0, 0, 0);
@@ -86,7 +91,7 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)));
- connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newCleanTab()));
+ connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()));
connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
@@ -94,34 +99,47 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
- connect(tabBar, SIGNAL(restoreLastClosedTab()), this, SLOT(restoreLastClosedTab()));
-
connect(tabBar, SIGNAL(tabLayoutChanged()), this, SLOT(updateNewTabButtonPosition()));
- // new tab button
- KAction* a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
- _addTabButton->setDefaultAction(a);
- _addTabButton->setAutoRaise(true);
- _addTabButton->raise();
- _addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
- connect(_addTabButton, SIGNAL(triggered(QAction *)), this, SLOT(newCleanTab()));
-
- connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ // ============================== Tab Window Actions ====================================
+ _ac->addAssociatedWidget(this);
+
+ KAction* a;
- // ----------------------------------------------------------------------------------------------
- KActionCollection *tabActionColl = new KActionCollection(this);
- tabActionColl->addAssociatedWidget(this);
+ a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
+ a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T));
+ actionCollection()->addAction(QL1S("new_tab"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(newTab()));
a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
- tabActionColl->addAction(QL1S("open_last_closed_tab"), a);
+ actionCollection()->addAction(QL1S("open_last_closed_tab"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(restoreLastClosedTab()));
a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
a->setShortcuts(KStandardShortcut::close());
- tabActionColl->addAction(QL1S("close_tab"), a);
+ actionCollection()->addAction(QL1S("close_tab"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(closeTab()));
+
+ a = KStandardAction::fullScreen(this, SLOT(setFullScreen(bool)), this, actionCollection());
+ KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
+ fullScreenShortcut.setAlternate(Qt::Key_F11);
+ a->setShortcut(fullScreenShortcut);
+ a = new KAction(KIcon("bookmarks"), i18n("Bookmark all tabs"), this);
+ actionCollection()->addAction(QL1S("bookmark_all_tabs"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkAllTabs()));
+
+ // ----------------------------------------------------------------------------------------------
+ // Add Tab Button
+ _addTabButton->setDefaultAction(actionByName(QL1S("new_tab")));
+ _addTabButton->setAutoRaise(true);
+ _addTabButton->raise();
+ _addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+
+ connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+
+
// NOTE: we usually create TabWindow with AT LEAST one tab, but
// in one important case...
if (withTab)
@@ -133,6 +151,18 @@ TabWindow::TabWindow(bool withTab, bool PrivateBrowsingMode, QWidget *parent)
}
+KActionCollection *TabWindow::actionCollection() const
+{
+ return _ac;
+}
+
+
+QAction *TabWindow::actionByName(const QString &name)
+{
+ return actionCollection()->action(name);
+}
+
+
TabBar *TabWindow::tabBar() const
{
TabBar *tabBar = qobject_cast<TabBar *>(QTabWidget::tabBar());
@@ -218,9 +248,13 @@ void TabWindow::loadUrl(const KUrl &url, Rekonq::OpenType type, TabHistory *hist
}
-void TabWindow::newCleanTab()
+void TabWindow::newTab()
{
- loadUrl(QUrl("about:home"), Rekonq::NewFocusedTab);
+ WebWindow *tab = prepareNewTab();
+ addTab(tab, i18n("new tab"));
+ setCurrentWidget(tab);
+
+ tab->load(KUrl("about:home"));
}
@@ -256,6 +290,9 @@ void TabWindow::currentChanged(int newIndex)
void TabWindow::updateNewTabButtonPosition()
{
+ if (isFullScreen())
+ return;
+
int tabWidgetWidth = frameSize().width();
int tabBarWidth = tabBar()->sizeHint().width();
@@ -529,6 +566,18 @@ void TabWindow::reloadAllTabs()
}
+void TabWindow::bookmarkAllTabs()
+{
+ KBookmarkGroup rGroup = BookmarkManager::self()->rootGroup();
+ KBookmarkGroup folderGroup = rGroup.createNewFolder( i18n("Bookmarked tabs: ") + QDate::currentDate().toString());
+ for (int i = 0; i < count(); ++i)
+ {
+ WebWindow *tab = webWindow(i);
+ KBookmark bk = folderGroup.addBookmark(tab->title(), tab->url());
+ }
+}
+
+
void TabWindow::restoreLastClosedTab()
{
if (m_recentlyClosedTabs.isEmpty())
@@ -549,7 +598,11 @@ void TabWindow::setFullScreen(bool makeFullScreen)
{
tabBar()->setVisible(!makeFullScreen);
_addTabButton->setVisible(!makeFullScreen);
+
KToggleFullScreenAction::setFullScreen(this, makeFullScreen);
+
+ for(int i = 0; i < count(); i++)
+ webWindow(i)->setWidgetsHidden(makeFullScreen);
}
diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h
index 65c3e945..dd938af3 100644
--- a/src/tabwindow/tabwindow.h
+++ b/src/tabwindow/tabwindow.h
@@ -36,6 +36,7 @@
// KDE Includes
#include <KTabWidget>
+#include <KActionCollection>
// Forward Declarations
class KUrl;
@@ -68,9 +69,12 @@ public:
bool isPrivateBrowsingWindowMode();
+ virtual KActionCollection *actionCollection() const;
+ QAction *actionByName(const QString &name);
+
public Q_SLOTS:
void loadUrl(const KUrl &, Rekonq::OpenType type = Rekonq::CurrentTab, TabHistory *history = 0);
- void newCleanTab();
+ void newTab();
private:
/**
@@ -99,7 +103,9 @@ private Q_SLOTS:
void closeOtherTabs(int index = -1);
void detachTab(int index = -1, TabWindow *toWindow = 0);
void reloadTab(int index = -1);
+
void reloadAllTabs();
+ void bookmarkAllTabs();
void restoreLastClosedTab();
@@ -114,6 +120,8 @@ private:
QList<TabHistory> m_recentlyClosedTabs;
bool _isPrivateBrowsing;
+
+ KActionCollection *_ac;
};
#endif // TAB_WINDOW
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 9321d442..2b32738d 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -40,7 +40,6 @@
// Local Includes
#include "adblockmanager.h"
#include "bookmarkmanager.h"
-#include "bookmarkowner.h" // FIXME: Why is this needed? Why everything interesting in BookmarkManager is in its owner?
#include "iconmanager.h"
#include "adblockwidget.h"
@@ -726,7 +725,7 @@ void UrlBar::manageBookmarks()
if (bookmark.isNull())
{
- bookmark = BookmarkManager::self()->owner()->bookmarkCurrentPage();
+ bookmark = BookmarkManager::self()->bookmarkCurrentPage();
}
// calculate position
diff --git a/src/webwindow/rekonqfactory.cpp b/src/webwindow/rekonqfactory.cpp
index 163935a3..9de9e367 100644
--- a/src/webwindow/rekonqfactory.cpp
+++ b/src/webwindow/rekonqfactory.cpp
@@ -68,10 +68,30 @@ bool readDocument(QDomDocument & document, const QString & filePath)
}
+// Only used internally
+QAction *actionByName(const QString &name)
+{
+ QList<KActionCollection *> lac = KActionCollection::allCollections();
+
+ // NOTE: last action collection created is surely the one interests us more!
+ // So let's start from the end...
+ int lac_count = lac.count();
+ for(int i = lac_count - 1; i>=0; i--)
+ {
+ KActionCollection *ac = lac.at(i);
+ QAction *a = ac->action(name);
+ if (a)
+ return a;
+ }
+
+ kDebug() << "NO ACTION FOUND: " << name;
+ return 0;
+}
+
// ---------------------------------------------------------------------------------------------------------
-QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActionCollection *ac)
+QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent)
{
QDomDocument document("rekonqui.rc");
QString xmlFilePath = KStandardDirs::locate("data", "rekonq/rekonqui.rc");
@@ -104,13 +124,13 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
if (name == QL1S("bookmarkToolBar"))
{
BookmarkToolBar *b = new BookmarkToolBar(parent);
- fillToolbar(b, node, ac);
+ fillToolbar(b, node);
return b;
}
else
{
KToolBar *b = new KToolBar(parent, false , false);
- fillToolbar(b, node, ac);
+ fillToolbar(b, node);
return b;
}
}
@@ -139,7 +159,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
if (name == QL1S("rekonqMenu"))
{
RekonqMenu *m = new RekonqMenu(parent);
- fillMenu(m, node, ac);
+ fillMenu(m, node);
return m;
}
else if (name == QL1S("help"))
@@ -150,7 +170,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
else
{
KMenu *m = new KMenu(parent);
- fillMenu(m, node, ac);
+ fillMenu(m, node);
return m;
}
@@ -161,7 +181,7 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent, KActi
}
-void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *ac)
+void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node)
{
QDomElement element = node.toElement();
@@ -208,7 +228,7 @@ void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *a
if (el.tagName() == QL1S("Action"))
{
const QString actionName = el.attribute("name");
- QAction *a = ac->action(actionName);
+ QAction *a = actionByName(actionName);
if (a)
{
b->addAction(a);
@@ -225,7 +245,7 @@ void RekonqFactory::fillToolbar(KToolBar *b, QDomNode node, KActionCollection *a
}
-void RekonqFactory::fillMenu(KMenu *m, QDomNode node, KActionCollection *ac)
+void RekonqFactory::fillMenu(KMenu *m, QDomNode node)
{
QDomNodeList childrenList = node.childNodes();
@@ -236,7 +256,7 @@ void RekonqFactory::fillMenu(KMenu *m, QDomNode node, KActionCollection *ac)
if (el.tagName() == QL1S("Action"))
{
const QString actionName = el.attribute("name");
- QAction *a = ac->action(actionName);
+ QAction *a = actionByName(actionName);
if (a)
{
m->addAction(a);
@@ -252,7 +272,7 @@ void RekonqFactory::fillMenu(KMenu *m, QDomNode node, KActionCollection *ac)
if (el.tagName() == QL1S("Menu"))
{
const QString menuName = el.attribute("name");
- KMenu *subm = qobject_cast<KMenu *>(createWidget(menuName, m, ac));
+ KMenu *subm = qobject_cast<KMenu *>(createWidget(menuName, m));
m->addMenu(subm);
}
@@ -264,4 +284,3 @@ void RekonqFactory::fillMenu(KMenu *m, QDomNode node, KActionCollection *ac)
}
}
-
diff --git a/src/webwindow/rekonqfactory.h b/src/webwindow/rekonqfactory.h
index a0bf956d..4a4f46dd 100644
--- a/src/webwindow/rekonqfactory.h
+++ b/src/webwindow/rekonqfactory.h
@@ -30,7 +30,6 @@
// Rekonq Includes
#include "rekonq_defines.h"
-class KActionCollection;
class KMenu;
class KToolBar;
@@ -41,10 +40,11 @@ class QWidget;
namespace RekonqFactory
{
-QWidget *createWidget(const QString &name, QWidget *parent, KActionCollection *);
+QWidget *createWidget(const QString &name, QWidget *parent);
+
+void fillToolbar(KToolBar *, QDomNode);
+void fillMenu(KMenu *, QDomNode);
-void fillToolbar(KToolBar *, QDomNode, KActionCollection *);
-void fillMenu(KMenu *, QDomNode, KActionCollection *);
};
#endif
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 06f0ffac..df38c969 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -99,13 +99,12 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
QVBoxLayout *l = new QVBoxLayout(this);
// main toolbar
- _mainToolBar = qobject_cast<KToolBar *>(RekonqFactory::createWidget(QL1S("mainToolBar"), this, actionCollection()));
+ _mainToolBar = qobject_cast<KToolBar *>(RekonqFactory::createWidget(QL1S("mainToolBar"), this));
l->addWidget(_mainToolBar);
if (ReKonfig::showBookmarksToolbar())
{
- _bookmarksBar = qobject_cast<BookmarkToolBar *>(RekonqFactory::createWidget(QL1S("bookmarkToolBar"),
- this, actionCollection()));
+ _bookmarksBar = qobject_cast<BookmarkToolBar *>(RekonqFactory::createWidget(QL1S("bookmarkToolBar"), this));
BookmarkManager::self()->registerBookmarkBar(_bookmarksBar.data());
l->addWidget(_bookmarksBar.data());
@@ -143,6 +142,9 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg)
connect(_tab, SIGNAL(infoToShow(QString)), this, SLOT(notifyMessage(QString)));
updateHistoryActions();
+
+ if (parent && parent->isFullScreen())
+ setWidgetsHidden(true);
}
@@ -215,24 +217,23 @@ void WebWindow::setupActions()
actionCollection()->addAction(QL1S("show_bookmarks_toolbar"), a);
connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleBookmarksToolbar(bool)));
- // Open special pages
- // Home
+ // Open Home page
a = actionCollection()->addAction(KStandardAction::Home);
connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(openHomePage(Qt::MouseButtons, Qt::KeyboardModifiers)));
- // Downloads
+ // Open Downloads page
a = new KAction(KIcon("download"), i18n("Downloads page"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_J));
actionCollection()->addAction(QL1S("open_downloads_page"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(openDownloadsPage()));
- // History
+ // Open History page
a = new KAction(KIcon("view-history"), i18n("History page"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
actionCollection()->addAction(QL1S("open_history_page"), a);
connect(a, SIGNAL(triggered(bool)), this, SLOT(openHistoryPage()));
- // Bookmarks
+ // Open Bookmarks page
a = new KAction(KIcon("bookmarks"), i18n("Bookmarks page"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
actionCollection()->addAction(QL1S("open_bookmarks_page"), a);
@@ -246,11 +247,10 @@ void WebWindow::setupActions()
KStandardAction::findNext(m_findBar, SLOT(findNext()), actionCollection());
KStandardAction::findPrev(m_findBar, SLOT(findPrevious()), actionCollection());
- a = KStandardAction::fullScreen(this, SLOT(setWidgetsHidden(bool)), this, actionCollection());
+ a = KStandardAction::fullScreen(this, SIGNAL(setFullScreen(bool)), this, actionCollection());
KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
fullScreenShortcut.setAlternate(Qt::Key_F11);
a->setShortcut(fullScreenShortcut);
- connect(a, SIGNAL(toggled(bool)), this, SIGNAL(setFullScreen(bool)));
a = KStandardAction::redisplay(_tab->view(), SLOT(reload()), actionCollection());
a->setText(i18n("Reload"));
@@ -328,12 +328,6 @@ void WebWindow::setupActions()
a = new KAction(KIcon("tools-wizard"), i18n("Sync"), this); // FIXME sync icon!!
actionCollection()->addAction(QL1S("sync"), a);
connect(a, SIGNAL(triggered(bool)), SyncManager::self(), SLOT(showSettings()));
-
- // ============================== General Tab Actions ====================================
- a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T));
- actionCollection()->addAction(QL1S("new_tab"), a);
- connect(a, SIGNAL(triggered(bool)), rApp, SLOT(newTab()));
}
@@ -343,7 +337,7 @@ void WebWindow::setupTools()
toolsAction->setDelayed(false);
toolsAction->setShortcutConfigurable(true);
toolsAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_T));
- m_rekonqMenu = qobject_cast<RekonqMenu *>(RekonqFactory::createWidget(QL1S("rekonqMenu"), this, actionCollection()));
+ m_rekonqMenu = qobject_cast<RekonqMenu *>(RekonqFactory::createWidget(QL1S("rekonqMenu"), this));
toolsAction->setMenu(m_rekonqMenu); // dummy menu to have the dropdown arrow
// adding rekonq_tools to rekonq actionCollection
@@ -412,7 +406,7 @@ void WebWindow::webLoadFinished(bool b)
connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), _tab->view(), SLOT(reload()));
}
- updateHistoryActions();
+ updateHistoryActions();
}
@@ -833,8 +827,6 @@ void WebWindow::setWidgetsHidden(bool hide)
if (!_bookmarksBar.isNull() && bookmarksToolBarFlag)
_bookmarksBar.data()->show();
}
-
- emit setFullScreen(hide);
}
@@ -883,7 +875,7 @@ void WebWindow::toggleBookmarksToolbar(bool b)
if (b)
{
- _bookmarksBar = qobject_cast<BookmarkToolBar *>(RekonqFactory::createWidget(QL1S("bookmarkToolBar"), this, actionCollection()));
+ _bookmarksBar = qobject_cast<BookmarkToolBar *>(RekonqFactory::createWidget(QL1S("bookmarkToolBar"), this));
BookmarkManager::self()->registerBookmarkBar(_bookmarksBar.data());
qobject_cast<QVBoxLayout *>(layout())->insertWidget(1, _bookmarksBar.data());