From 334173058625101133bb1064913bc21708cde502 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 29 Mar 2016 22:56:42 +0000 Subject: [PATCH] generic: misc cleanups Signed-off-by: Ivailo Monev --- kdecore/io/kurl.cpp | 10 ---------- kdecore/io/kurl.h | 20 +++----------------- kio/CMakeLists.txt | 1 - kio/kio/kfileitem.cpp | 2 +- kio/kio/kfilemetainfo.cpp | 7 ++----- kio/kio/kfilemetainfo.h | 7 +++++-- 6 files changed, 11 insertions(+), 36 deletions(-) diff --git a/kdecore/io/kurl.cpp b/kdecore/io/kurl.cpp index 0d282d5e..bc487cc3 100644 --- a/kdecore/io/kurl.cpp +++ b/kdecore/io/kurl.cpp @@ -319,11 +319,6 @@ KUrl::List KUrl::List::fromMimeData(const QMimeData *mimeData, return uris; } -KUrl::List KUrl::List::fromMimeData( const QMimeData *mimeData, KUrl::MetaDataMap* metaData ) -{ - return fromMimeData(mimeData, PreferKdeUrls, metaData); -} - KUrl::List::operator QVariant() const { return qVariantFromValue(*this); @@ -1003,11 +998,6 @@ QString KUrl::prettyUrl( int _trailing, AdjustementFlags _flags) const } #endif -QString KUrl::pathOrUrl() const -{ - return pathOrUrl(LeaveTrailingSlash); -} - QString KUrl::pathOrUrl(AdjustPathOption trailing) const { if ( isLocalFile() && fragment().isNull() && encodedQuery().isNull() ) { diff --git a/kdecore/io/kurl.h b/kdecore/io/kurl.h index 07830d70..dc162d38 100644 --- a/kdecore/io/kurl.h +++ b/kdecore/io/kurl.h @@ -271,16 +271,6 @@ public: */ static QStringList mimeDataTypes(); - /** - * Extract a list of KUrls from the contents of @p mimeData. - * Decoding will fail if @p mimeData does not contain any URLs, or if at - * least one extracted URL is not valid. - * @param mimeData the mime data to extract from; cannot be 0 - * @param metaData optional pointer to a map holding the metadata - * @return the list of urls - */ - static KUrl::List fromMimeData( const QMimeData *mimeData, KUrl::MetaDataMap* metaData = 0 ); - /** * Flags to be used in fromMimeData. * @since 4.2.3 @@ -313,7 +303,7 @@ public: * @since 4.2.3 */ static KUrl::List fromMimeData( const QMimeData *mimeData, - DecodeOptions decodeOptions, // TODO KDE5: = PreferKdeUrls, and merge with above + DecodeOptions decodeOptions = PreferKdeUrls, KUrl::MetaDataMap* metaData = 0 ); }; @@ -837,15 +827,11 @@ public: * You can give the result of pathOrUrl back to the KUrl constructor, it accepts * both paths and urls. * - * @return the new KUrl - */ - QString pathOrUrl() const; - /** - * Overload with @p trailing parameter * @param trailing use to add or remove a trailing slash to/from the path. see adjustPath. + * @return the new KUrl * @since 4.2 */ - QString pathOrUrl(AdjustPathOption trailing) const; // KDE5: merge with above. Rename to toUrlOrLocalFile? + QString pathOrUrl(AdjustPathOption trailing = LeaveTrailingSlash) const; /** * Returns the URL as a string, using the standard conventions for mime data diff --git a/kio/CMakeLists.txt b/kio/CMakeLists.txt index a1a57e17..f46ec12e 100644 --- a/kio/CMakeLists.txt +++ b/kio/CMakeLists.txt @@ -7,7 +7,6 @@ endif() if(NOT STRIGI_FOUND) set(KIO_NO_STRIGI TRUE) endif() -set(KIO_NO_STRIGI TRUE) if(OPENSSL_FOUND) set(KSSL_HAVE_SSL 1) diff --git a/kio/kio/kfileitem.cpp b/kio/kio/kfileitem.cpp index 227d3f67..bf055fc0 100644 --- a/kio/kio/kfileitem.cpp +++ b/kio/kio/kfileitem.cpp @@ -1246,7 +1246,7 @@ KFileMetaInfo KFileItem::metaInfo(bool autoget, int what) const { bool isLocalUrl; KUrl url(mostLocalUrl(isLocalUrl)); - d->m_metaInfo = KFileMetaInfo(url.toLocalFile(), mimetype(), (KFileMetaInfo::What)what); + d->m_metaInfo = KFileMetaInfo(url.toLocalFile(), (KFileMetaInfo::What)what); } return d->m_metaInfo; } diff --git a/kio/kio/kfilemetainfo.cpp b/kio/kio/kfilemetainfo.cpp index 42eb2c80..b46cb585 100644 --- a/kio/kio/kfilemetainfo.cpp +++ b/kio/kio/kfilemetainfo.cpp @@ -261,7 +261,6 @@ void KFileMetaInfoPrivate::init ( QIODevice& stream, const KUrl& url, time_t mti void KFileMetaInfoPrivate::initWriters ( const KUrl& file ) { - QStringList mimetypes; QHash::iterator i; for ( i = items.begin(); i != items.end(); ++i ) { KFileWritePlugin *w = @@ -272,8 +271,7 @@ void KFileMetaInfoPrivate::initWriters ( const KUrl& file ) } } -KFileMetaInfo::KFileMetaInfo ( const QString& path, const QString& /*mimetype*/, - KFileMetaInfo::WhatFlags w ) +KFileMetaInfo::KFileMetaInfo ( const QString& path, KFileMetaInfo::WhatFlags w ) : d ( new KFileMetaInfoPrivate() ) { QFileInfo fileinfo ( path ); @@ -392,8 +390,7 @@ class KFileMetaInfoPrivate : public QSharedData public: }; -KFileMetaInfo::KFileMetaInfo ( const QString& path, const QString& /*mimetype*/, - KFileMetaInfo::WhatFlags w ) +KFileMetaInfo::KFileMetaInfo ( const QString& path, KFileMetaInfo::WhatFlags w ) { Q_UNUSED(path); Q_UNUSED(w); diff --git a/kio/kio/kfilemetainfo.h b/kio/kio/kfilemetainfo.h index 6012e74c..3079939a 100644 --- a/kio/kio/kfilemetainfo.h +++ b/kio/kio/kfilemetainfo.h @@ -87,9 +87,12 @@ public: * the resource pointed to by @p path. * * When w is not Everything, a limit of 64kbytes is imposed on the file size. + * @note The path must be full (start with a slash) or relative, e.g. + * "/home/joe/pic.png" or "../joe/pic.png". If it starts with a URL scheme, + * e.g. "file:///home/joe/pic.png" it will be considered invalid. If it may + * start with URL scheme use the constructor that takes KUrl. **/ - explicit KFileMetaInfo(const QString& path, const QString& mimetype = QString(), - WhatFlags w = Everything); + explicit KFileMetaInfo(const QString& path, WhatFlags w = Everything); /** * @brief Construct a KFileMetaInfo that contains metainformation about * the resource pointed to by @p url.