mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Get correct action kind from progress Dispatcher in case of Context
kind.
This commit is contained in:
parent
6c0f6ae62e
commit
268004b4ff
3 changed files with 27 additions and 0 deletions
|
@ -534,6 +534,15 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
|
|||
// stay with the previous kind-string for Context.
|
||||
if( progress.kind != Progress::Context ) {
|
||||
_kindContext = Progress::asActionString(progress.kind);
|
||||
} else {
|
||||
if( _kindContext.isEmpty() ) {
|
||||
// empty kind context means that the dialog was opened after the action
|
||||
// was started.
|
||||
Progress::Kind kind = ProgressDispatcher::instance()->currentFolderContext(progress.folder);
|
||||
if( kind != Progress::Invalid ) {
|
||||
_kindContext = Progress::asActionString(kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
QString kindString = _kindContext;
|
||||
|
||||
|
|
|
@ -174,13 +174,28 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
|
|||
if( newProgress.kind == Progress::EndSync ) {
|
||||
newProgress.overall_current_bytes = newProgress.overall_transmission_size;
|
||||
newProgress.current_file_no = newProgress.overall_file_count;
|
||||
_currentAction.remove(newProgress.folder);
|
||||
}
|
||||
if( newProgress.kind == Progress::EndDownload || newProgress.kind == Progress::EndUpload ||
|
||||
newProgress.kind == Progress::EndDelete ) {
|
||||
_recentChanges.enqueue(newProgress);
|
||||
}
|
||||
// store the last real action to help clients that start during
|
||||
// the Context-phase of an upload or download.
|
||||
if( newProgress.kind != Progress::Context ) {
|
||||
_currentAction[folder] = newProgress.kind;
|
||||
}
|
||||
|
||||
emit progressInfo( folder, newProgress );
|
||||
}
|
||||
}
|
||||
|
||||
Progress::Kind ProgressDispatcher::currentFolderContext( const QString& folder )
|
||||
{
|
||||
if( _currentAction.contains(folder)) {
|
||||
return _currentAction[folder];
|
||||
}
|
||||
return Progress::Invalid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,8 @@ public:
|
|||
|
||||
QList<Progress::Info> recentChangedItems(int count);
|
||||
QList<Progress::SyncProblem> recentProblems(int count);
|
||||
|
||||
Progress::Kind currentFolderContext( const QString& folder );
|
||||
signals:
|
||||
/**
|
||||
@brief Signals the progress of data transmission.
|
||||
|
@ -114,6 +116,7 @@ private:
|
|||
QQueue<Progress::Info> _recentChanges;
|
||||
QQueue<Progress::SyncProblem> _recentProblems;
|
||||
|
||||
QHash<QString, Progress::Kind> _currentAction;
|
||||
static ProgressDispatcher* _instance;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue