| |   |
| 115 | 115 | m_closeTab = new KAction(KIcon("tab-close.png"), i18n("Close Tab"), this); |
| 116 | 116 | m_closeTab->setStatusTip(i18n("Closes the current tab.")); |
| 117 | 117 | m_closeTab->setShortcut(i18n("Ctrl+W")); |
| 118 | | connect(m_closeTab, SIGNAL(triggered()), this, SLOT(closeCurrentTab())); |
| 118 | connect(m_closeTab, SIGNAL(triggered()), this, SLOT(closeTab())); |
| 119 | 119 | actionCollection()->addAction("closetab", m_closeTab); |
| 120 | 120 | |
| 121 | 121 | KStandardAction::back(this, SLOT(pageBack()), actionCollection()); |
| 122 | 122 | KStandardAction::forward(this, SLOT(pageForward()), actionCollection()); |
| 123 | 123 | m_reload = new KAction(KIcon("view-refresh.png"), i18n("Reload"), this); |
| 124 | | m_closeTab->setStatusTip(i18n("Reloads the current tab.")); |
| 125 | | m_closeTab->setShortcut(i18n("F5")); |
| 124 | m_reload->setStatusTip(i18n("Reloads the current tab.")); |
| 125 | m_reload->setShortcut(i18n("F5")); |
| 126 | 126 | connect(m_reload, SIGNAL(triggered()), this, SLOT(pageReload())); |
| 127 | 127 | actionCollection()->addAction("reload", m_reload); |
| 128 | 128 | KStandardAction::quit(kapp, SLOT(quit()), actionCollection()); |
| … | … | |
| 299 | 299 | newTab(url); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | | void foxkit::closeCurrentTab() |
| 303 | | { |
| 304 | | closeTab(tabs->currentIndex()); |
| 305 | | } |
| 306 | | |
| 307 | 302 | void foxkit::closeTab(int index) |
| 308 | 303 | { |
| 304 | if(index == CLOSECURRENT) |
| 305 | index = tabs->currentIndex(); // We wanna close the current tab. |
| 306 | |
| 309 | 307 | //FIXME unless a new tab is created before removing the last tab it will segfault |
| 310 | 308 | //TODO: Make a nice little template for a blank page and show that instead (call it 'about:foxkit'?) |
| 311 | 309 | if(tabs->count() == 1) |
| … | … | |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | | //TODO Inline these functions? Maybe connect the buttons directly to m_activeView->back()? |
| 338 | //TODO Connect the buttons directly to m_activeView->back() and delete these? |
| 339 | 339 | void foxkit::pageBack() |
| 340 | 340 | { |
| 341 | 341 | m_activeView->back(); |
| toggle raw diff |
--- a/src/foxkit.cpp
+++ b/src/foxkit.cpp
@@ -115,14 +115,14 @@ void foxkit::createActions()
m_closeTab = new KAction(KIcon("tab-close.png"), i18n("Close Tab"), this);
m_closeTab->setStatusTip(i18n("Closes the current tab."));
m_closeTab->setShortcut(i18n("Ctrl+W"));
- connect(m_closeTab, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
+ connect(m_closeTab, SIGNAL(triggered()), this, SLOT(closeTab()));
actionCollection()->addAction("closetab", m_closeTab);
KStandardAction::back(this, SLOT(pageBack()), actionCollection());
KStandardAction::forward(this, SLOT(pageForward()), actionCollection());
m_reload = new KAction(KIcon("view-refresh.png"), i18n("Reload"), this);
- m_closeTab->setStatusTip(i18n("Reloads the current tab."));
- m_closeTab->setShortcut(i18n("F5"));
+ m_reload->setStatusTip(i18n("Reloads the current tab."));
+ m_reload->setShortcut(i18n("F5"));
connect(m_reload, SIGNAL(triggered()), this, SLOT(pageReload()));
actionCollection()->addAction("reload", m_reload);
KStandardAction::quit(kapp, SLOT(quit()), actionCollection());
@@ -299,13 +299,11 @@ void foxkit::newViewUrl(bool newWin, QUrl url)
newTab(url);
}
-void foxkit::closeCurrentTab()
-{
- closeTab(tabs->currentIndex());
-}
-
void foxkit::closeTab(int index)
{
+ if(index == CLOSECURRENT)
+ index = tabs->currentIndex(); // We wanna close the current tab.
+
//FIXME unless a new tab is created before removing the last tab it will segfault
//TODO: Make a nice little template for a blank page and show that instead (call it 'about:foxkit'?)
if(tabs->count() == 1)
@@ -337,7 +335,7 @@ void foxkit::loadProgress(int progress, int index)
}
}
-//TODO Inline these functions? Maybe connect the buttons directly to m_activeView->back()?
+//TODO Connect the buttons directly to m_activeView->back() and delete these?
void foxkit::pageBack()
{
m_activeView->back(); |
| |   |
| 41 | 41 | class QProgressBar; |
| 42 | 42 | #include <KLineEdit> |
| 43 | 43 | |
| 44 | #define CLOSECURRENT -5 |
| 45 | |
| 44 | 46 | class foxkit : public KXmlGuiWindow |
| 45 | 47 | { |
| 46 | 48 | Q_OBJECT |
| … | … | |
| 71 | 71 | void setCurrentTitle(QString title, int); |
| 72 | 72 | void setIcon(QIcon icon, int index); |
| 73 | 73 | void setStatusBarText(QString text, int); |
| 74 | | void closeCurrentTab(); |
| 75 | | void closeTab(int index); |
| 74 | void closeTab(int index = CLOSECURRENT); |
| 76 | 75 | void loadProgress(int progress, int index); |
| 77 | 76 | void newViewUrl(bool newWin, QUrl url); |
| 78 | 77 | |
| toggle raw diff |
--- a/src/foxkit.h
+++ b/src/foxkit.h
@@ -41,6 +41,8 @@ class QStatusBar;
class QProgressBar;
#include <KLineEdit>
+#define CLOSECURRENT -5
+
class foxkit : public KXmlGuiWindow
{
Q_OBJECT
@@ -69,8 +71,7 @@ private slots:
void setCurrentTitle(QString title, int);
void setIcon(QIcon icon, int index);
void setStatusBarText(QString text, int);
- void closeCurrentTab();
- void closeTab(int index);
+ void closeTab(int index = CLOSECURRENT);
void loadProgress(int progress, int index);
void newViewUrl(bool newWin, QUrl url);
|