KRecentFilesAction / KUrl::List (Re: Adding simple API / freeze in effect?)

David Faure faure at kde.org
Wed Nov 14 23:43:20 GMT 2007


On Thursday 15 November 2007, Olivier Goffart wrote:
> Do you know the existence of QMap::values() ?  
> It would make the code shorter.
> (But would require to return QList<KUrl>)

We want to return a KUrl::List, but this post made me realize that we were missing QList<KUrl> to KUrl::List conversion.
OK if I commit this patch? Then KRecentFilesAction can use values() :)

--- kurl.cpp    (revision 736448)
+++ kurl.cpp    (working copy)
@@ -151,6 +151,11 @@ KUrl::List::List(const KUrl &url)
     append( url );
 }

+KUrl::List::List(const QList<KUrl> &list)
+    : QList<KUrl>(list)
+{
+}
+
 KUrl::List::List(const QStringList &list)
 {
   for (QStringList::ConstIterator it = list.begin();
Index: kurl.h
===================================================================
--- kurl.h      (revision 736448)
+++ kurl.h      (working copy)
@@ -138,6 +138,12 @@ public:
        */
       List(const QStringList &list);
       /**
+       * Creates a list that contains the URLs from the given
+       * list.
+       * @param list the list containing the URLs
+       */
+      List(const QList<KUrl> &list);
+      /**
        * Converts the URLs of this list to a list of strings.
        * @return the list of strings
        */

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list