[Patch] KUrl::prettyUrl and xmpp: url
Olivier Goffart
ogoffart at kde.org
Mon Oct 8 00:16:07 BST 2007
Le dimanche 7 octobre 2007, David Faure a écrit :
> On Sunday 07 October 2007, Olivier Goffart wrote:
> > In Konqueror, if you have a link such as,
> > <a href="xmpp:foo at bar.com"> , it is modified to xmpp://foo@bar.com
> > xmpp: and xmpp:// have very different meaning, and the most common use is
> > xmpp:
> I assume kurltest still passes without failure, so yes. If anything breaks
> it'll be the fault of a missing unit test ;) (but kurltest is pretty
> extensive).
Thanks, I have committed.
Anyway, another question comes to me : Why is the pretty URL passed to the
application, and not the real URL? I mean, if a link contains a password, it
make sens to pass the password to the application.
KRun replace %u by KUrl::pathOrUrl() which uses prettyUrl()
the documentation of pathOrUrl say it is used for user display, so we should
not use that in KRun.
So I've replaced pathOrUrl by url() in KRun, the side effect is that local
files will have file:/// prefix, but i think application should cope with
this. Or should we try to remove the file:/// from urls anyway ?
the krunuittest doesn't run fine, but i think it's not related to my patch.
Ok to commit this one ?
-------------- next part --------------
Index: kio/krun.cpp
===================================================================
--- kio/krun.cpp (revision 722424)
+++ kio/krun.cpp (working copy)
@@ -308,7 +308,7 @@ KRunMX2::subst( int option, const KUrl &
{
switch( option ) {
case 'u':
- ret << url.pathOrUrl();
+ ret << url.url();
break;
case 'd':
ret << url.directory();
Index: tests/krununittest.cpp
===================================================================
--- tests/krununittest.cpp (revision 722424)
+++ tests/krununittest.cpp (working copy)
@@ -133,6 +133,7 @@ void KRunUnitTest::testProcessDesktopExe
KUrl::List l1; l1 << KUrl( "file:/tmp" );
KUrl::List l2; l2 << KUrl( "http://localhost/foo" );
KUrl::List l3; l3 << KUrl( "file:/local/file" ) << KUrl( "http://remotehost.org/bar" );
+ KUrl::List l4; l4 << KUrl( "http://login:password@www.kde.org" );
// A real-world use case would be kate.
// But I picked kdeinit4 since it's installed by kdelibs
@@ -146,13 +147,13 @@ void KRunUnitTest::testProcessDesktopExe
QVERIFY(kmailservice.contains("kde4/libexec"));
}
- QTest::newRow("%U l0") << "kdeinit4 %U" << l0 << false << kdeinit;
- QTest::newRow("%U l1") << "kdeinit4 %U" << l1 << false << kdeinit + " /tmp";
+ QTest::newRow("%U l0") << "kdeinit4 %U" << l0 << false << kdeinit;
+ QTest::newRow("%U l1") << "kdeinit4 %U" << l1 << false << kdeinit + " file:///tmp";
QTest::newRow("%U l2") << "kdeinit4 %U" << l2 << false << kdeinit + " http://localhost/foo";
- QTest::newRow("%U l3") << "kdeinit4 %U" << l3 << false << kdeinit + " /local/file http://remotehost.org/bar";
+ QTest::newRow("%U l3") << "kdeinit4 %U" << l3 << false << kdeinit + " file:///local/file http://remotehost.org/bar";
//QTest::newRow("%u l0") << "kdeinit4 %u" << l0 << false << kdeinit; // gives runtime warning
- QTest::newRow("%u l1") << "kdeinit4 %u" << l1 << false << kdeinit + " /tmp";
+ QTest::newRow("%u l1") << "kdeinit4 %u" << l1 << false << kdeinit + " file:///tmp";
QTest::newRow("%u l2") << "kdeinit4 %u" << l2 << false << kdeinit + " http://localhost/foo";
//QTest::newRow("%u l3") << "kdeinit4 %u" << l3 << false << kdeinit; // gives runtime warning
@@ -166,7 +167,8 @@ void KRunUnitTest::testProcessDesktopExe
QTest::newRow("sh -c kdeinit4 %F") << "sh -c \"kdeinit4 \"'\\\"'\"%F\"'\\\"'"
<< l1 << false << "/bin/sh -c 'kdeinit4 \\\"/tmp\\\"'";
- QTest::newRow("kmailservice %u l1") << "kmailservice %u" << l1 << false << kmailservice + " /tmp";
+ QTest::newRow("kmailservice %u l1") << "kmailservice %u" << l1 << false << kmailservice + " file:///tmp";
+ QTest::newRow("kmailservice %u l4") << "kmailservice %u" << l4 << false << kmailservice + " http://login:password@www.kde.org";
}
void KRunUnitTest::testProcessDesktopExecNoFile()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071008/48ba3996/attachment.sig>
More information about the kde-core-devel
mailing list