- Timestamp:
- Nov 14, 2009, 3:06:49 PM (16 years ago)
- Location:
- trunk/src/gui/kernel
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/kernel/qclipboard_pm.cpp
r95 r321 57 57 QT_BEGIN_NAMESPACE 58 58 59 //////////////////////////////////////////////////////////////////////////////// 60 61 class QClipboardWatcher : public QInternalMimeData 62 { 63 public: 64 QClipboardWatcher() {} 65 66 bool hasFormat_sys(const QString &mimetype) const; 67 QStringList formats_sys() const; 68 QVariant retrieveData_sys(const QString &mimetype, QVariant::Type preferredType) const; 69 }; 70 71 bool QClipboardWatcher::hasFormat_sys(const QString &mime) const 72 { 73 bool ok = false; 74 if (WinOpenClipbrd(NULLHANDLE)) { 75 ULONG cf = 0; 76 while ((cf = WinEnumClipbrdFmts(NULLHANDLE, cf))) { 77 if (QPMMime::converterToMime(mime, cf)) { 78 ok = true; 79 break; 80 } 81 } 82 WinCloseClipbrd(NULLHANDLE); 83 } 84 #ifndef QT_NO_DEBUG 85 else 86 qWarning("QClipboardWatcher: WinOpenClipbrd failed with %lX", 87 WinGetLastError(NULLHANDLE)); 88 #endif 89 return ok; 90 } 91 92 QStringList QClipboardWatcher::formats_sys() const 93 { 94 QStringList fmts; 95 if (WinOpenClipbrd(NULLHANDLE)) { 96 fmts = QPMMime::allMimesForFormats(); 97 WinCloseClipbrd(NULLHANDLE); 98 } 99 #ifndef QT_NO_DEBUG 100 else 101 qWarning("QClipboardWatcher: WinOpenClipbrd failed with %lX", 102 WinGetLastError(NULLHANDLE)); 103 #endif 104 return fmts; 105 } 106 107 QVariant QClipboardWatcher::retrieveData_sys(const QString &mime, 108 QVariant::Type type) const 109 { 110 QStringList fmts; 111 if (WinOpenClipbrd(NULLHANDLE)) { 112 // @todo enumerate all formats and select the best converter 113 QPMMime *converter = QPMMime::converterToMime(mime, cf); 114 if (converter) 115 result = converter->convertToMime(mime, cf, type); 116 WinCloseClipbrd(NULLHANDLE); 117 } 118 #ifndef QT_NO_DEBUG 119 else 120 qWarning("QClipboardWatcher: WinOpenClipbrd failed with %lX", 121 WinGetLastError(NULLHANDLE)); 122 #endif 123 return fmts; 124 } 125 126 //////////////////////////////////////////////////////////////////////////////// 127 128 class QClipboardData 129 { 130 public: 131 QClipboardData(); 132 ~QClipboardData(); 133 134 // @todo ... 135 136 private: 137 }; 138 139 QClipboardData::QClipboardData() 140 { 141 } 142 143 QClipboardData::~QClipboardData() 144 { 145 } 146 147 static QClipboardData *ptrClipboardData = 0; 148 149 static QClipboardData *clipboardData() 150 { 151 if (ptrClipboardData == 0) { 152 ptrClipboardData = new QClipboardData; 153 // @todo ... 154 } 155 return ptrClipboardData; 156 } 157 158 static void cleanupClipboardData() 159 { 160 delete ptrClipboardData; 161 ptrClipboardData = 0; 162 } 163 164 //////////////////////////////////////////////////////////////////////////////// 165 59 166 QClipboard::~QClipboard() 60 167 { 61 // @todo implement168 cleanupClipboardData(); 62 169 } 63 170 -
trunk/src/gui/kernel/qmime.h
r2 r321 108 108 109 109 #endif 110 #if defined(Q_WS_PM) 111 112 /* 113 Encapsulation of conversion between MIME and OS/2 PM clipboard. 114 */ 115 116 class Q_GUI_EXPORT QPMMime 117 { 118 public: 119 QPMMime(); 120 virtual ~QPMMime(); 121 }; 122 123 #endif 110 124 #if defined(Q_WS_MAC) 111 125
Note:
See TracChangeset
for help on using the changeset viewer.