diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2019-11-09 10:14:15 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-11-10 21:59:32 +0100 |
commit | 4f0d437f1e5bde5f4e193eb81914a87d34c13eba (patch) | |
tree | 99da72d8b78cadf9fd0523a4f4651e5db7d12146 /mobile-widgets/qmlmanager.cpp | |
parent | 80f123ce2aacc8f3180b0b7a56a027e4804ae498 (diff) | |
download | subsurface-4f0d437f1e5bde5f4e193eb81914a87d34c13eba.tar.gz |
Mobile: add ability to directly open support email
This is even easier and more obvious than copying the logs on the About page
and then manually creating an email and pasting those logs.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c27e2ca23..015e72626 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -375,13 +375,28 @@ void QMLManager::mergeLocalRepo() void QMLManager::copyAppLogToClipboard() { - /* - * The user clicked the button, so copy the log file - * to the clipboard for easy access - */ + // The About page offers a button to copy logs so they can be pasted elsewhere + QApplication::clipboard()->setText(getCombinedLogs(), QClipboard::Clipboard); +} +bool QMLManager::createSupportEmail() +{ + QString mailToLink = "mailto:in-app-support@subsurface-divelog.org?subject=Subsurface-mobile support request"; + mailToLink += "&body=Please describe your issue here and keep the logs below:\n\n\n\n"; + mailToLink += getCombinedLogs(); + if (QDesktopServices::openUrl(QUrl(mailToLink))) { + appendTextToLog("OS accepted support email"); + return true; + } + appendTextToLog("failed to create support email"); + return false; +} + +// useful for support requests +QString QMLManager::getCombinedLogs() +{ // Add heading and append subsurface.log - QString copyString = "---------- subsurface.log ----------\n"; + QString copyString = "\n---------- subsurface.log ----------\n"; copyString += MessageHandlerModel::self()->logAsString(); // Add heading and append libdivecomputer.log @@ -408,9 +423,7 @@ void QMLManager::copyAppLogToClipboard() copyString += "\n\n---------- truncated ----------\n"; } #endif - - // and copy to clipboard - QApplication::clipboard()->setText(copyString, QClipboard::Clipboard); + return copyString; } void QMLManager::finishSetup() |