1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Improved Saving Passwords

It is now saving webview's url, not url of request (used to have
problems on some pages)
And addition small improvements
- added possibility to open rss feed in new tab with middle click
- middle click on home button loads homepage in new tab
- right click on back/next buttons now show menu instantly (instead of
holding left mouse button to get menu shown)
This commit is contained in:
nowrep 2011-10-26 19:23:50 +02:00
parent 3edeb2464f
commit 627fcd1d7b
30 changed files with 1278 additions and 1102 deletions

Binary file not shown.

View File

@ -58,6 +58,8 @@
#include "pagescreen.h"
#include "webinspectordockwidget.h"
#include "bookmarksimportdialog.h"
#include "globalfunctions.h"
const QString QupZilla::VERSION = "1.0.0-rc1";
const QString QupZilla::BUILDTIME = __DATE__" "__TIME__;
@ -748,6 +750,16 @@ void QupZilla::bookmarkAllTabs()
mApp->browsingLibrary()->bookmarksManager()->insertAllTabs();
}
void QupZilla::goHome()
{
loadAddress(m_homepage);
}
void QupZilla::goHomeInNewTab()
{
m_tabWidget->addView(m_homepage, tr("New tab"), TabWidget::NewSelectedTab);
}
void QupZilla::loadActionUrl()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
@ -818,6 +830,7 @@ void QupZilla::showPreferences()
void QupZilla::showSource(const QString &selectedHtml)
{
SourceViewer* source = new SourceViewer(weView()->page(), selectedHtml);
qz_centerWidgetToParent(source, this);
source->show();
}
@ -1044,7 +1057,7 @@ void QupZilla::printPage()
void QupZilla::savePageScreen()
{
PageScreen* p = new PageScreen(weView());
PageScreen* p = new PageScreen(weView(), this);
p->show();
}

View File

@ -129,7 +129,8 @@ private slots:
void postLaunch();
void goNext() { weView()->forward(); }
void goBack() { weView()->back(); }
void goHome() { loadAddress(m_homepage); }
void goHome();
void goHomeInNewTab();
void stop() { weView()->stop(); }
void reload() { weView()->reload(); }
void reloadByPassCache() { weView()->page()->triggerAction(QWebPage::ReloadAndBypassCache); }

View File

@ -201,7 +201,6 @@ void AutoFillModel::post(const QNetworkRequest &request, const QByteArray &outgo
if (!outgoingData.contains((QUrl(passwordName).toEncoded() + "=")) || passwordValue.isEmpty())
return;
AutoFillNotification* aWidget = new AutoFillNotification(request.url(), outgoingData, passwordValue);
AutoFillNotification* aWidget = new AutoFillNotification(webView->url(), outgoingData, passwordValue);
webView->addNotification(aWidget);
}

View File

@ -22,10 +22,13 @@
#include "mainapplication.h"
#include "globalfunctions.h"
CookieManager::CookieManager(QWidget* parent) :
QWidget(parent)
,ui(new Ui::CookieManager)
CookieManager::CookieManager(QWidget* parent)
: QWidget(parent)
, ui(new Ui::CookieManager)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowModality(Qt::WindowModal);
ui->setupUi(this);
qz_centerWidgetOnScreen(this);

View File

@ -22,8 +22,8 @@
HistoryModel::HistoryModel(QupZilla* mainClass, QObject* parent)
: QObject(parent)
,m_isSaving(true)
,p_QupZilla(mainClass)
, m_isSaving(true)
, p_QupZilla(mainClass)
{
loadSettings();
}

View File

@ -107,6 +107,7 @@ NavigationBar::NavigationBar(QupZilla *mainClass, QWidget *parent)
connect(m_reloadStop->buttonStop(), SIGNAL(clicked()), p_QupZilla, SLOT(stop()));
connect(m_reloadStop->buttonReload(), SIGNAL(clicked()), p_QupZilla, SLOT(reload()));
connect(m_buttonHome, SIGNAL(clicked()), p_QupZilla, SLOT(goHome()));
connect(m_buttonHome, SIGNAL(middleMouseClicked()), p_QupZilla, SLOT(goHomeInNewTab()));
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab()));
connect(m_exitFullscreen, SIGNAL(clicked(bool)), p_QupZilla, SLOT(fullScreen(bool)));
}

View File

@ -24,17 +24,19 @@
#include "ui_clearprivatedata.h"
#include "iconprovider.h"
ClearPrivateData::ClearPrivateData(QupZilla* mainClass, QWidget* parent) :
QDialog(parent)
,p_QupZilla(mainClass)
,ui(new Ui::ClearPrivateData)
ClearPrivateData::ClearPrivateData(QupZilla* mainClass, QWidget* parent)
: QDialog(parent)
, p_QupZilla(mainClass)
, ui(new Ui::ClearPrivateData)
{
ui->setupUi(this);
ui->buttonBox->setFocus();
connect(ui->clearAdobeCookies, SIGNAL(clicked(QPoint)), this, SLOT(clearFlash()));
connect(ui->history, SIGNAL(clicked(bool)), this, SLOT(historyClicked(bool)));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(dialogAccepted()));
resize(sizeHint());
//Resizing +2 of sizeHint to get visible underlined link
resize(sizeHint().width(), sizeHint().height() + 2);
}
void ClearPrivateData::historyClicked(bool state)

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>308</width>
<height>243</height>
<height>260</height>
</rect>
</property>
<property name="windowTitle">

View File

@ -20,14 +20,13 @@
#include "webview.h"
#include "globalfunctions.h"
PageScreen::PageScreen(WebView *view)
: QWidget()
PageScreen::PageScreen(WebView* view, QWidget* parent)
: QDialog(parent)
, ui(new Ui::PageScreen)
, m_view(view)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
qz_centerWidgetOnScreen(this);
createPixmap();
ui->label->setPixmap(m_pagePixmap);

View File

@ -18,7 +18,7 @@
#ifndef PAGESCREEN_H
#define PAGESCREEN_H
#include <QWidget>
#include <QDialog>
#include <QWebFrame>
#include <QDialogButtonBox>
#include <QAbstractButton>
@ -29,12 +29,12 @@ namespace Ui {
}
class WebView;
class PageScreen : public QWidget
class PageScreen : public QDialog
{
Q_OBJECT
public:
explicit PageScreen(WebView* view);
explicit PageScreen(WebView* view, QWidget* parent);
~PageScreen();
private slots:

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PageScreen</class>
<widget class="QWidget" name="PageScreen">
<widget class="QDialog" name="PageScreen">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -18,15 +18,17 @@
#include "autofillmanager.h"
#include "ui_autofillmanager.h"
AutoFillManager::AutoFillManager(QWidget* parent) :
QDialog(parent),
ui(new Ui::AutoFillManager)
AutoFillManager::AutoFillManager(QWidget* parent)
: QWidget(parent)
, ui(new Ui::AutoFillManager)
, m_passwordsShown(false)
{
ui->setupUi(this);
connect(ui->removePass, SIGNAL(clicked()), this, SLOT(removePass()));
connect(ui->removeAllPass, SIGNAL(clicked()), this, SLOT(removeAllPass()));
connect(ui->editPass, SIGNAL(clicked()), this, SLOT(editPass()));
connect(ui->showPasswords, SIGNAL(clicked()), this, SLOT(showPasswords()));
connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept()));
connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept()));
@ -42,8 +44,10 @@ void AutoFillManager::loadPasswords()
while(query.next()) {
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treePass);
item->setText(0, query.value(0).toString());
item->setText(1, query.value(1).toString());
item->setWhatsThis(1, query.value(2).toString());
// item->setText(1, query.value(1).toString());
item->setText(1, "*****");
item->setWhatsThis(0, query.value(2).toString());
item->setWhatsThis(1, query.value(1).toString());
ui->treePass->addTopLevelItem(item);
}
@ -57,15 +61,38 @@ void AutoFillManager::loadPasswords()
}
}
void AutoFillManager::showPasswords()
{
if (m_passwordsShown)
return;
m_passwordsShown = true;
int result = QMessageBox::question(this, tr("Show Passwords"), tr("Are you sure that you want to show all passwords?"),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (result != QMessageBox::Yes)
return;
for (int i = 0; i < ui->treePass->topLevelItemCount(); i++) {
QTreeWidgetItem* item = ui->treePass->topLevelItem(i);
if (!item)
continue;
item->setText(1, item->whatsThis(1));
}
ui->showPasswords->hide();
delete ui->showPasswordsLayout;
}
void AutoFillManager::removePass()
{
QTreeWidgetItem* curItem = ui->treePass->currentItem();
if (!curItem)
return;
QString id = curItem->whatsThis(1);
QString id = curItem->whatsThis(0);
QSqlQuery query;
query.exec("DELETE FROM autofill WHERE id="+id);
loadPasswords();
delete curItem;
}
void AutoFillManager::removeAllPass()
@ -77,7 +104,8 @@ void AutoFillManager::removeAllPass()
QSqlQuery query;
query.exec("DELETE FROM autofill");
loadPasswords();
ui->treePass->clear();
}
void AutoFillManager::editPass()
@ -86,12 +114,28 @@ void AutoFillManager::editPass()
if (!curItem)
return;
bool ok;
QString text = QInputDialog::getText(this, tr("Edit password"), tr("Change password:"), QLineEdit::Normal, curItem->text(1), &ok);
QString text = QInputDialog::getText(this, tr("Edit password"), tr("Change password:"), QLineEdit::Normal, curItem->whatsThis(1), &ok);
if (ok && !text.isEmpty()) {
QSqlQuery query;
query.exec("UPDATE autofill SET password='"+text+"' WHERE id="+curItem->whatsThis(1));
loadPasswords();
query.prepare("SELECT data, password FROM autofill WHERE id=?");
query.addBindValue(curItem->whatsThis(0));
query.exec();
query.next();
QString data = query.value(0).toString();
QString oldPass = "=" + query.value(1).toString();
data.replace(oldPass, "=" + text);
query.prepare("UPDATE autofill SET data=?, password=? WHERE id=?");
query.bindValue(0, data);
query.bindValue(1, text);
query.bindValue(2, curItem->whatsThis(0));
query.exec();
if (m_passwordsShown)
curItem->setText(1, text);
curItem->setWhatsThis(1, text);
}
}
@ -103,14 +147,16 @@ void AutoFillManager::removeExcept()
QString id = curItem->whatsThis(0);
QSqlQuery query;
query.exec("DELETE FROM autofill_exceptions WHERE id="+id);
loadPasswords();
delete curItem;
}
void AutoFillManager::removeAllExcept()
{
QSqlQuery query;
query.exec("DELETE FROM autofill_exceptions");
loadPasswords();
ui->treeExcept->clear();
}
void AutoFillManager::showExceptions()

View File

@ -19,8 +19,8 @@
#define AUTOFILLMANAGER_H
#include <QWidget>
#include <QDialog>
#include <QTimer>
#include <QtSql/QSqlDatabase>
#include <QSqlQuery>
#include <QTreeWidgetItem>
#include <QDebug>
@ -31,7 +31,7 @@ namespace Ui {
class AutoFillManager;
}
class AutoFillManager : public QDialog
class AutoFillManager : public QWidget
{
Q_OBJECT
@ -47,12 +47,15 @@ private slots:
void removePass();
void removeAllPass();
void editPass();
void showPasswords();
void removeExcept();
void removeAllExcept();
private:
Ui::AutoFillManager* ui;
bool m_passwordsShown;
};
#endif // AUTOFILLMANAGER_H

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AutoFillManager</class>
<widget class="QDialog" name="AutoFillManager">
<widget class="QWidget" name="AutoFillManager">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>412</height>
<width>537</width>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
@ -26,11 +26,11 @@
<attribute name="title">
<string>Passwords</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTreeWidget" name="treePass">
<attribute name="headerDefaultSectionSize">
<number>200</number>
<attribute name="headerMinimumSectionSize">
<number>180</number>
</attribute>
<column>
<property name="text">
@ -44,7 +44,7 @@
</column>
</widget>
</item>
<item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="removePass">
@ -82,6 +82,30 @@
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="showPasswordsLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="showPasswords">
<property name="text">
<string>Show Passwords</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabExcept">

View File

@ -37,6 +37,7 @@
#include "navigationbar.h"
#include "thememanager.h"
#include "acceptlanguage.h"
#include "globalfunctions.h"
bool removeFile(const QString &fullFileName)
{
@ -425,15 +426,13 @@ void Preferences::showCookieManager()
{
CookieManager* m = new CookieManager();
m->refreshTable();
m->setAttribute(Qt::WA_DeleteOnClose);
m->setWindowModality(Qt::WindowModal);
m->show();
}
void Preferences::openSslManager()
{
SSLManager* m = new SSLManager();
m->setWindowModality(Qt::WindowModal);
SSLManager* m = new SSLManager(this);
// qz_centerWidgetToParent(m, this);
m->show();
}

View File

@ -23,12 +23,12 @@
#include "certificateinfowidget.h"
SSLManager::SSLManager(QWidget* parent)
: QWidget(parent)
: QDialog(parent)
, ui(new Ui::SSLManager)
{
// setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
qz_centerWidgetOnScreen(this);
refreshLocalList();
refreshCAList();
@ -126,7 +126,7 @@ void SSLManager::showLocalCertInfo()
void SSLManager::showCertificateInfo(const QSslCertificate &cert)
{
QWidget* w = new QWidget();
QDialog* w = new QDialog(this);
w->setAttribute(Qt::WA_DeleteOnClose);
w->setWindowTitle(tr("Certificate Informations"));
w->setLayout(new QVBoxLayout);
@ -137,7 +137,7 @@ void SSLManager::showCertificateInfo(const QSslCertificate &cert)
connect(b, SIGNAL(clicked(QAbstractButton*)), w, SLOT(close()));
w->layout()->addWidget(b);
w->resize(w->sizeHint());
qz_centerWidgetOnScreen(w);
qz_centerWidgetToParent(w, this);
w->show();
}

View File

@ -18,7 +18,7 @@
#ifndef SSLMANAGER_H
#define SSLMANAGER_H
#include <QWidget>
#include <QDialog>
#include <QDebug>
#include <QMessageBox>
#include <QSslCertificate>
@ -31,7 +31,7 @@ namespace Ui {
class SSLManager;
}
class SSLManager : public QWidget
class SSLManager : public QDialog
{
Q_OBJECT

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SSLManager</class>
<widget class="QWidget" name="SSLManager">
<widget class="QDialog" name="SSLManager">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -25,10 +25,10 @@
#include "browsinglibrary.h"
#include "globalfunctions.h"
RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent) :
QWidget(parent)
,ui(new Ui::RSSManager)
,p_QupZilla(mainClass)
RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent)
: QWidget(parent)
, ui(new Ui::RSSManager)
, p_QupZilla(mainClass)
{
ui->setupUi(this);
qz_centerWidgetOnScreen(this);
@ -73,6 +73,7 @@ void RSSManager::refreshTable()
ui->tabWidget->addTab(tree, title);
ui->tabWidget->setTabToolTip(i, address.toString());
connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(loadFeed(QTreeWidgetItem*)));
connect(tree, SIGNAL(itemMiddleButtonClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*)));
connect(tree, SIGNAL(itemControlClicked(QTreeWidgetItem*)), this, SLOT(controlLoadFeed(QTreeWidgetItem*)));
QTreeWidgetItem* item = new QTreeWidgetItem();
item->setText(0, tr("Loading..."));

View File

@ -45,6 +45,21 @@ void qz_centerWidgetOnScreen(QWidget *w)
w->move( (screen.width()-size.width())/2, (screen.height()-size.height())/2 );
}
// Very, very, very simplified QDialog::adjustPosition from qdialog.cpp
void qz_centerWidgetToParent(QWidget* w, QWidget* parent)
{
if (!parent || !w)
return;
QPoint p;
parent = parent->window();
QPoint pp = parent->mapToGlobal(QPoint(0,0));
p = QPoint(pp.x() + parent->width()/2, pp.y() + parent->height()/ 2);
p = QPoint(p.x()-w->width()/2, p.y()-w->height()/2 - 20);
w->move(p);
}
QString qz_samePartOfStrings(const QString &one, const QString &other)
{
int i = 0;

View File

@ -31,6 +31,8 @@ QByteArray qz_pixmapToByteArray(const QPixmap &pix);
QByteArray qz_readAllFileContents(const QString &filename);
void qz_centerWidgetOnScreen(QWidget* w);
void qz_centerWidgetToParent(QWidget* w, QWidget* parent);
QString qz_samePartOfStrings(const QString &one, const QString &other);
QUrl qz_makeRelativeUrl(const QUrl &baseUrl, const QUrl &rUrl);

View File

@ -68,6 +68,13 @@ void ToolButton::mousePressEvent(QMouseEvent *e)
{
if (e->buttons() == Qt::MiddleButton) {
emit middleMouseClicked();
return;
}
if (e->button() == Qt::RightButton && menu()) {
setDown(true);
showMenu();
return;
}
QToolButton::mousePressEvent(e);

View File

@ -28,13 +28,14 @@
#include "widget.h"
#include "globalfunctions.h"
QString WebPage::m_lastUploadLocation = QDir::homePath();
WebPage::WebPage(WebView* parent, QupZilla* mainClass)
: QWebPage(parent)
,p_QupZilla(mainClass)
,m_view(parent)
,m_blockAlerts(false)
,m_lastUploadLocation(QDir::homePath())
,m_secureStatus(false)
, p_QupZilla(mainClass)
, m_view(parent)
, m_blockAlerts(false)
, m_secureStatus(false)
// ,m_isOpeningNextWindowAsNewTab(false)
{
setForwardUnsupportedContent(true);

View File

@ -84,6 +84,7 @@ private:
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest &request, NavigationType type);
QString chooseFile(QWebFrame *originatingFrame, const QString &oldFile);
static QString m_lastUploadLocation;
QupZilla* p_QupZilla;
QNetworkRequest m_lastRequest;
@ -92,9 +93,8 @@ private:
QSslCertificate m_SslCert;
QList<QSslCertificate> m_SslCerts;
QList<AdBlockedEntry> m_adBlockedEntries;
bool m_blockAlerts;
QString m_lastUploadLocation;
bool m_blockAlerts;
bool m_secureStatus;
// bool m_isOpeningNextWindowAsNewTab;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff