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

List:       kde-commits
Subject:    [kdelibs/frameworks] kio/kio: KUrl -> QUrl
From:       David Faure <faure () kde ! org>
Date:       2012-07-18 18:27:27
Message-ID: 20120718182727.DCC15A6094 () git ! kde ! org
[Download RAW message or body]

Git commit 917d6b2fbb1c466fef563ce6d7ec194c21caf2a0 by David Faure.
Committed on 16/07/2012 at 00:50.
Pushed by dfaure into branch 'frameworks'.

KUrl -> QUrl

M  +11   -11   kio/kio/kdesktopfileactions.cpp
M  +6    -6    kio/kio/kdesktopfileactions.h
M  +1    -1    kio/kio/kfileitemactions.cpp
M  +14   -16   kio/kio/kfilemetainfo.cpp
M  +3    -3    kio/kio/kfilemetainfo.h
M  +1    -2    kio/kio/kfilemetainfoitem_p.h

http://commits.kde.org/kdelibs/917d6b2fbb1c466fef563ce6d7ec194c21caf2a0

diff --git a/kio/kio/kdesktopfileactions.cpp b/kio/kio/kdesktopfileactions.cpp
index b0c7832..7b5b756 100644
--- a/kio/kio/kdesktopfileactions.cpp
+++ b/kio/kio/kdesktopfileactions.cpp
@@ -47,11 +47,11 @@
 
 enum BuiltinServiceType { ST_MOUNT = 0x0E1B05B0, ST_UNMOUNT = 0x0E1B05B1 }; // \
random numbers  
-static bool runFSDevice( const KUrl& _url, const KDesktopFile &cfg );
-static bool runApplication( const KUrl& _url, const QString & _serviceFile );
-static bool runLink( const KUrl& _url, const KDesktopFile &cfg );
+static bool runFSDevice( const QUrl& _url, const KDesktopFile &cfg );
+static bool runApplication( const QUrl& _url, const QString & _serviceFile );
+static bool runLink( const QUrl& _url, const KDesktopFile &cfg );
 
-bool KDesktopFileActions::run( const KUrl& u, bool _is_local )
+bool KDesktopFileActions::run( const QUrl& u, bool _is_local )
 {
     // It might be a security problem to run external untrusted desktop
     // entry files
@@ -83,7 +83,7 @@ bool KDesktopFileActions::run( const KUrl& u, bool _is_local )
     return false;
 }
 
-static bool runFSDevice( const KUrl& _url, const KDesktopFile &cfg )
+static bool runFSDevice( const QUrl& _url, const KDesktopFile &cfg )
 {
     bool retval = false;
 
@@ -99,7 +99,7 @@ static bool runFSDevice( const KUrl& _url, const KDesktopFile &cfg \
                )
     KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByDevice( dev );
     // Is the device already mounted ?
     if (mp) {
-        KUrl mpURL(mp->mountPoint());
+        const QUrl mpURL = QUrl::fromLocalFile(mp->mountPoint());
         // Open a new window
         retval = KRun::runUrl( mpURL, QLatin1String("inode/directory"), 0 /*TODO - \
window*/ );  } else {
@@ -118,7 +118,7 @@ static bool runFSDevice( const KUrl& _url, const KDesktopFile \
&cfg )  return retval;
 }
 
-static bool runApplication( const KUrl& , const QString & _serviceFile )
+static bool runApplication( const QUrl& , const QString & _serviceFile )
 {
     KService s( _serviceFile );
     if ( !s.isValid() )
@@ -130,17 +130,17 @@ static bool runApplication( const KUrl& , const QString & \
_serviceFile )  return KRun::run( s, lst, 0 /*TODO - window*/ );
 }
 
-static bool runLink( const KUrl& _url, const KDesktopFile &cfg )
+static bool runLink(const QUrl& _url, const KDesktopFile &cfg)
 {
     QString u = cfg.readUrl();
     if ( u.isEmpty() )
     {
-        QString tmp = i18n("The desktop entry file\n%1\nis of type Link but has no \
URL=... entry.",  _url.prettyUrl() ); +        QString tmp = i18n("The desktop entry \
file\n%1\nis of type Link but has no URL=... entry.",  _url.toString() );  \
KMessageBoxWrapper::error( 0, tmp );  return false;
     }
 
-    KUrl url ( u );
+    QUrl url = QUrl::fromUserInput(u);
     KRun* run = new KRun(url,(QWidget*)0);
 
     // X-KDE-LastOpenedWith holds the service desktop entry name that
@@ -153,7 +153,7 @@ static bool runLink( const KUrl& _url, const KDesktopFile &cfg )
     return false;
 }
 
-QList<KServiceAction> KDesktopFileActions::builtinServices( const KUrl& _url )
+QList<KServiceAction> KDesktopFileActions::builtinServices( const QUrl& _url )
 {
     QList<KServiceAction> result;
 
diff --git a/kio/kio/kdesktopfileactions.h b/kio/kio/kdesktopfileactions.h
index 27e6c5e..1118a10 100644
--- a/kio/kio/kdesktopfileactions.h
+++ b/kio/kio/kdesktopfileactions.h
@@ -36,7 +36,7 @@ namespace KDesktopFileActions
      * by kio itself. Namely mount/unmount for FSDevice files.
      * @return the list of services
      */
-    KIO_EXPORT QList<KServiceAction> builtinServices( const KUrl& url );
+    KIO_EXPORT QList<KServiceAction> builtinServices(const QUrl& url);
 
     /**
      * Returns a list of services defined by the user as possible actions
@@ -48,14 +48,14 @@ namespace KDesktopFileActions
      * (if false, services that don't have %u or %U in the Exec line won't be taken \
                into account).
      * @return the list of user defined actions
      */
-    KIO_EXPORT QList<KServiceAction> userDefinedServices( const QString& path, bool \
bLocalFiles ); +    KIO_EXPORT QList<KServiceAction> userDefinedServices(const \
QString& path, bool bLocalFiles);  
     /**
      * Overload of userDefinedServices but also allows you to pass a list of urls \
                for this file.
      * This allows for the menu to be changed depending on the exact files via
      * the X-KDE-GetActionMenu extension.
      */
-    KIO_EXPORT QList<KServiceAction> userDefinedServices( const QString& path, const \
KDesktopFile& desktopFile, bool bLocalFiles, const QList<QUrl> & file_list = \
KUrl::List()); +    KIO_EXPORT QList<KServiceAction> userDefinedServices(const \
QString& path, const KDesktopFile& desktopFile, bool bLocalFiles, const QList<QUrl> & \
file_list = QList<QUrl>());  
     /**
      * Returns a list of services defined by the user as possible actions
@@ -71,14 +71,14 @@ namespace KDesktopFileActions
      *
      * @return the list of user defined actions
      */
-    KIO_EXPORT QList<KServiceAction> userDefinedServices( const KService& service, \
bool bLocalFiles, const QList<QUrl> & file_list = KUrl::List() ); +    KIO_EXPORT \
QList<KServiceAction> userDefinedServices(const KService& service, bool bLocalFiles, \
const QList<QUrl> & file_list = QList<QUrl>());  
    /**
      * Execute @p service on the list of @p urls.
      * @param urls the list of urls
      * @param service the service to execute
      */
-    KIO_EXPORT void executeService( const QList<QUrl>& urls, const KServiceAction& \
service ); +    KIO_EXPORT void executeService(const QList<QUrl>& urls, const \
KServiceAction& service);  
     /**
      * Invokes the default action for the desktop entry. If the desktop
@@ -91,7 +91,7 @@ namespace KDesktopFileActions
      * @return true on success and false on failure.
      * @see KRun::runUrl
      */
-    KIO_EXPORT bool run( const KUrl& _url, bool _is_local );
+    KIO_EXPORT bool run(const QUrl& _url, bool _is_local);
 }
 
 #endif
diff --git a/kio/kio/kfileitemactions.cpp b/kio/kio/kfileitemactions.cpp
index 6528cf5..62723b0 100644
--- a/kio/kio/kfileitemactions.cpp
+++ b/kio/kio/kfileitemactions.cpp
@@ -216,7 +216,7 @@ int KFileItemActions::addServiceActionsTo(QMenu* mainMenu)
         d->m_props.mimeType() == "inode/blockdevice")) { // dev file
         // get builtin services, like mount/unmount
         const QString path = firstItem.localPath();
-        s.builtin = KDesktopFileActions::builtinServices(path);
+        s.builtin = KDesktopFileActions::builtinServices(QUrl::fromLocalFile(path));
         KDesktopFile desktopFile(path);
         KConfigGroup cfg = desktopFile.desktopGroup();
         const QString priority = cfg.readEntry("X-KDE-Priority");
diff --git a/kio/kio/kfilemetainfo.cpp b/kio/kio/kfilemetainfo.cpp
index b32d4ee..21331e2 100644
--- a/kio/kio/kfilemetainfo.cpp
+++ b/kio/kio/kfilemetainfo.cpp
@@ -34,7 +34,6 @@
 #include <strigi/fieldtypes.h>
 #endif
 
-#include <kurl.h>
 #include <kdebug.h>
 
 #include <QFileInfo>
@@ -213,10 +212,10 @@ class KFileMetaInfoPrivate : public QSharedData
 {
 public:
     QHash<QString, KFileMetaInfoItem> items;
-    KUrl m_url;
+    QUrl m_url;
 
-    void init ( QIODevice& stream, const KUrl& url, time_t mtime, \
                KFileMetaInfo::WhatFlags w = KFileMetaInfo::Everything );
-    void initWriters ( const KUrl& /*file*/ );
+    void init ( QIODevice& stream, const QUrl& url, time_t mtime, \
KFileMetaInfo::WhatFlags w = KFileMetaInfo::Everything ); +    void initWriters ( \
const QUrl& /*file*/ );  void operator= ( const KFileMetaInfoPrivate& k ) {
         items = k.items;
     }
@@ -243,7 +242,7 @@ private:
     KFileMetaInfo::WhatFlags m_indexDetail;
 };
 
-void KFileMetaInfoPrivate::init ( QIODevice& stream, const KUrl& url, time_t mtime, \
KFileMetaInfo::WhatFlags w ) +void KFileMetaInfoPrivate::init ( QIODevice& stream, \
const QUrl& url, time_t mtime, KFileMetaInfo::WhatFlags w )  {
     m_url = url;
 
@@ -261,7 +260,7 @@ void KFileMetaInfoPrivate::init ( QIODevice& stream, const KUrl& \
url, time_t mti  // TODO: get data from Nepomuk
 }
 
-void KFileMetaInfoPrivate::initWriters ( const KUrl& file )
+void KFileMetaInfoPrivate::initWriters ( const QUrl& file )
 {
     QStringList mimetypes;
     QHash<QString, KFileMetaInfoItem>::iterator i;
@@ -284,7 +283,7 @@ KFileMetaInfo::KFileMetaInfo ( const QString& path, const \
QString& /*mimetype*/,  // if e.g. the path points to a pipe, it is not opened
     if ( ( fileinfo.isFile() || fileinfo.isDir() || fileinfo.isSymLink() )
             && file.open ( QIODevice::ReadOnly ) ) {
-        KUrl u ( path );
+        const QUrl u = QUrl::fromLocalFile(path);
         d->init ( file, u, fileinfo.lastModified().toTime_t(), w );
         if ( fileinfo.isWritable() ) {
             d->initWriters ( u );
@@ -292,12 +291,12 @@ KFileMetaInfo::KFileMetaInfo ( const QString& path, const \
QString& /*mimetype*/,  }
 }
 
-KFileMetaInfo::KFileMetaInfo ( const KUrl& url )
+KFileMetaInfo::KFileMetaInfo(const QUrl& url)
         : d ( new KFileMetaInfoPrivate() )
 {
-    QFileInfo fileinfo ( url.toLocalFile() );
-    QFile file ( url.toLocalFile() );
+    QFile file(url.toLocalFile());
     if ( file.open ( QIODevice::ReadOnly ) ) {
+        QFileInfo fileinfo(url.toLocalFile());
         d->init ( file, url, fileinfo.lastModified().toTime_t() );
         if ( fileinfo.isWritable() ) {
             d->initWriters ( url );
@@ -343,7 +342,7 @@ bool KFileMetaInfo::applyChanges()
     return ok;
 }
 
-const KUrl& KFileMetaInfo::url() const
+const QUrl& KFileMetaInfo::url() const
 {
     return d->m_url;
 }
@@ -409,7 +408,7 @@ KFileMetaInfo::KFileMetaInfo ( const QString& path, const \
QString& /*mimetype*/,  {
 }
 
-KFileMetaInfo::KFileMetaInfo ( const KUrl& url )
+KFileMetaInfo::KFileMetaInfo(const QUrl& url)
 {
 }
 
@@ -435,10 +434,9 @@ bool KFileMetaInfo::applyChanges()
     return false;
 }
 
-const KUrl& KFileMetaInfo::url() const
+QUrl KFileMetaInfo::url() const
 {
-    static const KUrl item;
-    return item;
+    return QUrl();
 }
 
 const QHash<QString, KFileMetaInfoItem>& KFileMetaInfo::items() const
@@ -478,7 +476,7 @@ QStringList KFileMetaInfo::supportedKeys() const
 {
     return QStringList();
 }
-#endif
+#endif //KIO_NO_STRIGI
 
 KFileMetaInfoItemList KFileMetaInfoGroup::items() const
 {
diff --git a/kio/kio/kfilemetainfo.h b/kio/kio/kfilemetainfo.h
index d2a5fbb..c72c540 100644
--- a/kio/kio/kfilemetainfo.h
+++ b/kio/kio/kfilemetainfo.h
@@ -25,7 +25,7 @@
 #include "kfilemetainfoitem.h"
 #include <QtCore/QList>
 #include <QtCore/QStringList>
-class KUrl;
+class QUrl;
 
 typedef QList<KFileMetaInfoItem> KFileMetaInfoItemList;
 
@@ -101,7 +101,7 @@ public:
      * the resource pointed to by @p url.
      * @note that c'tor is not thread-safe
      **/
-    KFileMetaInfo(const KUrl& url);
+    KFileMetaInfo(const QUrl& url);
     /**
      * @brief Construct an empty, invalid KFileMetaInfo instance.
      **/
@@ -154,7 +154,7 @@ public:
 #endif
     KFileMetaInfoGroupList groups() const;
     QStringList keys() const;
-    const KUrl& url() const;
+    const QUrl& url() const;
 
 private:
     QSharedDataPointer<KFileMetaInfoPrivate> d;
diff --git a/kio/kio/kfilemetainfoitem_p.h b/kio/kio/kfilemetainfoitem_p.h
index 48bb4f1..30726e3 100644
--- a/kio/kio/kfilemetainfoitem_p.h
+++ b/kio/kio/kfilemetainfoitem_p.h
@@ -2,7 +2,7 @@
 
    Copyright (c) 2007 Jos van den Oever <jos@vandenoever.info>
                  2010 Sebastian Trueg <trueg@kde.org>
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License (LGPL) as published by the Free Software Foundation; either
@@ -47,7 +47,6 @@ public:
     Nepomuk::Types::Property pp;
 #endif
 #endif
-    KUrl propertyUri;
     QVariant value;
     KFileWritePlugin* writer;
     bool embedded;


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

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