From 7e99f4c2cd1a66c39117df3b49ba2aec4b2fa0d8 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Fri, 6 May 2011 12:20:00 +0200 Subject: [PATCH] mimetype -> mimeType --- packagestructure.cpp | 43 +++++++++++++++++++++---------------------- packagestructure.h | 34 +++++++++++++++++----------------- 2 files changed, 38 insertions(+), 39 deletions(-) diff --git a/packagestructure.cpp b/packagestructure.cpp index 4fb78c33a..03408d4d7 100644 --- a/packagestructure.cpp +++ b/packagestructure.cpp @@ -59,14 +59,14 @@ class ContentStructure { paths = other.paths; name = other.name; - mimetypes = other.mimetypes; + mimeTypes = other.mimeTypes; directory = other.directory; required = other.required; } QStringList paths; QString name; - QStringList mimetypes; + QStringList mimeTypes; bool directory : 1; bool required : 1; }; @@ -100,7 +100,7 @@ public: QString packageRoot; QString servicePrefix; QMap contents; - QStringList mimetypes; + QStringList mimeTypes; PackageMetadata *metadata; bool externalPaths; }; @@ -411,33 +411,33 @@ bool PackageStructure::isRequired(const char *key) const return it.value().required; } -void PackageStructure::setDefaultMimetypes(QStringList mimetypes) +void PackageStructure::setDefaultMimetypes(QStringList mimeTypes) { - d->mimetypes = mimetypes; + d->mimeTypes = mimeTypes; } -void PackageStructure::setMimetypes(const char *key, QStringList mimetypes) +void PackageStructure::setMimetypes(const char *key, QStringList mimeTypes) { QMap::iterator it = d->contents.find(key); if (it == d->contents.end()) { return; } - it.value().mimetypes = mimetypes; + it.value().mimeTypes = mimeTypes; } -QStringList PackageStructure::mimetypes(const char *key) const +QStringList PackageStructure::mimeTypes(const char *key) const { QMap::const_iterator it = d->contents.constFind(key); if (it == d->contents.constEnd()) { return QStringList(); } - if (it.value().mimetypes.isEmpty()) { - return d->mimetypes; + if (it.value().mimeTypes.isEmpty()) { + return d->mimeTypes; } - return it.value().mimetypes; + return it.value().mimeTypes; } void PackageStructure::setPath(const QString &path) @@ -481,7 +481,7 @@ void PackageStructure::pathChanged() void PackageStructure::read(const KConfigBase *config) { d->contents.clear(); - d->mimetypes.clear(); + d->mimeTypes.clear(); KConfigGroup general(config, QString()); d->type = general.readEntry("Type", QString()); d->contentsPrefixPaths = general.readEntry("ContentsPrefixPaths", d->contentsPrefixPaths); @@ -495,7 +495,7 @@ void PackageStructure::read(const KConfigBase *config) QString path = entry.readEntry("Path", QString()); QString name = entry.readEntry("Name", QString()); - QStringList mimetypes = entry.readEntry("Mimetypes", QStringList()); + QStringList mimeTypes = entry.readEntry("Mimetypes", QStringList()); bool directory = entry.readEntry("Directory", false); bool required = entry.readEntry("Required", false); @@ -505,7 +505,7 @@ void PackageStructure::read(const KConfigBase *config) addFileDefinition(key, path, name); } - setMimetypes(key, mimetypes); + setMimetypes(key, mimeTypes); setRequired(key, required); } } @@ -523,8 +523,8 @@ void PackageStructure::write(KConfigBase *config) const KConfigGroup group = config->group(it.key()); group.writeEntry("Path", it.value().paths); group.writeEntry("Name", it.value().name); - if (!it.value().mimetypes.isEmpty()) { - group.writeEntry("Mimetypes", it.value().mimetypes); + if (!it.value().mimeTypes.isEmpty()) { + group.writeEntry("Mimetypes", it.value().mimeTypes); } if (it.value().directory) { group.writeEntry("Directory", true); @@ -608,7 +608,6 @@ void PackageStructurePrivate::createPackageMetadata(const QString &path) metadata = new PackageMetadata(metadataPath); } -//FIXME KDE5: should be const PackageMetadata PackageStructure::metadata() { if (!d->metadata && !d->path.isEmpty()) { @@ -618,15 +617,15 @@ PackageMetadata PackageStructure::metadata() d->createPackageMetadata(d->path); } else if (fileInfo.exists()) { KArchive *archive = 0; - KMimeType::Ptr mimetype = KMimeType::findByPath(d->path); + KMimeType::Ptr mimeType = KMimeType::findByPath(d->path); - if (mimetype->is("application/zip")) { + if (mimeType->is("application/zip")) { archive = new KZip(d->path); - } else if (mimetype->is("application/x-compressed-tar") || - mimetype->is("application/x-tar")|| mimetype->is("application/x-bzip-compressed-tar")) { + } else if (mimeType->is("application/x-compressed-tar") || + mimeType->is("application/x-tar")|| mimeType->is("application/x-bzip-compressed-tar")) { archive = new KTar(d->path); } else { - kWarning() << "Could not open package file, unsupported archive format:" << d->path << mimetype->name(); + kWarning() << "Could not open package file, unsupported archive format:" << d->path << mimeType->name(); } if (archive && archive->open(QIODevice::ReadOnly)) { diff --git a/packagestructure.h b/packagestructure.h index b2f2e4387..334985c59 100644 --- a/packagestructure.h +++ b/packagestructure.h @@ -51,14 +51,14 @@ class PackageStructurePrivate; PackageStructure structure; structure.addDirectoryDefinition("images", "pics/", i18n("Images")); - QStringList mimetypes; - mimetypes << "image/svg" << "image/png" << "image/jpeg"; - structure.setMimetypes("images", mimetypes); + QStringList mimeTypes; + mimeTypes << "image/svg" << "image/png" << "image/jpeg"; + structure.setMimetypes("images", mimeTypes); structure.addDirectoryDefinition("scripts", "code/", i18n("Executable Scripts")); - mimetypes.clear(); - mimetypes << "text/\*"; - structure.setMimetypes("scripts", mimetypes); + mimeTypes.clear(); + mimeTypes << "text/\*"; + structure.setMimetypes("scripts", mimeTypes); structure.addFileDefinition("mainscript", "code/main.js", i18n("Main Script File")); structure.setRequired("mainscript", true); @@ -131,7 +131,7 @@ public: /** * Adds a directory to the structure of the package. It is added as - * a not-required element with no associated mimetypes. + * a not-required element with no associated mimeTypes. * * Starting in 4.6, if an entry with the given key * already exists, the path is added to it as a search alternative. @@ -144,7 +144,7 @@ public: /** * Adds a file to the structure of the package. It is added as - * a not-required element with no associated mimetypes. + * a not-required element with no associated mimeTypes. * * Starting in 4.6, if an entry with the given key * already exists, the path is added to it as a search alternative. @@ -206,28 +206,28 @@ public: bool isRequired(const char *key) const; /** - * Defines the default mimetypes for any definitions that do not have - * associated mimetypes. Handy for packages with only one or predominantly + * Defines the default mimeTypes for any definitions that do not have + * associated mimeTypes. Handy for packages with only one or predominantly * one file type. * - * @param mimetypes a list of mimetypes + * @param mimeTypes a list of mimeTypes **/ - void setDefaultMimetypes(QStringList mimetypes); + void setDefaultMimetypes(QStringList mimeTypes); /** - * Define mimetypes for a given part of the structure + * Define mimeTypes for a given part of the structure * The path must already have been added using addDirectoryDefinition * or addFileDefinition. * * @param key the entry within the package - * @param mimetypes a list of mimetypes + * @param mimeTypes a list of mimeTypes **/ - void setMimetypes(const char *key, QStringList mimetypes); + void setMimetypes(const char *key, QStringList mimeTypes); /** - * @return the mimetypes associated with the path, if any + * @return the mimeTypes associated with the path, if any **/ - QStringList mimetypes(const char *key) const; + QStringList mimeTypes(const char *key) const; /** * Sets the path to the package. Useful for package formats