diff options
-rw-r--r-- | mobile-widgets/qml/main.qml | 30 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 29 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 2 |
3 files changed, 44 insertions, 17 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 47b3d8f50..3a88ad91b 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -436,6 +436,27 @@ if you have network connectivity and want to sync your data to cloud storage."), }, Kirigami.Action { icon { + name: ":/icons/ic_help_outline.svg" + } + text: qsTr("Help") + onTriggered: { + Qt.openUrlExternally("https://subsurface-divelog.org/documentation/subsurface-mobile-v2-user-manual/") + } + }, + Kirigami.Action { + icon { + name: ":/icons/ic_help_outline.svg" + } + text: qsTr("Ask for support") + onTriggered: { + if (!manager.createSupportEmail()) { + manager.copyAppLogToClipboard() + showPassiveNotification(qsTr("failed to open email client, please manually create support email to support@subsurface-divelog.org - the logs have been copied to the clipboard and can be pasted into that email."), 6000) + } + } + }, + Kirigami.Action { + icon { name: ":/icons/ic_adb.svg" } text: qsTr("Developer") @@ -477,15 +498,6 @@ if you have network connectivity and want to sync your data to cloud storage."), pageStack.push(themetest) } } - }, - Kirigami.Action { - icon { - name: ":/icons/ic_help_outline.svg" - } - text: qsTr("Help") - onTriggered: { - Qt.openUrlExternally("https://subsurface-divelog.org/documentation/subsurface-mobile-v2-user-manual/") - } } ] // end actions Image { 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() diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 782cc6d22..4faf823b8 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -185,7 +185,9 @@ public slots: void populateGpsData(); void cancelDownloadDC(); void clearGpsData(); + QString getCombinedLogs(); void copyAppLogToClipboard(); + bool createSupportEmail(); void finishSetup(); void openLocalThenRemote(QString url); void mergeLocalRepo(); |