Line | Source | Count |
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 | #include "qxcbmime.h" | - |
41 | | - |
42 | #include <QtCore/QTextCodec> | - |
43 | #include <QtGui/QImageWriter> | - |
44 | #include <QtCore/QBuffer> | - |
45 | #include <qdebug.h> | - |
46 | | - |
47 | #include <X11/Xutil.h> | - |
48 | | - |
49 | #undef XCB_ATOM_STRING | - |
50 | #undef XCB_ATOM_PIXMAP | - |
51 | #undef XCB_ATOM_BITMAP | - |
52 | | - |
53 | QT_BEGIN_NAMESPACE | - |
54 | | - |
55 | #if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) | - |
56 | | - |
57 | QXcbMime::QXcbMime() | - |
58 | : QInternalMimeData() | - |
59 | {executed 140 times by 9 tests: end of block Executed by:- tst_QApplication
- tst_QClipboard
- tst_QGuiApplication
- tst_QPlainTextEdit
- tst_QStyleSheetStyle
- tst_QTextEdit
- tst_qapplication - unknown status
- tst_qprocess - unknown status
- tst_selftests - unknown status
}executed 140 times by 9 tests: end of block Executed by:- tst_QApplication
- tst_QClipboard
- tst_QGuiApplication
- tst_QPlainTextEdit
- tst_QStyleSheetStyle
- tst_QTextEdit
- tst_qapplication - unknown status
- tst_qprocess - unknown status
- tst_selftests - unknown status
| 140 |
60 | | - |
61 | QXcbMime::~QXcbMime() | - |
62 | {} | - |
63 | | - |
64 | | - |
65 | | - |
66 | QString QXcbMime::mimeAtomToString(QXcbConnection *connection, xcb_atom_t a) | - |
67 | { | - |
68 | if (a == XCB_NONE)TRUE | never evaluated | FALSE | evaluated 59 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-59 |
69 | return QString(); never executed: return QString(); | 0 |
70 | | - |
71 | | - |
72 | if (a == XCB_ATOM_STRINGTRUE | evaluated 7 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 52 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 7-52 |
73 | || a == connection->atom(QXcbAtom::UTF8_STRING)TRUE | evaluated 9 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 43 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 9-43 |
74 | || a == connection->atom(QXcbAtom::TEXT))TRUE | evaluated 7 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 36 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 7-36 |
75 | return QLatin1String("text/plain");executed 23 times by 6 tests: return QLatin1String("text/plain"); Executed by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 23 |
76 | | - |
77 | | - |
78 | if (a == XCB_ATOM_PIXMAP)TRUE | never evaluated | FALSE | evaluated 36 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-36 |
79 | return QLatin1String("image/ppm"); never executed: return QLatin1String("image/ppm"); | 0 |
80 | | - |
81 | QByteArray atomName = connection->atomName(a); | - |
82 | | - |
83 | | - |
84 | if (atomName == "text/x-moz-url")TRUE | never evaluated | FALSE | evaluated 36 times by 6 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-36 |
85 | atomName = "text/uri-list"; never executed: atomName = "text/uri-list"; | 0 |
86 | | - |
87 | return QString::fromLatin1(atomName.constData());executed 36 times by 6 tests: return QString::fromLatin1(atomName.constData()); Executed by:- tst_QApplication
- tst_QStyleSheetStyle
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 36 |
88 | } | - |
89 | | - |
90 | bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeData *mimeData, QByteArray *data, | - |
91 | xcb_atom_t *atomFormat, int *dataFormat) | - |
92 | { | - |
93 | if (!data)TRUE | never evaluated | FALSE | evaluated 29 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-29 |
94 | return false; never executed: return false; | 0 |
95 | | - |
96 | bool ret = false; | - |
97 | *atomFormat = a; | - |
98 | *dataFormat = 8; | - |
99 | | - |
100 | if ((a == connection->atom(QXcbAtom::UTF8_STRING)TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 24 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5-24 |
101 | || a == XCB_ATOM_STRINGTRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 19 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5-19 |
102 | || a == connection->atom(QXcbAtom::TEXT))TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 14 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5-14 |
103 | && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) {TRUE | evaluated 15 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | never evaluated |
| 0-15 |
104 | if (a == connection->atom(QXcbAtom::UTF8_STRING)) {TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 10 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5-10 |
105 | *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); | - |
106 | ret = true; | - |
107 | } else if (a == XCB_ATOM_STRING ||executed 5 times by 5 tests: end of block Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5 |
108 | a == connection->atom(QXcbAtom::TEXT)) {TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | never evaluated |
| 0-5 |
109 | | - |
110 | *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( | - |
111 | QLatin1String("text/plain"), mimeData)).toLatin1(); | - |
112 | ret = true; | - |
113 | }executed 10 times by 5 tests: end of block Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 10 |
114 | return ret;executed 15 times by 5 tests: return ret; Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 15 |
115 | } | - |
116 | | - |
117 | QString atomName = mimeAtomToString(connection, a); | - |
118 | if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) {TRUE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 5-9 |
119 | *data = QInternalMimeData::renderDataHelper(atomName, mimeData); | - |
120 | | - |
121 | | - |
122 | if (atomName == QLatin1String("text/uri-list")TRUE | never evaluated | FALSE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-9 |
123 | && connection->atomName(a) == "text/x-moz-url") {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
124 | const QByteArray uri = data->split('\n').first(); | - |
125 | QString mozUri = QString::fromLatin1(uri, uri.size()); | - |
126 | mozUri += QLatin1Char('\n'); | - |
127 | *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), | - |
128 | mozUri.length() * 2); | - |
129 | } else if (atomName == QLatin1String("application/x-color")) never executed: end of block TRUE | never evaluated | FALSE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-9 |
130 | *dataFormat = 16; never executed: *dataFormat = 16; | 0 |
131 | ret = true; | - |
132 | } else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {executed 9 times by 5 tests: end of block Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
TRUE | never evaluated | FALSE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
TRUE | never evaluated | FALSE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
TRUE | never evaluated | FALSE | never evaluated |
| 0-9 |
133 | ret = true; | - |
134 | } else if (atomName == QLatin1String("text/plain") never executed: end of block TRUE | never evaluated | FALSE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-5 |
135 | && mimeData->hasFormat(QLatin1String("text/uri-list"))) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
136 | | - |
137 | *data = QInternalMimeData::renderDataHelper(atomName, mimeData); | - |
138 | ret = true; | - |
139 | } never executed: end of block | 0 |
140 | return ret;executed 14 times by 5 tests: return ret; Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 14 |
141 | } | - |
142 | | - |
143 | QVector<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, const QString &format) | - |
144 | { | - |
145 | QVector<xcb_atom_t> atoms; | - |
146 | atoms.reserve(7); | - |
147 | atoms.append(connection->internAtom(format.toLatin1())); | - |
148 | | - |
149 | | - |
150 | if (format == QLatin1String("text/plain")) {TRUE | evaluated 5 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| FALSE | evaluated 4 times by 2 testsEvaluated by:- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 4-5 |
151 | atoms.append(connection->atom(QXcbAtom::UTF8_STRING)); | - |
152 | atoms.append(XCB_ATOM_STRING); | - |
153 | atoms.append(connection->atom(QXcbAtom::TEXT)); | - |
154 | }executed 5 times by 5 tests: end of block Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 5 |
155 | | - |
156 | | - |
157 | if (format == QLatin1String("text/uri-list")) {TRUE | never evaluated | FALSE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-9 |
158 | atoms.append(connection->internAtom("text/x-moz-url")); | - |
159 | atoms.append(connection->internAtom("text/plain")); | - |
160 | } never executed: end of block | 0 |
161 | | - |
162 | | - |
163 | if (format == QLatin1String("image/ppm"))TRUE | never evaluated | FALSE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-9 |
164 | atoms.append(XCB_ATOM_PIXMAP); never executed: atoms.append(XCB_ATOM_PIXMAP); | 0 |
165 | if (format == QLatin1String("image/pbm"))TRUE | never evaluated | FALSE | evaluated 9 times by 5 testsEvaluated by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
|
| 0-9 |
166 | atoms.append(XCB_ATOM_BITMAP); never executed: atoms.append(XCB_ATOM_BITMAP); | 0 |
167 | | - |
168 | return atoms;executed 9 times by 5 tests: return atoms; Executed by:- tst_QApplication
- tst_qclipboard - unknown status
- tst_qlineedit - unknown status
- tst_qplaintextedit - unknown status
- tst_qtextedit - unknown status
| 9 |
169 | } | - |
170 | | - |
171 | QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format, | - |
172 | QVariant::Type requestedType, const QByteArray &encoding) | - |
173 | { | - |
174 | QString atomName = mimeAtomToString(connection, a); | - |
175 | | - |
176 | | - |
177 | if (!encoding.isEmpty()TRUE | never evaluated | FALSE | evaluated 2 times by 2 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
|
| 0-2 |
178 | && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
179 | | - |
180 | #ifndef QT_NO_TEXTCODEC | - |
181 | if (requestedType == QVariant::String) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
182 | QTextCodec *codec = QTextCodec::codecForName(encoding); | - |
183 | if (codec)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
184 | return codec->toUnicode(data); never executed: return codec->toUnicode(data); | 0 |
185 | } never executed: end of block | 0 |
186 | #endif | - |
187 | | - |
188 | return data; never executed: return data; | 0 |
189 | } | - |
190 | | - |
191 | | - |
192 | if (format == QLatin1String("text/plain")) {TRUE | evaluated 2 times by 2 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
| FALSE | never evaluated |
| 0-2 |
193 | if (a == connection->atom(QXcbAtom::UTF8_STRING))TRUE | evaluated 2 times by 2 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
| FALSE | never evaluated |
| 0-2 |
194 | return QString::fromUtf8(data);executed 2 times by 2 tests: return QString::fromUtf8(data); Executed by:- tst_QApplication
- tst_QStyleSheetStyle
| 2 |
195 | if (a == XCB_ATOM_STRING ||TRUE | never evaluated | FALSE | never evaluated |
| 0 |
196 | a == connection->atom(QXcbAtom::TEXT))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
197 | return QString::fromLatin1(data); never executed: return QString::fromLatin1(data); | 0 |
198 | } never executed: end of block | 0 |
199 | | - |
200 | | - |
201 | | - |
202 | | - |
203 | if ((format == QLatin1String("text/html") || format == QLatin1String("text/uri-list"))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
204 | && data.size() > 1) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
205 | const quint8 byte0 = data.at(0); | - |
206 | const quint8 byte1 = data.at(1); | - |
207 | if ((byte0 == 0xff && byte1 == 0xfe) || (byte0 == 0xfe && byte1 == 0xff)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
208 | || (byte0 != 0 && byte1 == 0) || (byte0 == 0 && byte1 != 0)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
209 | const QString str = QString::fromUtf16( | - |
210 | reinterpret_cast<const ushort *>(data.constData()), data.size() / 2); | - |
211 | if (!str.isNull()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
212 | if (format == QLatin1String("text/uri-list")) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
213 | const QStringList urls = str.split(QLatin1Char('\n')); | - |
214 | QList<QVariant> list; | - |
215 | foreach (const QString &s, urls) { | - |
216 | const QUrl url(s.trimmed()); | - |
217 | if (url.isValid())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
218 | list.append(url); never executed: list.append(url); | 0 |
219 | } never executed: end of block | 0 |
220 | | - |
221 | | - |
222 | | - |
223 | if (!list.isEmpty() && connection->atomName(a) == "text/x-moz-url")TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
224 | return list.first(); never executed: return list.first(); | 0 |
225 | return list; never executed: return list; | 0 |
226 | } else { | - |
227 | return str; never executed: return str; | 0 |
228 | } | - |
229 | } | - |
230 | } never executed: end of block | 0 |
231 | } never executed: end of block | 0 |
232 | | - |
233 | if (atomName == format)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
234 | return data; never executed: return data; | 0 |
235 | | - |
236 | #if 0 // ### | - |
237 | | - |
238 | if (format == QLatin1String("image/ppm")) { | - |
239 | if (a == XCB_ATOM_PIXMAP && data.size() == sizeof(Pixmap)) { | - |
240 | Pixmap xpm = *((Pixmap*)data.data()); | - |
241 | if (!xpm) | - |
242 | return QByteArray(); | - |
243 | Window root; | - |
244 | int x; | - |
245 | int y; | - |
246 | uint width; | - |
247 | uint height; | - |
248 | uint border_width; | - |
249 | uint depth; | - |
250 | | - |
251 | XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); | - |
252 | XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); | - |
253 | QImage qimg = QXlibStatic::qimageFromXImage(ximg); | - |
254 | XDestroyImage(ximg); | - |
255 | | - |
256 | QImageWriter imageWriter; | - |
257 | imageWriter.setFormat("PPMRAW"); | - |
258 | QBuffer buf; | - |
259 | buf.open(QIODevice::WriteOnly); | - |
260 | imageWriter.setDevice(&buf); | - |
261 | imageWriter.write(qimg); | - |
262 | return buf.buffer(); | - |
263 | } | - |
264 | } | - |
265 | #endif | - |
266 | return QVariant(); never executed: return QVariant(); | 0 |
267 | } | - |
268 | | - |
269 | xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString &format, QVariant::Type requestedType, | - |
270 | const QVector<xcb_atom_t> &atoms, QByteArray *requestedEncoding) | - |
271 | { | - |
272 | requestedEncoding->clear(); | - |
273 | | - |
274 | | - |
275 | if (format == QLatin1String("text/plain")) {TRUE | evaluated 2 times by 2 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
| FALSE | never evaluated |
| 0-2 |
276 | if (atoms.contains(connection->atom(QXcbAtom::UTF8_STRING)))TRUE | evaluated 2 times by 2 testsEvaluated by:- tst_QApplication
- tst_QStyleSheetStyle
| FALSE | never evaluated |
| 0-2 |
277 | return connection->atom(QXcbAtom::UTF8_STRING);executed 2 times by 2 tests: return connection->atom(QXcbAtom::UTF8_STRING); Executed by:- tst_QApplication
- tst_QStyleSheetStyle
| 2 |
278 | if (atoms.contains(XCB_ATOM_STRING))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
279 | return XCB_ATOM_STRING; never executed: return XCB_ATOM_STRING; | 0 |
280 | if (atoms.contains(connection->atom(QXcbAtom::TEXT)))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
281 | return connection->atom(QXcbAtom::TEXT); never executed: return connection->atom(QXcbAtom::TEXT); | 0 |
282 | } never executed: end of block | 0 |
283 | | - |
284 | | - |
285 | if (format == QLatin1String("text/uri-list")) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
286 | xcb_atom_t a = connection->internAtom(format.toLatin1()); | - |
287 | if (a && atoms.contains(a))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
288 | return a; never executed: return a; | 0 |
289 | a = connection->internAtom("text/x-moz-url"); | - |
290 | if (a && atoms.contains(a))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
291 | return a; never executed: return a; | 0 |
292 | } never executed: end of block | 0 |
293 | | - |
294 | | - |
295 | if (format == QLatin1String("image/ppm")) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
296 | if (atoms.contains(XCB_ATOM_PIXMAP))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
297 | return XCB_ATOM_PIXMAP; never executed: return XCB_ATOM_PIXMAP; | 0 |
298 | } never executed: end of block | 0 |
299 | | - |
300 | | - |
301 | | - |
302 | if (requestedType == QVariant::StringTRUE | never evaluated | FALSE | never evaluated |
| 0 |
303 | && format.startsWith(QLatin1String("text/"))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
304 | && !format.contains(QLatin1String("charset="))) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
305 | | - |
306 | QString formatWithCharset = format; | - |
307 | formatWithCharset.append(QLatin1String(";charset=utf-8")); | - |
308 | | - |
309 | xcb_atom_t a = connection->internAtom(formatWithCharset.toLatin1()); | - |
310 | if (a && atoms.contains(a)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
311 | *requestedEncoding = "utf-8"; | - |
312 | return a; never executed: return a; | 0 |
313 | } | - |
314 | } never executed: end of block | 0 |
315 | | - |
316 | xcb_atom_t a = connection->internAtom(format.toLatin1()); | - |
317 | if (a && atoms.contains(a))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
318 | return a; never executed: return a; | 0 |
319 | | - |
320 | return 0; never executed: return 0; | 0 |
321 | } | - |
322 | | - |
323 | #endif // !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD)) | - |
324 | | - |
325 | QT_END_NAMESPACE | - |
| | |