diff --git a/declarativeimports/draganddrop/DeclarativeMimeData.cpp b/declarativeimports/draganddrop/DeclarativeMimeData.cpp index 09dbef02d..2b2659786 100644 --- a/declarativeimports/draganddrop/DeclarativeMimeData.cpp +++ b/declarativeimports/draganddrop/DeclarativeMimeData.cpp @@ -68,7 +68,7 @@ DeclarativeMimeData::DeclarativeMimeData(const QMimeData* copy) QUrl DeclarativeMimeData::url() const { if ( this->hasUrls() && !this->urls().isEmpty()) { - return urls().first(); + return QMimeData::urls().first(); } return QUrl(); } @@ -79,10 +79,29 @@ void DeclarativeMimeData::setUrl(const QUrl &url) QList urlList; urlList.append(url); - setUrls(urlList); + QMimeData::setUrls(urlList); emit urlChanged(); } +QVariantList DeclarativeMimeData::urls() const +{ + QVariantList varUrls; + foreach (const QUrl &url, QMimeData::urls()) { + varUrls << url; + } + return varUrls; +} + +void DeclarativeMimeData::setUrls(const QVariantList &urls) +{ + QList urlList; + foreach (const QVariant &varUrl, urls) { + urlList << varUrl.value(); + } + QMimeData::setUrls(urlList); + emit urlsChanged(); +} + // color QColor DeclarativeMimeData::color() const { diff --git a/declarativeimports/draganddrop/DeclarativeMimeData.h b/declarativeimports/draganddrop/DeclarativeMimeData.h index 1c9b1cd5b..e919584a9 100644 --- a/declarativeimports/draganddrop/DeclarativeMimeData.h +++ b/declarativeimports/draganddrop/DeclarativeMimeData.h @@ -35,7 +35,8 @@ class DeclarativeMimeData : public QMimeData Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) //TODO: use QDeclarativeListProperty to return the whole list instead of only the first url + Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) + Q_PROPERTY(QVariantList urls READ urls WRITE setUrls NOTIFY urlsChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(QDeclarativeItem* source READ source WRITE setSource NOTIFY sourceChanged) //TODO: Image property @@ -47,12 +48,16 @@ public: QUrl url() const; void setUrl(const QUrl &url); + QVariantList urls() const; + void setUrls(const QVariantList &urls); + QColor color() const; void setColor(const QColor &color); QDeclarativeItem* source() const; void setSource(QDeclarativeItem* source); + /* QString text() const; //TODO: Reimplement this to issue the onChanged signals void setText(const QString &text); @@ -64,12 +69,12 @@ signals: void textChanged(); //FIXME not being used void htmlChanged(); //FIXME not being used void urlChanged(); + void urlsChanged(); void colorChanged(); void sourceChanged(); private: - QDeclarativeItem* m_source; - + QDeclarativeItem* m_source; }; #endif // DECLARATIVEMIMEDATA_H