Changeset View
Changeset View
Standalone View
Standalone View
examples/teamdrive/mainwindow.cpp
Show First 20 Lines • Show All 257 Lines • ▼ Show 20 Line(s) | 242 | { | |||
---|---|---|---|---|---|
258 | 258 | | |||
259 | m_ui->renameTeamdriveEdit->setText(name); | 259 | m_ui->renameTeamdriveEdit->setText(name); | ||
260 | 260 | | |||
261 | KGAPI2::Drive::FileSearchQuery query; | 261 | KGAPI2::Drive::FileSearchQuery query; | ||
262 | query.addQuery(KGAPI2::Drive::FileSearchQuery::Trashed, KGAPI2::Drive::FileSearchQuery::Equals, false); | 262 | query.addQuery(KGAPI2::Drive::FileSearchQuery::Trashed, KGAPI2::Drive::FileSearchQuery::Equals, false); | ||
263 | query.addQuery(KGAPI2::Drive::FileSearchQuery::Parents, KGAPI2::Drive::FileSearchQuery::In, id); | 263 | query.addQuery(KGAPI2::Drive::FileSearchQuery::Parents, KGAPI2::Drive::FileSearchQuery::In, id); | ||
264 | 264 | | |||
265 | KGAPI2::Drive::FileFetchJob *fileFetchJob = new KGAPI2::Drive::FileFetchJob(query, m_account, nullptr); | 265 | KGAPI2::Drive::FileFetchJob *fileFetchJob = new KGAPI2::Drive::FileFetchJob(query, m_account, nullptr); | ||
266 | fileFetchJob->setFields((KGAPI2::Drive::FileFetchJob::BasicFields & ~KGAPI2::Drive::FileFetchJob::Permissions) | 266 | fileFetchJob->setFields({ | ||
267 | | KGAPI2::Drive::FileFetchJob::Labels | 267 | KGAPI2::Drive::File::Fields::Id, | ||
268 | | KGAPI2::Drive::FileFetchJob::ExportLinks | 268 | KGAPI2::Drive::File::Fields::Title, | ||
269 | | KGAPI2::Drive::FileFetchJob::LastViewedByMeDate); | 269 | }); | ||
270 | connect(fileFetchJob, &KGAPI2::Job::finished, | 270 | connect(fileFetchJob, &KGAPI2::Job::finished, | ||
271 | this, &MainWindow::slotTeamdriveFetchJobFinished); | 271 | this, &MainWindow::slotTeamdriveFetchJobFinished); | ||
272 | } | 272 | } | ||
273 | 273 | | |||
274 | void MainWindow::slotTeamdriveFetchJobFinished(KGAPI2::Job *job) | 274 | void MainWindow::slotTeamdriveFetchJobFinished(KGAPI2::Job *job) | ||
275 | { | 275 | { | ||
276 | KGAPI2::Drive::FileFetchJob *fetchJob = qobject_cast<KGAPI2::Drive::FileFetchJob*>(job); | 276 | KGAPI2::Drive::FileFetchJob *fetchJob = qobject_cast<KGAPI2::Drive::FileFetchJob*>(job); | ||
277 | Q_ASSERT(fetchJob); | 277 | Q_ASSERT(fetchJob); | ||
Show All 26 Lines | 303 | { | |||
304 | bool hasSelection = (m_ui->teamdrivePreviewList->selectedItems().count() != 0); | 304 | bool hasSelection = (m_ui->teamdrivePreviewList->selectedItems().count() != 0); | ||
305 | if (!hasSelection) { | 305 | if (!hasSelection) { | ||
306 | return; | 306 | return; | ||
307 | } | 307 | } | ||
308 | 308 | | |||
309 | const QString id = m_ui->teamdrivePreviewList->selectedItems().at(0)->data(Qt::UserRole).toString(); | 309 | const QString id = m_ui->teamdrivePreviewList->selectedItems().at(0)->data(Qt::UserRole).toString(); | ||
310 | 310 | | |||
311 | KGAPI2::Drive::FileFetchJob *fileFetchJob = new KGAPI2::Drive::FileFetchJob(id, m_account, nullptr); | 311 | KGAPI2::Drive::FileFetchJob *fileFetchJob = new KGAPI2::Drive::FileFetchJob(id, m_account, nullptr); | ||
312 | fileFetchJob->setFields((KGAPI2::Drive::FileFetchJob::BasicFields & ~KGAPI2::Drive::FileFetchJob::Permissions) | 312 | fileFetchJob->setFields({ | ||
313 | | KGAPI2::Drive::FileFetchJob::Labels | 313 | KGAPI2::Drive::File::Fields::Title, | ||
314 | | KGAPI2::Drive::FileFetchJob::ExportLinks | 314 | KGAPI2::Drive::File::Fields::FileSize, | ||
315 | | KGAPI2::Drive::FileFetchJob::LastViewedByMeDate); | 315 | }); | ||
316 | connect(fileFetchJob, &KGAPI2::Job::finished, | 316 | connect(fileFetchJob, &KGAPI2::Job::finished, | ||
317 | this, &MainWindow::slotTeamdriveItemFetchJobFinished); | 317 | this, &MainWindow::slotTeamdriveItemFetchJobFinished); | ||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | void MainWindow::slotTeamdriveItemFetchJobFinished(KGAPI2::Job *job) | 320 | void MainWindow::slotTeamdriveItemFetchJobFinished(KGAPI2::Job *job) | ||
321 | { | 321 | { | ||
322 | KGAPI2::Drive::FileFetchJob *fetchJob = qobject_cast<KGAPI2::Drive::FileFetchJob*>(job); | 322 | KGAPI2::Drive::FileFetchJob *fetchJob = qobject_cast<KGAPI2::Drive::FileFetchJob*>(job); | ||
323 | Q_ASSERT(fetchJob); | 323 | Q_ASSERT(fetchJob); | ||
Show All 21 Lines |