summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/mainview.cpp68
-rw-r--r--src/mainwindow.cpp5
-rw-r--r--src/protocolhandler.cpp1
-rw-r--r--src/urlbar/iconbutton.cpp76
-rw-r--r--src/urlbar/iconbutton.h51
-rw-r--r--src/urlbar/lineedit.cpp71
-rw-r--r--src/urlbar/lineedit.h19
-rw-r--r--src/urlbar/urlbar.cpp208
-rw-r--r--src/urlbar/urlbar.h20
-rw-r--r--src/webpage.cpp35
-rw-r--r--src/webpage.h6
-rw-r--r--src/webview.cpp10
-rw-r--r--src/webview.h3
14 files changed, 361 insertions, 213 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a68faa59..8728bff8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,6 +49,7 @@ SET( rekonq_KDEINIT_SRCS
#----------------------------------------
urlbar/urlbar.cpp
urlbar/lineedit.cpp
+ urlbar/iconbutton.cpp
urlbar/completionwidget.cpp
urlbar/urlresolver.cpp
urlbar/listitem.cpp
diff --git a/src/mainview.cpp b/src/mainview.cpp
index a00325fb..b5829806 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -366,7 +366,7 @@ void MainView::newTab()
w->load( KUrl("about:home") );
break;
case 1: // blank page
- urlBar()->setUrl(KUrl(""));
+ urlBar()->clear();
break;
case 2: // homepage
w->load( KUrl(ReKonfig::homePage()) );
@@ -452,16 +452,18 @@ void MainView::cloneTab(int index)
// When index is -1 index chooses the current tab
void MainView::closeTab(int index)
{
+ urlBar()->clear();
+
// open default homePage if just one tab is opened
if (count() == 1)
{
WebView *w = currentWebTab()->view();
- urlBar()->setUrl(KUrl(""));
switch(ReKonfig::newTabsBehaviour())
{
case 0: // new tab page
case 1: // blank page
w->load( KUrl("about:home") );
+ urlBar()->setFocus();
break;
case 2: // homepage
w->load( KUrl(ReKonfig::homePage()) );
@@ -469,7 +471,6 @@ void MainView::closeTab(int index)
default:
break;
}
- urlBar()->setFocus();
return;
}
@@ -478,43 +479,36 @@ void MainView::closeTab(int index)
if (index < 0 || index >= count())
return;
- bool hasFocus = false;
WebTab *tab = webTab(index);
- if (tab)
- {
- if (tab->view()->isModified())
- {
- int risp = KMessageBox::warningContinueCancel(this,
- i18n("This tab contains changes that have not been submitted.\n"
- "Closing the tab will discard these changes.\n"
- "Do you really want to close this tab?\n"),
- i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel());
- if (risp != KMessageBox::Continue)
- return;
- }
- hasFocus = tab->hasFocus();
-
- // store close tab except homepage
- if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty())
- {
- QString title = tab->view()->title();
- QString url = tab->url().prettyUrl();
- HistoryItem item(url, QDateTime::currentDateTime(), title);
- m_recentlyClosedTabs.removeAll(item);
- m_recentlyClosedTabs.prepend(item);
- }
+ if (!tab)
+ return;
- removeTab(index);
- updateTabBar(); // UI operation: do it ASAP!!
- tab->deleteLater(); // tab is scheduled for deletion.
-
- emit tabsChanged();
+ if (tab->view()->isModified())
+ {
+ int risp = KMessageBox::warningContinueCancel(this,
+ i18n("This tab contains changes that have not been submitted.\n"
+ "Closing the tab will discard these changes.\n"
+ "Do you really want to close this tab?\n"),
+ i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"),"tab-close"), KStandardGuiItem::cancel());
+ if (risp != KMessageBox::Continue)
+ return;
+ }
- if (hasFocus && count() > 0)
- {
- currentWebTab()->setFocus();
- }
+ // store close tab except homepage
+ if (!tab->url().prettyUrl().startsWith( QLatin1String("about:") ) && !tab->url().isEmpty())
+ {
+ QString title = tab->view()->title();
+ QString url = tab->url().prettyUrl();
+ HistoryItem item(url, QDateTime::currentDateTime(), title);
+ m_recentlyClosedTabs.removeAll(item);
+ m_recentlyClosedTabs.prepend(item);
}
+
+ removeTab(index);
+ updateTabBar(); // UI operation: do it ASAP!!
+ tab->deleteLater(); // tab is scheduled for deletion.
+
+ emit tabsChanged();
}
@@ -582,8 +576,6 @@ void MainView::webViewIconChanged()
delete movie;
label->setMovie(0);
label->setPixmap(icon.pixmap(16, 16));
-
- urlBar()->updateUrl();
}
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c49df102..a3c07cec 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -545,11 +545,6 @@ void MainWindow::setupPanels()
void MainWindow::updateConfiguration()
{
- kDebug() << "======================================================================================================================";
- kDebug() << "======================================================================================================================";
- kDebug() << "======================================================================================================================";
- kDebug() << "======================================================================================================================";
-
// ============== General ==================
m_view->updateTabBar();
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index faba894b..f6867e81 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -305,7 +305,6 @@ void ProtocolHandler::showResults(const KFileItemList &list)
_frame->setHtml( html, _url );
Application::instance()->mainWindow()->currentTab()->setFocus();
- Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(_url);
Application::historyManager()->addHistoryEntry( _url.prettyUrl() );
delete _lister;
diff --git a/src/urlbar/iconbutton.cpp b/src/urlbar/iconbutton.cpp
new file mode 100644
index 00000000..60008993
--- /dev/null
+++ b/src/urlbar/iconbutton.cpp
@@ -0,0 +1,76 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "iconbutton.h"
+#include "iconbutton.moc"
+
+// Local Includes
+#include "application.h"
+
+// KDE Includes
+#include <KDebug>
+
+
+IconButton::IconButton(QWidget *parent)
+ : QToolButton(parent)
+{
+ QPalette p = palette();
+ p.setColor( QPalette::Button, Qt::transparent );
+ setPalette(p);
+
+ setCursor(Qt::ArrowCursor);
+ setStyleSheet("IconButton { border: none; padding: 0px}");
+}
+
+
+void IconButton::setIconUrl(const KUrl &url, bool trusted)
+{
+ setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ setIcon( Application::icon(url) );
+ setText( url.host() );
+
+ if(trusted)
+ {
+ setStyleSheet("IconButton { background-color:#0F0; padding: 2px }");
+ }
+ else
+ {
+ setStyleSheet("IconButton { background-color:#F00; padding: 2px}");
+ }
+
+ adjustSize();
+}
+
+
+void IconButton::updateIcon(KIcon icon)
+{
+ setToolButtonStyle(Qt::ToolButtonIconOnly);
+ setIcon( icon );
+
+ setStyleSheet("IconButton { background-color:transparent; border: none; padding: 0px}");
+ adjustSize();
+}
diff --git a/src/urlbar/iconbutton.h b/src/urlbar/iconbutton.h
new file mode 100644
index 00000000..b66e212b
--- /dev/null
+++ b/src/urlbar/iconbutton.h
@@ -0,0 +1,51 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+
+#ifndef ICON_BUTTON_H
+#define ICON_BUTTON_H
+
+
+// KDE Includes
+#include <KUrl>
+#include <KIcon>
+
+// Qt Includes
+#include <QToolButton>
+
+
+class IconButton : public QToolButton
+{
+ Q_OBJECT
+
+public:
+ IconButton(QWidget *parent = 0);
+
+ void setIconUrl(const KUrl &url, bool trusted);
+ void updateIcon(KIcon icon);
+};
+
+#endif // ICON_BUTTON_H
diff --git a/src/urlbar/lineedit.cpp b/src/urlbar/lineedit.cpp
index ac92b858..f7af1f61 100644
--- a/src/urlbar/lineedit.cpp
+++ b/src/urlbar/lineedit.cpp
@@ -30,24 +30,64 @@
#include "lineedit.h"
#include "lineedit.moc"
+// KDE Includes
+#include <klocalizedstring.h>
+#include <KDebug>
+
// Qt Includes
#include <QtGui/QContextMenuEvent>
#include <QtGui/QFocusEvent>
#include <QtGui/QKeyEvent>
+#include <QStyleOptionFrameV2>
+#include <QPainter>
LineEdit::LineEdit(QWidget* parent)
- : KLineEdit(parent)
+ : KLineEdit(parent)
+ , _icon( new IconButton(this) )
{
+ // cosmetic
+ setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setMinimumWidth(200);
- setFocusPolicy(Qt::WheelFocus);
- setHandleSignals(true);
+ setMinimumHeight(26);
+ updateStyles();
+
+ // doesn't show the clear button
setClearButtonShown(false);
+
+ // trap Key_Enter & Key_Return events, while emitting the returnPressed signal
+ setTrapReturnKey(true);
+
+ // insert decoded URLs
+ setUrlDropsEnabled(true);
+
+ // accept focus, via tabbing, clicking & wheeling
+ setFocusPolicy(Qt::WheelFocus);
+
+ // disable completion object (we have our own :) )
+ setCompletionObject(0);
}
LineEdit::~LineEdit()
{
+ delete _icon;
+}
+
+
+void LineEdit::updateStyles()
+{
+ adjustSize();
+ _icon->adjustSize();
+ if(_icon->toolButtonStyle() == Qt::ToolButtonIconOnly)
+ _icon->move( 4, 3);
+ else
+ _icon->move( 2, 1);
+
+ int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
+ setStyleSheet(QString("LineEdit { padding-left: %1px; } ").arg(_icon->sizeHint().width() + frameWidth + 1));
+
+ update();
}
@@ -67,3 +107,28 @@ void LineEdit::mouseDoubleClickEvent(QMouseEvent *)
{
selectAll();
}
+
+
+IconButton *LineEdit::iconButton() const
+{
+ return _icon;
+}
+
+
+void LineEdit::paintEvent(QPaintEvent *event)
+{
+ KLineEdit::paintEvent(event);
+
+ if (text().isEmpty() && !hasFocus())
+ {
+ QStyleOptionFrame option;
+ initStyleOption(&option);
+ QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
+ QPainter painter(this);
+ painter.setPen(Qt::gray);
+ painter.drawText( textRect,
+ Qt::AlignLeft | Qt::AlignVCenter,
+ i18n("Search Bookmarks, History, Google.. and the Kitchen Sink!")
+ );
+ }
+}
diff --git a/src/urlbar/lineedit.h b/src/urlbar/lineedit.h
index 67ded052..96f25918 100644
--- a/src/urlbar/lineedit.h
+++ b/src/urlbar/lineedit.h
@@ -30,13 +30,20 @@
#define LINEEDIT_H
+// Local Includes
+#include "iconbutton.h"
+
// KDE Includes
#include <KLineEdit>
+#include <KIcon>
+
+#include <QToolButton>
// Forward Declarations
class QContextMenuEvent;
class QFocusEvent;
class QKeyEvent;
+class QStyleOptionFrameV2;
class LineEdit : public KLineEdit
@@ -46,10 +53,18 @@ class LineEdit : public KLineEdit
public:
explicit LineEdit(QWidget *parent = 0);
virtual ~LineEdit();
-
+
+ IconButton *iconButton() const;
+
+ void updateStyles();
+
protected:
- virtual void keyPressEvent(QKeyEvent*);
+ virtual void keyPressEvent(QKeyEvent *);
virtual void mouseDoubleClickEvent(QMouseEvent *);
+ virtual void paintEvent(QPaintEvent *);
+
+private:
+ IconButton *_icon;
};
#endif // LINEEDIT_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 0dc91a1e..dd14a4a3 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -50,124 +50,59 @@
#include <QTimer>
#include <QVBoxLayout>
+// Defines
+#define QL1S(x) QLatin1String(x)
+
UrlBar::UrlBar(QWidget *parent)
- : KComboBox(true, parent)
- , m_lineEdit(new LineEdit)
- , m_box(new CompletionWidget(this))
+ : LineEdit(parent)
+ , _box(new CompletionWidget(this))
, _tab(0)
, _privateMode(false)
{
- //cosmetic
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- setMinimumWidth(180);
-
- // signal handlings
- setTrapReturnKey(true);
- setUrlDropsEnabled(true);
-
- // Make m_lineEdit background transparent
- QPalette p = m_lineEdit->palette();
- p.setColor(QPalette::Base, Qt::transparent);
- m_lineEdit->setPalette(p);
-
- setLineEdit(m_lineEdit);
-
- // clear the URL bar
- m_lineEdit->clear();
// load urls on activated urlbar signal
- connect(this, SIGNAL(returnPressed(const QString&)), SLOT(activated(const QString&)));
-
- installEventFilter(m_box);
- connect(m_box, SIGNAL(chosenUrl(const QString&, Rekonq::OpenType)), SLOT(activated(const QString&, Rekonq::OpenType)));
-}
-
-
-UrlBar::~UrlBar()
-{
-}
+ connect(this, SIGNAL(returnPressed(const QString&)), this, SLOT(activated(const QString&)));
-
-void UrlBar::selectAll() const
-{
- m_lineEdit->selectAll();
+ // suggestions
+ installEventFilter(_box);
+ connect(_box, SIGNAL(chosenUrl(const QString&, Rekonq::OpenType)), SLOT(activated(const QString&, Rekonq::OpenType)));
}
-KUrl UrlBar::url() const
+UrlBar::~UrlBar()
{
- return m_currentUrl;
+ delete _box;
}
-void UrlBar::setUrl(const QUrl& url)
+void UrlBar::setQUrl(const QUrl& url)
{
- if(url.scheme() == "about")
+ if(url.scheme() == QL1S("about") )
{
- m_currentUrl = KUrl();
- updateUrl();
+ iconButton()->updateIcon( KIcon("arrow-right") );
setFocus();
}
else
{
- m_currentUrl = KUrl(url);
- updateUrl();
+ LineEdit::setUrl(url);
+ setCursorPosition(0);
+ iconButton()->updateIcon( Application::icon(url) );
}
-}
-
-
-void UrlBar::updateUrl()
-{
- // Don't change my typed url...
- // FIXME this is not a proper solution (also if it works...)
- if(hasFocus())
- {
- kDebug() << "Don't change my typed url...";
- return;
- }
-
- KIcon icon;
- if(m_currentUrl.isEmpty())
- {
- icon = KIcon("arrow-right");
- }
- else
- {
- icon = Application::icon(m_currentUrl);
- }
-
- if (count())
- {
- changeUrl(0, icon, m_currentUrl);
- }
- else
- {
- insertUrl(0, icon, m_currentUrl);
- }
-
- setCurrentIndex(0);
-
- // important security consideration: always display the beginning
- // of the url rather than its end to prevent spoofing attempts.
- // Must be AFTER setCurrentIndex
- if (!hasFocus())
- {
- m_lineEdit->setCursorPosition(0);
- }
+ updateStyles();
}
void UrlBar::activated(const QString& urlString, Rekonq::OpenType type)
{
- disconnect(this, SIGNAL(editTextChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
+ disconnect(this, SIGNAL(textChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
if (urlString.isEmpty())
return;
clearFocus();
- setUrl(urlString);
- Application::instance()->loadUrl(m_currentUrl, type);
+ setText(urlString);
+ Application::instance()->loadUrl(urlString, type);
}
@@ -185,17 +120,16 @@ void UrlBar::paintEvent(QPaintEvent *event)
// set background color of UrlBar
QPalette p = palette();
- p.setColor(QPalette::Base, backgroundColor);
- setPalette(p);
- KComboBox::paintEvent(event);
-
- if (!hasFocus())
+ int progr = _tab->progress();
+ if (progr == 0)
+ {
+ p.setBrush(QPalette::Base, backgroundColor);
+ }
+ else
{
- QPainter painter(this);
-
QColor loadingColor;
- if (m_currentUrl.scheme() == QLatin1String("https"))
+ if ( _tab->url().scheme() == QLatin1String("https"))
{
loadingColor = QColor(248, 248, 100);
}
@@ -203,30 +137,16 @@ void UrlBar::paintEvent(QPaintEvent *event)
{
loadingColor = QColor(116, 192, 250);
}
- int progr = _tab->progress();
-
- backgroundColor.setAlpha(0);
- backgroundColor.setAlpha(200);
- QLinearGradient gradient(0, 0, width(), height() );
+
+
+ QLinearGradient gradient(0, 0, width(), 0);
gradient.setColorAt(0, loadingColor);
gradient.setColorAt(((double)progr)/100, backgroundColor);
-
- painter.setBrush( gradient );
- painter.setPen(Qt::transparent);
-
-
- QRect backgroundRect = m_lineEdit->frameGeometry();
- int mid = backgroundRect.width() * progr / 100;
- QRect progressRect(backgroundRect.x(), backgroundRect.y(), mid, backgroundRect.height());
- painter.drawRect(progressRect);
- painter.end();
+ p.setBrush(QPalette::Base, gradient);
}
-}
-
-
-QSize UrlBar::sizeHint() const
-{
- return m_lineEdit->sizeHint();
+ setPalette(p);
+
+ LineEdit::paintEvent(event);
}
@@ -234,12 +154,12 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
{
if(event->key() == Qt::Key_Escape)
{
- m_box->hide();
+ _box->hide();
return;
}
// this handles the Modifiers + Return key combinations
- QString currentText = m_lineEdit->text().trimmed();
+ QString currentText = text().trimmed();
if ((event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
&& !currentText.startsWith(QLatin1String("http://"), Qt::CaseInsensitive))
{
@@ -263,11 +183,11 @@ void UrlBar::keyPressEvent(QKeyEvent *event)
{
host += append;
url.setHost(host);
- m_lineEdit->setText(url.toString());
+ setText(url.toString());
}
}
- KComboBox::keyPressEvent(event);
+ LineEdit::keyPressEvent(event);
}
@@ -280,7 +200,7 @@ void UrlBar::suggestUrls(const QString &text)
if(text.isEmpty())
{
- m_box->hide();
+ _box->hide();
return;
}
@@ -289,31 +209,41 @@ void UrlBar::suggestUrls(const QString &text)
if(list.count() > 0)
{
- m_box->clear();
- m_box->insertSearchList(list);
- m_box->popup();
+ _box->clear();
+ _box->insertSearchList(list);
+ _box->popup();
}
}
+
void UrlBar::focusInEvent(QFocusEvent *event)
{
// activate suggestions on edit text
- connect(this, SIGNAL(editTextChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
+ connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(suggestUrls(const QString &)));
- KComboBox::focusInEvent(event);
+ LineEdit::focusInEvent(event);
}
void UrlBar::setCurrentTab(WebTab *tab)
{
if(_tab)
- disconnect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setUrl(const QUrl &)));
+ {
+ disconnect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setQUrl(const QUrl &)));
+ disconnect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
+ disconnect(_tab->page(), SIGNAL(validSSLInfo(bool)), this, SLOT(setTrustedHost(bool)));
+ disconnect(iconButton(), SIGNAL(clicked()), _tab->page(), SLOT(showSSLInfo()));
+ }
_tab = tab;
- connect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setUrl(const QUrl &)));
-
+ connect(_tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(setQUrl(const QUrl &)));
+ connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
+ connect(_tab->page(), SIGNAL(validSSLInfo(bool)), this, SLOT(setTrustedHost(bool)));
+ connect(iconButton(), SIGNAL(clicked()), _tab->page(), SLOT(showSSLInfo()));
+
// update it now (the first time)
- setUrl( _tab->url() );
- update();
+ updateStyles();
+ _tab->view()->setFocus();
+ setQUrl( _tab->url() );
}
@@ -321,3 +251,21 @@ void UrlBar::setPrivateMode(bool on)
{
_privateMode = on;
}
+
+
+void UrlBar::loadFinished()
+{
+ // show RSS
+
+ // show KGet downloads??
+
+ // last, but not least
+ updateStyles();
+}
+
+
+void UrlBar::setTrustedHost(bool on)
+{
+ kDebug() << "SET TRUSTED HOST..";
+ iconButton()->setIconUrl( _tab->url() , on );
+}
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
index 991b9038..848073db 100644
--- a/src/urlbar/urlbar.h
+++ b/src/urlbar/urlbar.h
@@ -49,7 +49,7 @@ class QLinearGradient;
class QWidget;
-class UrlBar : public KComboBox
+class UrlBar : public LineEdit
{
Q_OBJECT
@@ -57,32 +57,24 @@ public:
UrlBar(QWidget *parent = 0);
~UrlBar();
- void selectAll() const;
- KUrl url() const;
- QSize sizeHint() const;
-
void setCurrentTab(WebTab *);
void setPrivateMode(bool on);
-
-public slots:
- void setUrl(const QUrl &url);
- void updateUrl();
private slots:
void activated(const QString& url, Rekonq::OpenType = Rekonq::CurrentTab);
void suggestUrls(const QString &editedText);
+ void setQUrl(const QUrl &url);
+ void loadFinished();
+ void setTrustedHost(bool on);
+
protected:
virtual void paintEvent(QPaintEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void focusInEvent(QFocusEvent *event);
private:
- LineEdit *m_lineEdit;
-
- KUrl m_currentUrl;
-
- CompletionWidget *m_box;
+ CompletionWidget *_box;
WebTab *_tab;
bool _privateMode;
};
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 71cc8be4..8dc0ef96 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -304,18 +304,9 @@ void WebPage::loadFinished(bool)
{
wallet()->fillFormData(mainFrame());
}
-
- // TODO: implement me!
- if(_sslInfo.isValid())
- {
- // show an icon in the urlbar
- kDebug() << "----------------- SSL VALID INFO!!!! ------------------";
- }
- else
- {
- // hide the icon in the urlbar
- kDebug() << "----------------- SSL INFO NOT VALID... ------------------";
- }
+
+ if( mainFrame()->url().scheme() == QL1S("https") )
+ emit validSSLInfo( _sslInfo.isValid() );
}
@@ -538,13 +529,23 @@ void WebPage::showSSLInfo()
KSslInfoDialog::errorsFromString( _sslInfo.certificateErrors() )
);
- dlg->open();
+ dlg->exec();
delete dlg;
- }
- else
+
+ return;
+ }
+
+ if( mainFrame()->url().scheme() == QL1S("https") )
+ {
+ KMessageBox::error( view(),
+ i18n("The SSL information for this site appears to be corrupt."),
+ i18nc("Secure Sockets Layer", "SSL")
+ );
+ }
+ else
{
- KMessageBox::information( 0,
- i18n("The SSL information for this site appears to be corrupt."),
+ KMessageBox::information( view(),
+ i18n("This site doesn't contain SSL information."),
i18nc("Secure Sockets Layer", "SSL")
);
}
diff --git a/src/webpage.h b/src/webpage.h
index abc9833c..479d0cd3 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -58,8 +58,6 @@ public:
explicit WebPage(QWidget *parent = 0);
~WebPage();
- void showSSLInfo();
-
public slots:
virtual void downloadRequest(const QNetworkRequest &request);
void downloadAllContentsWithKGet();
@@ -77,7 +75,11 @@ protected Q_SLOTS:
private slots:
void manageNetworkErrors(QNetworkReply *reply);
void loadFinished(bool);
+ void showSSLInfo();
+signals:
+ void validSSLInfo(bool);
+
private:
QString errorPage(QNetworkReply *);
diff --git a/src/webview.cpp b/src/webview.cpp
index 6e3718e0..e874411d 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -66,6 +66,7 @@ WebView::WebView(QWidget* parent)
, _scrollTimer( new QTimer(this) )
, _VScrollSpeed(0)
, _HScrollSpeed(0)
+ , _disableAutoScroll(false)
{
WebPage *page = new WebPage(this);
setPage(page);
@@ -320,6 +321,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
void WebView::mousePressEvent(QMouseEvent *event)
{
+ QWebHitTestResult result = page()->mainFrame()->hitTestContent( event->pos() );
+ _disableAutoScroll = result.isContentEditable();
+
switch(event->button())
{
case Qt::XButton1:
@@ -425,6 +429,12 @@ void WebView::keyPressEvent(QKeyEvent *event)
return;
}
}
+
+ if(_disableAutoScroll)
+ {
+ KWebView::keyPressEvent(event);
+ return;
+ }
// Auto Scrolling
if ( event->modifiers() == Qt::ShiftModifier )
diff --git a/src/webview.h b/src/webview.h
index 59105267..0fe83ae4 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -52,7 +52,7 @@ public:
protected:
void contextMenuEvent(QContextMenuEvent *event);
- void mousePressEvent(QMouseEvent *event);// need to be ported
+ void mousePressEvent(QMouseEvent *event); // need to be ported
void mouseMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent *event);
@@ -79,6 +79,7 @@ private:
QTimer *_scrollTimer;
int _VScrollSpeed;
int _HScrollSpeed;
+ bool _disableAutoScroll;
};
#endif