From c1ee2010600adc00c74bcc16455b62c52f9c5b20 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 3 Nov 2008 03:53:12 +0000 Subject: [PATCH] collapse the construtors into one svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=879355 --- packagemetadata.cpp | 13 ++++++------- packagemetadata.h | 12 ++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) 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;