Permalink
Browse files

Change the AutoFillManager to not use hard coded offsets for request …

…attributes.

Rather than a offset from the QNetworkRequest::User utilize the static
WebPageProxy::pageAttributeId() to improve the code readability
(it is now grepable what it is used for) and prevent accidents in the
future if that number ever changed.
  • Loading branch information...
1 parent 17818d3 commit ce46bb4dfe22263544e41e752208cdb6bd0b6ed5 @icefox icefox committed Feb 6, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/autofillmanager.cpp
View
@@ -32,6 +32,7 @@
#include "browserapplication.h"
#include "browsermainwindow.h"
#include "networkaccessmanagerproxy.h"
+#include "webpageproxy.h"
#include "webview.h"
#include <qdesktopservices.h>
@@ -145,7 +146,7 @@ void AutoFillManager::post(const QNetworkRequest &request, const QByteArray &out
return;
// Check the request type
- QVariant typeVariant = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 101));
+ QVariant typeVariant = request.attribute((QNetworkRequest::Attribute)(WebPageProxy::pageAttributeId() + 1));
QWebPage::NavigationType type = (QWebPage::NavigationType)typeVariant.toInt();
if (typeVariant.isValid() && type != QWebPage::NavigationTypeFormSubmitted) {
// XXX Does this occur normally?
@@ -155,7 +156,7 @@ void AutoFillManager::post(const QNetworkRequest &request, const QByteArray &out
}
// Determine the QWebView
- QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
+ QVariant v = request.attribute((QNetworkRequest::Attribute)(WebPageProxy::pageAttributeId()));
QWebPage *webPage = (QWebPage*)(v.value<void*>());
if (!webPage) {
qWarning() << "AutoFillManager:" << "QWebPage is not set in QNetworkRequest.";

0 comments on commit ce46bb4

Please sign in to comment.