summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-04-05 17:30:51 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-04-05 17:30:51 +0200
commit51a5174d280aedf3508c7f4339345370545906d8 (patch)
tree77bff9a327eeec54759251b86c9d323680722c63 /src
parentCompiles just with 4.5.. (diff)
downloadrekonq-51a5174d280aedf3508c7f4339345370545906d8.tar.xz
tab bar refactoring
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp21
-rw-r--r--src/mainview.h6
2 files changed, 8 insertions, 19 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 1c1ee678..ac2355ce 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -59,7 +59,6 @@ MainView::MainView(QWidget *parent)
, m_lineEditCompleter(0)
, m_lineEdits(new QStackedWidget(this))
, m_tabBar(new TabBar(this))
- , m_parent(parent)
{
setTabBar(m_tabBar);
@@ -81,19 +80,9 @@ MainView::MainView(QWidget *parent)
m_recentlyClosedTabsAction->setMenu(m_recentlyClosedTabsMenu);
m_recentlyClosedTabsAction->setEnabled(false);
-// if (oneCloseButton)
-// {
-// QToolButton *closeTabButton = new QToolButton(this);
-// closeTabButton->setDefaultAction(m_closeTabAction);
-// closeTabButton->setAutoRaise(true);
-// closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
-// setCornerWidget(closeTabButton, Qt::TopRightCorner);
-// }
-// else
-// {
-// m_tabBar->setTabsClosable(true);
-// connect(m_tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
-// }
+ // 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)));
@@ -493,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())
diff --git a/src/mainview.h b/src/mainview.h
index 7ed750a6..f7e1bbb9 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -29,7 +29,6 @@
// Forward Declarations
class WebView;
class TabBar;
-class MainWindow;
class KUrl;
class KAction;
@@ -53,7 +52,7 @@ class MainView : public KTabWidget
Q_OBJECT
public:
- MainView(KMainWindow *parent);
+ MainView(QWidget *parent = 0);
~MainView();
@@ -146,9 +145,6 @@ private:
TabBar *m_tabBar;
QString loadingGitPath;
-
- // the MainWindow pointer
- MainWindow *m_parent;
};
#endif