From 84a93ab8a47c8e4546ae658b5400623cdccfe237 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 16 Mar 2009 15:45:45 +0100 Subject: updated rekonq site fixed tab actions.. really near rekonq 0.0.4! Perhaps this night!! --- src/main.cpp | 2 +- src/mainview.cpp | 4 ++-- src/tabbar.cpp | 61 +++++++++++++++++++------------------------------------- src/tabbar.h | 10 ++++++---- 4 files changed, 29 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index a97bb0d5..5315a1d2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) KAboutData::License_GPL, ki18n("(C) 2008 Andrea Diamantini"), KLocalizedString(), - "http://rekonq.adjam.org", + "http://rekonq.soourceforge.net", "adjam7@gmail.com" ); diff --git a/src/mainview.cpp b/src/mainview.cpp index 9e23ae2d..d7e07e14 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // Qt Includes #include @@ -55,7 +56,7 @@ MainView::MainView(QWidget *parent) , m_lineEdits(new QStackedWidget(this)) , m_tabBar(new TabBar(this)) { - setElideMode(Qt::ElideRight); + setTabBar(m_tabBar); connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newTab())); connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int))); @@ -64,7 +65,6 @@ MainView::MainView(QWidget *parent) connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int))); connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs())); connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(moveTab(int, int))); - setTabBar(m_tabBar); // Recently Closed Tab Action m_recentlyClosedTabsMenu = new KMenu(this); diff --git a/src/tabbar.cpp b/src/tabbar.cpp index c28a390c..8f648f28 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // Qt Includes #include @@ -48,18 +49,19 @@ TabBar::TabBar(QWidget *parent) setAcceptDrops(true); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); - QString alt = QLatin1String("Alt+%1"); - for (int i = 1; i <= 10; ++i) - { - int key = i; - if (key == 10) - { - key = 0; - } - QShortcut *shortCut = new QShortcut(alt.arg(key), this); - m_tabShortcuts.append(shortCut); - connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); - } +// FIXME: not sure we need this.. +// QString alt = QLatin1String("Alt+%1"); +// for (int i = 1; i <= 10; ++i) +// { +// int key = i; +// if (key == 10) +// { +// key = 0; +// } +// QShortcut *shortCut = new QShortcut(alt.arg(key), this); +// m_tabShortcuts.append(shortCut); +// connect(shortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); +// } } @@ -88,21 +90,14 @@ void TabBar::contextMenuRequested(const QPoint &position) int index = tabAt(position); if (-1 != index) { - KAction *action = (KAction * ) menu.addAction(i18n("Clone Tab"), this, SLOT(cloneTab())); - action->setData(index); + m_actualIndex = index; + KAction *action = (KAction * ) menu.addAction(i18n("Clone Tab"), this, SLOT(cloneTab())); menu.addSeparator(); - action = (KAction * ) menu.addAction(i18n("&Close Tab"), this, SLOT(closeTab()), QKeySequence::Close); - action->setData(index); - action = (KAction * ) menu.addAction(i18n("Close &Other Tabs"), this, SLOT(closeOtherTabs())); - action->setData(index); - menu.addSeparator(); - action = (KAction * ) menu.addAction(i18n("Reload Tab"), this, SLOT(reloadTab()), QKeySequence::Refresh); - action->setData(index); } else { @@ -115,31 +110,19 @@ void TabBar::contextMenuRequested(const QPoint &position) void TabBar::cloneTab() { - if (KAction *action = qobject_cast(sender())) - { - int index = action->data().toInt(); - emit cloneTab(index); - } + emit cloneTab(m_actualIndex); } void TabBar::closeTab() { - if (KAction *action = qobject_cast(sender())) - { - int index = action->data().toInt(); - emit closeTab(index); - } + emit closeTab(m_actualIndex); } void TabBar::closeOtherTabs() { - if (KAction *action = qobject_cast(sender())) - { - int index = action->data().toInt(); - emit closeOtherTabs(index); - } + emit closeOtherTabs(m_actualIndex); } @@ -199,10 +182,6 @@ void TabBar::dropEvent(QDropEvent *event) void TabBar::reloadTab() { - if (KAction *action = qobject_cast(sender())) - { - int index = action->data().toInt(); - emit reloadTab(index); - } + emit reloadTab(m_actualIndex); } diff --git a/src/tabbar.h b/src/tabbar.h index 0692fcd6..0dbdd004 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -36,6 +36,11 @@ class TabBar : public KTabBar { Q_OBJECT + +public: + TabBar(QWidget *parent = 0); + ~TabBar(); + signals: void newTab(); void cloneTab(int index); @@ -45,10 +50,6 @@ signals: void reloadAllTabs(); void tabMoveRequested(int fromIndex, int toIndex); -public: - TabBar(QWidget *parent = 0); - ~TabBar(); - protected: void mousePressEvent(QMouseEvent* event); void mouseMoveEvent(QMouseEvent* event); @@ -69,6 +70,7 @@ private: QPoint m_dragStartPos; int m_dragCurrentIndex; + int m_actualIndex; // the index in which we are seeing a Context menu }; #endif -- cgit v1.2.1