summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/RELEASE_HOWTO2
-rw-r--r--src/mainwindow.cpp23
-rw-r--r--src/tabbar.cpp72
-rw-r--r--src/tabbar.h5
-rw-r--r--src/urlbar.cpp35
-rw-r--r--src/urlbar.h1
-rw-r--r--src/webview.cpp2
7 files changed, 92 insertions, 48 deletions
diff --git a/scripts/RELEASE_HOWTO b/scripts/RELEASE_HOWTO
index 29492538..ec2ca3ce 100644
--- a/scripts/RELEASE_HOWTO
+++ b/scripts/RELEASE_HOWTO
@@ -10,7 +10,7 @@ Section 0: A few days in advance
SECTION 1: Preparation
* Check the README file is still relevant
-* Bump Version Number (in the CMakeLists.txt && in src/main.cpp) (TODO: something better?)
+* Bump Version Number (in the CMakeLists.txt file)
* Commit the source to GIT
--------------------------------------------------------------------------------
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index fcd5a778..d09bb490 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -340,16 +340,15 @@ void MainWindow::setupActions()
KStandardAction::forward(this, SLOT(slotOpenNext()) , actionCollection());
- // ============================== Tab Actions ====================================
+ // ============================== General Tab Actions ====================================
a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T));
actionCollection()->addAction(QLatin1String("new_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab()));
- 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(slotCloseTab()));
+ a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this);
+ actionCollection()->addAction( QLatin1String("reload_all_tabs"), a);
+ connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotReloadAllTabs()) );
a = new KAction(i18n("Show Next Tab"), this);
a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
@@ -361,6 +360,12 @@ void MainWindow::setupActions()
actionCollection()->addAction(QLatin1String("show_prev_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab()));
+ // ============================== Indexed Tab Actions ====================================
+ 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->tabBar(), SLOT(closeTab()));
+
a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this);
actionCollection()->addAction(QLatin1String("clone_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab()) );
@@ -372,14 +377,8 @@ void MainWindow::setupActions()
a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this);
actionCollection()->addAction( QLatin1String("reload_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()) );
-
- a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this);
- actionCollection()->addAction( QLatin1String("reload_all_tabs"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotReloadAllTabs()) );
-
- // ------------------------------------------------------------------------------------------------------------
- // Bookmarks ToolBar Action
+ // ----------------------- Bookmarks ToolBar Action --------------------------------------
QAction *qa = m_bmBar->toggleViewAction();
qa->setText( i18n("Bookmarks Toolbar") );
qa->setIcon( KIcon("bookmark-toolbar") );
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index b43bf4d0..65a65f7e 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -75,8 +75,8 @@ TabBar::TabBar(MainView *parent)
setContextMenuPolicy(Qt::CustomContextMenu);
- connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this,
- SLOT(contextMenuRequested(const QPoint &)));
+ connect(this, SIGNAL(contextMenu(int, const QPoint &)), this, SLOT(slotContextMenuRequested(int, const QPoint &)));
+ connect(this, SIGNAL(emptyAreaContextMenu(const QPoint &)), this, SLOT(slotEmptyAreaContextMenu(const QPoint &)));
QTimer::singleShot(0, this, SLOT(postLaunch()));
}
@@ -136,33 +136,6 @@ QSize TabBar::tabSizeHint(int index) const
}
-void TabBar::contextMenuRequested(const QPoint &position)
-{
- KMenu menu;
- MainWindow *mainWindow = Application::instance()->mainWindow();
-
- menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
- int index = tabAt(position);
- if (-1 != index)
- {
- m_actualIndex = index;
-
- menu.addAction( mainWindow->actionByName("clone_tab") );
- menu.addSeparator();
- menu.addAction( mainWindow->actionByName("close_tab") );
- menu.addAction( mainWindow->actionByName("close_other_tabs") );
- menu.addSeparator();
- menu.addAction( mainWindow->actionByName("reload_tab") );
- }
- else
- {
- menu.addSeparator();
- }
- menu.addAction( mainWindow->actionByName("reload_all_tabs") );
- menu.exec(QCursor::pos());
-}
-
-
void TabBar::cloneTab()
{
emit cloneTab(m_actualIndex);
@@ -190,21 +163,23 @@ void TabBar::reloadTab()
void TabBar::showTabPreview(int tab)
{
WebView *view = m_parent->webView(tab);
-
+ WebView *currentView = m_parent->webView(currentIndex());
+
int w = tabSizeHint(tab).width();
- int h = w*((0.0 + view->height())/view->width());
+ int h = w*((0.0 + currentView->height())/currentView->width());
//delete previous tab preview
if (m_previewPopup)
{
delete m_previewPopup;
}
-
+
m_previewPopup = new KPassivePopup(this);
m_previewPopup->setFrameShape(QFrame::StyledPanel);
m_previewPopup->setFrameShadow(QFrame::Plain);
m_previewPopup->setFixedSize(w, h);
QLabel *l = new QLabel();
+ view->page()->setViewportSize(currentView->page()->viewportSize());
l->setPixmap(WebSnap::renderPreview(*(view->page()), w, h));
m_previewPopup->setView(l);
m_previewPopup->layout()->setAlignment(Qt::AlignTop);
@@ -310,3 +285,36 @@ void TabBar::updateNewTabButton()
m_addTabButton->move(newPosX, newPosY);
}
}
+
+
+void TabBar::slotContextMenuRequested(int tab, const QPoint &pos)
+{
+ m_actualIndex = tab;
+
+ KMenu menu;
+ MainWindow *mainWindow = Application::instance()->mainWindow();
+
+ menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
+ menu.addAction( mainWindow->actionByName("clone_tab") );
+ menu.addSeparator();
+ menu.addAction( mainWindow->actionByName("close_tab") );
+ menu.addAction( mainWindow->actionByName("close_other_tabs") );
+ menu.addSeparator();
+ menu.addAction( mainWindow->actionByName("reload_tab") );
+ menu.addAction( mainWindow->actionByName("reload_all_tabs") );
+
+ menu.exec(pos);
+}
+
+
+void TabBar::slotEmptyAreaContextMenu(const QPoint &pos)
+{
+ KMenu menu;
+ MainWindow *mainWindow = Application::instance()->mainWindow();
+
+ menu.addAction(mainWindow->actionByName(QLatin1String("new_tab")));
+ menu.addSeparator();
+ menu.addAction( mainWindow->actionByName("reload_all_tabs") );
+
+ menu.exec(pos);
+}
diff --git a/src/tabbar.h b/src/tabbar.h
index 57b78628..f68528b8 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -86,9 +86,12 @@ private slots:
void closeTab();
void closeOtherTabs();
void reloadTab();
- void contextMenuRequested(const QPoint &position);
+
void postLaunch();
+ void slotContextMenuRequested(int, const QPoint &);
+ void slotEmptyAreaContextMenu(const QPoint &);
+
private:
MainView *m_parent;
QToolButton *m_addTabButton;
diff --git a/src/urlbar.cpp b/src/urlbar.cpp
index b6340fe7..d587fd80 100644
--- a/src/urlbar.cpp
+++ b/src/urlbar.cpp
@@ -140,7 +140,7 @@ void UrlBar::setUrl(const QUrl& url)
}
else
m_currentUrl = url;
-
+
slotUpdateUrl();
}
@@ -303,3 +303,36 @@ bool UrlBar::isLoading()
}
return true;
}
+
+void UrlBar::keyPressEvent(QKeyEvent *event)
+{
+ QString currentText = m_lineEdit->text().trimmed();
+ if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ && !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive))
+ {
+ QString append;
+ if (event->modifiers() == Qt::ControlModifier)
+ {
+ append = QLatin1String(".com");
+ }
+ else if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
+ {
+ append = QLatin1String(".org");
+ }
+ else if (event->modifiers() == Qt::ShiftModifier)
+ {
+ append = QLatin1String(".net");
+ }
+
+ QUrl url(QLatin1String("http://www.") + currentText);
+ QString host = url.host();
+ if (!host.endsWith(append, Qt::CaseInsensitive))
+ {
+ host += append;
+ url.setHost(host);
+ m_lineEdit->setText(url.toString());
+ }
+ }
+
+ KHistoryComboBox::keyPressEvent(event);
+} \ No newline at end of file
diff --git a/src/urlbar.h b/src/urlbar.h
index 28b1dc08..787032fb 100644
--- a/src/urlbar.h
+++ b/src/urlbar.h
@@ -80,6 +80,7 @@ private slots:
protected:
virtual void paintEvent(QPaintEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
+ virtual void keyPressEvent(QKeyEvent *event);
private:
void setupLineEdit();
diff --git a/src/webview.cpp b/src/webview.cpp
index 3bef7c1f..60bb496b 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -353,7 +353,7 @@ void WebView::mousePressEvent(QMouseEvent *event)
m_page->m_pressedButtons = event->buttons();
m_page->m_keyboardModifiers = event->modifiers();
- switch(event->button())
+ switch(event->button())
{
case Qt::XButton1:
triggerPageAction(QWebPage::Back);