Changeset f48433245d in tspsg for src
- Timestamp:
- Sep 10, 2012, 5:50:48 PM (12 years ago)
- Branches:
- appveyor, imgbot, master, readme
- Children:
- 89e5214692
- Parents:
- b26dc16dcf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mainwindow.cpp
rb26dc16dcf rf48433245d 263 263 #endif 264 264 filters.append(tr("HTML Files") + " (*.html *.htm)"); 265 filters.append(tr("Web Archive Files") + " (*.mht *.mhtml)"); 265 266 filters.append(tr("OpenDocument Files") + " (*.odt)"); 266 267 filters.append(tr("All Files") + " (*)"); … … 284 285 #endif 285 286 QByteArray imgdata; 286 bool embed = settings->value("Output/EmbedGraphIntoHTML", DEF_EMBED_GRAPH_INTO_HTML).toBool(); 287 if (selectedFile.endsWith(".htm", Qt::CaseInsensitive) || selectedFile.endsWith(".html", Qt::CaseInsensitive)) { 287 bool mhtml = selectedFile.contains(QRegExp("\\.mht(ml)?$", Qt::CaseInsensitive)); 288 bool embed = !mhtml && settings->value("Output/EmbedGraphIntoHTML", DEF_EMBED_GRAPH_INTO_HTML).toBool(); 289 if (selectedFile.contains(QRegExp("\\.(html?|mht(ml)?)$", Qt::CaseInsensitive))) { 288 290 QFile file(selectedFile); 289 291 if (!file.open(QFile::WriteOnly | QFile::Text)) { … … 335 337 QTextStream ts(&file); 336 338 ts.setCodec(QTextCodec::codecForName("UTF-8")); 339 QString boundary = QString("------=multipart_boundary.%1").arg(qHash(selectedFile)); 340 if (mhtml) { 341 ts << "Content-Type: multipart/related; start=<[email protected]>; boundary=\"" 342 << boundary << "\"; type=\"text/html\"" << endl; 343 boundary.prepend("--"); 344 ts << "MIME-Version: 1.0" << endl; 345 ts << endl; 346 ts << boundary << endl; 347 ts << "Content-Disposition: inline; filename=" << fi.completeBaseName() << ".html" << endl; 348 ts << "Content-Type: text/html; name=" << fi.completeBaseName() << ".html" << endl; 349 ts << "Content-ID: <[email protected]>" << endl; 350 ts << "Content-Location: " << fi.completeBaseName() << ".html" << endl; 351 ts << "Content-Transfer-Encoding: 8bit" << endl; 352 ts << endl; 353 } 337 354 ts << html << endl; 355 if (mhtml) { 356 ts << endl << boundary << endl; 357 ts << "Content-Disposition: inline; filename=" << fi.completeBaseName() << "." << format << endl; 358 ts << "Content-Type: image/" << format; 359 if (format == "svg") 360 ts << "+xml"; 361 ts << "; name=" << fi.completeBaseName() << "." << format << endl; 362 ts << "Content-Location: " << fi.completeBaseName() << "." << format << endl; 363 ts << "Content-Transfer-Encoding: Base64" << endl; 364 ts << endl; 365 ts << toWrappedBase64(imgdata) << endl; 366 ts << endl << boundary << "--" << endl; 367 } 338 368 file.close(); 339 if (!embed ) {369 if (!embed && !mhtml) { 340 370 QFile img(fi.path() + "/" + fi.completeBaseName() + "." + format); 341 371 if (!img.open(QFile::WriteOnly)) {
Note: See TracChangeset
for help on using the changeset viewer.