Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Drive: a Download button in the toolbar for what is selected

Yashwanth Kamireddi3ef7a8432e2d
diff --git a/.uiverify/drive-download.mjs b/.uiverify/drive-download.mjs
index 273598b..6fde7f1 100644
--- a/.uiverify/drive-download.mjs
+++ b/.uiverify/drive-download.mjs
@@ -28,6 +28,32 @@ const end = (batch, report) => page.evaluate(([batch, report]) => window.__downl
key: "k", saved: [], failed: [], moreFailed: 0, cancelled: false, problem: null, resumable: false, ...report }), [batch, report]);
const settle = () => page.waitForTimeout(250);
+// ── The toolbar's Download ─────────────────────────────────────────────────────────────────
+// Nothing selected, nothing to save; a file, saved as one; a folder, as its whole tree.
+const toolbarDownload = page.locator(".drive-tools").getByRole("button", { name: "Download" });
+ok(await toolbarDownload.isDisabled(), "the toolbar's Download waits for something to be selected");
+const firstFile = page.locator(".drive-row-hit").filter({ hasNotText: "Downloads" }).last();
+await firstFile.click();
+await settle();
+await toolbarDownload.click();
+await settle();
+ok((await got("__singleDownloads")).length === 1, `a selected file is saved from the toolbar ${JSON.stringify(await got("__singleDownloads"))}`);
+await row("Downloads").click();
+await settle();
+const before = (await got("__downloadItems")).length;
+await toolbarDownload.click();
+await settle();
+const fromBar = (await got("__downloadItems")).at(-1);
+ok((await got("__downloadItems")).length === before + 1 && fromBar?.items?.[0]?.drivewsid === "FOLDER::a", "a selected folder is saved as its whole tree");
+await end(await lastBatch(), { saved: [] });
+await settle();
+// What follows starts as it always has: a fresh window, counting its own downloads.
+await page.reload({ waitUntil: "networkidle" });
+await page.locator(".nav-item", { hasText: "Drive" }).click();
+await page.waitForSelector(".drive-row-hit");
+await page.waitForTimeout(300);
+await page.evaluate(() => { window.__singleDownloads = []; window.__downloadItems = []; });
+
// ── A folder, from its menu ────────────────────────────────────────────────────────────────
await row("Downloads").click({ button: "right" });
const entries = await page.getByRole("menuitem").allInnerTexts();
diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsx
index bdf52f3..34b70b0 100644
--- a/src/screens/DriveView.tsx
+++ b/src/screens/DriveView.tsx
@@ -1817,6 +1817,17 @@ export function DriveView() {
<ActionGlyph name="newFolder" />
New Folder
</button>
+ {/* What is selected, saved to Downloads — a file, a folder as its whole tree, or
+ several — as icloud.com's toolbar offers it; nothing selected, nothing to save. */}
+ <button
+ className="tool has-label with-glyph"
+ title={pickedItems.length ? "Download a copy of what is selected" : "Select something to download"}
+ onClick={() => downloadItems(pickedItems)}
+ disabled={pickedItems.length === 0}
+ >
+ <ActionGlyph name="download" />
+ Download
+ </button>
</span>
<span className="upload-menu-wrap">
<button