YandexNarodBuffer::YandexNarodBuffer(const QString &fileName, QIODevice *file, const QByteArray &boundary, QObject *parent) : QIODevice(parent) { QByteArray data; data.append("--").append(boundary).append("\r\n"); data.append("Content-Disposition: form-data; name=\"file\"; filename=\"") .append(fileName).append("\"\r\n"); data.append("Content-Transfer-Encoding: binary\r\n"); data.append("\r\n"); QBuffer *buffer = new QBuffer(this); buffer->setData(data); m_devices.append(buffer); m_devices.append(file); file->setParent(this); connect(file, SIGNAL(destroyed()), SLOT(deleteLater())); data.clear(); data.append("\r\n--").append(boundary).append("--\r\n"); buffer = new QBuffer(this); buffer->setData(data); m_devices.append(buffer); }
QNetworkReply* ownCloudInfo::getDirectoryListing( const QString& dir ) { QNetworkRequest req; req.setUrl( QUrl( webdavUrl(_connection) + dir ) ); req.setRawHeader("Depth", "1"); QByteArray xml("<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" " <d:resourcetype/>\n" " </d:prop>\n" "</d:propfind>\n"); QBuffer *buf = new QBuffer; buf->setData(xml); buf->open(QIODevice::ReadOnly); QNetworkReply *reply = davRequest("PROPFIND", req, buf); buf->setParent(reply); if( reply->error() != QNetworkReply::NoError ) { qDebug() << "getting quota: request network error: " << reply->errorString(); } connect( reply, SIGNAL( finished()), SLOT(slotGetDirectoryListingFinished()) ); connect( reply, SIGNAL( error(QNetworkReply::NetworkError)), this, SLOT( slotError(QNetworkReply::NetworkError))); return reply; }
const KeyboardTranslator* KeyboardTranslatorManager::defaultTranslator() { kDebug() << "Loading default translator from text" << defaultTranslatorText; QBuffer textBuffer; textBuffer.setData(defaultTranslatorText,strlen(defaultTranslatorText)); return loadTranslator(&textBuffer,"fallback"); }
void testPut() { #if defined(USE_QNAM) && QT_VERSION <= QT_VERSION_CHECK(5, 5, 0) QSKIP("This test is broken with Qt < 5.5, the fix is 9286a8e5dd97c5d4d7e0ed07a73d4ce7240fdc1d in qtbase"); #endif const QString aDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation); QVERIFY(QDir::temp().mkpath(aDir)); const QString aFile = aDir + QStringLiteral("/accessmanagertest-data"); const QByteArray content = "We love free software!"; QBuffer buffer; buffer.setData(content); QVERIFY(buffer.open(QIODevice::ReadOnly)); QFile::remove(aFile); QNetworkReply *reply = manager()->put(QNetworkRequest(QUrl::fromLocalFile(aFile)), &buffer); QSignalSpy spy(reply, SIGNAL(finished())); QVERIFY(reply->isRunning()); QVERIFY(spy.wait()); QVERIFY(QFile::exists(aFile)); QFile f(aFile); QVERIFY(f.open(QIODevice::ReadOnly)); QCOMPARE(f.readAll(), content); QFile::remove(aFile); }
void NetFlixQueueProxy::getQueueRequestCompleted(int retCode, QString body){ qDebug() << "queue request completed!!"; qDebug() << retCode; QXmlQuery query; QString result; QBuffer device; device.setData(body.toUtf8()); device.open(QIODevice::ReadOnly); query.bindVariable("netflix_queue",&device); query.setQuery(QUrl("qrc:/queries/queue.xq")); if (query.isValid()) { if (query.evaluateTo(&result)) qDebug() << result; else qDebug() << "Evaluate failed"; } else qDebug() << "setQuery Failed."; }
void RequestEtagJob::start() { QNetworkRequest req; if (_account && _account->rootEtagChangesNotOnlySubFolderEtags()) { // Fixed from 8.1 https://github.com/owncloud/client/issues/3730 req.setRawHeader("Depth", "0"); } else { // Let's always request all entries inside a directory. There are/were bugs in the server // where a root or root-folder ETag is not updated when its contents change. We work around // this by concatenating the ETags of the root and its contents. req.setRawHeader("Depth", "1"); // See https://github.com/owncloud/core/issues/5255 and others } QByteArray xml("<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" " <d:getetag/>\n" " </d:prop>\n" "</d:propfind>\n"); QBuffer *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); // assumes ownership sendRequest("PROPFIND", makeDavUrl(path()), req, buf); if (reply()->error() != QNetworkReply::NoError) { qCWarning(lcEtagJob) << "request network error: " << reply()->errorString(); } AbstractNetworkJob::start(); }
void PropfindJob::start() { QList<QByteArray> properties = _properties; if (properties.isEmpty()) { qWarning() << "Propfind with no properties!"; } QNetworkRequest req; req.setRawHeader("Depth", "0"); QByteArray propStr; foreach (const QByteArray &prop, properties) { if (prop.contains(':')) { int colIdx = prop.lastIndexOf(":"); propStr += " <" + prop.mid(colIdx+1) + " xmlns=\"" + prop.left(colIdx) + "\" />\n"; } else { propStr += " <d:" + prop + " />\n"; } } QByteArray xml = "<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" + propStr + " </d:prop>\n" "</d:propfind>\n"; QBuffer *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); setReply(davRequest("PROPFIND", path(), req, buf)); buf->setParent(reply()); setupConnections(reply()); AbstractNetworkJob::start(); }
static QString getImageType(const QByteArray& image) { #ifndef QXMPP_NO_GUI QBuffer buffer; buffer.setData(image); buffer.open(QIODevice::ReadOnly); QString format = QImageReader::imageFormat(&buffer); if(format.toUpper() == "PNG") return "image/png"; else if(format.toUpper() == "MNG") return "video/x-mng"; else if(format.toUpper() == "GIF") return "image/gif"; else if(format.toUpper() == "BMP") return "image/bmp"; else if(format.toUpper() == "XPM") return "image/x-xpm"; else if(format.toUpper() == "SVG") return "image/svg+xml"; else if(format.toUpper() == "JPEG") return "image/jpeg"; #endif return "image/unknown"; }
// +----------------------------------------------------------- bool f3::LogControl::getLogLevel(const QString &sAppName, QtMsgType &eLevel) const { // Try to lock the shared memory if(!m_pSharedMemory->lock()) return false; // Read the map from the shared memory QBuffer oBuffer; QDataStream oStream(&oBuffer); oBuffer.setData((char *) m_pSharedMemory->constData(), m_pSharedMemory->size()); oBuffer.open(QBuffer::ReadOnly); QMap<QString, int> mApps; oStream >> mApps; // Unlock the shared memory before returning m_pSharedMemory->unlock(); // Return the stored value for the application name (if found on the table) int iLevel = mApps[sAppName]; if(iLevel != 0) { eLevel = (QtMsgType) (iLevel - 1); return true; } else return false; }
// +----------------------------------------------------------- bool f3::LogControl::getAppLogData(QMap<QString, QtMsgType> &mAppLogData) const { // Try to lock the shared memory if(!m_pSharedMemory->lock()) return false; // Read the map from the shared memory QBuffer oBuffer; QDataStream oStream(&oBuffer); oBuffer.setData((char *) m_pSharedMemory->constData(), m_pSharedMemory->size()); oBuffer.open(QBuffer::ReadOnly); QMap<QString, int> mApps; oStream >> mApps; // Unlock the shared memory before returning m_pSharedMemory->unlock(); mAppLogData.clear(); QMap<QString, int>::iterator it; for(it = mApps.begin(); it != mApps.end(); ++it) mAppLogData.insert(it.key(), (QtMsgType) (it.value() - 1)); return true; }
QMap<QString, QMap<QString, int> > readExpMap() { QBuffer buffer; QDataStream in(&buffer); QMap<QString, QMap<QString, int> > expMap; expShm->attach(QSharedMemory::ReadWrite); if(!expShm->isAttached()) { return expMap; } expShm->lock(); buffer.setData((char*)expShm->constData(), expShm->size()); buffer.open(QBuffer::ReadOnly); in >> expMap; buffer.close(); expShm->unlock(); expShm->detach(); return expMap; }
int CUserInfoXmpp::UpdateUserInfo(const QXmppVCardIq &vCard, QString jid) { //if(!vCard.fullName().isEmpty()) // m_szName = vCard.fullName(); m_szNick = vCard.nickName(); m_Birthday = vCard.birthday(); m_szEmail = vCard.email(); m_szDescription = vCard.description(); if(!jid.isEmpty() && m_szJid.isEmpty()) m_szJid = jid; //保存头像 QByteArray photo = vCard.photo(); QBuffer buffer; buffer.setData(photo); buffer.open(QIODevice::ReadOnly); QImageReader imageReader(&buffer); m_imgPhoto = imageReader.read(); buffer.close(); //保存头像到本地 QImageWriter imageWriter(CGlobal::Instance()->GetFileUserAvatar(GetId()), "png"); if(!imageWriter.write(GetPhoto())) LOG_MODEL_ERROR("CUserInfo", "Save avater error, %s", imageWriter.errorString().toStdString().c_str()); return 0; }
bool FormWindowEditor::open(QString *errorString, const QString &fileName, const QString &realFileName) { if (Designer::Constants::Internal::debug) qDebug() << "FormWindowEditor::open" << fileName; auto document = qobject_cast<FormWindowFile *>(textDocument()); QDesignerFormWindowInterface *form = document->formWindow(); QTC_ASSERT(form, return false); if (fileName.isEmpty()) return true; const QFileInfo fi(fileName); const QString absfileName = fi.absoluteFilePath(); QString contents; if (document->read(absfileName, &contents, errorString) != Utils::TextFileFormat::ReadSuccess) return false; form->setFileName(absfileName); const QByteArray contentsBA = contents.toUtf8(); QBuffer str; str.setData(contentsBA); str.open(QIODevice::ReadOnly); if (!form->setContents(&str, errorString)) return false; form->setDirty(fileName != realFileName); document->syncXmlFromFormWindow(); document->setFilePath(absfileName); document->setShouldAutoSave(false); document->resourceHandler()->updateResources(true); return true; }
QBuffer *createBuffer (const QByteArray &data = "0123456789", QIODevice::OpenMode mode = QIODevice::ReadWrite) { QBuffer *buffer = new QBuffer (this); buffer->setData (data); buffer->open (mode); return buffer; }
bool readStream(POLE::Storage& storage, const char* streampath, QBuffer& buffer) { std::string path(streampath); if (storage.isDirectory("PP97_DUALSTORAGE")) { qDebug() << "PP97_DUALSTORAGE"; path = "PP97_DUALSTORAGE" + path; } POLE::Stream stream(&storage, path); if (stream.fail()) { qDebug() << "Unable to construct " << streampath << "stream"; return false; } QByteArray array; array.resize(stream.size()); unsigned long r = stream.read((unsigned char*)array.data(), stream.size()); if (r != stream.size()) { qDebug() << "Error while reading from " << streampath << "stream"; return false; } buffer.setData(array); buffer.open(QIODevice::ReadOnly); return true; }
void RequestEtagJob::start() { QNetworkRequest req; if (path().isEmpty() || path() == QLatin1String("/")) { /* For the root directory, we need to query the etags of all the sub directories * because, at the time I am writing this comment (Owncloud 5.0.9), the etag of the * root directory is not updated when the sub directories changes */ req.setRawHeader("Depth", "1"); } else { req.setRawHeader("Depth", "0"); } QByteArray xml("<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" " <d:getetag/>\n" " </d:prop>\n" "</d:propfind>\n"); QBuffer *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); // assumes ownership setReply(davRequest("PROPFIND", path(), req, buf)); buf->setParent(reply()); setupConnections(reply()); if( reply()->error() != QNetworkReply::NoError ) { qDebug() << "getting etag: request network error: " << reply()->errorString(); } AbstractNetworkJob::start(); }
void tst_WebSocketFrame::tst_invalidFrames() { QFETCH(int, rsv1); QFETCH(int, rsv2); QFETCH(int, rsv3); QFETCH(quint32, mask); QFETCH(QWebSocketProtocol::OpCode, opCode); QFETCH(bool, isFinal); QFETCH(QByteArray, payload); QFETCH(QWebSocketProtocol::CloseCode, expectedError); FrameHelper helper; helper.setRsv1(rsv1); helper.setRsv2(rsv2); helper.setRsv3(rsv3); helper.setMask(mask); helper.setOpCode(opCode); helper.setFinalFrame(isFinal); helper.setPayload(payload); QByteArray wireRepresentation = helper.wireRepresentation(); QBuffer buffer; buffer.setData(wireRepresentation); buffer.open(QIODevice::ReadOnly); QWebSocketFrame frame = QWebSocketFrame::readFrame(&buffer); buffer.close(); QVERIFY(!frame.isValid()); QCOMPARE(frame.closeCode(), expectedError); }
QNetworkReply * NetworkAccessManager::createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData) { QByteArray data; QBuffer* buffer = 0; // cache the content first if (outgoingData) { buffer = new QBuffer(this); data = outgoingData->readAll(); buffer->setData(data); } if (d->ShouldLogRequestResponse) { qDebug() << "Queueing Request: " << req.url().toString(); } QNetworkReply* reply = QNetworkAccessManager::createRequest(op, req, buffer); reply->ignoreSslErrors(); if (outgoingData) { qDebug() << "Request Details# op=" << op << ", url=" << req.url().toString() << ", data("<<data.length() <<")=" << data; if (d->removeRequestInfo(reply)) { qWarning() << "Same request aleady cached. So going to remove reference to old one."; } d->DataMap.insert(reply, new RequestInfo(op, data, buffer)); } return reply; }
void RequestEtagJob::start() { QNetworkRequest req; // Let's always request all entries inside a directory. There are/were bugs in the server // where a root or root-folder ETag is not updated when its contents change. We work around // this by concatenating the ETags of the root and its contents. req.setRawHeader("Depth", "1"); // See https://github.com/owncloud/core/issues/5255 and others QByteArray xml("<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" " <d:getetag/>\n" " </d:prop>\n" "</d:propfind>\n"); QBuffer *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); // assumes ownership setReply(davRequest("PROPFIND", path(), req, buf)); buf->setParent(reply()); setupConnections(reply()); if( reply()->error() != QNetworkReply::NoError ) { qDebug() << "getting etag: request network error: " << reply()->errorString(); } AbstractNetworkJob::start(); }
static HeadersMap parseHeaders(const QByteArray& headerData) { HeadersMap headersMap; QBuffer sourceBuffer; sourceBuffer.setData(headerData); sourceBuffer.open(QIODevice::ReadOnly); // The first line is special, it's the GET or POST line const QList<QByteArray> firstLine = sourceBuffer.readLine().split(' '); if (firstLine.count() < 3) { qDebug() << "Malformed HTTP request:" << firstLine; return headersMap; } const QByteArray requestType = firstLine.at(0); const QByteArray path = QDir::cleanPath(QString::fromLatin1(firstLine.at(1).constData())).toLatin1(); const QByteArray httpVersion = firstLine.at(2); headersMap.insert("_requestType", requestType); headersMap.insert("_path", path); headersMap.insert("_httpVersion", httpVersion); while (!sourceBuffer.atEnd()) { const QByteArray line = sourceBuffer.readLine(); const int pos = line.indexOf(':'); if (pos == -1) qDebug() << "Malformed HTTP header:" << line; const QByteArray header = line.left(pos).toLower(); // RFC2616 section 4.2 "Field names are case-insensitive" const QByteArray value = line.mid(pos+1).trimmed(); // remove space before and \r\n after //qDebug() << "HEADER" << header << "VALUE" << value; headersMap.insert(header, value); } return headersMap; }
void PropfindJob::start() { QList<QByteArray> properties = _properties; if (properties.isEmpty()) { qCWarning(lcLsColJob) << "Propfind with no properties!"; } QNetworkRequest req; // Always have a higher priority than the propagator because we use this from the UI // and really want this to be done first (no matter what internal scheduling QNAM uses). // Also possibly useful for avoiding false timeouts. req.setPriority(QNetworkRequest::HighPriority); req.setRawHeader("Depth", "0"); QByteArray propStr; foreach (const QByteArray &prop, properties) { if (prop.contains(':')) { int colIdx = prop.lastIndexOf(":"); propStr += " <" + prop.mid(colIdx + 1) + " xmlns=\"" + prop.left(colIdx) + "\" />\n"; } else { propStr += " <d:" + prop + " />\n"; } } QByteArray xml = "<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" + propStr + " </d:prop>\n" "</d:propfind>\n"; QBuffer *buf = new QBuffer(this); buf->setData(xml); buf->open(QIODevice::ReadOnly); sendRequest("PROPFIND", makeDavUrl(path()), req, buf); AbstractNetworkJob::start(); }
void tst_jpeg::jpegDecodingQtWebkitStyle() { // QtWebkit currently calls size() to get the image size for layouting purposes. // Then when it is in the viewport (we assume that here) it actually gets decoded. QString testFile = QFINDTESTDATA("n900.jpeg"); QVERIFY2(!testFile.isEmpty(), "cannot find test file n900.jpeg!"); QFile inputJpeg(testFile); QVERIFY(inputJpeg.exists()); inputJpeg.open(QIODevice::ReadOnly); QByteArray imageData = inputJpeg.readAll(); QBuffer buffer; buffer.setData(imageData); buffer.open(QBuffer::ReadOnly); QCOMPARE(buffer.size(), qint64(19016)); QBENCHMARK{ for (int i = 0; i < 50; i++) { QImageReader reader(&buffer, "jpeg"); QSize size = reader.size(); QVERIFY(!size.isNull()); QByteArray format = reader.format(); QVERIFY(!format.isEmpty()); QImage img = reader.read(); QVERIFY(!img.isNull()); buffer.reset(); } } }
void OsmReader::readFromString(QString xml, shared_ptr<OsmMap> map) { _osmFound = false; _missingNodeCount = 0; _missingWayCount = 0; _badAccuracyCount = 0; _map = map; // do xml parsing QXmlSimpleReader reader; reader.setContentHandler(this); reader.setErrorHandler(this); QBuffer buffer; buffer.setData(xml.toUtf8()); QXmlInputSource xmlInputSource(&buffer); if (reader.parse(xmlInputSource) == false) { throw Exception(_errorString); } ReportMissingElementsVisitor visitor; _map->visitRw(visitor); _map.reset(); }
static HeadersMap parseHeaders(const QByteArray& headerData) { HeadersMap headersMap; QBuffer sourceBuffer; sourceBuffer.setData(headerData); sourceBuffer.open(QIODevice::ReadOnly); // The first line is special, it's the GET or POST line const QList<QByteArray> firstLine = sourceBuffer.readLine().split(' '); if (firstLine.count() < 3) { qDebug() << "Malformed HTTP request:" << firstLine; return headersMap; } const QByteArray request = firstLine[0]; const QByteArray path = firstLine[1]; const QByteArray httpVersion = firstLine[2]; if (request != "GET" && request != "POST") { qDebug() << "Unknown HTTP request:" << firstLine; return headersMap; } headersMap.insert("_path", path); headersMap.insert("_httpVersion", httpVersion); while (!sourceBuffer.atEnd()) { const QByteArray line = sourceBuffer.readLine(); const int pos = line.indexOf(':'); if (pos == -1) qDebug() << "Malformed HTTP header:" << line; const QByteArray header = line.left(pos); const QByteArray value = line.mid(pos+1).trimmed(); // remove space before and \r\n after //qDebug() << "HEADER" << header << "VALUE" << value; headersMap.insert(header, value); } return headersMap; }
void YandexNarodUploadJob::sendImpl() { setState(Started); setStateString(QT_TR_NOOP("Creating directory...")); m_data = setCurrentIndex(0); // We need only resourcetype to detect if it is a directory QByteArray data = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" "<propfind xmlns=\"DAV:\">" "<prop><resourcetype/></prop>" "</propfind>"; QUrl url(WEBDAV_BASE_URL); url.setPath(QLatin1String("/qutim-filetransfer/")); YandexRequest request(url); request.setRawHeader("Depth", "1"); request.setRawHeader("Content-Length", QByteArray::number(data.size())); request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); QBuffer *buffer = new QBuffer; buffer->setData(data); buffer->open(QIODevice::ReadOnly); QNetworkReply *reply = YandexNarodFactory::networkManager() ->sendCustomRequest(request, "PROPFIND", buffer); buffer->setParent(reply); connect(reply, SIGNAL(finished()), this, SLOT(onDirectoryChecked())); }
QBuffer* RFileCache::getBuffer(const QString& fileName, bool forceReload) { QString abs = QFileInfo(fileName).canonicalFilePath(); if (abs.isEmpty()) { return NULL; } if (forceReload) { cache.remove(abs); } if (cache.contains(abs)) { return cache[abs]; } QFile f(fileName); if (!f.open(QIODevice::ReadOnly)) { qWarning() << "RFileCache::getBuffer: cannot read file: " << abs; return NULL; } QBuffer* buffer = new QBuffer(); buffer->setData(f.readAll()); cache.insert(abs, buffer, buffer->size()); f.close(); return buffer; }
void CheckForUpdatesJob::parseXmlData( const QByteArray& data ) { QBuffer buffer; buffer.setData( data ); buffer.open( QIODevice::ReadOnly ); QDomDocument document; QString errorMessage; int errorLine = 0; int errorColumn = 0; if ( !document.setContent( &buffer, &errorMessage, &errorLine, &errorColumn ) ) { m_jobData.errorString = tr( "Invalid XML: [%1:%2] %3" ).arg( QString::number( errorLine ), QString::number( errorColumn ), errorMessage ); m_jobData.error = 999; // this value is just to have an and does not mean anything - error != 0 return; } QDomElement element = document.documentElement(); QDomElement versionElement = element.firstChildElement( QLatin1String( "version" ) ); QDomElement linkElement = versionElement.nextSiblingElement( QLatin1String( "link" ) ); const QString releaseVersion = versionElement.text(); m_jobData.releaseVersion = releaseVersion; QUrl link( linkElement.text() ); m_jobData.link = link; QString releaseInfoLink( linkElement.nextSiblingElement( QLatin1String( "releaseinfolink" ) ).text() ); m_jobData.releaseInformationLink = releaseInfoLink; }
DocPropsCore DocPropsCore::loadFromXmlData(const QByteArray &data) { QBuffer buffer; buffer.setData(data); buffer.open(QIODevice::ReadOnly); return loadFromXmlFile(&buffer); }
WebKitBrowserExtension::WebKitBrowserExtension(KWebKitPart *parent, const QByteArray& cachedHistoryData) :KParts::BrowserExtension(parent), m_part(parent) { enableAction("cut", false); enableAction("copy", false); enableAction("paste", false); enableAction("print", true); if (cachedHistoryData.isEmpty()) { return; } QBuffer buffer; buffer.setData(cachedHistoryData); if (!buffer.open(QIODevice::ReadOnly)) { return; } // NOTE: When restoring history, webkit automatically navigates to // the previous "currentItem". Since we do not want that to happen, // we set a property on the WebPage object that is used to allow or // disallow history navigation in WebPage::acceptNavigationRequest. view()->page()->setProperty("HistoryNavigationLocked", true); QDataStream s (&buffer); s >> *(view()->history()); }
//---------------------------------------------------------------------------- // VCard //---------------------------------------------------------------------------- QString image2type(const QByteArray &ba) { QBuffer buf; buf.setData(ba); buf.open(QIODevice::ReadOnly); QString format = QImageReader::imageFormat( &buf ); // TODO: add more formats if ( format.toUpper() == "PNG" || format == "PsiPNG" ) return "image/png"; if ( format.toUpper() == "MNG" ) return "video/x-mng"; if ( format.toUpper() == "GIF" ) return "image/gif"; if ( format.toUpper() == "BMP" ) return "image/bmp"; if ( format.toUpper() == "XPM" ) return "image/x-xpm"; if ( format.toUpper() == "SVG" ) return "image/svg+xml"; if ( format.toUpper() == "JPEG" ) return "image/jpeg"; qWarning() << QString("WARNING! VCard::image2type: unknown format = '%1'").arg(format.isNull() ? QString("UNKNOWN") : format); return "image/unknown"; }