[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATH] KURL
From:       Frerich Raabe <raabe () kde ! org>
Date:       2002-03-12 15:54:15
[Download RAW message or body]

On Tuesday 12 March 2002 01:44, Dirk Mueller wrote:
> On Mon, 11 Mär 2002, Waldo Bastian wrote:
> > I think you try to say here that in your opinion the bool that Frerich
> > proposed isn't the optimal solution? Yes, I agree with that. An enum
> > would be better.
>
> Great.

Third revision attached. Feel free to come up with better names.

- Frerich

["kurl.diff" (text/x-diff)]

Index: kurl.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.h,v
retrieving revision 1.90
diff -u -3 -p -r1.90 kurl.h
--- kurl.h	2002/03/07 11:32:22	1.90
+++ kurl.h	2002/03/12 15:54:55
@@ -51,6 +51,12 @@ class KURLPrivate;
 class KURL
 {
 public:
+  enum AdjustementFlags
+  {
+    NoAdjustements = 0,
+    StripFileProtocol = 1
+  };
+  
   class List : public QValueList<KURL>
   {
   public:
@@ -436,6 +442,17 @@ public:
    * Example: http://localhost:8080/test.cgi?test=hello world&name=fred
    */
   QString prettyURL( int _trailing = 0) const;
+  
+  /**
+   * @return A human readable URL, with no non-necessary encodings/escaped
+   * characters.
+   * Example: http://localhost:8080/test.cgi?test=hello world&name=fred
+   */
+  QString prettyURL( AdjustementFlags _flags, int _trailing = 0) const;
+  /* ### BIC: Merge the two above into
+    QString prettyURL( int _trailing = 0, AdjustementFlags _flags = ) const;
+    after the freeze!
+   */
 
   /**
    * Test to see if the KURL is empty.
Index: kurl.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kurl.cpp,v
retrieving revision 1.198
diff -u -3 -p -r1.198 kurl.cpp
--- kurl.cpp	2002/03/05 14:57:24	1.198
+++ kurl.cpp	2002/03/12 15:54:57
@@ -1215,6 +1215,14 @@ QString KURL::prettyURL( int _trailing )
   return u;
 }
 
+QString KURL::prettyURL( AdjustementFlags _flags, int _trailing = 0) const
+{
+	QString u = prettyURL(_trailing);
+	if (_flags & StripFileProtocol && u.startsWith("file:"))
+		u.remove(0, 5);
+	return u;
+}
+
 KURL::List KURL::split( const KURL& _url )
 {
   QString ref;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic