New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed and standardized URL creation #370
Conversation
…Ls - fix #369 * assigns the URL for QSURLType * assigns the URL for QSTextType * initWithURL modified to call this new internal method
Good idea. Having a new method will certainly make things easier |
Yeah, when looking at it, I see that even the mighty |
* check type instead of parsing the string again (where possible) * use an FTP icon for FTP addresses
Scope creep! OK, I changed all the URLs-as-strings to |
don'tcha just love the creep?! Looks good :) But... if you want even more scope creep, I've played with setting primary It goes on and on! :P On 11 June 2011 23:58, skurfer <
|
I’ve uncommented that line (and also changed it from QSContactEmailType to QSEmailAddressType). The former was disabled in QSTypes for some reason (and they both refer to the same string anyway). |
Don’t merge this yet. I found a minor annoyance that I want to fix first. ("http://" shouldn’t be appended to text the user types anywhere except in the value for QSURLType.) |
The smarts for deciding whether or not to prepend “http://“ have been moved to the general application-wide method. This also allows us to set a URL string only for the URL type while preserving the original string for other purposes (like paste, email to, use as remote host, etc.). |
I've pretty sure QS always used to be like this, but what if the URL should be https://? I don't think it'd make much difference, but whilst we're on the topic it may be worth thinking about. ftp:// as well? Finally, I remember Again, I don't think it'll make a difference here, since the All looks good. I'll keep playing |
Yes, it typically worked this way. I broke it, but have fixed it now. It only adds http if there’s no scheme, so if it should have https, I imagine it already will and nothing will happen. Same with ftp. The behavior is the same as before, I just took it from
Hmm. It wasn’t well documented, but I saw it in
I don’t think we should rely on what One related (very old) issue remains: Something in the clipboard history that looks like a hostname has “http://” prepended to it, so when you paste, you don’t actually get what was copied. I haven’t looked into that yet, but don’t expect it to be part of this request. |
Fine with all of the above. It was mainly just for clarification and to make
I'm not having this problem? Are you saying that when you paste you get *P.S. I'm using a modded clipboard plugin. If the above is correct I'll On 14 June 2011 13:22, skurfer <
|
This is a problem with the On 14 June 2011 13:28, Patrick Robertson robertson.patrick@gmail.comwrote:
|
Yeah, the most recent thing copied is fine. It’s items in the history that get molested. I thought I was using your modified clipboard plug-in, but maybe there have been further updates. |
Looks good. One last thing you forgot to do was change the urlString names in the .h file Thanks for doing that though, it definitely looks a lot better (to me at least :) ) |
Good catch. Done. |
Pssst! You changed the |
I blame it on lack of sleep. :) |
Tsk. Tell me about it! :) |
fixed and standardized URL creation
Just an FYI, here's what Apple have reported on creating an url as follows:
|
I can’t believe this never blew up in our faces before. The
initWithURL
method would assign QSURLType as the primary type, but there was never anything for that type assigned to the object.So I fixed that by assigning the URL as QSURLType and as QSTextType. The type assignment was moved outside of
initWithURL
to its own method so it could be used across the application.All parts of the application that create QSObjects for URLs now use the same code to do so. This should ensure consistent behavior, eliminate the need for devs to manually (and potentially incorrectly) assign types for URLs, and simplify future updates by only having one place to change.
There are two basic scenarios this takes care of:
URLObjectWithURL
(which internally callsinitWithURL
which in turn calls the newassignURLTypesWithURL
method). This is what most plug-ins are doing.[self assignURLTypesWithURL:urlString]
directly. (This is the case for the HTML parser and string sniffer.)Other notes:
initWithURL
already had some understanding of what to do withmailto:
addresses, so some redundant code in the string sniffer could be removed.