diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 0b2b918eba889..915f1ff7562cb 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1714,7 +1714,7 @@ void FolderMan::trayOverallStatus(const QList &folders, } } -QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo &progress) +QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo *progress) { QString folderMessage; switch (syncStatus) { @@ -1728,22 +1728,22 @@ QString FolderMan::trayTooltipStatusString(SyncResult::Status syncStatus, bool h folderMessage = tr("Preparing for sync."); break; case SyncResult::SyncRunning: - if (progress.status() == ProgressInfo::Propagation) { - if (progress.totalSize() == 0) { - qint64 currentFile = progress.currentFile(); - qint64 totalFileCount = qMax(progress.totalFiles(), currentFile); - if (progress.trustEta()) { + if (progress && progress->status() == ProgressInfo::Propagation) { + if (progress->totalSize() == 0) { + qint64 currentFile = progress->currentFile(); + qint64 totalFileCount = qMax(progress->totalFiles(), currentFile); + if (progress->trustEta()) { folderMessage = tr("Syncing %1 of %2 (%3 left)") .arg(currentFile) .arg(totalFileCount) - .arg(Utility::durationToDescriptiveString2(progress.totalProgress().estimatedEta)); + .arg(Utility::durationToDescriptiveString2(progress->totalProgress().estimatedEta)); } else { folderMessage = tr("Syncing %1 of %2").arg(currentFile).arg(totalFileCount); } } else { - QString totalSizeStr = Utility::octetsToString(progress.totalSize()); - if (progress.trustEta()) { - folderMessage = tr("Syncing %1 (%2 left)").arg(totalSizeStr, Utility::durationToDescriptiveString2(progress.totalProgress().estimatedEta)); + QString totalSizeStr = Utility::octetsToString(progress->totalSize()); + if (progress->trustEta()) { + folderMessage = tr("Syncing %1 (%2 left)").arg(totalSizeStr, Utility::durationToDescriptiveString2(progress->totalProgress().estimatedEta)); } else { folderMessage = tr("Syncing %1").arg(totalSizeStr); } diff --git a/src/gui/folderman.h b/src/gui/folderman.h index 2a857513363cd..0f9cb0bd84e81 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -137,7 +137,7 @@ class FolderMan : public QObject bool startFromScratch(const QString &); /// Produce text for use in the tray tooltip - static QString trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo &progress); + static QString trayTooltipStatusString(SyncResult::Status syncStatus, bool hasUnresolvedConflicts, bool paused, const ProgressInfo *progress); /// Compute status summarizing multiple folders static void diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 2b71bf5c17767..cff58c1a3bc0b 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -384,7 +384,7 @@ void ownCloudGui::slotComputeOverallSyncStatus() SyncResult::Status overallStatus = SyncResult::Undefined; bool hasUnresolvedConflicts = false; - const ProgressInfo *overallProgressInfo; + const ProgressInfo *overallProgressInfo = nullptr; FolderMan::trayOverallStatus(map.values(), &overallStatus, &hasUnresolvedConflicts, &overallProgressInfo); #ifdef BUILD_FILE_PROVIDER_MODULE @@ -422,7 +422,7 @@ void ownCloudGui::slotComputeOverallSyncStatus() #endif #ifdef Q_OS_WIN // Windows has a 128-char tray tooltip length limit. - trayMessage = folderMan->trayTooltipStatusString(overallStatus, hasUnresolvedConflicts, false, *overallProgressInfo); + trayMessage = folderMan->trayTooltipStatusString(overallStatus, hasUnresolvedConflicts, false, overallProgressInfo); #else QStringList allStatusStrings; const auto folders = map.values(); @@ -430,7 +430,7 @@ void ownCloudGui::slotComputeOverallSyncStatus() QString folderMessage = FolderMan::trayTooltipStatusString(folder->syncResult().status(), folder->syncResult().hasUnresolvedConflicts(), folder->syncPaused(), - folder->syncEngine().progressInfo()); + &folder->syncEngine().progressInfo()); allStatusStrings += tr("%1: %2").arg(folder->shortGuiLocalPath(), folderMessage); } #ifdef BUILD_FILE_PROVIDER_MODULE