mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Fix Dump in Dropbox sync without network access ...
... improve error messages for upload/sync in case of no network access ... fix "authorized" icon position for Dropbox in Options
This commit is contained in:
@@ -55,6 +55,10 @@ Dropbox::open(QStringList &errors)
|
||||
connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
errors << tr("Network Problem reading Dropbox data");
|
||||
return false;
|
||||
}
|
||||
// did we get a good response ?
|
||||
QByteArray r = reply->readAll();
|
||||
QJsonParseError parseError;
|
||||
@@ -71,11 +75,13 @@ Dropbox::open(QStringList &errors)
|
||||
root_->isDir = document.object()["is_dir"].toBool();
|
||||
root_->size = document.object()["bytes"].toInt();
|
||||
|
||||
}
|
||||
// happy with what we got ?
|
||||
if (root_->name != "/") errors << tr("invalid root path.");
|
||||
if (root_->isDir != true) errors << tr("root is not a directory.");
|
||||
|
||||
// happy with what we got ?
|
||||
if (root_->name != "/") errors << tr("invalid root path.");
|
||||
if (root_->isDir != true) errors << tr("root is not a directory.");
|
||||
} else {
|
||||
errors << tr("problem parsing Dropbox data");
|
||||
}
|
||||
|
||||
// ok so far ?
|
||||
if (errors.count()) return false;
|
||||
@@ -249,7 +255,16 @@ Dropbox::writeFile(QByteArray &data, QString remotename)
|
||||
void
|
||||
Dropbox::writeFileCompleted()
|
||||
{
|
||||
notifyWriteComplete(replyName(static_cast<QNetworkReply*>(QObject::sender())), tr("Completed."));
|
||||
QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
notifyWriteComplete(
|
||||
replyName(static_cast<QNetworkReply*>(QObject::sender())),
|
||||
tr("Completed."));
|
||||
} else {
|
||||
notifyWriteComplete(
|
||||
replyName(static_cast<QNetworkReply*>(QObject::sender())),
|
||||
tr("Network Error - Upload failed."));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -54,6 +54,11 @@ WithingsDownload::download()
|
||||
void
|
||||
WithingsDownload::downloadFinished(QNetworkReply *reply)
|
||||
{
|
||||
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
QMessageBox::warning(context->mainWindow, tr("Network Problem"), tr("No Withings Data downloaded"));
|
||||
return;
|
||||
}
|
||||
QString text = reply->readAll();
|
||||
QStringList errors;
|
||||
|
||||
|
||||
@@ -461,7 +461,7 @@ CredentialsPage::CredentialsPage(QWidget *parent, Context *context) : QScrollAre
|
||||
grid->addWidget(dropauthLabel, ++row, 0);
|
||||
grid->addWidget(dropboxAuthorise, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
if (appsettings->cvalue(context->athlete->cyclist, GC_DROPBOX_TOKEN, "")!="")
|
||||
grid->addWidget(dropboxAuthorised, row, 2, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
grid->addWidget(dropboxAuthorised, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
|
||||
else
|
||||
dropboxAuthorised->hide(); // if no token no show
|
||||
|
||||
|
||||
Reference in New Issue
Block a user