From 5b5bbe370303f6d146c125b0cb0b0c465cc1b3ff Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 28 Nov 2008 02:05:42 +0100 Subject: Final (hopefully) adjustments in tabwidget (Q/K)action management.. --- src/tabwidget.cpp | 15 ++++++++------- src/tabwidget.h | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index e54dbee5..ef3dc4ea 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -215,12 +215,12 @@ TabWidget::TabWidget(QWidget *parent) // Actions m_newTabAction = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); -// m_newTabAction->setShortcuts(QKeySequence::AddTab); FIXME + m_newTabAction->setShortcuts(KShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_N, Qt::CTRL+Qt::Key_T)); m_newTabAction->setIconVisibleInMenu(false); connect(m_newTabAction, SIGNAL(triggered()), this, SLOT(newTab())); m_closeTabAction = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); -// m_closeTabAction->setShortcuts(QKeySequence::Close); FIXME + m_closeTabAction->setShortcut(Qt::CTRL+Qt::Key_W); m_closeTabAction->setIconVisibleInMenu(false); connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); @@ -242,7 +242,7 @@ TabWidget::TabWidget(QWidget *parent) m_previousTabAction->setShortcuts(shortcuts); connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab())); - m_recentlyClosedTabsMenu = new QMenu(this); + m_recentlyClosedTabsMenu = new KMenu(this); connect(m_recentlyClosedTabsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentTabsMenu())); connect(m_recentlyClosedTabsMenu, SIGNAL(triggered(QAction *)), this, SLOT(aboutToShowRecentTriggeredAction(QAction *))); m_recentlyClosedTabsAction = new KAction(i18n("Recently Closed Tabs"), this); @@ -657,7 +657,7 @@ void TabWidget::aboutToShowRecentTabsMenu() } } -void TabWidget::aboutToShowRecentTriggeredAction(KAction *action) +void TabWidget::aboutToShowRecentTriggeredAction(QAction *action) { QUrl url = action->data().toUrl(); loadUrlInCurrentTab(url); @@ -665,9 +665,10 @@ void TabWidget::aboutToShowRecentTriggeredAction(KAction *action) void TabWidget::mouseDoubleClickEvent(QMouseEvent *event) { - if (!childAt(event->pos()) - // Remove the line below when QTabWidget does not have a one pixel frame - && event->pos().y() < (tabBar()->y() + tabBar()->height())) { + if ( !childAt(event->pos()) + // Remove the line below when QTabWidget does not have a one pixel frame + && event->pos().y() < (tabBar()->y() + tabBar()->height())) + { newTab(); return; } diff --git a/src/tabwidget.h b/src/tabwidget.h index 7323c59d..63cd4e48 100644 --- a/src/tabwidget.h +++ b/src/tabwidget.h @@ -109,6 +109,7 @@ private: #include #include +#include QT_BEGIN_NAMESPACE class QCompleter; @@ -182,7 +183,7 @@ public slots: private slots: void currentChanged(int index); void aboutToShowRecentTabsMenu(); - void aboutToShowRecentTriggeredAction(KAction *action); + void aboutToShowRecentTriggeredAction(QAction *action); // need QAction! void webViewLoadStarted(); void webViewIconChanged(); void webViewTitleChanged(const QString &title); @@ -198,7 +199,7 @@ private: KAction *m_nextTabAction; KAction *m_previousTabAction; - QMenu *m_recentlyClosedTabsMenu; + KMenu *m_recentlyClosedTabsMenu; static const int m_recentlyClosedTabsSize = 10; QList m_recentlyClosedTabs; QList m_actions; -- cgit v1.2.1