Advertisement
Guest User

Untitled

a guest
May 14th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. void MainPage::fileBugReport()
  2. {
  3.     showWindow();
  4.     QFile file(LOG_FILE_PATH);
  5.     file.open(QIODevice::ReadOnly);
  6.     QString fileContents = file.readAll();
  7.     file.close();
  8.     QStringList lines = fileContents.split("\n");
  9.     QStringList processedLines;
  10.     foreach (QString line, lines) {
  11.         if (line.contains(m_accessToken))
  12.             line.replace(m_accessToken, "ACCESS_TOKEN_REMOVED");
  13.  
  14.         if (!line.contains("http"))
  15.             processedLines.append(line);
  16.         else
  17.             processedLines.append("There was a link here - it was removed for your own privacy.");
  18.     }
  19.  
  20.     QString processedText = processedLines.join("\n");
  21.     QString tempLog = "/tmp/sociality-mtf-crash-log.txt";
  22.     QFile tempFile(tempLog);
  23.     tempFile.open(QIODevice::WriteOnly);
  24.     tempFile.write(processedText.toAscii());
  25.     tempFile.close();
  26.     QDesktopServices::openUrl(QUrl("mailto:myemail?subject=Sociality%20bug%20report&attach=/tmp/sociality-mtf-crash-log.txt&Body=Sociality%20has%20crashed%20and%20this%20is%20an%20automated%20bug%20report.\nA%20log%20file%20has%20been%20attached,%20this%20may%20help%20in%20debugging%20the%20app,%20it%20was%20processed%20to%20remove%20all%20private%20links%20from%20it.\nIf%20the%20problem%20is%20reproduceable,%20please%20describe%20it:\n1.\n2.\n3."));
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement