[PATCH] Don't percent-encode URL completions
Jeff Mitchell
kde-dev at emailgoeshere.com
Mon Mar 31 12:42:14 BST 2008
KUrlCompletion tries to detect if it is completing on a URL and
percent-encode if so. The problem is that when the user is actually
typing a URL that is being completed, they are doing it with slashes, so
you end up with a URL that is all slashes except for the completed part:
file:///home/jeff/Test%2FDirectory
If percent-completion is needed, this URL must be percent-encoded
anyways, so you gain nothing by having the last part be percent-encoded
already.
My patch removes this behavior entirely.
I can only forsee this being an issue in cases where a completion is
made without any user interaction, but I don't know if that is actually
done anywhere.
Index: kurlcompletion.cpp
===================================================================
--- kurlcompletion.cpp (revision 792122)
+++ kurlcompletion.cpp (working copy)
@@ -380,7 +380,6 @@
KUrlCompletion::Mode mode; // ExeCompletion, FileCompletion,
DirCompletion
bool replace_env;
bool replace_home;
- bool complete_url; // if true completing a URL (i.e. 'prepend'
is a URL), otherwise a path
KIO::ListJob *list_job; // kio job to list directories
@@ -628,7 +627,6 @@
if ( url.kurl()->hasRef() )
toRemove += url.kurl()->ref().length() + 1;
d->prepend = text.left( text.length() - toRemove );
- d->complete_url = url.isURL();
QString aMatch;
@@ -1075,12 +1073,8 @@
QStringList::ConstIterator it = matchList.begin();
QStringList::ConstIterator end = matchList.end();
- if ( complete_url )
- for ( ; it != end; ++it )
- q->addItem( prepend +
QUrl::toPercentEncoding(*it) );
- else
- for ( ; it != end; ++it )
- q->addItem( prepend + (*it));
+ for ( ; it != end; ++it )
+ q->addItem( prepend + (*it));
}
/*
More information about the kde-core-devel
mailing list