23using namespace Qt::StringLiterals;
27QgsSimpleCopyExternalStorageStoredContent::QgsSimpleCopyExternalStorageStoredContent(
const QString &filePath,
const QString &url,
const QString &authcfg )
34 mUrl = mCopyTask->destination();
41 connect( mCopyTask, &
QgsTask::progressChanged,
this, [
this](
double progress ) { emit progressChanged( progress ); } );
44void QgsSimpleCopyExternalStorageStoredContent::store()
50void QgsSimpleCopyExternalStorageStoredContent::cancel()
64QString QgsSimpleCopyExternalStorageStoredContent::url()
const
69QgsSimpleCopyExternalStorageFetchedContent::QgsSimpleCopyExternalStorageFetchedContent(
const QString &filePath )
70 : mFilePath( filePath )
73void QgsSimpleCopyExternalStorageFetchedContent::fetch()
76 if ( !QFileInfo::exists( mFilePath ) )
78 reportError( tr(
"File '%1' does not exist" ).arg( mFilePath ) );
83 mResultFilePath = mFilePath;
88QString QgsSimpleCopyExternalStorageFetchedContent::filePath()
const
90 return mResultFilePath;
93QString QgsSimpleCopyExternalStorage::type()
const
95 return u
"SimpleCopy"_s;
98QString QgsSimpleCopyExternalStorage::displayName()
const
100 return QObject::tr(
"Simple copy" );
105 return new QgsSimpleCopyExternalStorageStoredContent( filePath, url, authcfg );
110 Q_UNUSED( authConfig );
112 return new QgsSimpleCopyExternalStorageFetchedContent( url );
@ Canceled
Content fetching/storing has been canceled.
@ Running
Content fetching/storing is in progress.
@ Finished
Content fetching/storing is finished and successful.
static QgsTaskManager * taskManager()
Returns the application's task manager, used for managing application wide background task handling.
Task to copy a file on disk.
Abstract base class for QgsExternalStorage fetched content.
Abstract base class for QgsExternalStorage stored content.
long addTask(QgsTask *task, int priority=0)
Adds a task to the manager.
void taskCompleted()
Will be emitted by task to indicate its successful completion.
void progressChanged(double progress)
Will be emitted by task when its progress changes.
void taskTerminated()
Will be emitted by task if it has terminated for any reason other then completion (e....