[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: [PATCH] Use KUrl::prettyUrl to display user entered remote URLs
From: Sebastian =?utf-8?q?Tr=C3=BCg?= <strueg () mandriva ! com>
Date: 2008-07-18 14:14:36
Message-ID: 200807181614.36580.strueg () mandriva ! com
[Download RAW message or body]
On Friday 18 July 2008 16:00:10 Sebastian Tr=C3=BCg wrote:
> On Friday 18 July 2008 15:10:24 David Faure wrote:
> > On Friday 18 July 2008, Sebastian Tr=C3=BCg wrote:
> > > On Friday 18 July 2008 11:47:53 Andreas Pakulat wrote:
> > > > On 18.07.08 11:26:06, Sebastian Tr=C3=BCg 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
sorry, apparently there is not just one place for this change in the file.
Updated patch attached.
Cheers,
Sebastian
["kurlcombobox-prettyurl.diff" (text/x-diff)]
Index: kio/kfile/kurlcombobox.cpp
===================================================================
--- kio/kfile/kurlcombobox.cpp (revision 834244)
+++ kio/kfile/kurlcombobox.cpp (working copy)
@@ -139,18 +139,11 @@
KUrlComboBoxPrivate::KUrlComboItem *item = new KUrlComboBoxPrivate::KUrlComboItem;
item->url = url;
item->icon = icon;
- if ( text.isEmpty() ) {
- KUrl::AdjustPathOption mode = KUrl::LeaveTrailingSlash;
- if (d->myMode == Directories)
- mode = KUrl::AddTrailingSlash;
+ if ( text.isEmpty() )
+ item->text = url.pathOrUrl(d->myMode == Directories
+ ? KUrl::AddTrailingSlash
+ : KUrl::RemoveTrailingSlash);
else
- mode = KUrl::RemoveTrailingSlash;
- if ( url.isLocalFile() )
- item->text = url.path( mode );
- else
- item->text = url.prettyUrl( mode );
- }
- else
item->text = text;
d->defaultList.append( item );
@@ -230,19 +223,10 @@
item = new KUrlComboBoxPrivate::KUrlComboItem;
item->url = u;
item->icon = d->getIcon( u );
+ item->text = u.pathOrUrl(d->myMode == Directories
+ ? KUrl::AddTrailingSlash
+ : KUrl::RemoveTrailingSlash);
- if ( u.isLocalFile() )
- {
- KUrl::AdjustPathOption mode = KUrl::LeaveTrailingSlash;
- if (d->myMode == Directories)
- mode = KUrl::AddTrailingSlash;
- else
- mode = KUrl::RemoveTrailingSlash;
- item->text = u.path( mode ); // don't show file:/
- }
- else
- item->text = *it;
-
d->insertUrlItem( item );
d->itemList.append( item );
++it;
@@ -290,18 +274,12 @@
while ( it.hasNext() )
d->insertUrlItem( it.next() );
- KUrl::AdjustPathOption mode = KUrl::LeaveTrailingSlash;
- if (d->myMode == Directories)
- mode = KUrl::AddTrailingSlash;
- else
- mode = KUrl::RemoveTrailingSlash;
KUrlComboBoxPrivate::KUrlComboItem *item = new KUrlComboBoxPrivate::KUrlComboItem;
item->url = url;
item->icon = d->getIcon( url );
- 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);
kDebug(250) << "setURL: text=" << item->text;
int id = count();
@@ -444,14 +422,9 @@
m_parent->setItemIcon(index,icon);
if ( m_parent->isEditable() ) {
- KUrl::AdjustPathOption mode = KUrl::LeaveTrailingSlash;
- if (myMode == Directories)
- mode = KUrl::AddTrailingSlash;
- else
- mode = KUrl::RemoveTrailingSlash;
-
- m_parent->setItemText( index, item->url.isLocalFile() ? item->url.path( mode ) :
- item->url.prettyUrl( mode ));
+ m_parent->setItemText(index, item->url.pathOrUrl(myMode == Directories
+ ? KUrl::AddTrailingSlash
+ : KUrl::RemoveTrailingSlash));
}
else {
m_parent->setItemText(index,item->text);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic