Commit 0dcf4269 authored by David Barchiesi's avatar David Barchiesi

Move useContentAsIndexableText param handling from FileAbstractUploadJob to FileAbstractDataJob.

parent 9404f971
Pipeline #31646 passed with stage
in 13 minutes and 18 seconds
POST https://www.googleapis.com/drive/v2/files/abcdefghijklmnopqrstuvwxyz/copy?convert=false&ocr=false&pinned=false&supportsAllDrives=true&prettyPrint=false POST https://www.googleapis.com/drive/v2/files/abcdefghijklmnopqrstuvwxyz/copy?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json Content-Type: application/json
{ {
......
POST https://www.googleapis.com/drive/v2/files?convert=false&ocr=false&pinned=false&supportsAllDrives=true&useContentAsIndexableText=false&prettyPrint=false POST https://www.googleapis.com/drive/v2/files?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json Content-Type: application/json
{ {
......
POST https://www.googleapis.com/drive/v2/files/abc123def456ghi789/copy?convert=false&ocr=false&pinned=false&supportsAllDrives=true&prettyPrint=false POST https://www.googleapis.com/drive/v2/files/abc123def456ghi789/copy?convert=false&ocr=false&pinned=false&useContentAsIndexableText=false&supportsAllDrives=true&prettyPrint=false
Content-Type: application/json Content-Type: application/json
{ {
......
...@@ -26,6 +26,7 @@ class Q_DECL_HIDDEN FileAbstractDataJob::Private ...@@ -26,6 +26,7 @@ class Q_DECL_HIDDEN FileAbstractDataJob::Private
bool pinned; bool pinned;
QString timedTextLanguage; QString timedTextLanguage;
QString timedTextTrackName; QString timedTextTrackName;
bool useContentAsIndexableText;
bool supportsAllDrives; bool supportsAllDrives;
}; };
...@@ -33,6 +34,7 @@ FileAbstractDataJob::Private::Private(): ...@@ -33,6 +34,7 @@ FileAbstractDataJob::Private::Private():
convert(false), convert(false),
ocr(false), ocr(false),
pinned(false), pinned(false),
useContentAsIndexableText(false),
supportsAllDrives(true) supportsAllDrives(true)
{ {
} }
...@@ -140,6 +142,21 @@ void FileAbstractDataJob::setTimedTextTrackName(const QString &timedTextTrackNam ...@@ -140,6 +142,21 @@ void FileAbstractDataJob::setTimedTextTrackName(const QString &timedTextTrackNam
d->timedTextTrackName = timedTextTrackName; d->timedTextTrackName = timedTextTrackName;
} }
void FileAbstractDataJob::setUseContentAsIndexableText(bool useContentAsIndexableText)
{
if (isRunning()) {
qCWarning(KGAPIDebug) << "Can't modify useContentAsIndexableText property when job is running";
return;
}
d->useContentAsIndexableText = useContentAsIndexableText;
}
bool FileAbstractDataJob::useContentAsIndexableText() const
{
return d->useContentAsIndexableText;
}
bool FileAbstractDataJob::supportsAllDrives() const bool FileAbstractDataJob::supportsAllDrives() const
{ {
return d->supportsAllDrives; return d->supportsAllDrives;
...@@ -175,6 +192,9 @@ QUrl FileAbstractDataJob::updateUrl(QUrl &url) ...@@ -175,6 +192,9 @@ QUrl FileAbstractDataJob::updateUrl(QUrl &url)
if (!d->timedTextTrackName.isEmpty()) { if (!d->timedTextTrackName.isEmpty()) {
query.addQueryItem(QStringLiteral("timedTextTrackName"), d->timedTextTrackName); query.addQueryItem(QStringLiteral("timedTextTrackName"), d->timedTextTrackName);
} }
query.removeQueryItem(QStringLiteral("useContentAsIndexableText"));
query.addQueryItem(QStringLiteral("useContentAsIndexableText"), Utils::bool2Str(d->useContentAsIndexableText));
query.removeQueryItem(QStringLiteral("supportsAllDrives")); query.removeQueryItem(QStringLiteral("supportsAllDrives"));
query.addQueryItem(QStringLiteral("supportsAllDrives"), Utils::bool2Str(d->supportsAllDrives)); query.addQueryItem(QStringLiteral("supportsAllDrives"), Utils::bool2Str(d->supportsAllDrives));
......
...@@ -84,6 +84,17 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job ...@@ -84,6 +84,17 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
READ timedTextTrackName READ timedTextTrackName
WRITE setTimedTextTrackName) WRITE setTimedTextTrackName)
/**
* Whether to use the content as indexable text.
*
* Default value is false.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(bool useContentAsIndexableText
READ useContentAsIndexableText
WRITE setUseContentAsIndexableText)
/** /**
* Sets whether the request supports both My Drives and shared drives. * Sets whether the request supports both My Drives and shared drives.
* *
...@@ -118,6 +129,9 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job ...@@ -118,6 +129,9 @@ class KGAPIDRIVE_EXPORT FileAbstractDataJob : public KGAPI2::Job
QString timedTextTrackName() const; QString timedTextTrackName() const;
void setTimedTextTrackName(const QString &timedTextTrackName); void setTimedTextTrackName(const QString &timedTextTrackName);
bool useContentAsIndexableText() const;
void setUseContentAsIndexableText(bool useContentAsIndexableText);
/** /**
* @brief Whether the request supports both My Drives and shared drives. * @brief Whether the request supports both My Drives and shared drives.
* *
......
...@@ -44,7 +44,6 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private ...@@ -44,7 +44,6 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private
QMap<QString, FilePtr> uploadedFiles; QMap<QString, FilePtr> uploadedFiles;
bool useContentAsIndexableText;
File::SerializationOptions serializationOptions = File::NoOptions; File::SerializationOptions serializationOptions = File::NoOptions;
private: private:
...@@ -53,7 +52,6 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private ...@@ -53,7 +52,6 @@ class Q_DECL_HIDDEN FileAbstractUploadJob::Private
FileAbstractUploadJob::Private::Private(FileAbstractUploadJob *parent): FileAbstractUploadJob::Private::Private(FileAbstractUploadJob *parent):
originalFilesCount(0), originalFilesCount(0),
useContentAsIndexableText(false),
q(parent) q(parent)
{ {
} }
...@@ -143,7 +141,6 @@ void FileAbstractUploadJob::Private::processNext() ...@@ -143,7 +141,6 @@ void FileAbstractUploadJob::Private::processNext()
q->updateUrl(url); q->updateUrl(url);
QUrlQuery query(url); QUrlQuery query(url);
query.addQueryItem(QStringLiteral("useContentAsIndexableText"), Utils::bool2Str(useContentAsIndexableText));
QByteArray rawData; QByteArray rawData;
QString contentType; QString contentType;
...@@ -269,21 +266,6 @@ FileAbstractUploadJob::~FileAbstractUploadJob() ...@@ -269,21 +266,6 @@ FileAbstractUploadJob::~FileAbstractUploadJob()
delete d; delete d;
} }
void FileAbstractUploadJob::setUseContentAsIndexableText(bool useContentAsIndexableText)
{
if (isRunning()) {
qCWarning(KGAPIDebug) << "Can't modify useContentAsIndexableText property when job is running";
return;
}
d->useContentAsIndexableText = useContentAsIndexableText;
}
bool FileAbstractUploadJob::useContentAsIndexableText() const
{
return d->useContentAsIndexableText;
}
void FileAbstractUploadJob::start() void FileAbstractUploadJob::start()
{ {
d->processNext(); d->processNext();
......
...@@ -26,17 +26,6 @@ class KGAPIDRIVE_EXPORT FileAbstractUploadJob : public KGAPI2::Drive::FileAbstra ...@@ -26,17 +26,6 @@ class KGAPIDRIVE_EXPORT FileAbstractUploadJob : public KGAPI2::Drive::FileAbstra
{ {
Q_OBJECT Q_OBJECT
/**
* Whether to use the content as indexable text.
*
* Default value is false.
*
* This property can be modified only when the job is not running.
*/
Q_PROPERTY(bool useContentAsIndexableText
READ useContentAsIndexableText
WRITE setUseContentAsIndexableText)
public: public:
explicit FileAbstractUploadJob(const FilePtr &metadata, explicit FileAbstractUploadJob(const FilePtr &metadata,
const AccountPtr &account, const AccountPtr &account,
...@@ -59,9 +48,6 @@ class KGAPIDRIVE_EXPORT FileAbstractUploadJob : public KGAPI2::Drive::FileAbstra ...@@ -59,9 +48,6 @@ class KGAPIDRIVE_EXPORT FileAbstractUploadJob : public KGAPI2::Drive::FileAbstra
const AccountPtr &account, QObject *parent = nullptr); const AccountPtr &account, QObject *parent = nullptr);
~FileAbstractUploadJob() override; ~FileAbstractUploadJob() override;
bool useContentAsIndexableText() const;
void setUseContentAsIndexableText(bool useContentAsIndexableText);
QMap < QString /* file path */, FilePtr /* metadata */ > files() const; QMap < QString /* file path */, FilePtr /* metadata */ > files() const;
protected: protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment