Bug 25823 - [Qt] Add API to generate a QUrl from a user string url
Summary: [Qt] Add API to generate a QUrl from a user string url
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-15 07:55 PDT by Benjamin Meyer
Modified: 2009-05-26 23:37 PDT (History)
2 users (show)

See Also:


Attachments
the patch with the api (13.70 KB, patch)
2009-05-15 07:56 PDT, Benjamin Meyer
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Meyer 2009-05-15 07:55:44 PDT
Add an API to generate a QUrl out of a string correcting for errors and missing information. See the API documentation for more details about the function.
Comment 1 Benjamin Meyer 2009-05-15 07:56:16 PDT
Created attachment 30387 [details]
the patch with the api
Comment 2 Kenneth Rohde Christiansen 2009-05-15 14:49:47 PDT
The patch is OK with me, and the autotest is definately a plus.

The reviewer might point out that this is probably not the best place for having such a function and that it should be in QUrl, but as it makes many web assumptions, that has been rejected. Thus QWebView seems like the best place to put such functionality, that taken in consideration.
Comment 3 Eric Seidel (no email) 2009-05-21 20:10:17 PDT
Comment on attachment 30387 [details]
the patch with the api

Personally I don't think this is a very good idea for Qt to expose.

"Guessing the URL" only helps on the first request.  After that there are redirects and URL re-writes and JavaScrpt which are going to cause the final URL to change quite a bit, making exposing this API less useful.

But I don't work on the Qt port.  So I'll let a Qt reviewer review this.
Comment 4 Holger Freyther 2009-05-22 21:49:44 PDT
Comment on attachment 30387 [details]
the patch with the api


> +    If that is not the case, an attempt is made to turn the string into a
> +    http:// or ftp:// URL. The latter in the case the string starts with
> +    'ftp'. The result is then passed through QUrl's tolerant parser, and
> +    in the case or success, a valid QUrl is returned, orelse a QUrl().

orelse??? space missing?



> +        QUrl url = view->guessUrlFromString(string);

my taste would say to use the static type QWebView::guessUrlFromString... ignore that at your will..


are you sure that QWebView is the best place for that? If I have a QWebPage in a graphics view item I still want to use the guessing and using QWebView might not feel right. Do you think QWebView is the best place to put it? what about QWebPage?
Comment 5 Holger Freyther 2009-05-26 23:37:16 PDT
Okay landed as is in r44180. Didn't know if you have commit access or not... I will await the usual API review that will happen before 4.6.