diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainview.cpp | 39 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 56 | ||||
-rw-r--r-- | src/mainwindow.h | 3 | ||||
-rw-r--r-- | src/rekonq.kcfg | 2 | ||||
-rw-r--r-- | src/webview.cpp | 11 |
6 files changed, 62 insertions, 51 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 46cd9a15..7dbe8b23 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -186,12 +186,15 @@ void MainView::updateTabBar() { if (ReKonfig::alwaysShowTabBar()) { - if (m_tabBar->isHidden()) + if (!isTabBarHidden()) { - m_tabBar->show(); - m_addTabButton->show(); + if (m_tabBar->isHidden()) + { + m_tabBar->show(); + m_addTabButton->show(); + } + updateTabButtonPosition(); } - updateTabButtonPosition(); return; } @@ -200,7 +203,7 @@ void MainView::updateTabBar() m_tabBar->hide(); m_addTabButton->hide(); } - else + else if (!isTabBarHidden()) { if (m_tabBar->isHidden()) { @@ -212,6 +215,13 @@ void MainView::updateTabBar() } +void MainView::setTabBarHidden(bool hide) +{ + m_addTabButton->setVisible(!hide); + KTabWidget::setTabBarHidden(hide); +} + + void MainView::webReload() { WebTab *webTab = currentWebTab(); @@ -447,9 +457,26 @@ void MainView::cloneTab(int index) // When index is -1 index chooses the current tab void MainView::closeTab(int index) { - // do nothing if just one tab is opened + // open default homePage if just one tab is opened if (count() == 1) + { + WebView *w = currentWebTab()->view(); + urlBar()->setUrl(KUrl("")); + switch(ReKonfig::newTabsBehaviour()) + { + case 0: // new tab page + case 1: // blank page + w->load( KUrl("about:home") ); + break; + case 2: // homepage + w->load( KUrl(ReKonfig::homePage()) ); + break; + default: + break; + } + urlBar()->setFocus(); return; + } if (index < 0) index = currentIndex(); diff --git a/src/mainview.h b/src/mainview.h index f57c30b5..f8a8c283 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -83,6 +83,8 @@ public: */ void updateTabBar(); + void setTabBarHidden(bool hide); + QToolButton *addTabButton() const; void clear(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b4174191..a0c25389 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -797,21 +797,30 @@ void MainWindow::viewTextSmaller() void MainWindow::viewFullScreen(bool makeFullScreen) { + setWidgetsVisible(!makeFullScreen); + KToggleFullScreenAction::setFullScreen(this, makeFullScreen); +} + + +void MainWindow::setWidgetsVisible(bool makeVisible) +{ // state flags static bool bookmarksToolBarFlag; static bool sidePanelFlag; - static bool bookmarksPanelFlag; + static bool bookmarksPanelFlag; - if (makeFullScreen == true) + if (!makeVisible) { // save current state bookmarksToolBarFlag = m_bmBar->isHidden(); m_bmBar->hide(); + m_view->setTabBarHidden(true); + sidePanelFlag = sidePanel()->isHidden(); sidePanel()->hide(); - bookmarksPanelFlag = bookmarksPanel()->isHidden(); + bookmarksPanelFlag = bookmarksPanel()->isHidden(); bookmarksPanel()->hide(); // hide main toolbar @@ -821,6 +830,7 @@ void MainWindow::viewFullScreen(bool makeFullScreen) { // show main toolbar m_mainBar->show(); + m_view->setTabBarHidden(false); // restore previous state if (!bookmarksToolBarFlag) @@ -829,9 +839,7 @@ void MainWindow::viewFullScreen(bool makeFullScreen) sidePanel()->show(); if (!bookmarksPanelFlag) bookmarksPanel()->show(); - } - - KToggleFullScreenAction::setFullScreen(this, makeFullScreen); + } } @@ -922,42 +930,6 @@ void MainWindow::openNext() } -bool MainWindow::queryClose() -{ - if (m_view->count() > 1) - { - - int answer = KMessageBox::questionYesNoCancel( - this, - i18np("Are you sure you want to close the window?\n" \ - "You still have 1 tab open.", - "Are you sure you want to close the window?\n" \ - "You still have %1 tabs open.", - m_view->count()), - i18n("Closing rekonq"), - KStandardGuiItem::quit(), - KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), - KStandardGuiItem::cancel(), - "confirmClosingMultipleTabs"); - - switch (answer) - { - case KMessageBox::Yes: - // Quit - return true; - break; - case KMessageBox::No: - // Close only the current tab - m_view->closeTab(); - default: - return false; - } - } - - return true; -} - - void MainWindow::keyPressEvent(QKeyEvent *event) { // hide findbar diff --git a/src/mainwindow.h b/src/mainwindow.h index 95964e22..49dc2a59 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -71,6 +71,7 @@ public: QAction *actionByName(const QString name); virtual QSize sizeHint() const; virtual KActionCollection *actionCollection () const; + void setWidgetsVisible(bool makeFullScreen); private: void setupActions(); @@ -107,8 +108,6 @@ signals: void shiftCtrlTabPressed(); protected: - bool queryClose(); - /** * Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed() * to make switch tab diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 14b727d3..333870d1 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -110,7 +110,7 @@ <default>true</default> </entry> <entry name="pluginsEnabled" type="Int"> - <default>1</default> + <default>0</default> </entry> <entry name="javascriptCanOpenWindows" type="Bool"> <default>true</default> diff --git a/src/webview.cpp b/src/webview.cpp index 462adc08..a35b7143 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -313,6 +313,17 @@ void WebView::mousePressEvent(QMouseEvent *event) void WebView::mouseMoveEvent(QMouseEvent *event) { m_mousePos = event->pos(); + if (Application::instance()->mainWindow()->isFullScreen()) + { + if (event->pos().y()>=0 && event->pos().y()<=4) + { + Application::instance()->mainWindow()->setWidgetsVisible(true); + } + else + { + Application::instance()->mainWindow()->setWidgetsVisible(false); + } + } KWebView::mouseMoveEvent(event); } |