Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small mobile updates #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/gpslocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,16 @@ void GpsLocation::loadFromStorage()
}
}

QString GpsLocation::getFixString()
{
// only used for debugging
QString res;
struct gpsTracker gpsEntry;
foreach (gpsEntry, m_trackers.values())
res += QString("%1: %2; %3 ; \"%4\"\n").arg(gpsEntry.when).arg(gpsEntry.location.lat.udeg).arg(gpsEntry.location.lon.udeg).arg(gpsEntry.name);
return res;
}

void GpsLocation::replaceFixToStorage(gpsTracker &gt)
{
if (!m_trackers.keys().contains(gt.when)) {
Expand Down
2 changes: 1 addition & 1 deletion core/gpslocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class GpsLocation : public QObject {
bool hasLocationsSource();
QString currentPosition();
void setLogCallBack(void (*showMsgCB)(const char *msg));

QString getFixString();
QMap<qint64, gpsTracker> currentGPSInfo() const;

private:
Expand Down
1 change: 1 addition & 0 deletions mobile-widgets/qml/DiveList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Kirigami.ScrollablePage {
if (Backend.cloud_verification_status === Enums.CS_VERIFIED) {
detailsWindow.endEditMode()
manager.saveChangesCloud(true)
showPassiveNotification(qsTr("Completed manual sync with cloud\n") + manager.syncState)
refreshing = false
} else {
manager.appendTextToLog("sync with cloud storage requested, but credentialStatus is " + Backend.cloud_verification_status)
Expand Down
10 changes: 10 additions & 0 deletions mobile-widgets/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ Kirigami.ApplicationWindow {
globalDrawer.close()
detailsWindow.endEditMode()
manager.saveChangesCloud(true);
showPassiveNotification(qsTr("Completed manual sync with cloud\n") + manager.syncState)
globalDrawer.close()
}
}
Expand Down Expand Up @@ -605,6 +606,15 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
}

Kirigami.Action {
text: qsTr("Copy GPS to clipboard")
onTriggered: {
globalDrawer.close()
manager.copyGpsFixesToClipboard()
}

}

/* disable for now
Kirigami.Action {
text: qsTr("Dive planner")
Expand Down
10 changes: 10 additions & 0 deletions mobile-widgets/qmlmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,16 @@ void QMLManager::copyAppLogToClipboard()
QApplication::clipboard()->setText(getCombinedLogs(), QClipboard::Clipboard);
}

void QMLManager::copyGpsFixesToClipboard()
{
// This of course creates a potential privacy issue, so let's be clear about that
QString gpsWarning("Sending these GPS data to someone exposes your location history; ");
gpsWarning += "they can, however, be helpful when debugging problems with the app. ";
gpsWarning += "Please consider carefully where you are seninding these data.\n\n";
gpsWarning += GpsLocation::instance()->getFixString();
QApplication::clipboard()->setText(gpsWarning, QClipboard::Clipboard);
}

bool QMLManager::createSupportEmail()
{
QString mailToLink = "mailto:[email protected]?subject=Subsurface-mobile support request";
Expand Down
1 change: 1 addition & 0 deletions mobile-widgets/qmlmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public slots:
void clearGpsData();
QString getCombinedLogs();
void copyAppLogToClipboard();
void copyGpsFixesToClipboard();
bool createSupportEmail();
void finishSetup();
QString getNumber(const QString& diveId);
Expand Down