From 98f53721514116b876d18bf0a2da89d2a53cc97d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 00:05:45 +0100 Subject: Revert "pedantic" Too much things committed a time.. This reverts commit 651f97d0652e90ab1af4e80418f42468cc5932e2. --- src/tabbar.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index cf3a1988..43940f7d 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -50,14 +50,6 @@ TabBar::TabBar(QWidget *parent) setAcceptDrops(true); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); - // we count to 9 because Ctrl+0 is already taken by Normal Font - for (int i = 1; i < 10; ++i) - { - QShortcut *tabShortCut = new QShortcut(QString("Ctrl+%1").arg(i), this); - connect(tabShortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); - m_tabShortcuts.append(tabShortCut); - } - QFont standardFont = KGlobalSettings::generalFont(); QString fontFamily = standardFont.family(); int dim = standardFont.pointSize(); @@ -72,25 +64,16 @@ TabBar::~TabBar() QSize TabBar::tabSizeHint(int index) const { + Q_UNUSED(index); QSize s = m_parent->sizeHint(); int w; - - int n = count(); - - if(n > 6) + if (count() > 3) { - w = s.width() / 5; + w = s.width() / 4; } else { - if (n > 3) - { - w = s.width() / 4; - } - else - { - w = s.width() / 3; - } + w = s.width() / 3; } int h = KTabBar::tabSizeHint(index).height(); @@ -98,22 +81,22 @@ QSize TabBar::tabSizeHint(int index) const return ts; } - + void TabBar::selectTabAction() { if (QShortcut *shortCut = qobject_cast(sender())) { int index = m_tabShortcuts.indexOf(shortCut); - if (index != 0) - { - setCurrentIndex(index); - } + if (index == 0) + index = 10; + setCurrentIndex(index); } } void TabBar::contextMenuRequested(const QPoint &position) { + // FIXME: use right actions KMenu menu; menu.addAction(i18n("New &Tab"), this, SIGNAL(newTab()), QKeySequence::AddTab); int index = tabAt(position); -- cgit v1.2.1