diff options
author | Luís Pereira <luis.artur.pereira@gmail.com> | 2013-09-12 12:08:25 -0700 |
---|---|---|
committer | Luís Pereira <luis.artur.pereira@gmail.com> | 2013-09-13 16:47:53 +0200 |
commit | 2e91c499ca50264805d438a37c1176b0a415019e (patch) | |
tree | ae501c196f28f8d55d54ff37e76cd297f26cc59a | |
parent | b80b96a6e9db660e03777233973045cc2c28ed89 (diff) |
Kills all the QML stuff
It didn't make to Qt5 because it made no sense. No point in having it in
Qt4.
Change-Id: I94a4444d0c667c4dc2b07565f45ff05ad53680db
Signed-off-by: Luís Pereira <luis.artur.pereira@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
22 files changed, 2 insertions, 2407 deletions
diff --git a/mimetypes-nolibs.pri b/mimetypes-nolibs.pri index 66e94a0..5178197 100644 --- a/mimetypes-nolibs.pri +++ b/mimetypes-nolibs.pri @@ -3,7 +3,7 @@ MIMETYPES_PRI_INCLUDED = 1 INCLUDEPATH += $$PWD/include/QtMimeTypes INCLUDEPATH += $$PWD/src/mimetypes/inqt5 -INCLUDEPATH += $$PWD/src/mimetypes $$PWD/src/imports/mimetypes +INCLUDEPATH += $$PWD/src/mimetypes mac|darwin: { QMAKE_CXXFLAGS += -ansi diff --git a/src/imports/imports.pro b/src/imports/imports.pro deleted file mode 100644 index 8d627c0..0000000 --- a/src/imports/imports.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += mimetypes diff --git a/src/imports/mimetypes/mimetypes.cpp b/src/imports/mimetypes/mimetypes.cpp deleted file mode 100644 index 8499150..0000000 --- a/src/imports/mimetypes/mimetypes.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativemimetype_p.h" -#include "qdeclarativemimedatabase_p.h" - -#include <QtDeclarative/qdeclarativeextensionplugin.h> - -// ------------------------------------------------------------------------------------------------ - -class QMimeTypesDeclarativeModule : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - virtual void registerTypes(const char* uri); -}; - -// ------------------------------------------------------------------------------------------------ - -void QMimeTypesDeclarativeModule::registerTypes(const char* uri) -{ - qmlRegisterType<QDeclarativeMimeType>(uri, 1, 0, "MimeType"); - qmlRegisterType<QDeclarativeMimeDatabase>(uri, 1, 0, "MimeDatabase"); -} - -// ------------------------------------------------------------------------------------------------ - -#include "mimetypes.moc" - -Q_EXPORT_PLUGIN2(qmimetypesdeclarativemodule, QT_PREPEND_NAMESPACE(QMimeTypesDeclarativeModule)) diff --git a/src/imports/mimetypes/mimetypes.pro b/src/imports/mimetypes/mimetypes.pro deleted file mode 100644 index d5ed658..0000000 --- a/src/imports/mimetypes/mimetypes.pro +++ /dev/null @@ -1,38 +0,0 @@ -include(../../../mimetypes-nolibs.pri) -LIBS += -L$$OUT_PWD/../../../src/mimetypes -lQtMimeTypes - -CONFIG += qt plugin -TEMPLATE = lib -TARGET = declarative_mimetypes - -# QtCore/qlist.h uses /usr/include/limits.h which uses does not compile with -pedantic. -# QtDeclarative/qdeclarativeprivate.h will not compile with -pedantic. -#MAKE_CXXFLAGS += -W -Wall -Wextra -Werror -pedantic -Wshadow -Wno-long-long -Wnon-virtual-dtor -QMAKE_CXXFLAGS += -W -Wall -Wextra -Werror -Wshadow -Wno-long-long -Wnon-virtual-dtor - - -CONFIG += depend_includepath - -QT += declarative - - -SOURCES += mimetypes.cpp - -# No headers - - -SOURCES += qdeclarativemimetype.cpp \ - qdeclarativemimedatabase.cpp - -HEADERS += qdeclarativemimetype_p.h \ - qdeclarativemimedatabase_p.h - - -qmldir.files += $$PWD/qmldir plugins.qmltypes - - -unix:!symbian { - target.path = $$[QT_INSTALL_IMPORTS]/QtMimeTypes - qmldir.path = $$[QT_INSTALL_IMPORTS]/QtMimeTypes - INSTALLS += qmldir target -} diff --git a/src/imports/mimetypes/plugins.qmltypes b/src/imports/mimetypes/plugins.qmltypes deleted file mode 100644 index ab6c8d1..0000000 --- a/src/imports/mimetypes/plugins.qmltypes +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick.tooling 1.1 - -// This file describes the plugin-supplied types contained in the library. -// It is used for QML tooling purposes only. - -Module { - Component { - name: "QDeclarativeMimeDatabase" - prototype: "QObject" - exports: ["MimeDatabase 1.0"] - Property { name: "mimeTypeNames"; type: "QVariantList"; isReadonly: true } - Method { - name: "mimeTypeForName" - type: "QDeclarativeMimeType*" - Parameter { name: "nameOrAlias"; type: "string" } - } - Method { - name: "mimeTypeForFileName" - type: "QDeclarativeMimeType*" - Parameter { name: "fileName"; type: "string" } - } - Method { - name: "mimeTypeForFile" - type: "QDeclarativeMimeType*" - Parameter { name: "fileName"; type: "string" } - } - } - Component { - name: "QDeclarativeMimeType" - prototype: "QObject" - exports: ["MimeType 1.0"] - Property { name: "name"; type: "string" } - Property { name: "genericIconName"; type: "string" } - Property { name: "iconName"; type: "string" } - Property { name: "globPatterns"; type: "QVariantList" } - Property { name: "suffixes"; type: "QVariantList"; isReadonly: true } - Property { name: "preferredSuffix"; type: "string"; isReadonly: true } - Property { name: "isValid"; type: "bool"; isReadonly: true } - Method { - name: "assign" - Parameter { name: "other"; type: "QDeclarativeMimeType"; isPointer: true } - } - Method { - name: "equals" - type: "bool" - Parameter { name: "other"; type: "QDeclarativeMimeType"; isPointer: true } - } - Method { name: "properties"; type: "QVariantMap" } - Method { - name: "assignProperties" - Parameter { name: "other"; type: "QVariantMap" } - } - Method { - name: "equalsProperties" - type: "bool" - Parameter { name: "other"; type: "QVariantMap" } - } - } -} diff --git a/src/imports/mimetypes/qdeclarativemimedatabase.cpp b/src/imports/mimetypes/qdeclarativemimedatabase.cpp deleted file mode 100644 index f7d3da0..0000000 --- a/src/imports/mimetypes/qdeclarativemimedatabase.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativemimedatabase_p.h" // Basis - -#include "qdeclarativemimetype_p.h" - -#include <QtCore/QDebug> - -// ------------------------------------------------------------------------------------------------ - -extern bool qt_isQMimeDatabaseDebuggingActivated; - -#ifndef QT_NO_DEBUG_OUTPUT -#define DBG() if (qt_isQMimeDatabaseDebuggingActivated) qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO -#else -#define DBG() if (0) qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO -#endif - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlclass MimeDatabase QDeclarativeMimeDatabase - \brief The QML MimeDatabase element maintains a database of MIME types. - - The MIME type database is provided by the freedesktop.org shared-mime-info - project. If the MIME type database cannot be found on the system, Qt - will use its own copy of it. - - Applications which want to define custom MIME types need to install an - XML file into the locations searched for MIME definitions. - These locations can be queried with - QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/packages"), - QStandardPaths::LocateDirectory); - On a typical Unix system, this will be /usr/share/mime/packages/, but it is also - possible to extend the list of directories by setting the environment variable - XDG_DATA_DIRS. For instance adding /opt/myapp/share to XDG_DATA_DIRS will result - in /opt/myapp/share/mime/packages/ being searched for MIME definitions. - - Here is an example of MIME XML: - \code - <?xml version="1.0" encoding="UTF-8"?> - <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> - <mime-type type="application/vnd.nokia.qt.qmakeprofile"> - <comment xml:lang="en">Qt qmake Profile</comment> - <glob pattern="*.pro" weight="50"/> - </mime-type> - </mime-info> - \endcode - - For more details about the syntax of XML MIME definitions, including defining - "magic" in order to detect MIME types based on data as well, read the - Shared Mime Info specification at - http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html - - On Unix systems, a binary cache is used for more performance. This cache is generated - by the command "update-mime-database path", where path would be /opt/myapp/share/mime - in the above example. Make sure to run this command when installing the MIME type - definition file. - - The class is protected by a QMutex and can therefore be accessed by threads. - - \sa QMimeType - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \class QDeclarativeMimeDatabase - \brief The QDeclarativeMimeDatabase class is the QML wrapper for the class QMimeDatabase which maintains a database of MIME types. - \inherits QObject - - The MIME type database is provided by the freedesktop.org shared-mime-info - project. If the MIME type database cannot be found on the system, Qt - will use its own copy of it. - - Applications which want to define custom MIME types need to install an - XML file into the locations searched for MIME definitions. - These locations can be queried with - QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/packages"), - QStandardPaths::LocateDirectory); - On a typical Unix system, this will be /usr/share/mime/packages/, but it is also - possible to extend the list of directories by setting the environment variable - XDG_DATA_DIRS. For instance adding /opt/myapp/share to XDG_DATA_DIRS will result - in /opt/myapp/share/mime/packages/ being searched for MIME definitions. - - Here is an example of MIME XML: - \code - <?xml version="1.0" encoding="UTF-8"?> - <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> - <mime-type type="application/vnd.nokia.qt.qmakeprofile"> - <comment xml:lang="en">Qt qmake Profile</comment> - <glob pattern="*.pro" weight="50"/> - </mime-type> - </mime-info> - \endcode - - For more details about the syntax of XML MIME definitions, including defining - "magic" in order to detect MIME types based on data as well, read the - Shared Mime Info specification at - http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html - - On Unix systems, a binary cache is used for more performance. This cache is generated - by the command "update-mime-database path", where path would be /opt/myapp/share/mime - in the above example. Make sure to run this command when installing the MIME type - definition file. - - The class is protected by a QMutex and can therefore be accessed by threads. - - \sa QMimeType - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QDeclarativeMimeDatabase::QDeclarativeMimeDatabase(QObject *theParent); - \brief Performs default initialization of the contained MimeDatabase, and attaches the object to the specified \a theParent for destruction. - */ -QDeclarativeMimeDatabase::QDeclarativeMimeDatabase(QObject *theParent) : - QObject(theParent), - m_MimeDatabase() -{ - DBG() << "mimeTypeNames():" << mimeTypeNames(); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QDeclarativeMimeDatabase::~QDeclarativeMimeDatabase(); - \brief Destroys the contained MimeDatabase. - */ -QDeclarativeMimeDatabase::~QDeclarativeMimeDatabase() -{ - DBG() << "mimeTypeNames():" << mimeTypeNames(); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QMimeDatabase &QDeclarativeMimeDatabase::mimeDatabase() - \brief Returns the contained MimeDatabase. - */ -QMimeDatabase &QDeclarativeMimeDatabase::mimeDatabase() -{ - return m_MimeDatabase; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty bool MimeDatabase::isDebuggingActivated - Holds the indication if debugging for the class is activated. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeDatabase::isDebuggingActivated - Holds the indication if debugging for the class is activated. - */ - -// ------------------------------------------------------------------------------------------------ - -bool QDeclarativeMimeDatabase::isDebuggingActivated() const -{ - return qt_isQMimeDatabaseDebuggingActivated; -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeDatabase::setIsDebuggingActivated(const bool newIsDebuggingActivated) -{ - qt_isQMimeDatabaseDebuggingActivated = newIsDebuggingActivated; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty list<string> MimeDatabase::mimeTypeNames - Holds the list of registered MIME types. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \property QDeclarativeMimeDatabase::mimeTypeNames - Holds the list of registered MIME types. - */ - -// ------------------------------------------------------------------------------------------------ - -QVariantList QDeclarativeMimeDatabase::mimeTypeNames() const -{ - QVariantList result; - - foreach (const QMimeType &mimeType, m_MimeDatabase.allMimeTypes()) { - result << mimeType.name(); - } - - return result; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod MimeType MimeDatabase::mimeTypeForName(string nameOrAlias) - \brief Returns a MIME type for \a nameOrAlias or an invalid one if none found. - */ - -// ------------------------------------------------------------------------------------------------ - -QDeclarativeMimeType *QDeclarativeMimeDatabase::mimeTypeForName ( - const QString &nameOrAlias - ) -{ - return new QDeclarativeMimeType ( - m_MimeDatabase.mimeTypeForName(nameOrAlias), - this // <- The new object will be released later - // when this registry is released. - ); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod MimeType MimeDatabase::mimeTypeForFileName(string fileName) - \brief Returns a MIME type for the file \a fileName. - - A valid MIME type is always returned. If the file name doesn't match any - known pattern, the default MIME type (application/octet-stream) - is returned. - - This function does not try to open the file. To also use the content - when determining the MIME type, use mimeTypeForFile(). -*/ -QDeclarativeMimeType *QDeclarativeMimeDatabase::mimeTypeForFileName ( - const QString &fileName - ) -{ - return new QDeclarativeMimeType ( - m_MimeDatabase.mimeTypeForFile(fileName, QMimeDatabase::MatchExtension), - this // <- The new object will be released later - // when this registry is released. - ); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod MimeType MimeDatabase::mimeTypeForFile(string fileName) - \brief Returns a MIME type for \a fileName. - - This method looks at both the file name and the file contents, - if necessary. The file extension has priority over the contents, - but the contents will be used if the file extension is unknown, or - matches multiple MIME types. - - A valid MIME type is always returned. If the file doesn't match any - known pattern or data, the default MIME type (application/octet-stream) - is returned. - - The \a fileName can also include an absolute or relative path. -*/ -QDeclarativeMimeType *QDeclarativeMimeDatabase::mimeTypeForFile( - const QString &fileName - ) -{ - return new QDeclarativeMimeType ( - m_MimeDatabase.mimeTypeForFile(fileName), - this // <- The new object will be released later - // when this registry is released. - ); -} - -// ------------------------------------------------------------------------------------------------ - -#undef DBG diff --git a/src/imports/mimetypes/qdeclarativemimedatabase_p.h b/src/imports/mimetypes/qdeclarativemimedatabase_p.h deleted file mode 100644 index 9d24b47..0000000 --- a/src/imports/mimetypes/qdeclarativemimedatabase_p.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMIMEDATABASE_P_H_INCLUDED -#define QDECLARATIVEMIMEDATABASE_P_H_INCLUDED - -#include <QtCore/QObject> -#include <qmimedatabase.h> -#include <QtDeclarative/qdeclarative.h> - -class QDeclarativeMimeType; - -// ------------------------------------------------------------------------------------------------ - -class QDeclarativeMimeDatabase : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QVariantList mimeTypeNames - READ mimeTypeNames - STORED false) - - Q_PROPERTY(bool isDebuggingActivated - READ isDebuggingActivated - WRITE setIsDebuggingActivated) - -protected: - // We keep this destructor with its default value of 0 protected since - // only QDeclarativePrivate::QDeclarativeElement<T> needs it: - QDeclarativeMimeDatabase(QObject *theParent = 0); - -public: - ~QDeclarativeMimeDatabase(); - - QMimeDatabase &mimeDatabase(); - - bool isDebuggingActivated() const; - void setIsDebuggingActivated(bool newIsDebuggingActivated); - - QVariantList mimeTypeNames() const; - - Q_INVOKABLE QDeclarativeMimeType *mimeTypeForName ( - const QString &nameOrAlias - ); - - Q_INVOKABLE QDeclarativeMimeType *mimeTypeForFileName ( - const QString &fileName - ); - - Q_INVOKABLE QDeclarativeMimeType *mimeTypeForFile ( - const QString &fileName - ); - -private: - QMimeDatabase m_MimeDatabase; -}; - -QML_DECLARE_TYPE(QDeclarativeMimeDatabase) - -#endif // QDECLARATIVEMIMEDATABASE_P_H_INCLUDED diff --git a/src/imports/mimetypes/qdeclarativemimetype.cpp b/src/imports/mimetypes/qdeclarativemimetype.cpp deleted file mode 100644 index 323e5dd..0000000 --- a/src/imports/mimetypes/qdeclarativemimetype.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qdeclarativemimetype_p.h" // Basis - -#include <QtCore/QDebug> -#include <qmimetype_p.h> - -// ------------------------------------------------------------------------------------------------ - -extern bool qt_isQMimeTypeDebuggingActivated; - -#ifndef QT_NO_DEBUG_OUTPUT -#define DBG() if (qt_isQMimeTypeDebuggingActivated) qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO -#else -#define DBG() if (0) qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO -#endif - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlclass MimeType QDeclarativeMimeType - \brief The QML MimeType element describes types of file or data, represented by a MIME type string. - - For instance a file named "readme.txt" has the MIME type "text/plain". - The MIME type can be determined from the file name, or from the file - contents, or from both. MIME type determination can also be done on - buffers of data not coming from files. - - Determining the MIME type of a file can be useful to make sure your - application supports it. It is also useful in file-manager-like applications - or widgets, in order to display an appropriate icon() for the file, or even - the descriptive comment() in detailed views. - - To check if a file has the expected MIME type, you should use inherits() - rather than a simple string comparison based on the name(). This is because - MIME types can inherit from each other: for instance a C source file is - a specific type of plain text file, so text/x-csrc inherits text/plain. - - \sa QMimeDatabase - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \class QDeclarativeMimeType - \brief The QDeclarativeMimeType class is the QML wrapper for the class QMimeType which describes types of file or data, represented by a MIME type string. - \inherits QObject - - For instance a file named "readme.txt" has the MIME type "text/plain". - The MIME type can be determined from the file name, or from the file - contents, or from both. MIME type determination can also be done on - buffers of data not coming from files. - - Determining the MIME type of a file can be useful to make sure your - application supports it. It is also useful in file-manager-like applications - or widgets, in order to display an appropriate icon() for the file, or even - the descriptive comment() in detailed views. - - To check if a file has the expected MIME type, you should use inherits() - rather than a simple string comparison based on the name(). This is because - MIME types can inherit from each other: for instance a C source file is - a specific type of plain text file, so text/x-csrc inherits text/plain. - - \sa QMimeDatabase - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QDeclarativeMimeType::QDeclarativeMimeType(QObject *theParent); - \brief Performs default initialization of the contained MimeType, and attaches the object to the specified \a theParent for destruction. - */ -QDeclarativeMimeType::QDeclarativeMimeType(QObject *theParent) : - QObject(theParent), - m_MimeType() -{ - DBG() << "name():" << name(); - //DBG() << "aliases():" << aliases(); - //DBG() << "comment():" << comment(); - DBG() << "genericIconName():" << genericIconName(); - DBG() << "iconName():" << iconName(); - DBG() << "globPatterns():" << globPatterns(); - DBG() << "suffixes():" << suffixes(); - DBG() << "preferredSuffix():" << preferredSuffix(); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QDeclarativeMimeType::QDeclarativeMimeType(const QMimeType &other, QObject *theParent); - \brief Copies the specified MimeType \a other, and attaches the object to the specified \a theParent for destruction. - */ -QDeclarativeMimeType::QDeclarativeMimeType(const QMimeType &other, QObject *theParent) : - QObject(theParent), - m_MimeType(other) -{ - DBG() << "name():" << name(); - //DBG() << "aliases():" << aliases(); - //DBG() << "comment():" << comment(); - DBG() << "genericIconName():" << genericIconName(); - DBG() << "iconName():" << iconName(); - DBG() << "globPatterns():" << globPatterns(); - DBG() << "suffixes():" << suffixes(); - DBG() << "preferredSuffix():" << preferredSuffix(); -} - -// ------------------------------------------------------------------------------------------------ - -#ifdef Q_COMPILER_RVALUE_REFS -/*! - \internal - \fn QDeclarativeMimeType::QDeclarativeMimeType(QMimeType &&other, QObject *theParent); - \brief Constructs this QDeclarativeMimeType object by moving the data of the QMimeType rvalue reference \a other, and attaches the object to the specified \a theParent for destruction. - */ -QDeclarativeMimeType::QDeclarativeMimeType(QMimeType &&other, QObject *theParent) : - QObject(theParent), - m_MimeType(other) -{ - DBG() << "name():" << name(); - //DBG() << "aliases():" << aliases(); - //DBG() << "comment():" << comment(); - DBG() << "genericIconName():" << genericIconName(); - DBG() << "iconName():" << iconName(); - DBG() << "globPatterns():" << globPatterns(); - DBG() << "suffixes():" << suffixes(); - DBG() << "preferredSuffix():" << preferredSuffix(); -} -#endif - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QDeclarativeMimeType::~QDeclarativeMimeType(); - \brief Destroys the contained MimeType. - */ -QDeclarativeMimeType::~QDeclarativeMimeType() -{ - DBG() << "name():" << name(); - //DBG() << "aliases():" << aliases(); - //DBG() << "comment():" << comment(); - DBG() << "genericIconName():" << genericIconName(); - DBG() << "iconName():" << iconName(); - DBG() << "globPatterns():" << globPatterns(); - DBG() << "suffixes():" << suffixes(); - DBG() << "preferredSuffix():" << preferredSuffix(); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod void MimeType::assign(MimeType other) - Assigns the data of \a other to this MimeType object. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \fn void QDeclarativeMimeType::assign(QDeclarativeMimeType *other); - \brief Assigns the data of \a other to this QDeclarativeMimeType object. - */ -void QDeclarativeMimeType::assign(QDeclarativeMimeType *other) -{ - if (other == 0) { - qWarning() << Q_FUNC_INFO << "other is 0!"; - m_MimeType = QMimeType(); - return; - } - - m_MimeType = other->m_MimeType; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \qmlmethod bool MimeType::equals(MimeType other) - Returns true if \a other equals this MimeType object, otherwise returns false. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn bool QDeclarativeMimeType::equals(QDeclarativeMimeType *other) const; - \brief Returns true if \a other equals this QDeclarativeMimeType object, otherwise returns false. - */ -bool QDeclarativeMimeType::equals(QDeclarativeMimeType *other) const -{ - if (other == 0) { - qWarning() << Q_FUNC_INFO << "other is 0!"; - return false; - } - - return this == other || m_MimeType == other->m_MimeType; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod object MimeType::properties() - Returns the properties as a JavaScript object. - */ - -// ------------------------------------------------------------------------------------------------ - -#define ASSIGN_TO_PROPERTY(name) \ - result[#name] = name(); - -/*! - \internal - \fn QVariantMap QDeclarativeMimeType::properties() const; - \brief Returns the properties as a JavaScript object. - */ -QVariantMap QDeclarativeMimeType::properties() const -{ - QVariantMap result; - ASSIGN_TO_PROPERTY(name) - //ASSIGN_TO_PROPERTY(aliases) - //ASSIGN_TO_PROPERTY(comment) - ASSIGN_TO_PROPERTY(genericIconName) - ASSIGN_TO_PROPERTY(iconName) - ASSIGN_TO_PROPERTY(globPatterns) - return result; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod void MimeType::assignProperties(object other) - Assigns the data of the JavaScript object \a other to this MimeType object. - */ - -// ------------------------------------------------------------------------------------------------ - -#define ASSIGN_FROM_PROPERTY(name, setter, variantType, converter) \ - if (!other.contains(#name)) { \ - if (false) { \ - qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO << "Variant does not contain" << #name; \ - } \ - } \ - else if (other[#name].type() != QVariant::variantType) { \ - if (false) { \ - qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO << "Variant for" << #name << "has wrong type" << other[#name].type() << "with" << other[#name]; \ - } \ - } \ - else { \ - setter(other[#name].converter()); \ - } - -/*! - \internal - \fn void QDeclarativeMimeType::assignProperties(const QVariantMap &other); - \brief Assigns the data of the QVariantMap \a other to this QDeclarativeMimeType object. - */ -void QDeclarativeMimeType::assignProperties(const QVariantMap &other) -{ - m_MimeType = QMimeType(); - ASSIGN_FROM_PROPERTY(name, setName, String, toString) - //ASSIGN_FROM_PROPERTY(aliases, setAliases, List, toList) - //ASSIGN_FROM_PROPERTY(comment, setComment, String, toString) - ASSIGN_FROM_PROPERTY(genericIconName, setGenericIconName, String, toString) - ASSIGN_FROM_PROPERTY(iconName, setIconName, String, toString) - ASSIGN_FROM_PROPERTY(globPatterns, setGlobPatterns, List, toList) -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlmethod bool MimeType::equalsProperties(object other) - Returns true if the properties of the JavaScript object \a other equal the properties of this MimeType object, otherwise returns false. - */ - -// ------------------------------------------------------------------------------------------------ - -#define EQUALS_PROPERTY(name, variantType, converter) \ - if (!other.contains(#name)) { \ - if (false) { \ - qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO << "Variant does not contain" << #name << name(); \ - } \ - return false; \ - } \ - \ - if (other[#name].type() != QVariant::variantType) { \ - if (false) { \ - qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO << "Variant for" << #name << "has wrong type" << other[#name].type() << "for" << name() << "with" << other[#name]; \ - } \ - return false; \ - } \ - if (name() != other[#name].converter()) { \ - if (false) { \ - qDebug() << static_cast<const void *>(this) << Q_FUNC_INFO << "Values for" << #name << "differ:" << name() << other[#name]; \ - } \ - return false; \ - } - -/*! - \internal - \fn bool QDeclarativeMimeType::equalsProperties(const QVariantMap &other) const; - \brief Returns true if the properties of the JavaScript object \a other equal the properties of this QDeclarativeMimeType object, otherwise returns false. - */ -bool QDeclarativeMimeType::equalsProperties(const QVariantMap &other) const -{ - EQUALS_PROPERTY(name, String, toString) - //EQUALS_PROPERTY(aliases, List, toList) - //EQUALS_PROPERTY(comment, String, toString) - EQUALS_PROPERTY(genericIconName, String, toString) - EQUALS_PROPERTY(iconName, String, toString) - EQUALS_PROPERTY(globPatterns, List, toList) - - return true; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \fn QMimeType QDeclarativeMimeType::mimeType() const; - \brief Returns the contained MimeType. - */ -QMimeType QDeclarativeMimeType::mimeType() const -{ - return m_MimeType; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty bool MimeType::isValid - Holds the indication if the object contains valid data. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::isValid - Holds the indication if the object contains valid data. - */ - -// ------------------------------------------------------------------------------------------------ - -bool QDeclarativeMimeType::isValid() const -{ - return m_MimeType.isValid(); -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty bool MimeType::isDebuggingActivated - Holds the indication if debugging for the class is activated. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::isDebuggingActivated - Holds the indication if debugging for the class is activated. - */ - -// ------------------------------------------------------------------------------------------------ - -bool QDeclarativeMimeType::isDebuggingActivated() const -{ - return qt_isQMimeTypeDebuggingActivated; -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setIsDebuggingActivated(const bool newIsDebuggingActivated) -{ - qt_isQMimeTypeDebuggingActivated = newIsDebuggingActivated; -} - -// ------------------------------------------------------------------------------------------------ - -#ifndef Q_COMPILER_RVALUE_REFS -QMIMETYPE_BUILDER -#else -QMIMETYPE_BUILDER_FROM_RVALUE_REFS -#endif - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty string MimeType::name - Holds the name of the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::name - Holds the name of the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -QString QDeclarativeMimeType::name() const -{ - return m_MimeType.name(); -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setName(const QString &newName) -{ -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(newName, m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#else - m_MimeType = buildQMimeType(QString(newName), m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#endif -} - -// ------------------------------------------------------------------------------------------------ - -#if 0 -QVariantList QDeclarativeMimeType::aliases() const -{ - QVariantList result; - - foreach (const QString &str, m_MimeType.aliases()) { - result << str; - } - - return result; -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setAliases(const QVariantList &newAliases) -{ - QList<QString> newAliasesStringList; - - foreach (const QVariant &variant, newAliases) { - if (variant.type() != QVariant::String) { - qWarning() << Q_FUNC_INFO << "variant" << variant << "is not a string!"; - continue; - } - - newAliasesStringList << variant.toString(); - } - -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(m_MimeType.name(), newAliasesStringList, m_MimeType.comment(), m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#else - m_MimeType = buildQMimeType(m_MimeType.name(), QVariantList(newAliasesStringList), m_MimeType.comment(), m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#endif -} - -// ------------------------------------------------------------------------------------------------ - -QString QDeclarativeMimeType::comment() const -{ - return m_MimeType.comment(); -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setComment(const QString &newComment) -{ -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(m_MimeType.name(), /*m_MimeType.aliases(),*/ newComment, m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#else - m_MimeType = buildQMimeType(m_MimeType.name(), /*m_MimeType.aliases(),*/ QString(newComment), m_MimeType.genericIconName(), m_MimeType.iconName(), m_MimeType.globPatterns()); -#endif -} - -// ------------------------------------------------------------------------------------------------ -#endif - -/*! - \qmlproperty string MimeType::genericIconName - Holds the file name of an icon image that represents the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::genericIconName - Holds the file name of an icon image that represents the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -QString QDeclarativeMimeType::genericIconName() const -{ - return m_MimeType.genericIconName(); -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setGenericIconName(const QString &newGenericIconName) -{ -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(m_MimeType.name(), newGenericIconName, m_MimeType.iconName(), m_MimeType.globPatterns()); -#else - m_MimeType = buildQMimeType(m_MimeType.name(), QString(newGenericIconName), m_MimeType.iconName(), m_MimeType.globPatterns()); -#endif -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty string MimeType::iconName - Holds the file name of an icon image that represents the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::iconName - Holds the file name of an icon image that represents the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -QString QDeclarativeMimeType::iconName() const -{ - return m_MimeType.iconName(); -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setIconName(const QString &newIconName) -{ -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(m_MimeType.name(), m_MimeType.genericIconName(), newIconName, m_MimeType.globPatterns()); -#else - m_MimeType = buildQMimeType(m_MimeType.name(), m_MimeType.genericIconName(), QString(newIconName), m_MimeType.globPatterns()); -#endif -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty list<string> MimeType::globPatterns - Holds the list of glob matching patterns. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::globPatterns - Holds the list of glob matching patterns. - */ - -// ------------------------------------------------------------------------------------------------ - -QVariantList QDeclarativeMimeType::globPatterns() const -{ - QVariantList result; - - foreach (const QString &str, m_MimeType.globPatterns()) { - result << str; - } - - return result; -} - -// ------------------------------------------------------------------------------------------------ - -void QDeclarativeMimeType::setGlobPatterns(const QVariantList &newGlobPatterns) -{ - QList<QString> newGlobPatternsStringList; - - foreach (const QVariant &variant, newGlobPatterns) { - if (variant.type() != QVariant::String) { - qWarning() << Q_FUNC_INFO << "variant" << variant << "is not a string!"; - continue; - } - - newGlobPatternsStringList << variant.toString(); - } - -#ifndef Q_COMPILER_RVALUE_REFS - m_MimeType = buildQMimeType(m_MimeType.name(), m_MimeType.genericIconName(), m_MimeType.iconName(), newGlobPatternsStringList); -#else - m_MimeType = buildQMimeType(m_MimeType.name(), m_MimeType.genericIconName(), m_MimeType.iconName(), QStringList(newGlobPatternsStringList)); -#endif -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty list<string> MimeType::suffixes - Holds the known suffixes for the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::suffixes - Holds the known suffixes for the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -QVariantList QDeclarativeMimeType::suffixes() const -{ - QVariantList result; - - foreach (const QString &str, m_MimeType.suffixes()) { - result << str; - } - - return result; -} - -// ------------------------------------------------------------------------------------------------ - -/*! - \qmlproperty string MimeType::preferredSuffix - Holds the preferred suffix for the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -/*! - \internal - \property QDeclarativeMimeType::preferredSuffix - Holds the preferred suffix for the MIME type. - */ - -// ------------------------------------------------------------------------------------------------ - -QString QDeclarativeMimeType::preferredSuffix() const -{ - return m_MimeType.preferredSuffix(); -} - -// ------------------------------------------------------------------------------------------------ - -#undef DBG diff --git a/src/imports/mimetypes/qdeclarativemimetype_p.h b/src/imports/mimetypes/qdeclarativemimetype_p.h deleted file mode 100644 index 8108501..0000000 --- a/src/imports/mimetypes/qdeclarativemimetype_p.h +++ /dev/null @@ -1,155 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVEMIMETYPE_P_H_INCLUDED -#define QDECLARATIVEMIMETYPE_P_H_INCLUDED - -#include <QtCore/QObject> -#include <qmimetype.h> -#include <QtDeclarative/qdeclarative.h> - -QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -QT_BEGIN_NAMESPACE class QStringList; QT_END_NAMESPACE - -// ------------------------------------------------------------------------------------------------ - -class QDeclarativeMimeType : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name - READ name - WRITE setName) - -#if 0 - Q_PROPERTY(QVariantList aliases - READ aliases - WRITE setAliases - STORED false) - - Q_PROPERTY(QString comment - READ comment - WRITE setComment) -#endif - - Q_PROPERTY(QString genericIconName - READ genericIconName - WRITE setGenericIconName) - - Q_PROPERTY(QString iconName - READ iconName - WRITE setIconName) - - Q_PROPERTY(QVariantList globPatterns - READ globPatterns - WRITE setGlobPatterns - STORED false) - - Q_PROPERTY(QVariantList suffixes - READ suffixes - STORED false) - - Q_PROPERTY(QString preferredSuffix - READ preferredSuffix - STORED false) - - Q_PROPERTY(bool isValid - READ isValid - STORED false) - - Q_PROPERTY(bool isDebuggingActivated - READ isDebuggingActivated - WRITE setIsDebuggingActivated) - -protected: - // We keep this destructor with its default value of 0 protected since - // only QDeclarativePrivate::QDeclarativeElement<T> needs it: - QDeclarativeMimeType(QObject *theParent = 0); - -public: - // We don't allow theParent to have a default value of 0 because in all - // likelyhood we want to force the caller to specify its QObject so the - // object will get destroyed in the caller's destructor: - QDeclarativeMimeType(const QMimeType &other, QObject *theParent); -#ifdef Q_COMPILER_RVALUE_REFS - QDeclarativeMimeType(QMimeType &&other, QObject *theParent); -#endif - - ~QDeclarativeMimeType(); - - Q_INVOKABLE void assign(QDeclarativeMimeType *other); - Q_INVOKABLE bool equals(QDeclarativeMimeType *other) const; - - Q_INVOKABLE QVariantMap properties() const; - Q_INVOKABLE void assignProperties(const QVariantMap &other); - Q_INVOKABLE bool equalsProperties(const QVariantMap &other) const; - - QMimeType mimeType() const; - - bool isValid() const; - - bool isDebuggingActivated() const; - void setIsDebuggingActivated(bool newIsDebuggingActivated); - - QString name() const; - void setName(const QString &newName); -#if 0 - QVariantList aliases() const; - void setAliases(const QVariantList &newAliases); - QString comment() const; - void setComment(const QString &newComment); -#endif - QString genericIconName() const; - void setGenericIconName(const QString &newGenericIconName); - QString iconName() const; - void setIconName(const QString &newIconName); - QVariantList globPatterns() const; - void setGlobPatterns(const QVariantList &newGlobPatterns); - QVariantList suffixes() const; - QString preferredSuffix() const; - -private: - QMimeType m_MimeType; -}; - -QML_DECLARE_TYPE(QDeclarativeMimeType) - -#endif // QDECLARATIVEMIMETYPE_P_H_INCLUDED diff --git a/src/imports/mimetypes/qmldir b/src/imports/mimetypes/qmldir deleted file mode 100644 index a8d4763..0000000 --- a/src/imports/mimetypes/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin declarative_mimetypes diff --git a/src/src.pro b/src/src.pro index a2e5f2f..fe93b2b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS += mimetypes imports +SUBDIRS += mimetypes diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 148bdd5..e90552c 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -3,8 +3,6 @@ TEMPLATE = subdirs SUBDIRS += \ qmimetype \ qmimedatabase \ - qdeclarativemimetype \ - qdeclarativemimedatabase testrunner_config.files += tests.xml diff --git a/tests/auto/qdeclarativemimedatabase/qdeclarativemimedatabase.pro b/tests/auto/qdeclarativemimedatabase/qdeclarativemimedatabase.pro deleted file mode 100644 index 483bdd2..0000000 --- a/tests/auto/qdeclarativemimedatabase/qdeclarativemimedatabase.pro +++ /dev/null @@ -1,29 +0,0 @@ -include(../../../mimetypes-nolibs.pri) -LIBS += -L$$OUT_PWD/../../../src/mimetypes -lQtMimeTypes - -TEMPLATE = app - -TARGET = tst_qdeclarativemimedatabase - -#CONFIG += warn_on qmltestcase -CONFIG -= app_bundle - -CONFIG += depend_includepath - -SOURCES += tst_qdeclarativemimedatabase.cpp - -# this reads the QML files from the same directory as this pro file -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\".\\\"\" - -testcases.files += testdata_list.js tst_qdeclarativemimedatabase.qml - -unix:!symbian { - maemo5 { - target.path = /opt/usr/lib/QtMimeTypes-tests/qdeclarativemimedatabase - testcases.path = /opt/usr/lib/QtMimeTypes-tests/qdeclarativemimedatabase - } else { - target.path = /usr/lib/QtMimeTypes-tests/qdeclarativemimedatabase - testcases.path = /usr/lib/QtMimeTypes-tests/qdeclarativemimedatabase - } - INSTALLS += testcases target -} diff --git a/tests/auto/qdeclarativemimedatabase/testdata_list.js b/tests/auto/qdeclarativemimedatabase/testdata_list.js deleted file mode 100644 index 42be544..0000000 --- a/tests/auto/qdeclarativemimedatabase/testdata_list.js +++ /dev/null @@ -1,209 +0,0 @@ -function list() { - return [ - { filePath: "../qmimedatabase/testfiles/test.bmp", mimeType: "image/bmp", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.cel", mimeType: "image/x-cel", xFail: "xxx" } - , { filePath: "../qmimedatabase/testfiles/test.dcm", mimeType: "application/dicom", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.eps", mimeType: "image/x-eps", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/GammaChart.exr", mimeType: "image/x-exr", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.fit", mimeType: "image/fits", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/test.fli", mimeType: "video/x-flic", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.gif", mimeType: "image/gif", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.ico", mimeType: "image/vnd.microsoft.icon", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.im1", mimeType: "image/x-sun-raster", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/test.jp2", mimeType: "image/jp2", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.jpg", mimeType: "image/jpeg", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.jpc", mimeType: "image/jp2", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.mng", mimeType: "video/x-mng", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.pat", mimeType: "image/x-pat", xFail: "xxx" } - , { filePath: "../qmimedatabase/testfiles/test.pbm", mimeType: "image/x-portable-bitmap", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.pcx", mimeType: "image/x-pcx", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.pgm", mimeType: "image/x-portable-graymap", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.pix", mimeType: "image/x-pix", xFail: "xxx" } - , { filePath: "../qmimedatabase/testfiles/test.png", mimeType: "image/png", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.ppm", mimeType: "image/x-portable-pixmap", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test2.ppm", mimeType: "image/x-portable-pixmap", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.ps", mimeType: "application/postscript", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.psd", mimeType: "image/vnd.adobe.photoshop", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.sgi", mimeType: "image/x-sgi", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.tga", mimeType: "image/x-tga", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.tif", mimeType: "image/tiff", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.xbm", mimeType: "image/x-xbitmap", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.xcf", mimeType: "image/x-xcf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.xpm", mimeType: "image/x-xpixmap", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.xwd", mimeType: "image/x-xwindowdump", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/2001_compression_overview.djvu", mimeType: "image/vnd.djvu", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.kdc", mimeType: "image/x-kodak-kdc", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/bathead.sk", mimeType: "image/x-skencil", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/jc-win.ani", mimeType: "application/x-navi-animation", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/aero_alt.cur", mimeType: "image/x-win-bitmap", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/mypaint.ora", mimeType: "image/openraster", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.xml.in", mimeType: "application/xml", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/dia.shape", mimeType: "application/x-dia-shape", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/attachment.tif", mimeType: "image/jpeg", xFail: "xox" } - , { filePath: "../qmimedatabase/testfiles/panasonic_lumix_dmc_fz38_05.rw2", mimeType: "image/x-panasonic-raw2", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-6.0.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-95.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo.rtf", mimeType: "application/rtf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo.sdw", mimeType: "application/vnd.stardivision.writer", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo.stw", mimeType: "application/vnd.sun.xml.writer.template", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/ooo.sxw", mimeType: "application/vnd.sun.xml.writer", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/ooo.vor", mimeType: "application/vnd.stardivision.writer", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-xp.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/office.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.odg", mimeType: "application/vnd.oasis.opendocument.graphics", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.odp", mimeType: "application/vnd.oasis.opendocument.presentation", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.ods", mimeType: "application/vnd.oasis.opendocument.spreadsheet", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.odt", mimeType: "application/vnd.oasis.opendocument.text", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.fodg", mimeType: "application/vnd.oasis.opendocument.graphics-flat-xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.fodp", mimeType: "application/vnd.oasis.opendocument.presentation-flat-xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.fods", mimeType: "application/vnd.oasis.opendocument.spreadsheet-flat-xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/ooo-test.fodt", mimeType: "application/vnd.oasis.opendocument.text-flat-xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/foo.doc", mimeType: "application/msword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test-template.dot", mimeType: "application/msword-template", xFail: "oxx" } - , { filePath: "../qmimedatabase/testfiles/ocf10-20060911.epub", mimeType: "application/epub+zip", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.wps", mimeType: "application/vnd.ms-works", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/sample.docx", mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/sample.xlsx", mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/sample.pptx", mimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/sample.ppsx", mimeType: "application/vnd.openxmlformats-officedocument.presentationml.slideshow", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/pocket-word.psw", mimeType: "application/x-pocket-word", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/aportis.pdb", mimeType: "application/x-aportisdoc", xFail: "oox" } - , { filePath: "../qmimedatabase/testfiles/internet.ez", mimeType: "application/andrew-inset", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/Anaphraseus-1.21-beta.oxt", mimeType: "application/vnd.openofficeorg.extension", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/petite-ouverture-a-danser.ly", mimeType: "text/x-lilypond", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/sqlite2.kexi", mimeType: "application/x-kexiproject-sqlite2", xFail: "oxx" } - , { filePath: "../qmimedatabase/testfiles/sqlite3.kexi", mimeType: "application/x-kexiproject-sqlite3", xFail: "xxo" } - , { filePath: "../qmimedatabase/testfiles/combined.karbon", mimeType: "application/x-karbon", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/Empty.chrt", mimeType: "application/x-kchart", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/layersupdatesignals.flw", mimeType: "application/x-kivio", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/Presentation.kpt", mimeType: "application/x-kpresenter", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/testcases.ksp", mimeType: "application/x-kspread", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test-kounavail2.kwd", mimeType: "application/x-kword", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/white_640x480.kra", mimeType: "application/x-krita", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/stream.nsc", mimeType: "application/x-netshow-channel", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/stream.sdp", mimeType: "application/sdp", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/playlist.asx", mimeType: "audio/x-ms-asx", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/feed.rss", mimeType: "application/rss+xml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/feed2", mimeType: "application/rss+xml", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/560051.xml", mimeType: "application/rss+xml", xFail: "xxx" } - , { filePath: "../qmimedatabase/testfiles/feed.atom", mimeType: "application/atom+xml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/feeds.opml", mimeType: "text/x-opml+xml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/subtitle.srt", mimeType: "application/x-subrip", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/subtitle.smi", mimeType: "application/x-sami", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/subtitle-microdvd.sub", mimeType: "text/x-microdvd", xFail: "oox" } - , { filePath: "../qmimedatabase/testfiles/subtitle-mpsub.sub", mimeType: "text/x-mpsub", xFail: "xox" } - , { filePath: "../qmimedatabase/testfiles/subtitle.ssa", mimeType: "text/x-ssa", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/subtitle-subviewer.sub", mimeType: "text/x-subviewer", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/ringtone.ime", mimeType: "text/x-iMelody", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ringtone.mmf", mimeType: "application/x-smaf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/playlist.mrl", mimeType: "text/x-mrml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/hbo-playlist.qtl", mimeType: "application/x-quicktime-media-link", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/playlist.wpl", mimeType: "application/vnd.ms-wpl", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.flac", mimeType: "audio/flac", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/live-streaming.m3u", mimeType: "application/vnd.apple.mpegurl", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/all_w.m3u8", mimeType: "application/vnd.apple.mpegurl", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/text-iso8859-15.txt", mimeType: "text/plain", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/text-utf8.txt", mimeType: "text/plain", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.tex", mimeType: "text/x-tex", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/registry.reg", mimeType: "text/x-ms-regedit", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/registry-nt.reg", mimeType: "text/x-ms-regedit", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.ext,v", mimeType: "text/plain", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.fl", mimeType: "application/x-fluid", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/helloworld.java", mimeType: "text/x-java", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/survey.js", mimeType: "application/javascript", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.cs", mimeType: "text/x-csharp", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.dot", mimeType: "text/vnd.graphviz", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/test.vala", mimeType: "text/x-vala", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.ooc", mimeType: "text/x-ooc", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.mof", mimeType: "text/x-mof", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test-cdda.toc", mimeType: "application/x-cdrdao-toc", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test-cdrom.toc", mimeType: "application/x-cdrdao-toc", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.iptables", mimeType: "text/x-iptables", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test-vpn.pcf", mimeType: "application/x-cisco-vpn-settings", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/test.php", mimeType: "application/x-php", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/evolution.eml", mimeType: "application/mbox", xFail: "xox" } - , { filePath: "../qmimedatabase/testfiles/tb-from-sentbox.eml", mimeType: "message/rfc822", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/tb-saved.eml", mimeType: "message/rfc822", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.url", mimeType: "application/x-mswinurl", xFail: "xox" } - , { filePath: "../qmimedatabase/testfiles/test.d", mimeType: "text/x-dsrc", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.v", mimeType: "text/x-verilog", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.sv", mimeType: "text/x-svsrc", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.svh", mimeType: "text/x-svhdr", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.manifest", mimeType: "text/cache-manifest", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.yaml", mimeType: "application/x-yaml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/mysum.m", mimeType: "text/x-matlab", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/isdir.m", mimeType: "text/x-matlab", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/bibtex.bib", mimeType: "text/x-bibtex", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/simple-obj-c.m", mimeType: "text/x-objcsrc", xFail: "oox" } - , { filePath: "../qmimedatabase/testfiles/ssh-public-key.txt", mimeType: "text/plain", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.vcf", mimeType: "text/directory", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.go", mimeType: "text/x-go", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/test.ttx", mimeType: "application/x-font-ttx", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/project.glade", mimeType: "application/x-glade", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ISOcyr1.ent", mimeType: "application/xml-external-parsed-entity", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.metalink", mimeType: "application/metalink+xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.mml", mimeType: "application/mathml+xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/linguist.ts", mimeType: "text/vnd.trolltech.linguist", xFail: "oox" } - , { filePath: "../qmimedatabase/testfiles/test.xsl", mimeType: "application/xslt+xml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.cbl", mimeType: "text/x-cobol", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.alz", mimeType: "application/x-alz", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.class", mimeType: "application/x-java", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/hello.pack", mimeType: "application/x-java-pack200", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.msi", mimeType: "application/x-msi", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/archive.7z", mimeType: "application/x-7z-compressed", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/comics.cb7", mimeType: "application/x-cb7", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/archive.tar", mimeType: "application/x-tar", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/comics.cbt", mimeType: "application/x-cbt", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/copying.cab", mimeType: "application/vnd.ms-cab-compressed", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/archive.gz", mimeType: "application/x-gzip", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/archive.tar.gz", mimeType: "application/x-compressed-tar", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/good-1-delta-lzma2.tiff.xz", mimeType: "application/x-xz", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/spinboxes-0.1.1-Linux.tar.xz", mimeType: "application/x-xz-compressed-tar", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.lz", mimeType: "application/x-lzip", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.lzo", mimeType: "application/x-lzop", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/archive.lrz", mimeType: "application/x-lrzip", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/fuji.themepack", mimeType: "application/x-windows-themepack", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/helloworld.xpi", mimeType: "application/x-xpinstall", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.wim", mimeType: "application/x-ms-wim", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.wav", mimeType: "audio/x-wav", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.avi", mimeType: "video/x-msvideo", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/hereyes_remake.mo3", mimeType: "audio/x-mo3", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/ccfilm.axv", mimeType: "video/annodex", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/ccfilm.axv", mimeType: "application/annodex", xFail: "xxx" } - , { filePath: "../qmimedatabase/testfiles/test.ogg", mimeType: "audio/ogg", xFail: "oxx" } - , { filePath: "../qmimedatabase/testfiles/test.ogg", mimeType: "audio/x-vorbis+ogg", xFail: "x" } - , { filePath: "../qmimedatabase/testfiles/msg0001.gsm", mimeType: "audio/x-gsm", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/small_wav.mxf", mimeType: "application/mxf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/Elephants_Dream-360p-Stereo.webm", mimeType: "video/webm", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/settopbox.ts", mimeType: "video/mp2t", xFail: "xx" } - , { filePath: "../qmimedatabase/testfiles/bbc.ram", mimeType: "application/ram", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/bbc.ram", mimeType: "application/vnd.rn-realmedia", xFail: "xox" } - , { filePath: "../qmimedatabase/testfiles/text.pdf", mimeType: "application/pdf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/README.pdf", mimeType: "application/pdf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/testcase.is-really-a-pdf", mimeType: "application/pdf", xFail: "xo" } - , { filePath: "../qmimedatabase/testfiles/test.pdf.xz", mimeType: "application/x-xzpdf", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/Makefile", mimeType: "text/x-makefile", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/Makefile.gnu", mimeType: "text/x-makefile", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/googleearth.kml", mimeType: "application/vnd.google-earth.kml+xml", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.gnd", mimeType: "application/gnunet-directory", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/text.ps", mimeType: "application/postscript", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/text.ps.gz", mimeType: "application/x-gzpostscript", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/text.PS.gz", mimeType: "application/x-gzpostscript", xFail: "oxo" } - , { filePath: "../qmimedatabase/testfiles/test.cmake", mimeType: "text/x-cmake", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/bluerect.mdi", mimeType: "image/vnd.ms-modi", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/Stallman_Richard_-_The_GNU_Manifesto.fb2", mimeType: "application/x-fictionbook+xml", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.p7b", mimeType: "application/x-pkcs7-certificates", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.pkipath", mimeType: "application/pkix-pkipath", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/test.jks", mimeType: "application/x-java-keystore", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.jceks", mimeType: "application/x-java-jce-keystore", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.sav", mimeType: "application/x-spss-sav", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.por", mimeType: "application/x-spss-por", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/core", mimeType: "application/x-core", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/bluish.icc", mimeType: "application/vnd.iccprofile", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.it87", mimeType: "application/x-it87", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.hdf4", mimeType: "application/x-hdf", xFail: "" } - , { filePath: "../qmimedatabase/testfiles/test.h5", mimeType: "application/x-hdf", xFail: "ox" } - , { filePath: "../qmimedatabase/testfiles/without_an_extension", mimeType: "image/vnd.djvu", xFail: "x" } - ] -} diff --git a/tests/auto/qdeclarativemimedatabase/testdata_list.sh b/tests/auto/qdeclarativemimedatabase/testdata_list.sh deleted file mode 100644 index 0f9b786..0000000 --- a/tests/auto/qdeclarativemimedatabase/testdata_list.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -# -# Prepares the data from testfiles/list for tests in QML in the same way as -# tst_QMimeDatabase::findByFileName_data() for C++. -# For QML, instead of passing the data in QTest columns the data is passed -# via the JavaScript include file testdata_list.js. -# - -doit() -{ - SRCDIR=../qmimedatabase/ - - prefix=$SRCDIR"testfiles/" - - f=$prefix"list" - - cat $f | while read line; do - if [ "`echo $line | cut -c3-`" = "" -o "`echo $line | cut -c1`" = "#" ]; then - true - else - set $line - if [ $# -ge 2 ]; then - filePath=$1 - mimeType=$2 - xFail=$3 - if [ "$isFirst" != "" ]; then - echo -n " " - echo -n ", " - else - isFirst="notIsFirst" - echo "function list() {" - echo " return [" - echo -n " " - fi - echo "{ filePath: \"$prefix$filePath\", mimeType: \"$mimeType\", xFail: \"$xFail\" }" - else - echo "Illegal line: $line" >&2 - fi - fi - done - echo " ]" - echo "}" -} - -doit > testdata_list.js diff --git a/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.cpp b/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.cpp deleted file mode 100644 index b2d429f..0000000 --- a/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/qglobal.h> - -int main() -{ - return 1; -} diff --git a/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.qml b/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.qml deleted file mode 100644 index b33c19a..0000000 --- a/tests/auto/qdeclarativemimedatabase/tst_qdeclarativemimedatabase.qml +++ /dev/null @@ -1,216 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtTest 1.0 -import QtMimeTypes 1.0 - -import "testdata_list.js" as TestData - -TestCase { - name: "tst_QDeclarativeMimedatabase" - - function pngMimeTypeName() { - return "image/png" - } - - function pngMimeTypeComment() { - return "PNG File"; - } - - function pngMimeTypeGenericIconName() { - return "/usr/share/icons/oxygen/64x64/mimetypes/image-x-generic.png" - } - - function pngMimeTypeIconName() { - return "/usr/share/icons/oxygen/64x64/mimetypes/image-x-generic.png" - } - - function firstPngMimeTypeSuffixes() { - return ".png" - } - - MimeType { - id: instantiatedPngMimeType - name: pngMimeTypeName() - genericIconName: pngMimeTypeGenericIconName() - iconName: pngMimeTypeIconName() - } - - MimeType { - id: otherPngMimeType - } - - function test_name() { - otherPngMimeType.assign(instantiatedPngMimeType) - otherPngMimeType.name = "" - - // Verify that the Id is part of the equality test: - compare(instantiatedPngMimeType.name, pngMimeTypeName()) - - compare(instantiatedPngMimeType.equals(otherPngMimeType), false) - } - - MimeDatabase { - id: database - } - - function list() { - return TestData.list() -// return [ -// { filePath: "test.bmp", mimeType: "image/bmp", xFail: "" }, -// { filePath: "archive.tar.gz", mimeType: "application/x-compressed-tar", xFail: "ox" } -// ] - } - - function listValue(ix) { - return list()[ix] - } - - function fileInfoSuffix(fileName) - { - var foundSuffix = ""; - - var mimeTypeNames = database.mimeTypeNames - for (var mimeTypeIx = 0; mimeTypeIx < mimeTypeNames.length; ++mimeTypeIx) { - var suffixes = database.mimeTypeForName(mimeTypeNames[mimeTypeIx]).suffixes - //print(mimeTypeNames[mimeTypeIx], suffixes.length) - for (var suffixIx = 0; suffixIx < suffixes.length; ++suffixIx) { - var suffix = suffixes[suffixIx] - //print(mimeTypeNames[mimeTypeIx], '*.' + suffix, suffix.length, '*.' + foundSuffix, foundSuffix.length) - if (fileName.length >= suffix.length + 1 && suffix.length > foundSuffix.length) { - if (fileName.slice(-(suffix.length + 1)) == '.' + suffix) { - //print(mimeTypeNames[mimeTypeIx], '*.' + suffix) - foundSuffix = suffix - } - } - } - } - - return foundSuffix - } - - function listContains(stringList, searchString) - { - // TODO sort the list and perform binary search! - for (var stringListIx = 0; stringListIx < stringList.length; ++stringListIx) { - if (stringList[stringListIx] == searchString) { - return true - } - } - - return false; - } - - function test_mimeTypeForFileName() { - var ok = 0 - - for (var listIx = 0; listIx < list().length; ++listIx) { - //print(listValue(listIx).filePath) - - var resultMimeTypeName = database.mimeTypeForFileName(listValue(listIx).filePath).name - //print("mimeTypeForFileName(" + listValue(listIx).filePath + ") returned", resultMimeTypeName) - - // Results are ambiguous when multiple MIME types have the same glob - // -> accept the current result if the found MIME type actually - // matches the file's extension. - var foundMimeType = database.mimeTypeForName(resultMimeTypeName); - var extension = fileInfoSuffix(listValue(listIx).filePath); - //print("findNameSuffix() returned", extension) - //print("globPatterns:", foundMimeType.globPatterns, "- extension:", "*." + extension) - if (listContains(foundMimeType.globPatterns, "*." + extension)) { - ok = ok + 1 - continue; - } - - // Expected to fail - if (listValue(listIx).xFail.length >= 1 && listValue(listIx).xFail[0] == "x") { - if (resultMimeTypeName != listValue(listIx).mimeType) { - ok = ok + 1 - } - else { - print("Error:", listValue(listIx).filePath, "has xFail[0] == \"x\" but has a correct resultMimeTypeName") - } - } - else { - if (resultMimeTypeName == listValue(listIx).mimeType) { - ok = ok + 1 - } - else { - print("Error:", listValue(listIx).filePath, "has been identified incorrectly as", resultMimeTypeName) - } - } - } - - compare(ok, list().length) - } - - function test_mimeTypeForFile() { - var ok = 0 - - for (var listIx = 0; listIx < list().length; ++listIx) { - //print(listValue(listIx).filePath) - - var resultMimeTypeName = database.mimeTypeForFile(listValue(listIx).filePath).name - //print("mimeTypeForFile(" + listValue(listIx).filePath + ") returned", resultMimeTypeName) - - // Expected to fail - if (listValue(listIx).xFail.length >= 3 && listValue(listIx).xFail[2] == "x") { - if (resultMimeTypeName != listValue(listIx).mimeType) { - ok = ok + 1 - } - else { - print("Error:", listValue(listIx).filePath, "has xFail[2] == \"x\" but has a correct resultMimeTypeName") - } - } - else { - if (resultMimeTypeName == listValue(listIx).mimeType) { - ok = ok + 1 - } - else { - print("Error:", listValue(listIx).filePath, "has been identified incorrectly as", resultMimeTypeName, listValue(listIx).xFail.length, listValue(listIx).xFail[2]) - } - } - } - - compare(ok, list().length) - } -} diff --git a/tests/auto/qdeclarativemimetype/qdeclarativemimetype.pro b/tests/auto/qdeclarativemimetype/qdeclarativemimetype.pro deleted file mode 100644 index 7b957df..0000000 --- a/tests/auto/qdeclarativemimetype/qdeclarativemimetype.pro +++ /dev/null @@ -1,29 +0,0 @@ -include(../../../mimetypes-nolibs.pri) -LIBS += -L$$OUT_PWD/../../../src/mimetypes -lQtMimeTypes - -TEMPLATE = app - -TARGET = tst_qdeclarativemimetype - -#CONFIG += warn_on qmltestcase -CONFIG -= app_bundle - -CONFIG += depend_includepath - -SOURCES += tst_qdeclarativemimetype.cpp - -# this reads the QML files from the same directory as this pro file -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\".\\\"\" - -testcases.files += tst_qdeclarativemimetypedata.js tst_qdeclarativemimetypeproperties.qml tst_qdeclarativemimetype.qml - -unix:!symbian { - maemo5 { - target.path = /opt/usr/lib/QtMimeTypes-tests/qdeclarativemimetype - testcases.path = /opt/usr/lib/QtMimeTypes-tests/qdeclarativemimetype - } else { - target.path = /usr/lib/QtMimeTypes-tests/qdeclarativemimetype - testcases.path = /usr/lib/QtMimeTypes-tests/qdeclarativemimetype - } - INSTALLS += testcases target -} diff --git a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.cpp b/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.cpp deleted file mode 100644 index b2d429f..0000000 --- a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtCore/qglobal.h> - -int main() -{ - return 1; -} diff --git a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.qml b/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.qml deleted file mode 100644 index df50232..0000000 --- a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetype.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtTest 1.0 -import QtMimeTypes 1.0 - -import "tst_qdeclarativemimetypedata.js" as Data - -TestCase { - name: "tst_QDeclarativeMimeType" - - MimeType { - id: instantiatedPngMimeType - name: Data.mimeTypeName() - genericIconName: Data.mimeTypeGenericIconName() - iconName: Data.mimeTypeIconName() - globPatterns: Data.mimeTypeGlobPatterns() - } - - MimeType { - id: otherPngMimeType - } - - MimeType { - id: defaultMimeType - } - - function test_isValid() { - compare(instantiatedPngMimeType.isValid, true) - - otherPngMimeType.assign(instantiatedPngMimeType) - - compare(otherPngMimeType.isValid, true) - compare(instantiatedPngMimeType.equals(otherPngMimeType), true) - compare(otherPngMimeType.equals(instantiatedPngMimeType), true) - - compare(defaultMimeType.isValid, false) - } -} diff --git a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypedata.js b/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypedata.js deleted file mode 100644 index fd8b610..0000000 --- a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypedata.js +++ /dev/null @@ -1,79 +0,0 @@ -function equalStrings(lhs, rhs) { - return lhs == rhs; -} - -function equalArrays(lhs, rhs) { - var ix; - - if (lhs.length != rhs.length) { - return false; - } - - for (ix = 0; ix < lhs.length; ix = ix + 1) { - if (typeof lhs[ix] != typeof rhs[ix]) { - return false; - } - - if (lhs[ix] != rhs[ix]) { - return false; - } - } - - return true; -} - -function mimeTypeName() { - return "image/png"; -} - -function equalMimeTypeName(lhs, rhs) { - return equalStrings(lhs, rhs); -} - -//function mimeTypeAliases() { -// return [ "picture/png" ]; -//} - -//function equalMimeTypeAliases(lhs, rhs) { -// return equalArrays(lhs, rhs); -//} - -//function mimeTypeComment() { -// return "PNG File"; -//} - -//function equalMimeTypeComment(lhs, rhs) { -// return equalStrings(lhs, rhs); -//} - -function mimeTypeGenericIconName() { - return "/usr/share/icons/oxygen/64x64/mimetypes/image-x-generic.png"; -} - -function equalMimeTypeGenericIconName(lhs, rhs) { - return equalStrings(lhs, rhs); -} - -function mimeTypeIconName() { - return "/usr/share/icons/oxygen/64x64/mimetypes/image-x-generic.png"; -} - -function equalMimeTypeIconName(lhs, rhs) { - return equalStrings(lhs, rhs); -} - -function mimeTypeGlobPatterns() { - return [ "*.png" ]; -} - -function equalMimeTypeGlobPatterns(lhs, rhs) { - return equalArrays(lhs, rhs); -} - -function mimeTypeSuffixes() { - return [ ".png" ]; -} - -function equalMimeTypeSuffixes(lhs, rhs) { - return equalArrays(lhs, rhs); -} diff --git a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypeproperties.qml b/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypeproperties.qml deleted file mode 100644 index e6d2655..0000000 --- a/tests/auto/qdeclarativemimetype/tst_qdeclarativemimetypeproperties.qml +++ /dev/null @@ -1,197 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtMimeTypes addon of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import Qt 4.7 -import QtTest 1.0 -import QtMimeTypes 1.0 - -import "tst_qdeclarativemimetypedata.js" as Data - -TestCase { - name: "tst_QDeclarativeMimeTypeProperties" - - MimeType { - id: firstMimeType - name: Data.mimeTypeName() - genericIconName: Data.mimeTypeGenericIconName() - iconName: Data.mimeTypeIconName() - globPatterns: Data.mimeTypeGlobPatterns() - } - - MimeType { - id: secondMimeType - } - - MimeType { - id: defaultMimeType - } - - function test_Elements() { - secondMimeType.assign(firstMimeType) - compare(secondMimeType.equals(firstMimeType), true) - compare(secondMimeType.equals(defaultMimeType), false) - compare(firstMimeType.equals(secondMimeType), true) - compare(defaultMimeType.equals(secondMimeType), false) - - secondMimeType.assign(defaultMimeType) - compare(secondMimeType.equals(firstMimeType), false) - compare(secondMimeType.equals(defaultMimeType), true) - compare(firstMimeType.equals(secondMimeType), false) - compare(defaultMimeType.equals(secondMimeType), true) - } - - function test_JavaScriptObjects() { - secondMimeType.assign(firstMimeType) // to uncover problems in assignProperties() - var javaScriptObject = new Object - - compare(firstMimeType.equalsProperties(javaScriptObject), false) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), false) - - javaScriptObject.name = Data.mimeTypeName() - javaScriptObject.genericIconName = Data.mimeTypeGenericIconName() - javaScriptObject.iconName = Data.mimeTypeIconName() - javaScriptObject.globPatterns = Data.mimeTypeGlobPatterns() - compare(firstMimeType.equalsProperties(javaScriptObject), true) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), true) - } - - function test_name() { - // Verify that the Name is part of the equality test: - //compare(firstMimeType.name, Data.mimeTypeName()) - compare(Data.equalMimeTypeName(firstMimeType.name, Data.mimeTypeName()), true) - - secondMimeType.assign(firstMimeType) - - secondMimeType.name = defaultMimeType.name // simulate an error - compare(firstMimeType.equals(secondMimeType), false) - secondMimeType.name = firstMimeType.name - compare(firstMimeType.equals(secondMimeType), true) - - var javaScriptObject = firstMimeType.properties() - - javaScriptObject.name = defaultMimeType.name // simulate an error - compare(firstMimeType.equalsProperties(javaScriptObject), false) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), false) - - javaScriptObject.name = firstMimeType.name - compare(firstMimeType.equalsProperties(javaScriptObject), true) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), true) - } - - function test_genericIconName() { - // Verify that the GenericIconName is part of the equality test: - //compare(firstMimeType.genericIconName, Data.mimeTypeGenericIconName()) - compare(Data.equalMimeTypeGenericIconName(firstMimeType.genericIconName, Data.mimeTypeGenericIconName()), true) - - secondMimeType.assign(firstMimeType) - - secondMimeType.genericIconName = defaultMimeType.genericIconName // simulate an error - compare(firstMimeType.equals(secondMimeType), false) - secondMimeType.genericIconName = firstMimeType.genericIconName - compare(firstMimeType.equals(secondMimeType), true) - - var javaScriptObject = firstMimeType.properties() - - javaScriptObject.genericIconName = defaultMimeType.genericIconName // simulate an error - compare(firstMimeType.equalsProperties(javaScriptObject), false) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), false) - - javaScriptObject.genericIconName = firstMimeType.genericIconName - compare(firstMimeType.equalsProperties(javaScriptObject), true) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), true) - } - - function test_iconName() { - // Verify that the IconName is part of the equality test: - //compare(firstMimeType.iconName, Data.mimeTypeIconName()) - compare(Data.equalMimeTypeIconName(firstMimeType.iconName, Data.mimeTypeIconName()), true) - - secondMimeType.assign(firstMimeType) - - secondMimeType.iconName = defaultMimeType.iconName // simulate an error - compare(firstMimeType.equals(secondMimeType), false) - secondMimeType.iconName = firstMimeType.iconName - compare(firstMimeType.equals(secondMimeType), true) - - var javaScriptObject = firstMimeType.properties() - - javaScriptObject.iconName = defaultMimeType.iconName // simulate an error - compare(firstMimeType.equalsProperties(javaScriptObject), false) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), false) - - javaScriptObject.iconName = firstMimeType.iconName - compare(firstMimeType.equalsProperties(javaScriptObject), true) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), true) - } - - function test_globPatterns() { - // Verify that the GlobPatterns is part of the equality test: - //compare(firstMimeType.globPatterns, Data.mimeTypeGlobPatterns()) - compare(Data.equalMimeTypeGlobPatterns(firstMimeType.globPatterns, Data.mimeTypeGlobPatterns()), true) - - secondMimeType.assign(firstMimeType) - - secondMimeType.globPatterns = defaultMimeType.globPatterns // simulate an error - compare(firstMimeType.equals(secondMimeType), false) - secondMimeType.globPatterns = firstMimeType.globPatterns - compare(firstMimeType.equals(secondMimeType), true) - - var javaScriptObject = firstMimeType.properties() - - javaScriptObject.globPatterns = defaultMimeType.globPatterns // simulate an error - compare(firstMimeType.equalsProperties(javaScriptObject), false) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), false) - - javaScriptObject.globPatterns = firstMimeType.globPatterns - compare(firstMimeType.equalsProperties(javaScriptObject), true) - secondMimeType.assignProperties(javaScriptObject); - compare(firstMimeType.equals(secondMimeType), true) - } -} |