<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/120138/">https://git.reviewboard.kde.org/r/120138/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">My attempt at this. Feel free to use it as you see fit.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">diff --git a/src/urifilters/shorturi/kshorturifilter.cpp b/src/urifilters/shorturi/kshorturifilter.cpp<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
index 00668d9..6c35393 100644<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
--- a/src/urifilters/shorturi/kshorturifilter.cpp<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
+++ b/src/urifilters/shorturi/kshorturifilter.cpp<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
@@ -130,6 +130,24 @@ bool KShortUriFilter::filterUri( KUriFilterData& data ) const<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
   //QUrl url = data.uri();<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
   QString cmd = data.typedString();</p>
<ul style="padding: 0;text-rendering: inherit;margin: 0 0 0 1em;line-height: inherit;white-space: normal;">
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">// If a string starts with forward slashes, replace it by one forward slash.</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">if (cmd.startsWith('/')) {</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">const int cmdLength = cmd.length();</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">for (int i = 0; i < cmdLength; i++) {</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">if (cmd[i] != '/') {</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">QString slashes = cmd.left(i).replace(QRegExp("/+"), "/");</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">cmd.replace(0, i, slashes);</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">break;</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">}<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
+</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">// The full string contains slashes..</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">if (i == cmdLength - 1) {</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">cmd = "/";</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">break;</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">}</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">}</li>
<li style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">}<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
+<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
   // Replicate what KUrl(cmd) did in KDE4. This could later be folded into the checks further down...<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
   QUrl url(cmd);<br style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;" />
   if (QDir::isAbsolutePath(cmd)) {</li>
</ul>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I'm not sure if this approach is always OK. It works with the current test cases and those two that Arjun added.</p></pre>
 <br />









<p>- Mark Gaiser</p>


<br />
<p>On september 11th, 2014, 8:50 a.m. UTC, Arjun Ak wrote:</p>









<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
 <tr>
  <td>

<div>Review request for KDE Frameworks.</div>
<div>By Arjun Ak.</div>


<p style="color: grey;"><i>Updated sep 11, 2014, 8:50 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</div>


<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;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">"///..." should produce <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">QUrl("file:///")</code> not <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">QUrl("file://")</code></p></pre>
  </td>
 </tr>
</table>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>autotests/kurifiltertest.cpp <span style="color: grey">(b84dcd0)</span></li>

 <li>src/urifilters/shorturi/kshorturifilter.cpp <span style="color: grey">(00668d9)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/120138/diff/" style="margin-left: 3em;">View Diff</a></p>






  </td>
 </tr>
</table>








  </div>
 </body>
</html>