summaryrefslogtreecommitdiffstats
path: root/src/imports/mimetypes/qdeclarativemimetype.cpp
blob: 1d841f5df690970cc18a8381edf52fabd1f42891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** 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