Skip to content

Commit

Permalink
Ask user if credentials should be updated when fields match existing …
Browse files Browse the repository at this point in the history
…entry but password differs, references #832
  • Loading branch information
Emdek committed Oct 1, 2016
1 parent 3e5da45 commit a195d7c
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ QNetworkReply* QtWebKitNetworkManager::createRequest(QNetworkAccessManager::Oper

if (match != PasswordsManager::FullMatch)
{
m_widget->notifyAddPasswordRequested(password);
m_widget->notifySavePasswordRequested(password, (match == PasswordsManager::PartialMatch));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/backends/web/qtwebkit/QtWebKitWebWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,9 +833,9 @@ void QtWebKitWebWidget::notifyPermissionRequested(QWebFrame *frame, QWebPage::Fe
}
}

void QtWebKitWebWidget::notifyAddPasswordRequested(const PasswordsManager::PasswordInformation &password)
void QtWebKitWebWidget::notifySavePasswordRequested(const PasswordsManager::PasswordInformation &password, bool isUpdate)
{
emit requestedAddPassword(password);
emit requestedSavePassword(password, isUpdate);
}

void QtWebKitWebWidget::notifyContentStateChanged()
Expand Down
2 changes: 1 addition & 1 deletion src/modules/backends/web/qtwebkit/QtWebKitWebWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected slots:
void notifyUrlChanged(const QUrl &url);
void notifyIconChanged();
void notifyPermissionRequested(QWebFrame *frame, QWebPage::Feature nativeFeature, bool cancel);
void notifyAddPasswordRequested(const PasswordsManager::PasswordInformation &password);
void notifySavePasswordRequested(const PasswordsManager::PasswordInformation &password, bool isUpdate);
void notifyContentStateChanged();
void updateUndoText(const QString &text);
void updateRedoText(const QString &text);
Expand Down
4 changes: 2 additions & 2 deletions src/modules/windows/web/PasswordBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
namespace Otter
{

PasswordBarWidget::PasswordBarWidget(const PasswordsManager::PasswordInformation &password, QWidget *parent) : QWidget(parent),
PasswordBarWidget::PasswordBarWidget(const PasswordsManager::PasswordInformation &password, bool isUpdate, QWidget *parent) : QWidget(parent),
m_created(QDateTime::currentDateTime()),
m_password(password),
m_ui(new Ui::PasswordBarWidget)
{
m_ui->setupUi(this);
m_ui->iconLabel->setPixmap(ThemesManager::getIcon(QLatin1String("dialog-password"), false).pixmap(m_ui->iconLabel->size()));
m_ui->messageLabel->setText(tr("Do you want to save login data for %1?").arg(password.url.host().isEmpty() ? QLatin1String("localhost") : password.url.host()));
m_ui->messageLabel->setText((isUpdate ? tr("Do you want to update login data for %1?") : tr("Do you want to save login data for %1?")).arg(password.url.host().isEmpty() ? QLatin1String("localhost") : password.url.host()));

connect(m_ui->okButton, SIGNAL(clicked()), this, SLOT(accepted()));
connect(m_ui->cancelButton, SIGNAL(clicked()), this, SLOT(rejected()));
Expand Down
2 changes: 1 addition & 1 deletion src/modules/windows/web/PasswordBarWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PasswordBarWidget : public QWidget
Q_OBJECT

public:
explicit PasswordBarWidget(const PasswordsManager::PasswordInformation &password, QWidget *parent = NULL);
explicit PasswordBarWidget(const PasswordsManager::PasswordInformation &password, bool isUpdate, QWidget *parent = NULL);
~PasswordBarWidget();

bool shouldClose(const QUrl &url) const;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/windows/web/WebContentsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ void WebContentsWidget::handleUrlChange(const QUrl &url)
}
}

void WebContentsWidget::handleAddPasswordRequest(const PasswordsManager::PasswordInformation &password)
void WebContentsWidget::handleSavePasswordRequest(const PasswordsManager::PasswordInformation &password, bool isUpdate)
{
if (!m_passwordBarWidget)
{
m_passwordBarWidget = new PasswordBarWidget(password, this);
m_passwordBarWidget = new PasswordBarWidget(password, isUpdate, this);

connect(m_passwordBarWidget, SIGNAL(requestedClose()), this, SLOT(closePasswordBar()));

Expand Down Expand Up @@ -1102,7 +1102,7 @@ void WebContentsWidget::setWidget(WebWidget *widget, bool isPrivate)
connect(m_webWidget, SIGNAL(requestedSearch(QString,QString,WindowsManager::OpenHints)), this, SIGNAL(requestedSearch(QString,QString,WindowsManager::OpenHints)));
connect(m_webWidget, SIGNAL(requestedPopupWindow(QUrl,QUrl)), this, SLOT(handlePopupWindowRequest(QUrl,QUrl)));
connect(m_webWidget, SIGNAL(requestedPermission(WebWidget::FeaturePermission,QUrl,bool)), this, SLOT(handlePermissionRequest(WebWidget::FeaturePermission,QUrl,bool)));
connect(m_webWidget, SIGNAL(requestedAddPassword(PasswordsManager::PasswordInformation)), this, SLOT(handleAddPasswordRequest(PasswordsManager::PasswordInformation)));
connect(m_webWidget, SIGNAL(requestedSavePassword(PasswordsManager::PasswordInformation,bool)), this, SLOT(handleSavePasswordRequest(PasswordsManager::PasswordInformation,bool)));
connect(m_webWidget, SIGNAL(requestedGeometryChange(QRect)), this, SIGNAL(requestedGeometryChange(QRect)));
connect(m_webWidget, SIGNAL(statusMessageChanged(QString)), this, SIGNAL(statusMessageChanged(QString)));
connect(m_webWidget, SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
Expand Down
2 changes: 1 addition & 1 deletion src/modules/windows/web/WebContentsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ protected slots:
void closePasswordBar();
void closePopupsBar();
void handleUrlChange(const QUrl &url);
void handleAddPasswordRequest(const PasswordsManager::PasswordInformation &password);
void handleSavePasswordRequest(const PasswordsManager::PasswordInformation &password, bool isUpdate);
void handlePopupWindowRequest(const QUrl &parentUrl, const QUrl &popupUrl);
void handlePermissionRequest(WebWidget::FeaturePermission feature, const QUrl &url, bool cancel);
void handleLoadingStateChange(WindowsManager::LoadingState state);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/WebWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ protected slots:
void requestedSearch(const QString &query, const QString &search, WindowsManager::OpenHints hints);
void requestedPopupWindow(const QUrl &parentUrl, const QUrl &popupUrl);
void requestedPermission(WebWidget::FeaturePermission feature, const QUrl &url, bool cancel);
void requestedAddPassword(const PasswordsManager::PasswordInformation &password);
void requestedSavePassword(const PasswordsManager::PasswordInformation &password, bool isUpdate);
void requestedGeometryChange(const QRect &geometry);
void progressBarGeometryChanged();
void statusMessageChanged(const QString &message);
Expand Down

0 comments on commit a195d7c

Please sign in to comment.