Changeset View
Changeset View
Standalone View
Standalone View
src/kio_gdrive.cpp
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | |||||
139 | void KIOGDrive::fileSystemFreeSpace(const QUrl &url) | 139 | void KIOGDrive::fileSystemFreeSpace(const QUrl &url) | ||
140 | { | 140 | { | ||
141 | const auto gdriveUrl = GDriveUrl(url); | 141 | const auto gdriveUrl = GDriveUrl(url); | ||
142 | const QString accountId = gdriveUrl.account(); | 142 | const QString accountId = gdriveUrl.account(); | ||
143 | if (accountId == QLatin1String("new-account")) { | 143 | if (accountId == QLatin1String("new-account")) { | ||
144 | finished(); | 144 | finished(); | ||
145 | return; | 145 | return; | ||
146 | } | 146 | } | ||
147 | if (!gdriveUrl.isRoot()) { | 147 | if (gdriveUrl.isRoot()) { | ||
148 | qCDebug(GDRIVE) << "fileSystemFreeSpace is not supported for gdrive root urls"; | ||||
elvisangelaccio: This message is a bit cryptic. How about "fileSystemFreeSpace is not supported for gdrive root… | |||||
149 | error(KIO::ERR_CANNOT_STAT, url.toDisplayString()); | ||||
150 | return; | ||||
151 | } | ||||
152 | | ||||
148 | AboutFetchJob aboutFetch(getAccount(accountId)); | 153 | AboutFetchJob aboutFetch(getAccount(accountId)); | ||
149 | aboutFetch.setFields({ | 154 | aboutFetch.setFields({ | ||
150 | About::Fields::Kind, | 155 | About::Fields::Kind, | ||
151 | About::Fields::QuotaBytesTotal, | 156 | About::Fields::QuotaBytesTotal, | ||
152 | About::Fields::QuotaBytesUsedAggregate | 157 | About::Fields::QuotaBytesUsedAggregate | ||
153 | }); | 158 | }); | ||
154 | if (runJob(aboutFetch, url, accountId)) { | 159 | if (runJob(aboutFetch, url, accountId)) { | ||
155 | const AboutPtr about = aboutFetch.aboutData(); | 160 | const AboutPtr about = aboutFetch.aboutData(); | ||
156 | if (about) { | 161 | if (about) { | ||
157 | setMetaData(QStringLiteral("total"), QString::number(about->quotaBytesTotal())); | 162 | setMetaData(QStringLiteral("total"), QString::number(about->quotaBytesTotal())); | ||
158 | setMetaData(QStringLiteral("available"), QString::number(about->quotaBytesTotal() - about->quotaBytesUsedAggregate())); | 163 | setMetaData(QStringLiteral("available"), QString::number(about->quotaBytesTotal() - about->quotaBytesUsedAggregate())); | ||
159 | finished(); | 164 | finished(); | ||
160 | return; | 165 | return; | ||
161 | } | 166 | } | ||
162 | } | 167 | } | ||
163 | } | 168 | } | ||
164 | error(KIO::ERR_CANNOT_STAT, url.toDisplayString()); | | |||
165 | } | | |||
166 | 169 | | |||
167 | AccountPtr KIOGDrive::getAccount(const QString &accountName) | 170 | AccountPtr KIOGDrive::getAccount(const QString &accountName) | ||
168 | { | 171 | { | ||
169 | return m_accountManager->account(accountName); | 172 | return m_accountManager->account(accountName); | ||
170 | } | 173 | } | ||
171 | 174 | | |||
172 | void KIOGDrive::virtual_hook(int id, void *data) | 175 | void KIOGDrive::virtual_hook(int id, void *data) | ||
173 | { | 176 | { | ||
▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Line(s) | 434 | { | |||
461 | query.addQuery(FileSearchQuery::Parents, FileSearchQuery::In, folderId); | 464 | query.addQuery(FileSearchQuery::Parents, FileSearchQuery::In, folderId); | ||
462 | FileFetchJob fileFetchJob(query, getAccount(accountId)); | 465 | FileFetchJob fileFetchJob(query, getAccount(accountId)); | ||
463 | const auto extraFields = | 466 | const auto extraFields = | ||
464 | QStringList({ KGAPI2::Drive::File::Fields::Labels, | 467 | QStringList({ KGAPI2::Drive::File::Fields::Labels, | ||
465 | KGAPI2::Drive::File::Fields::ExportLinks, | 468 | KGAPI2::Drive::File::Fields::ExportLinks, | ||
466 | KGAPI2::Drive::File::Fields::LastViewedByMeDate, | 469 | KGAPI2::Drive::File::Fields::LastViewedByMeDate, | ||
467 | }); | 470 | }); | ||
468 | fileFetchJob.setFields(KGAPI2::Drive::FileFetchJob::FieldShorthands::BasicFields + extraFields); | 471 | fileFetchJob.setFields(KGAPI2::Drive::FileFetchJob::FieldShorthands::BasicFields + extraFields); | ||
469 | runJob(fileFetchJob, url, accountId); | 472 | if (!runJob(fileFetchJob, url, accountId)) { | ||
473 | return; | ||||
Please move this comment in the runJob() doxygen comment in kio_gdrive.h, rather than duplicating it here n times. elvisangelaccio: Please move this comment in the `runJob()` doxygen comment in kio_gdrive.h, rather than… | |||||
474 | } | ||||
470 | 475 | | |||
471 | ObjectsList objects = fileFetchJob.items(); | 476 | ObjectsList objects = fileFetchJob.items(); | ||
472 | Q_FOREACH (const ObjectPtr &object, objects) { | 477 | Q_FOREACH (const ObjectPtr &object, objects) { | ||
473 | const FilePtr file = object.dynamicCast<File>(); | 478 | const FilePtr file = object.dynamicCast<File>(); | ||
474 | 479 | | |||
475 | const KIO::UDSEntry entry = fileToUDSEntry(file, url.adjusted(QUrl::StripTrailingSlash).path()); | 480 | const KIO::UDSEntry entry = fileToUDSEntry(file, url.adjusted(QUrl::StripTrailingSlash).path()); | ||
476 | listEntry(entry); | 481 | listEntry(entry); | ||
477 | 482 | | |||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 500 | { | |||
522 | FilePtr file(new File()); | 527 | FilePtr file(new File()); | ||
523 | file->setTitle(gdriveUrl.filename()); | 528 | file->setTitle(gdriveUrl.filename()); | ||
524 | file->setMimeType(File::folderMimeType()); | 529 | file->setMimeType(File::folderMimeType()); | ||
525 | 530 | | |||
526 | ParentReferencePtr parent(new ParentReference(parentId)); | 531 | ParentReferencePtr parent(new ParentReference(parentId)); | ||
527 | file->setParents(ParentReferencesList() << parent); | 532 | file->setParents(ParentReferencesList() << parent); | ||
528 | 533 | | |||
529 | FileCreateJob createJob(file, getAccount(accountId)); | 534 | FileCreateJob createJob(file, getAccount(accountId)); | ||
530 | runJob(createJob, url, accountId); | 535 | if (runJob(createJob, url, accountId)) { | ||
531 | | ||||
532 | finished(); | 536 | finished(); | ||
533 | } | 537 | } | ||
538 | } | ||||
534 | 539 | | |||
535 | void KIOGDrive::stat(const QUrl &url) | 540 | void KIOGDrive::stat(const QUrl &url) | ||
536 | { | 541 | { | ||
537 | qCDebug(GDRIVE) << "Going to stat()" << url; | 542 | qCDebug(GDRIVE) << "Going to stat()" << url; | ||
538 | 543 | | |||
539 | const auto gdriveUrl = GDriveUrl(url); | 544 | const auto gdriveUrl = GDriveUrl(url); | ||
540 | const QString accountId = gdriveUrl.account(); | 545 | const QString accountId = gdriveUrl.account(); | ||
541 | if (gdriveUrl.isRoot()) { | 546 | if (gdriveUrl.isRoot()) { | ||
Show All 15 Lines | 560 | = urlQuery.hasQueryItem(QStringLiteral("id")) | |||
557 | : resolveFileIdFromPath(url.adjusted(QUrl::StripTrailingSlash).path(), | 562 | : resolveFileIdFromPath(url.adjusted(QUrl::StripTrailingSlash).path(), | ||
558 | KIOGDrive::None); | 563 | KIOGDrive::None); | ||
559 | if (fileId.isEmpty()) { | 564 | if (fileId.isEmpty()) { | ||
560 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | 565 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | ||
561 | return; | 566 | return; | ||
562 | } | 567 | } | ||
563 | 568 | | |||
564 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | 569 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | ||
565 | runJob(fileFetchJob, url, accountId); | 570 | if (!runJob(fileFetchJob, url, accountId)) { | ||
571 | return; | ||||
572 | } | ||||
566 | 573 | | |||
567 | const ObjectsList objects = fileFetchJob.items(); | 574 | const ObjectsList objects = fileFetchJob.items(); | ||
568 | if (objects.count() != 1) { | 575 | if (objects.count() != 1) { | ||
569 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | 576 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | ||
570 | return; | 577 | return; | ||
571 | } | 578 | } | ||
572 | 579 | | |||
573 | const FilePtr file = objects.first().dynamicCast<File>(); | 580 | const FilePtr file = objects.first().dynamicCast<File>(); | ||
Show All 33 Lines | 613 | : resolveFileIdFromPath(url.adjusted(QUrl::StripTrailingSlash).path(), | |||
607 | KIOGDrive::PathIsFile); | 614 | KIOGDrive::PathIsFile); | ||
608 | if (fileId.isEmpty()) { | 615 | if (fileId.isEmpty()) { | ||
609 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | 616 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | ||
610 | return; | 617 | return; | ||
611 | } | 618 | } | ||
612 | 619 | | |||
613 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | 620 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | ||
614 | fileFetchJob.setFields({File::Fields::Id, File::Fields::MimeType, File::Fields::ExportLinks, File::Fields::DownloadUrl}); | 621 | fileFetchJob.setFields({File::Fields::Id, File::Fields::MimeType, File::Fields::ExportLinks, File::Fields::DownloadUrl}); | ||
615 | runJob(fileFetchJob, url, accountId); | 622 | if (!runJob(fileFetchJob, url, accountId)) { | ||
623 | return; | ||||
624 | } | ||||
616 | 625 | | |||
617 | const ObjectsList objects = fileFetchJob.items(); | 626 | const ObjectsList objects = fileFetchJob.items(); | ||
618 | if (objects.count() != 1) { | 627 | if (objects.count() != 1) { | ||
619 | error(KIO::ERR_DOES_NOT_EXIST, url.fileName()); | 628 | error(KIO::ERR_DOES_NOT_EXIST, url.fileName()); | ||
620 | return; | 629 | return; | ||
621 | } | 630 | } | ||
622 | 631 | | |||
623 | FilePtr file = objects.first().dynamicCast<File>(); | 632 | FilePtr file = objects.first().dynamicCast<File>(); | ||
624 | QUrl downloadUrl; | 633 | QUrl downloadUrl; | ||
625 | if (GDriveHelper::isGDocsDocument(file)) { | 634 | if (GDriveHelper::isGDocsDocument(file)) { | ||
626 | downloadUrl = GDriveHelper::convertFromGDocs(file); | 635 | downloadUrl = GDriveHelper::convertFromGDocs(file); | ||
627 | } else { | 636 | } else { | ||
628 | downloadUrl = file->downloadUrl(); | 637 | downloadUrl = file->downloadUrl(); | ||
629 | } | 638 | } | ||
630 | 639 | | |||
631 | mimeType(file->mimeType()); | 640 | mimeType(file->mimeType()); | ||
632 | 641 | | |||
633 | FileFetchContentJob contentJob(downloadUrl, getAccount(accountId)); | 642 | FileFetchContentJob contentJob(downloadUrl, getAccount(accountId)); | ||
634 | runJob(contentJob, url, accountId); | 643 | if (!runJob(contentJob, url, accountId)) { | ||
644 | return; | ||||
645 | } | ||||
635 | 646 | | |||
636 | QByteArray contentData = contentJob.data(); | 647 | QByteArray contentData = contentJob.data(); | ||
637 | 648 | | |||
638 | totalSize(contentData.size()); | 649 | totalSize(contentData.size()); | ||
639 | 650 | | |||
640 | // data() has a maximum transfer size of 14 MiB so we need to send it in chunks. | 651 | // data() has a maximum transfer size of 14 MiB so we need to send it in chunks. | ||
641 | // See TransferJob::slotDataReq. | 652 | // See TransferJob::slotDataReq. | ||
642 | int transferred = 0; | 653 | int transferred = 0; | ||
▲ Show 20 Lines • Show All 219 Lines • ▼ Show 20 Line(s) | 872 | = urlQuery.hasQueryItem(QStringLiteral("id")) | |||
862 | ? urlQuery.queryItemValue(QStringLiteral("id")) | 873 | ? urlQuery.queryItemValue(QStringLiteral("id")) | ||
863 | : resolveFileIdFromPath(src.adjusted(QUrl::StripTrailingSlash).path()); | 874 | : resolveFileIdFromPath(src.adjusted(QUrl::StripTrailingSlash).path()); | ||
864 | if (sourceFileId.isEmpty()) { | 875 | if (sourceFileId.isEmpty()) { | ||
865 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | 876 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | ||
866 | return; | 877 | return; | ||
867 | } | 878 | } | ||
868 | FileFetchJob sourceFileFetchJob(sourceFileId, getAccount(sourceAccountId)); | 879 | FileFetchJob sourceFileFetchJob(sourceFileId, getAccount(sourceAccountId)); | ||
869 | sourceFileFetchJob.setFields({File::Fields::Id, File::Fields::ModifiedDate, File::Fields::LastViewedByMeDate, File::Fields::Description}); | 880 | sourceFileFetchJob.setFields({File::Fields::Id, File::Fields::ModifiedDate, File::Fields::LastViewedByMeDate, File::Fields::Description}); | ||
870 | runJob(sourceFileFetchJob, src, sourceAccountId); | 881 | if (!runJob(sourceFileFetchJob, src, sourceAccountId)) { | ||
882 | return; | ||||
883 | } | ||||
871 | 884 | | |||
872 | const ObjectsList objects = sourceFileFetchJob.items(); | 885 | const ObjectsList objects = sourceFileFetchJob.items(); | ||
873 | if (objects.count() != 1) { | 886 | if (objects.count() != 1) { | ||
874 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | 887 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | ||
875 | return; | 888 | return; | ||
876 | } | 889 | } | ||
877 | 890 | | |||
878 | const FilePtr sourceFile = objects[0].dynamicCast<File>(); | 891 | const FilePtr sourceFile = objects[0].dynamicCast<File>(); | ||
Show All 15 Lines | |||||
894 | FilePtr destFile(new File); | 907 | FilePtr destFile(new File); | ||
895 | destFile->setTitle(destGDriveUrl.filename()); | 908 | destFile->setTitle(destGDriveUrl.filename()); | ||
896 | destFile->setModifiedDate(sourceFile->modifiedDate()); | 909 | destFile->setModifiedDate(sourceFile->modifiedDate()); | ||
897 | destFile->setLastViewedByMeDate(sourceFile->lastViewedByMeDate()); | 910 | destFile->setLastViewedByMeDate(sourceFile->lastViewedByMeDate()); | ||
898 | destFile->setDescription(sourceFile->description()); | 911 | destFile->setDescription(sourceFile->description()); | ||
899 | destFile->setParents(destParentReferences); | 912 | destFile->setParents(destParentReferences); | ||
900 | 913 | | |||
901 | FileCopyJob copyJob(sourceFile, destFile, getAccount(sourceAccountId)); | 914 | FileCopyJob copyJob(sourceFile, destFile, getAccount(sourceAccountId)); | ||
902 | runJob(copyJob, dest, sourceAccountId); | 915 | if (runJob(copyJob, dest, sourceAccountId)) { | ||
903 | | ||||
904 | finished(); | 916 | finished(); | ||
905 | } | 917 | } | ||
918 | } | ||||
906 | 919 | | |||
907 | void KIOGDrive::del(const QUrl &url, bool isfile) | 920 | void KIOGDrive::del(const QUrl &url, bool isfile) | ||
908 | { | 921 | { | ||
909 | // FIXME: Verify that a single file cannot actually have multiple parent | 922 | // FIXME: Verify that a single file cannot actually have multiple parent | ||
910 | // references. If it can, then we need to be more careful: currently this | 923 | // references. If it can, then we need to be more careful: currently this | ||
911 | // implementation will simply remove the file from all it's parents but | 924 | // implementation will simply remove the file from all it's parents but | ||
912 | // it actually should just remove the current parent reference | 925 | // it actually should just remove the current parent reference | ||
913 | 926 | | |||
Show All 31 Lines | 950 | if (gdriveUrl.isAccountRoot()) { | |||
945 | return; | 958 | return; | ||
946 | } | 959 | } | ||
947 | 960 | | |||
948 | // GDrive allows us to delete entire directory even when it's not empty, | 961 | // GDrive allows us to delete entire directory even when it's not empty, | ||
949 | // so we need to emulate the normal behavior ourselves by checking number of | 962 | // so we need to emulate the normal behavior ourselves by checking number of | ||
950 | // child references | 963 | // child references | ||
951 | if (!isfile) { | 964 | if (!isfile) { | ||
952 | ChildReferenceFetchJob referencesFetch(fileId, getAccount(accountId)); | 965 | ChildReferenceFetchJob referencesFetch(fileId, getAccount(accountId)); | ||
953 | runJob(referencesFetch, url, accountId); | 966 | if (!runJob(referencesFetch, url, accountId)) { | ||
967 | return; | ||||
968 | } | ||||
954 | const bool isEmpty = !referencesFetch.items().count(); | 969 | const bool isEmpty = !referencesFetch.items().count(); | ||
955 | 970 | | |||
956 | if (!isEmpty && metaData(QStringLiteral("recurse")) != QLatin1String("true")) { | 971 | if (!isEmpty && metaData(QStringLiteral("recurse")) != QLatin1String("true")) { | ||
957 | error(KIO::ERR_CANNOT_RMDIR, url.path()); | 972 | error(KIO::ERR_CANNOT_RMDIR, url.path()); | ||
958 | return; | 973 | return; | ||
959 | } | 974 | } | ||
960 | } | 975 | } | ||
961 | 976 | | |||
962 | FileTrashJob trashJob(fileId, getAccount(accountId)); | 977 | FileTrashJob trashJob(fileId, getAccount(accountId)); | ||
963 | runJob(trashJob, url, accountId); | 978 | if (runJob(trashJob, url, accountId)) { | ||
964 | | ||||
965 | m_cache.removePath(url.path()); | 979 | m_cache.removePath(url.path()); | ||
966 | | ||||
967 | finished(); | 980 | finished(); | ||
968 | 981 | } | |||
969 | } | 982 | } | ||
970 | 983 | | |||
971 | void KIOGDrive::rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags) | 984 | void KIOGDrive::rename(const QUrl &src, const QUrl &dest, KIO::JobFlags flags) | ||
972 | { | 985 | { | ||
973 | Q_UNUSED(flags) | 986 | Q_UNUSED(flags) | ||
974 | qCDebug(GDRIVE) << "Renaming" << src << "to" << dest; | 987 | qCDebug(GDRIVE) << "Renaming" << src << "to" << dest; | ||
975 | 988 | | |||
976 | const auto srcGDriveUrl = GDriveUrl(src); | 989 | const auto srcGDriveUrl = GDriveUrl(src); | ||
Show All 24 Lines | 1013 | : resolveFileIdFromPath(src.adjusted(QUrl::StripTrailingSlash).path(), | |||
1001 | KIOGDrive::PathIsFile); | 1014 | KIOGDrive::PathIsFile); | ||
1002 | if (sourceFileId.isEmpty()) { | 1015 | if (sourceFileId.isEmpty()) { | ||
1003 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | 1016 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | ||
1004 | return; | 1017 | return; | ||
1005 | } | 1018 | } | ||
1006 | 1019 | | |||
1007 | // We need to fetch ALL, so that we can do update later | 1020 | // We need to fetch ALL, so that we can do update later | ||
1008 | FileFetchJob sourceFileFetchJob(sourceFileId, getAccount(sourceAccountId)); | 1021 | FileFetchJob sourceFileFetchJob(sourceFileId, getAccount(sourceAccountId)); | ||
1009 | runJob(sourceFileFetchJob, src, sourceAccountId); | 1022 | if (!runJob(sourceFileFetchJob, src, sourceAccountId)) { | ||
1023 | return; | ||||
1024 | } | ||||
1010 | 1025 | | |||
1011 | const ObjectsList objects = sourceFileFetchJob.items(); | 1026 | const ObjectsList objects = sourceFileFetchJob.items(); | ||
1012 | if (objects.count() != 1) { | 1027 | if (objects.count() != 1) { | ||
1013 | qCDebug(GDRIVE) << "FileFetchJob retrieved" << objects.count() << "items, while only one was expected."; | 1028 | qCDebug(GDRIVE) << "FileFetchJob retrieved" << objects.count() << "items, while only one was expected."; | ||
1014 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | 1029 | error(KIO::ERR_DOES_NOT_EXIST, src.path()); | ||
1015 | return; | 1030 | return; | ||
1016 | } | 1031 | } | ||
1017 | 1032 | | |||
Show All 35 Lines | |||||
1053 | } | 1068 | } | ||
1054 | 1069 | | |||
1055 | FilePtr destFile(sourceFile); | 1070 | FilePtr destFile(sourceFile); | ||
1056 | destFile->setTitle(destGDriveUrl.filename()); | 1071 | destFile->setTitle(destGDriveUrl.filename()); | ||
1057 | destFile->setParents(parentReferences); | 1072 | destFile->setParents(parentReferences); | ||
1058 | 1073 | | |||
1059 | FileModifyJob modifyJob(destFile, getAccount(sourceAccountId)); | 1074 | FileModifyJob modifyJob(destFile, getAccount(sourceAccountId)); | ||
1060 | modifyJob.setUpdateModifiedDate(true); | 1075 | modifyJob.setUpdateModifiedDate(true); | ||
1061 | runJob(modifyJob, dest, sourceAccountId); | 1076 | if (runJob(modifyJob, dest, sourceAccountId)) { | ||
1062 | | ||||
1063 | finished(); | 1077 | finished(); | ||
1064 | } | 1078 | } | ||
1079 | } | ||||
1065 | 1080 | | |||
1066 | void KIOGDrive::mimetype(const QUrl &url) | 1081 | void KIOGDrive::mimetype(const QUrl &url) | ||
1067 | { | 1082 | { | ||
1068 | qCDebug(GDRIVE) << Q_FUNC_INFO << url; | 1083 | qCDebug(GDRIVE) << Q_FUNC_INFO << url; | ||
1069 | 1084 | | |||
1070 | const QUrlQuery urlQuery(url); | 1085 | const QUrlQuery urlQuery(url); | ||
1071 | const QString fileId | 1086 | const QString fileId | ||
1072 | = urlQuery.hasQueryItem(QStringLiteral("id")) | 1087 | = urlQuery.hasQueryItem(QStringLiteral("id")) | ||
1073 | ? urlQuery.queryItemValue(QStringLiteral("id")) | 1088 | ? urlQuery.queryItemValue(QStringLiteral("id")) | ||
1074 | : resolveFileIdFromPath(url.adjusted(QUrl::StripTrailingSlash).path()); | 1089 | : resolveFileIdFromPath(url.adjusted(QUrl::StripTrailingSlash).path()); | ||
1075 | if (fileId.isEmpty()) { | 1090 | if (fileId.isEmpty()) { | ||
1076 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | 1091 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | ||
1077 | return; | 1092 | return; | ||
1078 | } | 1093 | } | ||
1079 | const QString accountId = GDriveUrl(url).account(); | 1094 | const QString accountId = GDriveUrl(url).account(); | ||
1080 | 1095 | | |||
1081 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | 1096 | FileFetchJob fileFetchJob(fileId, getAccount(accountId)); | ||
1082 | fileFetchJob.setFields({File::Fields::Id, File::Fields::MimeType}); | 1097 | fileFetchJob.setFields({File::Fields::Id, File::Fields::MimeType}); | ||
1083 | runJob(fileFetchJob, url, accountId); | 1098 | if (!runJob(fileFetchJob, url, accountId)) { | ||
1099 | return; | ||||
1100 | } | ||||
1084 | 1101 | | |||
1085 | const ObjectsList objects = fileFetchJob.items(); | 1102 | const ObjectsList objects = fileFetchJob.items(); | ||
1086 | if (objects.count() != 1) { | 1103 | if (objects.count() != 1) { | ||
1087 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | 1104 | error(KIO::ERR_DOES_NOT_EXIST, url.path()); | ||
1088 | return; | 1105 | return; | ||
1089 | } | 1106 | } | ||
1090 | 1107 | | |||
1091 | const FilePtr file = objects.first().dynamicCast<File>(); | 1108 | const FilePtr file = objects.first().dynamicCast<File>(); | ||
1092 | mimeType(file->mimeType()); | 1109 | mimeType(file->mimeType()); | ||
1093 | finished(); | 1110 | finished(); | ||
1094 | } | 1111 | } | ||
1095 | 1112 | | |||
1096 | #include "kio_gdrive.moc" | 1113 | #include "kio_gdrive.moc" |
This message is a bit cryptic. How about "fileSystemFreeSpace is not supported for gdrive root urls?"