summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-04-10 18:57:01 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-04-10 18:57:01 +0200
commit6d37e632d445b51f5321b4138dcd1fce0cae30f9 (patch)
tree0802d82262600af121d1e522bb2dfe926e661b4f /src
parentPorted to rekonq coding style (diff)
downloadrekonq-6d37e632d445b51f5321b4138dcd1fce0cae30f9.tar.xz
Fixed webview API
Removed some unuseful comments
Diffstat (limited to 'src')
-rw-r--r--src/mainview.cpp55
-rw-r--r--src/mainview.h14
-rw-r--r--src/mainwindow.cpp6
-rw-r--r--src/webview.cpp1
4 files changed, 43 insertions, 33 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 604cb7cd..2ada96e0 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -65,12 +65,12 @@ MainView::MainView(QWidget *parent)
loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.gif");
connect(m_tabBar, SIGNAL(newTab()), this, SLOT(newWebView()));
- connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
- connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
- connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
- 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)));
+ connect(m_tabBar, SIGNAL(closeTab(int)), this, SLOT(slotCloseTab(int)));
+ connect(m_tabBar, SIGNAL(cloneTab(int)), this, SLOT(slotCloneTab(int)));
+ connect(m_tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(slotCloseOtherTabs(int)));
+ connect(m_tabBar, SIGNAL(reloadTab(int)), this, SLOT(slotReloadTab(int)));
+ connect(m_tabBar, SIGNAL(reloadAllTabs()), this, SLOT(slotReloadAllTabs()));
+ connect(m_tabBar, SIGNAL(tabMoveRequested(int, int)), this, SLOT(slotMoveTab(int, int)));
// Recently Closed Tab Action
m_recentlyClosedTabsMenu = new KMenu(this);
@@ -82,10 +82,10 @@ MainView::MainView(QWidget *parent)
// add close button to tab bar..
m_tabBar->setTabsClosable(true);
- connect(m_tabBar, SIGNAL(tabCloseRequested(int)),this, SLOT(closeTab(int)));
+ connect(m_tabBar, SIGNAL(tabCloseRequested(int)),this, SLOT(slotCloseTab(int)));
// --
- connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
}
@@ -223,9 +223,9 @@ void MainView::clear()
}
-void MainView::moveTab(int fromIndex, int toIndex)
+void MainView::slotMoveTab(int fromIndex, int toIndex)
{
- disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ disconnect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
QWidget *tabWidget = widget(fromIndex);
QIcon icon = tabIcon(fromIndex);
@@ -234,13 +234,13 @@ void MainView::moveTab(int fromIndex, int toIndex)
removeTab(fromIndex);
insertTab(toIndex, tabWidget, icon, text);
m_tabBar->setTabData(toIndex, data);
- connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
+ connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int)));
setCurrentIndex(toIndex);
}
// When index is -1 index chooses the current tab
-void MainView::reloadTab(int index)
+void MainView::slotReloadTab(int index)
{
if (index < 0)
index = currentIndex();
@@ -253,7 +253,7 @@ void MainView::reloadTab(int index)
}
-void MainView::currentChanged(int index)
+void MainView::slotCurrentChanged(int index)
{
WebView *webView = this->webView(index);
if (!webView)
@@ -265,7 +265,8 @@ void MainView::currentChanged(int index)
if (oldWebView)
{
disconnect(oldWebView, SIGNAL(statusBarMessage(const QString&)), this, SIGNAL(showStatusBarMessage(const QString&)));
- disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)), this, SIGNAL(linkHovered(const QString&)));
+ disconnect(oldWebView->page(), SIGNAL(linkHovered(const QString&, const QString&, const QString&)),
+ this, SIGNAL(linkHovered(const QString&)));
disconnect(oldWebView, SIGNAL(loadProgress(int)), this, SIGNAL(loadProgress(int)));
}
@@ -325,7 +326,7 @@ WebView *MainView::webView(int index) const
MainView *that = const_cast<MainView*>(this);
that->setUpdatesEnabled(false);
that->newWebView();
- that->closeTab(0);
+ that->slotCloseTab(0);
that->setUpdatesEnabled(true);
return currentWebView();
}
@@ -414,7 +415,7 @@ WebView *MainView::newWebView(bool makeCurrent)
}
-void MainView::reloadAllTabs()
+void MainView::slotReloadAllTabs()
{
for (int i = 0; i < count(); ++i)
{
@@ -448,28 +449,38 @@ void MainView::windowCloseRequested()
if (index >= 0)
{
if (count() == 1)
+ {
webView->webPage()->mainWindow()->close();
+ }
else
- closeTab(index);
+ {
+ slotCloseTab(index);
+ }
}
}
-void MainView::closeOtherTabs(int index)
+void MainView::slotCloseOtherTabs(int index)
{
if (-1 == index)
return;
+
for (int i = count() - 1; i > index; --i)
- closeTab(i);
+ {
+ slotCloseTab(i);
+ }
+
for (int i = index - 1; i >= 0; --i)
- closeTab(i);
+ {
+ slotCloseTab(i);
+ }
showTabBar();
}
// When index is -1 index chooses the current tab
-void MainView::cloneTab(int index)
+void MainView::slotCloneTab(int index)
{
if (index < 0)
index = currentIndex();
@@ -483,7 +494,7 @@ void MainView::cloneTab(int index)
// When index is -1 index chooses the current tab
-void MainView::closeTab(int index)
+void MainView::slotCloseTab(int index)
{
// do nothing if just one tab is opened
if( count() == 1 )
diff --git a/src/mainview.h b/src/mainview.h
index 41543b65..96417d4f 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -100,11 +100,11 @@ protected:
public slots:
void loadUrlInCurrentTab(const KUrl &url);
WebView *newWebView(bool makeCurrent = true);
- void cloneTab(int index = -1);
- void closeTab(int index = -1);
- void closeOtherTabs(int index);
- void reloadTab(int index = -1);
- void reloadAllTabs();
+ void slotCloneTab(int index = -1);
+ void slotCloseTab(int index = -1);
+ void slotCloseOtherTabs(int index);
+ void slotReloadTab(int index = -1);
+ void slotReloadAllTabs();
void nextTab();
void previousTab();
@@ -120,7 +120,7 @@ public slots:
void slotWebPaste();
private slots:
- void currentChanged(int index);
+ void slotCurrentChanged(int index);
void aboutToShowRecentTabsMenu();
void aboutToShowRecentTriggeredAction(QAction *action); // need QAction!
void webViewLoadStarted();
@@ -129,7 +129,7 @@ private slots:
void webViewUrlChanged(const QUrl &url);
void lineEditReturnPressed();
void windowCloseRequested();
- void moveTab(int fromIndex, int toIndex);
+ void slotMoveTab(int fromIndex, int toIndex);
private:
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 76312c32..82f555ef 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -272,7 +272,7 @@ void MainWindow::setupActions()
a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W));
actionCollection()->addAction(QLatin1String("close_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab()));
+ connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotCloseTab()));
a = new KAction(i18n("Show Next Tab"), this);
a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
@@ -341,7 +341,7 @@ void MainWindow::slotUpdateConfiguration()
void MainWindow::slotUpdateBrowser()
{
slotUpdateConfiguration();
- mainView()->reloadAllTabs();
+ mainView()->slotReloadAllTabs();
}
@@ -679,7 +679,7 @@ void MainWindow::slotToggleInspector(bool enable)
i18n("Web Inspector"));
if (result == KMessageBox::Yes)
{
- m_view->reloadAllTabs();
+ m_view->slotReloadAllTabs();
}
}
}
diff --git a/src/webview.cpp b/src/webview.cpp
index f0df89db..89647694 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -316,7 +316,6 @@ void WebView::wheelEvent(QWheelEvent *event)
void WebView::openLinkInNewTab()
{
m_page->m_openInNewTab = true;
- kWarning() << "NO panic...";
pageAction(QWebPage::OpenLinkInNewWindow)->trigger();
}