diff --git a/packagemetadata.cpp b/packagemetadata.cpp index dd8256021..d6138ad9a 100644 --- a/packagemetadata.cpp +++ b/packagemetadata.cpp @@ -51,11 +51,6 @@ class PackageMetadataPrivate QString api; }; -PackageMetadata::PackageMetadata() - : d(new PackageMetadataPrivate) -{ -} - PackageMetadata::PackageMetadata(const PackageMetadata &other) : d(new PackageMetadataPrivate(*other.d)) { @@ -105,8 +100,12 @@ void PackageMetadata::write(const QString &filename) const void PackageMetadata::read(const QString &filename) { - KConfig cfg(filename); - KConfigGroup config(&cfg, "Desktop Entry"); + if (filename.isEmpty()) { + return; + } + + KDesktopFile cfg(filename); + KConfigGroup config = cfg.desktopGroup(); d->name = config.readEntry("Name", d->name); d->description = config.readEntry("Comment", d->description); diff --git a/packagemetadata.h b/packagemetadata.h index d3bc419e8..9bcc1f868 100644 --- a/packagemetadata.h +++ b/packagemetadata.h @@ -38,21 +38,17 @@ class PLASMA_EXPORT PackageMetadata { public: /** - * Default constructor + * Constructs a metadata object using the values in the file at path + * + * @param path path to a metadata.desktop file **/ - PackageMetadata(); + explicit PackageMetadata(const QString &path = QString()); /** * Copy constructor **/ PackageMetadata(const PackageMetadata &other); - /** - * Constructs a metadata object using the values in the file at path - * - * @param path path to a metadata.desktop file - **/ - PackageMetadata(const QString &path); ~PackageMetadata(); bool isValid() const;