Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public String getFileId(final Path file) throws BackgroundException {
if(file.isRoot()
|| new SimplePathPredicate(file).test(DriveHomeFinderService.MYDRIVE_FOLDER)
|| new SimplePathPredicate(file).test(DriveHomeFinderService.SHARED_FOLDER_NAME)
|| new SimplePathPredicate(file).test(DriveHomeFinderService.SHARED_DRIVES_NAME)) {
|| new SimplePathPredicate(file).test(DriveHomeFinderService.SHARED_DRIVES_NAME)
|| new SimplePathPredicate(file).test(DriveHomeFinderService.TRASH_NAME)) {
return DriveHomeFinderService.ROOT_FOLDER_ID;
}
final String cached = super.getFileId(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ public class DriveHomeFinderService extends AbstractHomeFeature {
public static final String ROOT_FOLDER_ID = "root";

public static final Path MYDRIVE_FOLDER
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("My Drive", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume), new PathAttributes().withFileId(ROOT_FOLDER_ID));
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("My Drive", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume), new PathAttributes().withFileId(ROOT_FOLDER_ID));

public static final Path SHARED_FOLDER_NAME
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Shared with me", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume));
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Shared with me", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume));

public static final Path SHARED_DRIVES_NAME
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Shared Drives", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume));
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Shared Drives", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume));

public static final Path TRASH_NAME
= new Path(PathNormalizer.normalize(LocaleFactory.localizedString("Trash", "Google Drive")),
EnumSet.of(Path.Type.directory, Path.Type.placeholder, Path.Type.volume));

@Override
public Path find() throws BackgroundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public AttributedList<Path> list(final Path directory, final ListProgressListene
list.add(DriveHomeFinderService.MYDRIVE_FOLDER);
list.add(DriveHomeFinderService.SHARED_FOLDER_NAME);
list.add(DriveHomeFinderService.SHARED_DRIVES_NAME);
list.add(DriveHomeFinderService.TRASH_NAME);
listener.chunk(directory, list);
return list;
}
Expand All @@ -49,6 +50,9 @@ public AttributedList<Path> list(final Path directory, final ListProgressListene
if(new SimplePathPredicate(DriveHomeFinderService.SHARED_DRIVES_NAME).test(directory)) {
return new DriveTeamDrivesListService(session, fileid).list(directory, listener);
}
if(new SimplePathPredicate(DriveHomeFinderService.TRASH_NAME).test(directory)) {
return new DriveTrashListService(session, fileid).list(directory, listener);
}
return new DriveDefaultListService(session, fileid).list(directory, listener);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ch.cyberduck.core.googledrive;

/*
* Copyright (c) 2002-2024 iterate GmbH. All rights reserved.
* https://cyberduck.io/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

import ch.cyberduck.core.ListProgressListener;
import ch.cyberduck.core.Path;

public class DriveTrashListService extends AbstractDriveListService {

public DriveTrashListService(final DriveSession session, final DriveFileIdProvider fileid) {
super(session, fileid);
}

public DriveTrashListService(final DriveSession session, final DriveFileIdProvider fileid, final int pagesize) {
super(session, fileid, pagesize);
}

@Override
protected String query(final Path directory, final ListProgressListener listener) {
return "trashed = true";
}
}