iOS: copy libdivecomputer.log to clipboard

Read libdivecomputer.log file and append to clipboard

Remark, subsurface_open is not available in iOS so using
QFile instead.

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-05-21 10:55:07 +02:00 committed by Dirk Hohndel
parent 4a872f74a4
commit 3646fa800b

View file

@ -340,7 +340,22 @@ void QMLManager::copyAppLogToClipboard()
* The user clicked the button, so copy the log file
* to the clipboard for easy access
*/
QString copyString = MessageHandlerModel::self()->logAsString();
// Add heading and append subsurface.log
QString copyString = "---------- subsurface.log ----------\n";
copyString += MessageHandlerModel::self()->logAsString();
// Add heading and append libdivecomputer.log
QFile f(logfile_name);
if (f.open(QFile::ReadOnly | QFile::Text)) {
copyString += "\n\n\n---------- libdivecomputer.log ----------\n";
QTextStream in(&f);
copyString += in.readAll();
}
copyString += "---------- finish ----------\n";
// and copy to clipboard
QApplication::clipboard()->setText(copyString, QClipboard::Clipboard);
}