diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54e64ab6..43418ed3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -320,7 +320,9 @@ void MainWindow::setupActions() browserLoading(false); //first init for blank start page a = new KAction(i18n("Open Location"), this); - a->setShortcut(Qt::CTRL + Qt::Key_L); + KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L); + openLocationShortcut.setAlternate(Qt::Key_F6); + a->setShortcut(openLocationShortcut); actionCollection()->addAction(QL1S("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation())); @@ -398,6 +400,16 @@ void MainWindow::setupActions() closedTabsMenu->setDelayed(false); actionCollection()->addAction(QL1S("closed_tab_menu"), closedTabsMenu); + // shortcuts for quickly switching to a tab + for( int i = 1; i <= 9; i++ ) { + a = new KAction(i18n("Switch to Tab %1", i), this); + a->setShortcut(KShortcut( QString("Alt+%1").arg(i) )); + a->setData( QVariant(i) ); + actionCollection()->addAction(QL1S(("switch_tab_" + QString::number(i)).toAscii()), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(switchToTab())); + } + + // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); actionCollection()->addAction(QL1S("close_tab"), a); @@ -941,26 +953,8 @@ void MainWindow::viewPageSource() if (!currentTab()) return; - KUrl url(currentTab()->url()); - bool isTempFile = false; - if (!url.isLocalFile()) - { - KTemporaryFile sourceFile; - - /// TODO: autochoose tempfile suffix - sourceFile.setSuffix(QString(".html")); - sourceFile.setAutoRemove(false); - - if (sourceFile.open()) - { - sourceFile.write(currentTab()->page()->mainFrame()->toHtml().toUtf8()); - - url = KUrl(); - url.setPath(sourceFile.fileName()); - isTempFile = true; - } - } - KRun::runUrl(url, QL1S("text/plain"), this, isTempFile); + KUrl url = currentTab()->url(); + KRun::runUrl(url, QL1S("text/plain"), this, false); } |