diff options
author | jan Iversen <jani@libreoffice.org> | 2018-05-16 16:50:17 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-05-18 12:43:15 -0700 |
commit | a181020b193f0ae44c49a1ac095713cd2fa10213 (patch) | |
tree | 23fc996d739439fee789f6835216e17ed53646c0 /mobile-widgets | |
parent | 2a0ee09cb2cf1c3cb7ee020d5c6b58bcc50123ca (diff) | |
download | subsurface-a181020b193f0ae44c49a1ac095713cd2fa10213.tar.gz |
mobile: add "Copy log to clipboard" button
on iOS it is practically impossible to copy the App log
to e.g. a mail! in iOS 11 the log file is stored within
the subsurface container and you first need to copy (actually
using the clipboard) out from there to the "normal" document
shared space, before it can be used.
At least iOS users (and I believe Android users) are not really
used to work with files, so the process is not easy to document
in an understandable way.
The alternative is to provide a button, which simply puts the
log on the general clipboard, allowing it to be pasted in a
multitud of applications.
Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/About.qml | 9 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 12 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/mobile-widgets/qml/About.qml b/mobile-widgets/qml/About.qml index 212ff5c6b..6d3bb28a3 100644 --- a/mobile-widgets/qml/About.qml +++ b/mobile-widgets/qml/About.qml @@ -56,5 +56,14 @@ Kirigami.ScrollablePage { anchors.horizontalCenter: parent.Center horizontalAlignment: Text.AlignHCenter } + SsrfButton { + id: copyAppLogToClipboard + Layout.alignment: Qt.AlignHCenter + text: qsTr("Copy app log to clipboard") + onClicked: { + manager.copyAppLogToClipboard() + rootItem.returnTopPage() + } + } } } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index fba9efb92..2b2d4cbbe 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -12,12 +12,14 @@ #include <QElapsedTimer> #include <QTimer> #include <QDateTime> +#include <QClipboard> #include <QBluetoothLocalDevice> #include "qt-models/divelistmodel.h" #include "qt-models/gpslistmodel.h" #include "qt-models/completionmodels.h" +#include "qt-models/messagehandlermodel.h" #include "core/divelist.h" #include "core/device.h" #include "core/pref.h" @@ -332,6 +334,16 @@ void QMLManager::cancelCredentialsPinSetup() setShowPin(false); } +void QMLManager::copyAppLogToClipboard() +{ + /* + * The user clicked the button, so copy the log file + * to the clipboard for easy access + */ + QString copyString = MessageHandlerModel::self()->logAsString(); + QApplication::clipboard()->setText(copyString, QClipboard::Clipboard); +} + void QMLManager::finishSetup() { // Initialize cloud credentials. diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index b158e43ee..1a7166b65 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -178,6 +178,7 @@ public slots: void clearGpsData(); void clearCredentials(); void cancelCredentialsPinSetup(); + void copyAppLogToClipboard(); void finishSetup(); void openLocalThenRemote(QString url); void mergeLocalRepo(); |