collapse the construtors into one

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=879355
This commit is contained in:
Aaron J. Seigo 2008-11-03 03:53:12 +00:00
parent 892396143f
commit c1ee201060
2 changed files with 10 additions and 15 deletions

View File

@ -51,11 +51,6 @@ class PackageMetadataPrivate
QString api; QString api;
}; };
PackageMetadata::PackageMetadata()
: d(new PackageMetadataPrivate)
{
}
PackageMetadata::PackageMetadata(const PackageMetadata &other) PackageMetadata::PackageMetadata(const PackageMetadata &other)
: d(new PackageMetadataPrivate(*other.d)) : d(new PackageMetadataPrivate(*other.d))
{ {
@ -105,8 +100,12 @@ void PackageMetadata::write(const QString &filename) const
void PackageMetadata::read(const QString &filename) void PackageMetadata::read(const QString &filename)
{ {
KConfig cfg(filename); if (filename.isEmpty()) {
KConfigGroup config(&cfg, "Desktop Entry"); return;
}
KDesktopFile cfg(filename);
KConfigGroup config = cfg.desktopGroup();
d->name = config.readEntry("Name", d->name); d->name = config.readEntry("Name", d->name);
d->description = config.readEntry("Comment", d->description); d->description = config.readEntry("Comment", d->description);

View File

@ -38,21 +38,17 @@ class PLASMA_EXPORT PackageMetadata
{ {
public: 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 * Copy constructor
**/ **/
PackageMetadata(const PackageMetadata &other); 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(); ~PackageMetadata();
bool isValid() const; bool isValid() const;