From kde-core-devel Fri Jul 18 14:00:10 2008 From: Sebastian =?iso-8859-1?q?Tr=FCg?= Date: Fri, 18 Jul 2008 14:00:10 +0000 To: kde-core-devel Subject: Re: [PATCH] Use KUrl::prettyUrl to display user entered remote URLs Message-Id: <200807181600.11462.strueg () mandriva ! com> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=121638965427964 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_rHKgIdS9/KKUQwe" --Boundary-00=_rHKgIdS9/KKUQwe Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 18 July 2008 15:10:24 David Faure wrote: > On Friday 18 July 2008, Sebastian Tr=FCg wrote: > > On Friday 18 July 2008 11:47:53 Andreas Pakulat wrote: > > > On 18.07.08 11:26:06, Sebastian Tr=FCg wrote: > > > > May I apply this patch? > > > > trunk and 4.1? > > > > > > How about adjusting the code a bit more and using KUrl::pathOrUrl()? > > > Would save the else part. > > > > strangly pathOrUrl does not have an option parameter. Maybe that could = be > > added for 4.2? > > Oh. No reason this is missing, indeed. Added. ok, updated patch for trunk. May I commit and use the old patch for 4.1? Cheers, Sebastian --Boundary-00=_rHKgIdS9/KKUQwe Content-Type: text/x-diff; charset="iso-8859-1"; name="kurlcombobox-prettyurl.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kurlcombobox-prettyurl.diff" Index: kio/kfile/kurlcombobox.cpp =================================================================== --- kio/kfile/kurlcombobox.cpp (revision 834244) +++ kio/kfile/kurlcombobox.cpp (working copy) @@ -140,15 +140,7 @@ item->url = url; item->icon = icon; if ( text.isEmpty() ) { - KUrl::AdjustPathOption mode = KUrl::LeaveTrailingSlash; - if (d->myMode == Directories) - mode = KUrl::AddTrailingSlash; - else - mode = KUrl::RemoveTrailingSlash; - if ( url.isLocalFile() ) - item->text = url.path( mode ); - else - item->text = url.prettyUrl( mode ); + item->text = url.pathOrUrl(d->myMode == Directories ? KUrl::AddTrailingSlash : KUrl::RemoveTrailingSlash); } else item->text = text; @@ -202,7 +194,7 @@ if (remove == RemoveBottom) { if (!urls.isEmpty()) urls.removeLast(); - } + } else { if (!urls.isEmpty()) urls.removeFirst(); @@ -241,7 +233,7 @@ item->text = u.path( mode ); // don't show file:/ } else - item->text = *it; + item->text = u.prettyUrl(); d->insertUrlItem( item ); d->itemList.append( item ); @@ -311,7 +303,7 @@ KComboBox::insertItem( id, d->opendirIcon, text); else KComboBox::insertItem( id,item->icon, text); - + d->itemMapper.insert( id, item ); d->itemList.append( item ); --Boundary-00=_rHKgIdS9/KKUQwe--