<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://reviewboard.kde.org/r/5148/">http://reviewboard.kde.org/r/5148/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 26th, 2010, 4:34 p.m., <b>Rolf Eike Beer</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why is that startsWith("ftp.") and not just startsWith("ftp")? I'm always annoyed Konqueror gets ftp5.gwdg.de wrong ;)</pre>
</blockquote>
<p>On August 26th, 2010, 4:44 p.m., <b>Mark</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">simple. If i do startsWith("ftp") then anything that starts with "ftp" will get the ftp:// prefix..
Besides, ftp. and ftp://ftp. is common. ftp5. is far from common if you ask me ^_^ And changing this would mean that anything before the point that contans "ftp" should get ftp:// ... i'm not sure if that's a good idea although not hard to make.
everything before the first point then .contains("ftp") and voila.. ^_^
But, someone else.. Is this a required change?</pre>
</blockquote>
<p>On August 26th, 2010, 5:20 p.m., <b>Dawit Alemayehu</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">@Mark:
The actual fix should be to replace the "KUrlCompletion::replacedPath" call with "KURIFilter::self()->filterUri" in that function as follows:
// Use short url and web shortcut filters of the uri input filtering class...
if (!KURIFilter::self()->filterUri(url, QStringList() << "kshorturifilter" << "kurisearchfilter"))
return;
@Rolf:
Since Konqueror already uses KURIFilter to filter user input, you can simply use the undocumented feature of the kshorturifilter plugin to solve your annoyance...
#1.) Create a $KDEHOME/share/config/kshorturifilterrc or copy the global one that comes with KDE by default.
#2.) Add the following to the file:
[Pattern]
myftpsite=ftp5.gwdg.de
[Protocol]
myftpsite=ftp://
Restart konqueror... Now whenever you type that url, ftp:// will be used instead of the default http://. You can add as many pattern/protocol associations as well as use regular expressions for the pattern. KDE comes with a pre installed global kshorturifilterrc file that contains the following:
[Pattern]
kdemailto=^(\\w+)(?:[.]\\w+)?@(\\w+)(?:[.]\\w+)+$
kdeftp=^ftp(?:\\.\\w+)?\\.\\D{2,}(?:[0-9]{1,5})?
[Protocol]
kdemailto=mailto:
kdeftp=ftp://</pre>
</blockquote>
<p>On August 26th, 2010, 6:08 p.m., <b>Mark</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">@Dawit Alemayehu
those filters are interesting indeed, but i don't get a few (kinda vital) things with it.
1. Where and how do i make the filters?
2. How is that filter stuff knowing all the filters like it says in the docs?
3. where is a list of existing filters?
The docs say this filter stuff is simple but i really miss an example of how it's all tight together...
Any help with that would be welcome.</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">#1. It is all automagically done for you. That is you do not need to write any filters yourself. Several filter plugins are already available in the location mentioned below (see #3). The issue you are trying to resolve is specifically handled by the presence of the "kdeftp=" pattern shown above. All you need to do is use the exact code I provided above (sans the wrong class name) or if you want a more detailed response from the plugin, you can use KUriFilterData as follows:
KUriFilterData data;
data.setData(url);
data.setCheckExecutables(false); // Do not filter an executable...
if (KUriFilter::self()->filterUri(data, QStringList() << "kshorturifilter" << "kurisearchfilter"))
url = data.uri();
data.uriType() would tell you what the filtered resource type is, etc...
#2. KURIFilter is a plugin based system. In other words, the actual filtering is done by plugins that are dynamically loaded when you get an instance of the class through self(). If no filter plugins are found, i.e. not installed, then the filtering process will fail. You can find out how many filters are available by calling calling "KURIFilter::self()->pluginNames()" function.
#3. Currently all the filter plugins are located under kdebase/runtime/kuri-filterplugins and unfortunately that might be an issue against using KURIFilter in this instance, but then again KUriFilter is used by kparts, khtml and kdewebkit all in kdelibs ; so this should not be a problem to use it in this case either...</pre>
<br />
<p>- Dawit</p>
<br />
<p>On August 26th, 2010, 2:26 p.m., Mark wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Dolphin, kdelibs and David Faure.</div>
<div>By Mark.</div>
<p style="color: grey;"><i>Updated 2010-08-26 14:26:16</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Read the bug report for the.. bug..
As for the fix. I had a hard time finding the right place to implement this since all was using const KUrl thus not editable... When searching deeper i ended up in making the fix in either KUrlNavigator or in KUrl itself. I decided to go for KUrlNavigator for no particular reason... I could just as well have tried it in KUrl. I hope this KUrlNavigator was the right place (either way, please do explain where is the right place and why the other one isn't the right place). </pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I did one simple tests on it:
typing "ftp.nluug.nl" in the url bar and pressing enter. It changed the url to "ftp://ftp.nluug.nl" and the ftp opened just perfectly. I browsed a bit on it to see if it stays working fins and it seems to do just that.</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://bugs.kde.org/show_bug.cgi?id=209031">209031</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/tags/KDE/4.5.0/kdelibs/kfile/kurlnavigator.cpp <span style="color: grey">(1168303)</span></li>
</ul>
<p><a href="http://reviewboard.kde.org/r/5148/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>