diff options
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 3c563230..ac2355ce 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -43,6 +43,7 @@ #include <KMessageBox> #include <KActionCollection> #include <KDebug> +#include <KStandardDirs> // Qt Includes #include <QtCore> @@ -61,6 +62,8 @@ MainView::MainView(QWidget *parent) { setTabBar(m_tabBar); + loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.gif"); + connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newWebView())); connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int))); @@ -77,6 +80,10 @@ MainView::MainView(QWidget *parent) m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu); m_recentlyClosedTabsAction->setEnabled(false); + // add close button to tab bar.. + m_tabBar->setTabsClosable(true); + connect(m_tabBar, SIGNAL(tabCloseRequested(int)),this, SLOT(closeTab(int))); + // -- connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); } @@ -475,6 +482,10 @@ 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 + if( count() == 1 ) + return; + if (index < 0) index = currentIndex(); if (index < 0 || index >= count()) @@ -488,8 +499,8 @@ void MainView::closeTab(int index) int risp = KMessageBox::questionYesNo(this , i18n("You have modified this page and when closing it you would lose the modification.\n" "Do you really want to close this page?\n"), - i18n("Do you really want to close this page?"), - KStandardGuiItem::no()); + i18n("Do you really want to close this page?") + ); if (risp == KMessageBox::No) return; } @@ -516,13 +527,15 @@ void MainView::closeTab(int index) } +// FIXME void MainView::webViewLoadStarted() { WebView *webView = qobject_cast<WebView*>(sender()); int index = webViewIndex(webView); if (-1 != index) { - setTabIcon(index, KIcon("rekonq")); +// setTabIcon(index, KIcon("rekonq")); + setTabIcon(index, QIcon(loadingGitPath)); } } |