summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lineedit.cpp2
-rw-r--r--src/mainwindow.cpp16
-rw-r--r--src/searchbar.cpp19
-rw-r--r--src/searchbar.h6
-rw-r--r--src/webview.cpp152
-rw-r--r--src/webview.h4
6 files changed, 83 insertions, 116 deletions
diff --git a/src/lineedit.cpp b/src/lineedit.cpp
index 9ca963af..dd90ce5a 100644
--- a/src/lineedit.cpp
+++ b/src/lineedit.cpp
@@ -33,7 +33,7 @@
LineEdit::LineEdit(QWidget* parent)
: KLineEdit(parent)
{
- setMinimumWidth(180);
+ setMinimumWidth(200);
setFocusPolicy(Qt::WheelFocus);
setHandleSignals(true);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index adc6fc87..930a4e64 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -224,7 +224,11 @@ void MainWindow::setupActions()
KStandardAction::find(this, SLOT(slotViewFindBar()) , actionCollection());
KStandardAction::findNext(this, SLOT(slotFindNext()) , actionCollection());
KStandardAction::findPrev(this, SLOT(slotFindPrevious()) , actionCollection());
- KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection());
+
+ // we all like "short" shortcuts.. ;)
+ a = KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection());
+ a->setShortcut(KShortcut(Qt::Key_F11));
+
KStandardAction::home(this, SLOT(slotHome()), actionCollection());
KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection());
KStandardAction::showMenubar(this, SLOT(slotShowMenubar(bool)), actionCollection());
@@ -332,15 +336,9 @@ void MainWindow::setupSidePanel()
addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel);
// setup side panel actions
- KAction* a = new KAction(this);
- a->setText(i18n("History"));
- a->setCheckable(true);
- a->setChecked(ReKonfig::showSideBar());
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
+ QAction* a = m_sidePanel->toggleViewAction();
+ a->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
actionCollection()->addAction(QLatin1String("show_history_panel"), a);
-
- // connect to toogle action
- connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger()));
}
diff --git a/src/searchbar.cpp b/src/searchbar.cpp
index 9f6b306d..48e9290a 100644
--- a/src/searchbar.cpp
+++ b/src/searchbar.cpp
@@ -28,6 +28,7 @@
// KDE Includes
#include <KUrl>
+#include <KCompletionBox>
// Qt Includes
#include <QtCore/QString>
@@ -38,19 +39,16 @@
#include <QtXml/QXmlStreamReader>
-SearchBar::SearchBar(QWidget *parent) :
- KLineEdit(parent)
- , m_networkAccessManager(new QNetworkAccessManager(this))
- , m_timer(new QTimer(this))
+SearchBar::SearchBar(QWidget *parent)
+ : LineEdit(parent)
+ , m_networkAccessManager(new QNetworkAccessManager(this))
+ , m_timer(new QTimer(this))
{
- setMinimumWidth(180);
-
setFocusPolicy(Qt::WheelFocus);
setMouseTracking(true);
setAcceptDrops(true);
- QSizePolicy policy = sizePolicy();
- setSizePolicy(QSizePolicy::Preferred, policy.verticalPolicy());
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
setClearButtonShown(true);
@@ -80,6 +78,7 @@ void SearchBar::searchNow()
{
m_timer->stop();
QString searchText = text();
+ completionBox()->hide();
KUrl url(QLatin1String("http://www.google.com/search"));
url.addQueryItem(QLatin1String("q"), searchText);
@@ -92,8 +91,8 @@ void SearchBar::searchNow()
void SearchBar::focusInEvent(QFocusEvent *event)
{
- KLineEdit::focusInEvent(event);
- clear();
+ selectAll();
+ LineEdit::focusInEvent(event);
}
diff --git a/src/searchbar.h b/src/searchbar.h
index 29588c58..fe30c946 100644
--- a/src/searchbar.h
+++ b/src/searchbar.h
@@ -22,8 +22,8 @@
#ifndef SEARCHBAR_H
#define SEARCHBAR_H
-// KDE Includes
-#include <KLineEdit>
+// Local Includes
+#include "lineedit.h"
// Forward Declarations
class KUrl;
@@ -36,7 +36,7 @@ class QNetworkReply;
* This class defines an internet search bar.
*
*/
-class SearchBar : public KLineEdit
+class SearchBar : public LineEdit
{
Q_OBJECT
diff --git a/src/webview.cpp b/src/webview.cpp
index 055f2f7d..01fd0d00 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -290,9 +290,6 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply)
// -----------------------------------------------------------------------------------------------------------------
-KActionCollection* WebView::s_webActionCollection;
-
-
WebView::WebView(QWidget* parent)
: QWebView(parent)
, m_page(new WebPage(this))
@@ -308,63 +305,6 @@ WebView::WebView(QWidget* parent)
}
-KActionCollection* WebView::webActions()
-{
- if (!s_webActionCollection)
- {
- s_webActionCollection = new KActionCollection(this);
-
- QAction *a;
-
- a = new KAction(KIcon("tab-new"), i18n("Open Link in New &Tab"), this);
- connect(a, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
- s_webActionCollection->addAction(QLatin1String("open_link_in_new_tab"), a);
-
- a = pageAction(QWebPage::Cut);
- a->setIcon(KIcon("edit-cut"));
- a->setText(i18n("Cu&t"));
- s_webActionCollection->addAction(QLatin1String("edit_cut"), a);
-
- a = pageAction(QWebPage::Copy);
- a->setIcon(KIcon("edit-copy"));
- a->setText(i18n("&Copy"));
- s_webActionCollection->addAction(QLatin1String("edit_copy"), a);
-
- a = pageAction(QWebPage::Paste);
- a->setIcon(KIcon("edit-paste"));
- a->setText(i18n("&Paste"));
- s_webActionCollection->addAction(QLatin1String("edit_paste"), a);
-
- a = pageAction(QWebPage::DownloadImageToDisk);
- a->setIcon(KIcon("folder-image"));
- a->setText(i18n("&Save Image As..."));
- s_webActionCollection->addAction(QLatin1String("save_image_as"), a);
-
- a = pageAction(QWebPage::CopyImageToClipboard);
- a->setIcon(KIcon("insert-image"));
- a->setText(i18n("&Copy This Image"));
- s_webActionCollection->addAction(QLatin1String("copy_this_image"), a);
-
- a = pageAction(QWebPage::DownloadLinkToDisk);
- a->setIcon(KIcon("folder-downloads"));
- a->setText(i18n("&Save Link As..."));
- s_webActionCollection->addAction(QLatin1String("save_link_as"), a);
-
- a = pageAction(QWebPage::CopyLinkToClipboard);
- a->setIcon(KIcon("insert-link"));
- a->setText(i18n("&Copy Link Location"));
- s_webActionCollection->addAction(QLatin1String("copy_link_location"), a);
-
- a = pageAction(QWebPage::InspectElement);
- a->setIcon(KIcon("tools-report-bug"));
- a->setText(i18n("&Inspect Element"));
- s_webActionCollection->addAction(QLatin1String("inspect_element"), a);
- }
-
- return s_webActionCollection;
-}
-
-
void WebView::contextMenuEvent(QContextMenuEvent *event)
{
QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
@@ -373,28 +313,62 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("add_bookmark_payload");
addBookmarkAction->setText(i18n("Bookmark This Page"));
addBookmarkAction->setData(QVariant());
+
KMenu menu(this);
+ QAction *a;
+ // link actions
+ bool linkIsEmpty = result.linkUrl().isEmpty();
+ if (!linkIsEmpty)
+ {
+ a = new KAction(KIcon("tab-new"), i18n("Open Link in New &Tab"), this);
+ connect(a, SIGNAL(triggered()), this, SLOT(openLinkInNewTab()));
+ menu.addAction(a);
+ }
+ else
+ {
+ menu.addAction(mainwindow->actionByName("new_tab"));
+ }
+ menu.addAction(mainwindow->actionByName("view_redisplay"));
+ menu.addSeparator();
+
+ // Developer Extras actions
+ if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
+ {
+ a = pageAction(QWebPage::InspectElement);
+ a->setIcon(KIcon("tools-report-bug"));
+ a->setText(i18n("&Inspect Element"));
+ menu.addAction(a);
+ menu.addSeparator();
+ }
// cut - copy - paste Actions.
- // If someone selects text perhaps wanna work with it..
bool b = false;
if (result.isContentSelected() && result.isContentEditable())
{
- menu.addAction(webActions()->action("edit_cut"));
+ a = pageAction(QWebPage::Cut);
+ a->setIcon(KIcon("edit-cut"));
+ a->setText(i18n("Cu&t"));
+ menu.addAction(a);
b = true;
}
if (result.isContentSelected())
{
- menu.addAction(webActions()->action("edit_copy"));
+ a = pageAction(QWebPage::Copy);
+ a->setIcon(KIcon("edit-copy"));
+ a->setText(i18n("&Copy"));
+ menu.addAction(a);
b = true;
}
if (result.isContentEditable())
{
- menu.addAction(webActions()->action("edit_paste"));
+ a = pageAction(QWebPage::Paste);
+ a->setIcon(KIcon("edit-paste"));
+ a->setText(i18n("&Paste"));
+ menu.addAction(a);
b = true;
}
@@ -403,38 +377,34 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addSeparator();
}
- // link actions
- bool linkIsEmpty = result.linkUrl().isEmpty();
+ // save/copy link actions
if (!linkIsEmpty)
{
- menu.addAction(webActions()->action("open_link_in_new_tab"));
- }
- else
- {
- menu.addAction(mainwindow->actionByName("new_tab"));
- }
- menu.addAction(mainwindow->actionByName("view_redisplay"));
- menu.addSeparator();
+ a = pageAction(QWebPage::DownloadLinkToDisk);
+ a->setIcon(KIcon("folder-downloads"));
+ a->setText(i18n("&Save Link As..."));
+ menu.addAction(a);
- // Developer Extras actions
- if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
- {
- menu.addAction(webActions()->action("inspect_element"));
- menu.addSeparator();
- }
+ a = pageAction(QWebPage::CopyLinkToClipboard);
+ a->setIcon(KIcon("insert-link"));
+ a->setText(i18n("&Copy Link Location"));
+ menu.addAction(a);
- // save/copy link actions
- if (!linkIsEmpty)
- {
- menu.addAction(webActions()->action("save_link_as"));
- menu.addAction(webActions()->action("copy_link_location"));
menu.addSeparator();
if (!result.pixmap().isNull())
{
- // TODO Add "View Image"
- menu.addAction(webActions()->action("save_image_as"));
- menu.addAction(webActions()->action("copy_this_image"));
+ // TODO Add "View Image" && remove copy_this_image action
+ a = pageAction(QWebPage::DownloadImageToDisk);
+ a->setIcon(KIcon("folder-image"));
+ a->setText(i18n("&Save Image As..."));
+ menu.addAction(a);
+
+ a = pageAction(QWebPage::CopyImageToClipboard);
+ a->setIcon(KIcon("insert-image"));
+ a->setText(i18n("&Copy This Image"));
+ menu.addAction(a);
+
menu.addSeparator();
}
}
@@ -452,6 +422,11 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(addBookmarkAction);
}
+ if(mainwindow->isFullScreen())
+ {
+ menu.addAction(mainwindow->actionByName("fullscreen"));
+ }
+
menu.exec(mapToGlobal(event->pos()));
}
@@ -534,4 +509,3 @@ void WebView::keyPressEvent(QKeyEvent *event)
QWebView::keyPressEvent(event);
}
-
diff --git a/src/webview.h b/src/webview.h
index 3742a36d..eba02505 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -92,8 +92,6 @@ class WebView : public QWebView
public:
WebView(QWidget *parent = 0);
- KActionCollection* webActions();
-
// inline
WebPage *webPage() const { return m_page; }
KUrl url() const { return KUrl(QWebView::url()); }
@@ -125,8 +123,6 @@ private slots:
void openLinkInNewTab();
private:
- static KActionCollection* s_webActionCollection;
-
WebPage *m_page;
int m_progress;