Changeset 986 for trunk/src/gui/kernel/qmime_pm.cpp
- Timestamp:
- Aug 16, 2011, 12:57:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qmime_pm.cpp
r776 r986 290 290 } 291 291 292 /*! 293 Constructs a new default drag worker instance. The \a exclusive flag 294 defines if this worker is exclusive (see isExclusive() for details). 295 */ 292 296 QPMMime::DefaultDragWorker::DefaultDragWorker(bool exclusive) 293 297 : d(new Data(this, exclusive)) … … 297 301 } 298 302 303 /*! 304 Destroys the instance. 305 */ 299 306 QPMMime::DefaultDragWorker::~DefaultDragWorker() 300 307 { … … 303 310 } 304 311 312 /*! 313 \reimp 314 */ 305 315 bool QPMMime::DefaultDragWorker::cleanup(bool isCancelled) 306 316 { … … 341 351 } 342 352 353 /*! 354 \reimp 355 */ 343 356 bool QPMMime::DefaultDragWorker::isExclusive() const 344 357 { … … 346 359 } 347 360 361 /*! 362 \reimp 363 */ 348 364 ULONG QPMMime::DefaultDragWorker::itemCount() const 349 365 { … … 351 367 } 352 368 369 /*! 370 \reimp 371 */ 353 372 ULONG QPMMime::DefaultDragWorker::hwnd() const 354 373 { … … 356 375 } 357 376 377 /*! 378 \reimp 379 */ 358 380 QByteArray QPMMime::DefaultDragWorker::composeFormatString() 359 381 { … … 392 414 } 393 415 416 /*! 417 \reimp 418 */ 394 419 bool QPMMime::DefaultDragWorker::prepare(const char *drm, const char *drf, 395 420 DRAGITEM *item, ULONG itemIndex) … … 434 459 } 435 460 461 /*! 462 \reimp 463 */ 436 464 void QPMMime::DefaultDragWorker::defaultFileType(QString &type, 437 465 QString &ext) … … 676 704 } 677 705 706 /*! 707 Adds \a provider that understands the \a drf format and provides \a itemCnt 708 items to the list of providers. 709 710 Returns \c true on success or \c false otherwise (e.g. on attempts to add 711 more than one a provider to the exclusive worker or to add a provider 712 supporting a different count of items compared to providers already in the 713 list). 714 */ 678 715 bool QPMMime::DefaultDragWorker::addProvider(const QByteArray &drf, Provider *provider, 679 716 ULONG itemCnt /* = 1 */) … … 701 738 } 702 739 740 /*! 741 Returns \c true if the default drag worker can render using the mechanism 742 specified in \a drm. 743 */ 703 744 // static 704 745 bool QPMMime::DefaultDragWorker::canRender(const char *drm) … … 748 789 }; 749 790 791 /*! 792 Constructs a new default drop worker instance. 793 */ 750 794 QPMMime::DefaultDropWorker::DefaultDropWorker() : d(new Data(this)) 751 795 { … … 755 799 } 756 800 801 /*! 802 Destroys the instance. 803 */ 757 804 QPMMime::DefaultDropWorker::~DefaultDropWorker() 758 805 { … … 760 807 } 761 808 809 /*! 810 \reimp 811 */ 762 812 void QPMMime::DefaultDropWorker::cleanup(bool isAccepted) 763 813 { … … 776 826 } 777 827 828 /*! 829 \reimp 830 */ 778 831 bool QPMMime::DefaultDropWorker::isExclusive() const 779 832 { … … 781 834 } 782 835 836 /*! 837 \reimp 838 */ 783 839 bool QPMMime::DefaultDropWorker::hasFormat(const QString &mimeType) const 784 840 { … … 786 842 } 787 843 844 /*! 845 \reimp 846 */ 788 847 QStringList QPMMime::DefaultDropWorker::formats() const 789 848 { … … 824 883 } 825 884 885 /*! 886 \reimp 887 */ 826 888 QVariant QPMMime::DefaultDropWorker::retrieveData(const QString &mimeType, 827 889 QVariant::Type preferredType) const … … 1132 1194 } 1133 1195 1196 /*! 1197 Adds \a provider that understands the \a mimeType format to the list of 1198 providers. 1199 1200 Returns \c true on success or \c false otherwise (e.g. if the list already 1201 contains an exclusive provider or other providers supporting the given MIME 1202 type). 1203 */ 1134 1204 bool QPMMime::DefaultDropWorker::addProvider(const QString &mimeType, 1135 1205 Provider *provider) … … 1145 1215 } 1146 1216 1217 /*! 1218 Adds \a provider that understands the \a mimeType format to the list of 1219 providers. The provider is marked as exclusive (responsive for converting 1220 the whole DRAGITEM structure). 1221 1222 Returns \c true on success or \c false otherwise (e.g. if the list already 1223 contains an exclusive provider). 1224 */ 1147 1225 bool QPMMime::DefaultDropWorker::addExclusiveProvider(const QString &mimeType, 1148 1226 Provider *provider) … … 1158 1236 } 1159 1237 1238 /*! 1239 Returns \c true if the given \a item can be rendered by the default drop 1240 worker can render in the \a drf rendering format. 1241 */ 1160 1242 // static 1161 1243 bool QPMMime::DefaultDropWorker::canRender(DRAGITEM *item, const char *drf) … … 1488 1570 DRAGITEM structures in order to represent different mime data types). As 1489 1571 opposed to super exclusive workers (identified by isExclusive() returning 1490 TRUE and by itemCount() returning zero), exclusive and cooperative workers1572 \c true and by itemCount() returning 0), exclusive and cooperative workers 1491 1573 do not create DRAGINFO/DRAGITEM structures on their own, they implement a 1492 1574 subset of methods that is used by the drag manager to fill drag structures … … 1504 1586 mime type. 1505 1587 1506 \note Subclasses must NOT free the DRAGINFO structure they allocated and1507 returned by createDragInfo().1508 1509 1588 \note Every exclusive drag worker must implement createDragInfo() and must 1510 not implement composeFormatSting()/canRender()/prepare()/defaultFileType(). 1511 And vice versa, every cooperative drag worker must implement the latter 1512 three functions but not the former two. 1513 1514 \note The return value of cleanup() is whether the Move operation is 1515 disallowed by this worker or not (if the worker doesn't participate in the 1516 DND session, it should return FALSE, to let other workers allow Move). 1589 not implement composeFormatSting()/prepare()/defaultFileType(). And vice 1590 versa, every cooperative drag worker must implement the latter three 1591 functions but not the former two. 1592 */ 1593 1594 /*! 1595 \fn QPMMime::DragWorker::DragWorker() 1596 1597 Constructs a new instance. 1598 */ 1599 1600 /*! 1601 \fn QPMMime::DragWorker::~DragWorker() 1602 1603 Destroys the instance. 1604 */ 1605 1606 /*! 1607 \fn QPMMime::DragWorker::source() const 1608 1609 Returns the source of the current drag operation. 1610 */ 1611 1612 /*! 1613 \fn QPMMime::DragWorker::init() 1614 1615 Initializes the instance before the drag operation. 1616 */ 1617 1618 /*! 1619 \fn QPMMime::DragWorker::cleanup(bool isCancelled) 1620 1621 Performs cleanup after the drag operation. If the drag operation was 1622 cancelled, \a isCancelled will be \c true. 1623 1624 Returns \c true if the Move operation is disallowed by this worker. Note 1625 that if this worker doesn't participate in a given DnD session, it should 1626 return \c false to let other workers allow Move. 1627 1628 Must be reimplemented in subclasses. 1629 */ 1630 1631 /*! 1632 \fn QPMMime::DragWorker::isExclusive() const 1633 1634 Returns \c true if this is an exclusive drag worker. 1635 1636 Must be reimplemented in subclasses. 1637 */ 1638 1639 /*! 1640 \fn QPMMime::DragWorker::itemCount() const 1641 1642 Returns the number of DRAGITEM elements this drag worker needs to represent 1643 its data. If isExclusive() is \c true and this method returns 0, this drag 1644 worker will manage creation of the DRAGINFO structure on its onwn. 1645 1646 Must be reimplemented in subclasses. 1647 */ 1648 1649 /*! 1650 \fn QPMMime::DragWorker::hwnd() const 1651 1652 Returns a window handle to be associated with DRAGITEM elemetns of this drag 1653 worker. 1654 1655 Must be reimplemented in subclasses. 1656 */ 1657 1658 /*! 1659 \fn QPMMime::DragWorker::createDragInfo(const QString &targetName, USHORT 1660 supportedOps) 1661 1662 Creates a new DRAGINFO structure for the drag operation with the suggested 1663 \a targetName and supported operations represented by \a supportedOps. 1664 1665 \note The created structure is owned by QPMMime and should be not freed by 1666 subclasses. 1667 1668 Must be reimplemented in subclasses if the isExclusive() implementation 1669 returns \c true and itemCount() returns 0. 1670 */ 1671 1672 /*! 1673 \fn QPMMime::DragWorker::composeFormatString() 1674 1675 Returns a format string containing "<mechanism,format>" pairs supported by 1676 this drag worker. 1677 1678 Must be reimplemented in subclasses if the isExclusive() implementation 1679 returns \c false. 1680 */ 1681 1682 /*! 1683 \fn QPMMime::DragWorker::prepare(const char *drm, const char *drf, 1684 DRAGITEM *item, ULONG itemIndex) 1685 1686 Prepares this worker for the drop operation of the \a item having 1687 \a itemIndex using the mechanism and format specified in \a drm and \a drf, 1688 respectively. 1689 1690 Must be reimplemented in subclasses if the isExclusive() implementation 1691 returns \c false. 1692 */ 1693 1694 /*! 1695 \fn QPMMime::DragWorker::defaultFileType(QString &type, QString &ext) 1696 1697 Returns the default file \a type (and extension \a ext) for the data 1698 represented by this worker. 1699 1700 Must be reimplemented in subclasses if the isExclusive() implementation 1701 returns \c false. 1517 1702 */ 1518 1703 … … 1528 1713 1529 1714 /*! 1715 \class QPMMime::DefaultDragWorker::Provider 1716 1717 This class is used to map mime types of the object being dragged to 1718 rendering formats and apply preprocessing of data before rendering. 1719 */ 1720 1721 /*! 1722 \fn QPMMime::DefaultDragWorker::Provider::format(const char *drf) const 1723 1724 Returns a MIME format string for the given \a drf rendering format that this 1725 provider can provide. Returns a null string if the format is unsupported. 1726 */ 1727 1728 /*! 1729 \fn QPMMime::DefaultDragWorker::Provider::provide(const char *drf, 1730 const QByteArray &allData, 1731 ULONG itemIndex, 1732 QByteArray &itemData) 1733 1734 If the \a drf format is supported by this provider, converts \a allData to 1735 it, stores the result in \a itemData and returns \c true. In case of 1736 multi-item data, \a itemIndex is an index of the item in question. 1737 */ 1738 1739 /*! 1740 \fn QPMMime::DefaultDragWorker::Provider::fileType(const char *drf, QString 1741 &type, QString &ext) 1742 1743 If the \a drf format is supported by this provider, returns the file type in 1744 \a type and the extension in \a ext for the data it provides. 1745 */ 1746 1747 /*! 1530 1748 \class QPMMime::DropWorker 1531 1749 … … 1539 1757 processing the drop event, all other workers are silently ignored. 1540 1758 1541 \note Subclasses must NOT free the DRAGINFO structure pointed to by info(). 1542 1543 \note Subclasses must NOT send DM_ENDCONVERSATION to the source. 1759 \note Subclasses must \b not send \c DM_ENDCONVERSATION to the source. 1760 */ 1761 1762 /*! 1763 \fn QPMMime::DropWorker::DropWorker() 1764 1765 Constructs a new instance. 1766 */ 1767 1768 /*! 1769 \fn QPMMime::DropWorker::~DropWorker() 1770 1771 Destroys the instance. 1772 */ 1773 1774 /*! 1775 \fn QPMMime::DropWorker::info() const 1776 1777 Returns a pointer to the DRAGINFO sctructure describing the current 1778 drag operation. 1779 1780 \note Subclasses must \b not free this DRAGINFO structure. 1781 */ 1782 1783 /*! 1784 \fn QPMMime::DropWorker::init() 1785 1786 Initializes the instance before the drop operation. 1787 */ 1788 1789 /*! 1790 \fn QPMMime::DropWorker::cleanup(bool isAccepted) 1791 1792 Performs the cleanup after the drop operation. If the drag was accepted, 1793 \a isAccepted will be \c true. 1794 */ 1795 1796 /*! 1797 \fn QPMMime::DropWorker::isExclusive() const 1798 1799 Returns \c true if this is an exclusive drop worker. 1800 1801 Must be reimplemented in subclasses. 1802 */ 1803 1804 /*! 1805 \fn QPMMime::DropWorker::hasFormat(const QString &mimeType) const 1806 1807 Returns \c true if this drop worker supports the given \a mimeType. 1808 1809 Must be reimplemented in subclasses. 1810 */ 1811 1812 /*! 1813 \fn QPMMime::DropWorker::formats() const 1814 1815 Returns a list of all MIME types supported by this drop worker. 1816 1817 Must be reimplemented in subclasses. 1818 */ 1819 1820 /*! 1821 \fn QPMMime::DropWorker::retrieveData(const QString &mimeType, 1822 QVariant::Type preferredType) const 1823 1824 Returns data represented by this drag worker converted to the given 1825 \a mimeType. The QVariant type preferred by the caller is indicated by 1826 \a preferredType. 1827 1828 Must be reimplemented in subclasses. 1544 1829 */ 1545 1830 … … 1552 1837 formats to particular mime types and apply postprocessing of data after 1553 1838 rendering. 1839 */ 1840 1841 /*! 1842 \class QPMMime::DefaultDropWorker::Provider 1843 1844 This class is used to map rendering formats to particular mime and apply 1845 preprocessing of data after rendering. 1846 */ 1847 1848 /*! 1849 \fn QPMMime::DefaultDropWorker::Provider::drf(const QString &mimeType) const 1850 1851 Returns a rendering format string for the given \a mimeType that this 1852 provider can provide. Returns a null string if the MIME type is unsupported. 1853 */ 1854 1855 /*! 1856 \fn QPMMime::DefaultDropWorker::Provider::provide(const QString &mimeType 1857 ULONG itemIndex, 1858 const QByteArray 1859 &itemData, QByteArray 1860 &allData) 1861 1862 If the \a mimeType is supported by this provider, converts \a itemData to 1863 it, stores the result in \a allData and returns \c true. In case of 1864 multi-item data, \a itemIndex is an index of the item in question. 1554 1865 */ 1555 1866 … … 1701 2012 mechanism and can be rendered by a target w/o involving the source (i.e., 1702 2013 \c DRM_OS2FILE is the first supported format and a valid file name with full 1703 path is provided). If the function returns \c TRUE, \a fullName (if not2014 path is provided). If the function returns \c true, \a fullName (if not 1704 2015 \c NULL) will be assigned the item's full source file name (composed from 1705 2016 \c hstrContainerName and \c hstrSourceName fields).
Note:
See TracChangeset
for help on using the changeset viewer.