diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/browsermainwindow.cpp | 87 | ||||
-rw-r--r-- | src/browsermainwindow.h | 6 | ||||
-rw-r--r-- | src/tabwidget.cpp | 22 |
3 files changed, 22 insertions, 93 deletions
diff --git a/src/browsermainwindow.cpp b/src/browsermainwindow.cpp index f6691101..04447f87 100644 --- a/src/browsermainwindow.cpp +++ b/src/browsermainwindow.cpp @@ -278,10 +278,10 @@ void BrowserMainWindow::setupMenu() // ------------------------------------------------------------- VIEW ------------------------------------------------------------------------------------------------- KMenu *viewMenu = (KMenu *) menuBar()->addMenu( i18n("&View") ); - m_viewStatusbar = new KAction(this); - updateStatusbarActionText(true); + m_viewStatusbar = KStandardAction::showStatusbar( this, SLOT(slotViewStatusbar() ), this); +/* updateStatusbarActionText(true); m_viewStatusbar->setShortcut( i18n("Ctrl+/") ); - connect(m_viewStatusbar, SIGNAL(triggered()), this, SLOT(slotViewStatusbar())); + connect(m_viewStatusbar, SIGNAL(triggered()), this, SLOT(slotViewStatusbar()));*/ viewMenu->addAction(m_viewStatusbar); viewMenu->addSeparator(); @@ -355,7 +355,6 @@ void BrowserMainWindow::setupMenu() toolsMenu->addSeparator(); - toolsMenu->addAction( i18n("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence( tr("Ctrl+K", "Web Search"))); action = (KAction *) toolsMenu->addAction( i18n("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); action->setCheckable(true); @@ -370,9 +369,6 @@ void BrowserMainWindow::setupMenu() } - - - void BrowserMainWindow::setupToolBar() { m_navigationBar = new KToolBar( i18n("Navigation") , this, Qt::TopToolBarArea, true, false, false); @@ -409,31 +405,21 @@ void BrowserMainWindow::setupToolBar() } - -void BrowserMainWindow::slotAddBookmark() -{ -// WebView *webView = currentTab(); -// QString url = webView->url().toString(); -// QString title = webView->title(); -// AddBookmarkDialog dialog(url, title); -// dialog.exec(); -} - - void BrowserMainWindow::updateStatusbarActionText(bool visible) { m_viewStatusbar->setText(!visible ? i18n("Show Status Bar") : i18n("Hide Status Bar")); } - - void BrowserMainWindow::slotViewStatusbar() { - if (statusBar()->isVisible()) { + if (statusBar()->isVisible()) + { updateStatusbarActionText(false); statusBar()->close(); - } else { + } + else + { updateStatusbarActionText(true); statusBar()->show(); } @@ -441,8 +427,6 @@ void BrowserMainWindow::slotViewStatusbar() } - - KUrl BrowserMainWindow::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); @@ -498,23 +482,18 @@ KUrl BrowserMainWindow::guessUrlFromString(const QString &string) } - - void BrowserMainWindow::loadUrl(const KUrl &url) { loadPage( url.url() ); } - - void BrowserMainWindow::slotDownloadManager() { BrowserApplication::downloadManager()->show(); } - void BrowserMainWindow::slotSelectLineEdit() { m_tabWidget->currentLineEdit()->selectAll(); @@ -522,15 +501,12 @@ void BrowserMainWindow::slotSelectLineEdit() } - void BrowserMainWindow::slotFileSaveAs() { BrowserApplication::downloadManager()->download(currentTab()->url(), true); } - - void BrowserMainWindow::slotPreferences() { SettingsDialog *s = new SettingsDialog(this); @@ -538,16 +514,12 @@ void BrowserMainWindow::slotPreferences() } - - void BrowserMainWindow::slotUpdateStatusbar(const QString &string) { statusBar()->showMessage(string, 2000); } - - void BrowserMainWindow::slotUpdateWindowTitle(const QString &title) { if (title.isEmpty()) { @@ -558,7 +530,6 @@ void BrowserMainWindow::slotUpdateWindowTitle(const QString &title) } - void BrowserMainWindow::slotFileNew() { BrowserApplication::instance()->newMainWindow(); @@ -567,8 +538,6 @@ void BrowserMainWindow::slotFileNew() } - - void BrowserMainWindow::slotFileOpen() { QString file = QFileDialog::getOpenFileName(this, i18n("Open Web Resource"), QString(), @@ -581,8 +550,6 @@ void BrowserMainWindow::slotFileOpen() } - - void BrowserMainWindow::slotFilePrintPreview() { if (!currentTab()) @@ -593,7 +560,6 @@ void BrowserMainWindow::slotFilePrintPreview() } - void BrowserMainWindow::slotFilePrint() { if (!currentTab()) @@ -602,7 +568,6 @@ void BrowserMainWindow::slotFilePrint() } - void BrowserMainWindow::printRequested(QWebFrame *frame) { QPrinter printer; @@ -614,7 +579,6 @@ void BrowserMainWindow::printRequested(QWebFrame *frame) } - void BrowserMainWindow::slotPrivateBrowsing() { QWebSettings *settings = QWebSettings::globalSettings(); @@ -654,7 +618,6 @@ void BrowserMainWindow::slotPrivateBrowsing() } - void BrowserMainWindow::closeEvent(QCloseEvent *event) { if (m_tabWidget->count() > 1) @@ -710,7 +673,6 @@ void BrowserMainWindow::slotFindPrevious() } - void BrowserMainWindow::slotViewTextBigger() { if (!currentTab()) @@ -719,7 +681,6 @@ void BrowserMainWindow::slotViewTextBigger() } - void BrowserMainWindow::slotViewTextNormal() { if (!currentTab()) @@ -728,7 +689,6 @@ void BrowserMainWindow::slotViewTextNormal() } - void BrowserMainWindow::slotViewTextSmaller() { if (!currentTab()) @@ -737,8 +697,6 @@ void BrowserMainWindow::slotViewTextSmaller() } - - void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen) { if (makeFullScreen) @@ -766,8 +724,6 @@ void BrowserMainWindow::slotViewFullScreen(bool makeFullScreen) } - - void BrowserMainWindow::slotViewPageSource() { if (!currentTab()) @@ -782,7 +738,6 @@ void BrowserMainWindow::slotViewPageSource() } - void BrowserMainWindow::slotHome() { KConfig config("rekonqrc"); @@ -792,17 +747,6 @@ void BrowserMainWindow::slotHome() } - - -void BrowserMainWindow::slotWebSearch() -{ -// m_toolbarSearch->lineEdit()->selectAll(); -// m_toolbarSearch->lineEdit()->setFocus(); -} - - - - void BrowserMainWindow::slotToggleInspector(bool enable) { QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); @@ -820,8 +764,6 @@ void BrowserMainWindow::slotToggleInspector(bool enable) } - - void BrowserMainWindow::slotSwapFocus() { if (currentTab()->hasFocus()) @@ -831,20 +773,17 @@ void BrowserMainWindow::slotSwapFocus() } - void BrowserMainWindow::loadPage(const QString &page) { if (!currentTab() || page.isEmpty()) return; - QUrl url = guessUrlFromString(page); - m_tabWidget->currentLineEdit()->setText(url.toString()); + KUrl url = guessUrlFromString(page); + m_tabWidget->currentLineEdit()->setText( url.prettyUrl() ); m_tabWidget->loadUrlInCurrentTab(url); } - - TabWidget *BrowserMainWindow::tabWidget() const { return m_tabWidget; @@ -879,8 +818,6 @@ void BrowserMainWindow::slotLoadProgress(int progress) } - - void BrowserMainWindow::slotAboutToShowBackMenu() { m_historyBackMenu->clear(); @@ -901,7 +838,6 @@ void BrowserMainWindow::slotAboutToShowBackMenu() } - void BrowserMainWindow::slotShowWindow() { if (KAction *action = qobject_cast<KAction*>(sender())) @@ -918,8 +854,6 @@ void BrowserMainWindow::slotShowWindow() } - - void BrowserMainWindow::slotOpenActionUrl(QAction *action) { int offset = action->data().toInt(); @@ -953,6 +887,7 @@ void BrowserMainWindow::slotOpenNext() history->goToItem( history->forwardItem() ); } + void BrowserMainWindow::geometryChangeRequested(const QRect &geometry) { setGeometry(geometry); diff --git a/src/browsermainwindow.h b/src/browsermainwindow.h index 811584f8..19ab51c9 100644 --- a/src/browsermainwindow.h +++ b/src/browsermainwindow.h @@ -32,6 +32,7 @@ #include <KIcon> #include <KToolBar> #include <KAction> +#include <KToggleAction> #include <KMenu> @@ -88,7 +89,6 @@ private slots: void slotPrivateBrowsing(); void slotFileSaveAs(); - void slotAddBookmark(); void slotViewTextBigger(); void slotViewTextNormal(); void slotViewTextSmaller(); @@ -97,7 +97,6 @@ private slots: void slotViewFullScreen(bool enable); void slotViewFindBar(); - void slotWebSearch(); void slotToggleInspector(bool enable); void slotDownloadManager(); void slotSelectLineEdit(); @@ -137,9 +136,8 @@ private: KAction *m_reload; KAction *m_stopReload; KAction *m_goHome; - KAction *m_viewStatusbar; + KToggleAction *m_viewStatusbar; KAction *m_restoreLastSession; - KAction *m_addBookmark; KIcon m_reloadIcon; KIcon m_stopIcon; diff --git a/src/tabwidget.cpp b/src/tabwidget.cpp index 7f39bd8a..51a404d0 100644 --- a/src/tabwidget.cpp +++ b/src/tabwidget.cpp @@ -28,6 +28,9 @@ #include "urlbar.h" #include "webview.h" +// KDE Includes +#include <KShortcut> + // Qt Includes #include <QtGui> #include <QDebug> @@ -183,7 +186,8 @@ void TabBar::dropEvent(QDropEvent *event) void TabBar::reloadTab() { - if (KAction *action = qobject_cast<KAction*>(sender())) { + if (KAction *action = qobject_cast<KAction*>(sender())) + { int index = action->data().toInt(); emit reloadTab(index); } @@ -218,29 +222,21 @@ TabWidget::TabWidget(QWidget *parent) // Actions m_newTabAction = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - m_newTabAction->setShortcuts(KShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_N, Qt::CTRL+Qt::Key_T)); + m_newTabAction->setShortcut( 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->setShortcut(Qt::CTRL+Qt::Key_W); + m_closeTabAction->setShortcut( KShortcut( Qt::CTRL + Qt::Key_W ) ); m_closeTabAction->setIconVisibleInMenu(false); connect(m_closeTabAction, SIGNAL(triggered()), this, SLOT(closeTab())); m_nextTabAction = new KAction(i18n("Show Next Tab"), this); - QList<QKeySequence> shortcuts; - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceRight)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageDown)); - shortcuts.append(QKeySequence(Qt::CTRL + Qt::Key_Tab)); - m_nextTabAction->setShortcuts(shortcuts); + m_nextTabAction->setShortcut( KShortcut( Qt::CTRL | Qt::Key_Tab ) ); connect(m_nextTabAction, SIGNAL(triggered()), this, SLOT(nextTab())); m_previousTabAction = new KAction(i18n("Show Previous Tab"), this); - shortcuts.clear(); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_BraceLeft)); - shortcuts.append(QKeySequence(Qt::CTRL | Qt::Key_PageUp)); - shortcuts.append( QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab) );; - m_previousTabAction->setShortcuts(shortcuts); + m_previousTabAction->setShortcut( KShortcut( Qt::CTRL | Qt::SHIFT | Qt::Key_Tab ) ); connect(m_previousTabAction, SIGNAL(triggered()), this, SLOT(previousTab())); m_recentlyClosedTabsMenu = new KMenu(this); |