From b87d73147b681d548c11785004c21e469c026391 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 22 Sep 2012 12:36:01 +0200 Subject: Re-enable fullscreen capabilities --- src/webwindow/webwindow.cpp | 44 +++++++++++++++++++++++++++++++++----------- src/webwindow/webwindow.h | 6 +++++- 2 files changed, 38 insertions(+), 12 deletions(-) (limited to 'src/webwindow') diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index dc0bf0bd..fe150504 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -57,8 +57,8 @@ #include #include #include -#include #include +#include #include #include @@ -103,7 +103,8 @@ WebWindow::WebWindow(QWidget *parent, WebPage *pg) if (ReKonfig::showBookmarksToolbar()) { - _bookmarksBar = qobject_cast(RekonqFactory::createWidget(QL1S("bookmarkToolBar"), this, actionCollection())); + _bookmarksBar = qobject_cast(RekonqFactory::createWidget(QL1S("bookmarkToolBar"), + this, actionCollection())); BookmarkManager::self()->registerBookmarkBar(_bookmarksBar.data()); l->addWidget(_bookmarksBar.data()); @@ -215,11 +216,12 @@ void WebWindow::setupActions() KShortcut findShortcut = KStandardShortcut::find(); a->setShortcut(findShortcut); - a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection()); + a = KStandardAction::fullScreen(this, SLOT(setWidgetsHidden(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")); KShortcut reloadShortcut = KStandardShortcut::reload(); @@ -756,10 +758,6 @@ void WebWindow::fileSaveAs() void WebWindow::openLocation() { - if (isFullScreen()) - { - _mainToolBar->show(); - } _bar->selectAll(); _bar->setFocus(); } @@ -795,10 +793,34 @@ void WebWindow::viewPageSource() } -void WebWindow::viewFullScreen(bool makeFullScreen) +void WebWindow::setWidgetsHidden(bool hide) { -// FIXME setWidgetsVisible(!makeFullScreen); - KToggleFullScreenAction::setFullScreen(this, makeFullScreen); + // state flags + static bool bookmarksToolBarFlag = false; + + if (hide) + { + // save current state, if in windowed mode + if (!_bookmarksBar.isNull()) + { + bookmarksToolBarFlag = true; + _bookmarksBar.data()->hide(); + } + + // hide main toolbar + _mainToolBar->hide(); + } + else + { + // show main toolbar + _mainToolBar->show(); + + // restore state of windowed mode + if (!_bookmarksBar.isNull() && bookmarksToolBarFlag) + _bookmarksBar.data()->show(); + } + + emit setFullScreen(hide); } diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index 5f0eecad..35de3f10 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -87,6 +87,9 @@ private: void setupActions(); void setupTools(); +public Q_SLOTS: + void setWidgetsHidden(bool hide); + private Q_SLOTS: void webLoadProgress(int); void webLoadStarted(); @@ -115,7 +118,6 @@ private Q_SLOTS: // Tools Menu slots void viewPageSource(); - void viewFullScreen(bool enable); void populateUserAgentMenu(); void setEditable(bool); @@ -132,6 +134,8 @@ Q_SIGNALS: void pageCreated(WebPage *); + void setFullScreen(bool); + private: int _progress; -- cgit v1.2.1