diff options
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/l10n/cs.js | 2 | ||||
-rw-r--r-- | apps/files/l10n/cs.json | 2 | ||||
-rw-r--r-- | apps/files/l10n/en_GB.js | 1 | ||||
-rw-r--r-- | apps/files/l10n/en_GB.json | 1 | ||||
-rw-r--r-- | apps/files/l10n/ga.js | 3 | ||||
-rw-r--r-- | apps/files/l10n/ga.json | 3 | ||||
-rw-r--r-- | apps/files/l10n/it.js | 7 | ||||
-rw-r--r-- | apps/files/l10n/it.json | 7 | ||||
-rw-r--r-- | apps/files/l10n/zh_HK.js | 2 | ||||
-rw-r--r-- | apps/files/l10n/zh_HK.json | 2 | ||||
-rw-r--r-- | apps/files/src/newMenu/newFolder.ts | 5 | ||||
-rw-r--r-- | apps/files/src/views/favorites.spec.ts | 26 | ||||
-rw-r--r-- | apps/files/src/views/favorites.ts | 12 |
13 files changed, 54 insertions, 19 deletions
diff --git a/apps/files/l10n/cs.js b/apps/files/l10n/cs.js index 2f593d271c4..f941b6bdab2 100644 --- a/apps/files/l10n/cs.js +++ b/apps/files/l10n/cs.js @@ -142,6 +142,7 @@ OC.L10N.register( "Create new folder" : "Vytvořit novou složku", "This name is already in use." : "Tento název už je využíván.", "Create" : "Vytvořit", + "Files starting with a dot are hidden by default" : "Soubory, kterých názvy začínají tečkou, jsou ve výchozím stavu skryté", "Fill template fields" : "Vyplňte kolonky šablony", "Submitting fields …" : "Odesílání kolonek…", "Submit" : "Odeslat", @@ -213,6 +214,7 @@ OC.L10N.register( "Warnings" : "Varování", "Prevent warning dialogs from open or reenable them." : "Zabránit dialogům s varováními v otevírání nebo znovupovolení.", "Show a warning dialog when changing a file extension." : "Při měnění přípony souboru zobrazit varovný dialog.", + "Show a warning dialog when deleting files." : "Před smazáním souborů zobrazit varovný dialog.", "Keyboard shortcuts" : "Klávesové zkratky", "Speed up your Files experience with these quick shortcuts." : "Zrychlete svůj dojem ze Souborů pomocí těchto rychlých zkratek.", "Open the actions menu for a file" : "Otevřít nabídku akcí pro soubor", diff --git a/apps/files/l10n/cs.json b/apps/files/l10n/cs.json index b565488a6e2..5faa81dca0b 100644 --- a/apps/files/l10n/cs.json +++ b/apps/files/l10n/cs.json @@ -140,6 +140,7 @@ "Create new folder" : "Vytvořit novou složku", "This name is already in use." : "Tento název už je využíván.", "Create" : "Vytvořit", + "Files starting with a dot are hidden by default" : "Soubory, kterých názvy začínají tečkou, jsou ve výchozím stavu skryté", "Fill template fields" : "Vyplňte kolonky šablony", "Submitting fields …" : "Odesílání kolonek…", "Submit" : "Odeslat", @@ -211,6 +212,7 @@ "Warnings" : "Varování", "Prevent warning dialogs from open or reenable them." : "Zabránit dialogům s varováními v otevírání nebo znovupovolení.", "Show a warning dialog when changing a file extension." : "Při měnění přípony souboru zobrazit varovný dialog.", + "Show a warning dialog when deleting files." : "Před smazáním souborů zobrazit varovný dialog.", "Keyboard shortcuts" : "Klávesové zkratky", "Speed up your Files experience with these quick shortcuts." : "Zrychlete svůj dojem ze Souborů pomocí těchto rychlých zkratek.", "Open the actions menu for a file" : "Otevřít nabídku akcí pro soubor", diff --git a/apps/files/l10n/en_GB.js b/apps/files/l10n/en_GB.js index 086e763f4ab..c2cb142aac1 100644 --- a/apps/files/l10n/en_GB.js +++ b/apps/files/l10n/en_GB.js @@ -142,6 +142,7 @@ OC.L10N.register( "Create new folder" : "Create new folder", "This name is already in use." : "This name is already in use.", "Create" : "Create", + "Files starting with a dot are hidden by default" : "Files starting with a dot are hidden by default", "Fill template fields" : "Fill template fields", "Submitting fields …" : "Submitting fields …", "Submit" : "Submit", diff --git a/apps/files/l10n/en_GB.json b/apps/files/l10n/en_GB.json index 33d8c73111f..69149e1a00d 100644 --- a/apps/files/l10n/en_GB.json +++ b/apps/files/l10n/en_GB.json @@ -140,6 +140,7 @@ "Create new folder" : "Create new folder", "This name is already in use." : "This name is already in use.", "Create" : "Create", + "Files starting with a dot are hidden by default" : "Files starting with a dot are hidden by default", "Fill template fields" : "Fill template fields", "Submitting fields …" : "Submitting fields …", "Submit" : "Submit", diff --git a/apps/files/l10n/ga.js b/apps/files/l10n/ga.js index b872f9b4c48..d5a5e0fd8fc 100644 --- a/apps/files/l10n/ga.js +++ b/apps/files/l10n/ga.js @@ -129,6 +129,7 @@ OC.L10N.register( "Search globally by filename …" : "Cuardaigh go domhanda de réir ainm comhaid …", "Search here by filename …" : "Cuardaigh anseo de réir ainm comhaid …", "Search scope options" : "Roghanna raon feidhme cuardaigh", + "Filter and search from this location" : "Scag agus déan cuardach ón suíomh seo", "Search globally" : "Cuardaigh go domhanda", "{usedQuotaByte} used" : "{usedQuotaByte} úsáidte", "{used} of {quota} used" : "{used} de {quota} in úsáid", @@ -141,6 +142,7 @@ OC.L10N.register( "Create new folder" : "Cruthaigh fillteán nua", "This name is already in use." : "Tá an t-ainm seo in úsáid cheana féin.", "Create" : "Cruthaigh", + "Files starting with a dot are hidden by default" : "Bíonn comhaid a thosaíonn le ponc i bhfolach de réir réamhshocraithe", "Fill template fields" : "Líon réimsí teimpléid", "Submitting fields …" : "Réimsí á gcur isteach…", "Submit" : "Cuir isteach", @@ -212,6 +214,7 @@ OC.L10N.register( "Warnings" : "Rabhaidh", "Prevent warning dialogs from open or reenable them." : "Cosc a chur ar dialóga rabhaidh ó iad a oscailt nó iad a athchumasú.", "Show a warning dialog when changing a file extension." : "Taispeáin dialóg rabhaidh nuair a athraítear síneadh comhad.", + "Show a warning dialog when deleting files." : "Taispeáin comhrá rabhaidh agus comhaid á scriosadh.", "Keyboard shortcuts" : "Aicearraí méarchláir", "Speed up your Files experience with these quick shortcuts." : "Déan do thaithí Comhaid a bhrostú leis na haicearraí tapa seo.", "Open the actions menu for a file" : "Oscail an roghchlár gníomhartha le haghaidh comhad", diff --git a/apps/files/l10n/ga.json b/apps/files/l10n/ga.json index c71888d8c2b..8b01e76fc2e 100644 --- a/apps/files/l10n/ga.json +++ b/apps/files/l10n/ga.json @@ -127,6 +127,7 @@ "Search globally by filename …" : "Cuardaigh go domhanda de réir ainm comhaid …", "Search here by filename …" : "Cuardaigh anseo de réir ainm comhaid …", "Search scope options" : "Roghanna raon feidhme cuardaigh", + "Filter and search from this location" : "Scag agus déan cuardach ón suíomh seo", "Search globally" : "Cuardaigh go domhanda", "{usedQuotaByte} used" : "{usedQuotaByte} úsáidte", "{used} of {quota} used" : "{used} de {quota} in úsáid", @@ -139,6 +140,7 @@ "Create new folder" : "Cruthaigh fillteán nua", "This name is already in use." : "Tá an t-ainm seo in úsáid cheana féin.", "Create" : "Cruthaigh", + "Files starting with a dot are hidden by default" : "Bíonn comhaid a thosaíonn le ponc i bhfolach de réir réamhshocraithe", "Fill template fields" : "Líon réimsí teimpléid", "Submitting fields …" : "Réimsí á gcur isteach…", "Submit" : "Cuir isteach", @@ -210,6 +212,7 @@ "Warnings" : "Rabhaidh", "Prevent warning dialogs from open or reenable them." : "Cosc a chur ar dialóga rabhaidh ó iad a oscailt nó iad a athchumasú.", "Show a warning dialog when changing a file extension." : "Taispeáin dialóg rabhaidh nuair a athraítear síneadh comhad.", + "Show a warning dialog when deleting files." : "Taispeáin comhrá rabhaidh agus comhaid á scriosadh.", "Keyboard shortcuts" : "Aicearraí méarchláir", "Speed up your Files experience with these quick shortcuts." : "Déan do thaithí Comhaid a bhrostú leis na haicearraí tapa seo.", "Open the actions menu for a file" : "Oscail an roghchlár gníomhartha le haghaidh comhad", diff --git a/apps/files/l10n/it.js b/apps/files/l10n/it.js index 39787e39664..f22d1227b9f 100644 --- a/apps/files/l10n/it.js +++ b/apps/files/l10n/it.js @@ -82,7 +82,7 @@ OC.L10N.register( "Current directory path" : "Percorso della cartella corrente", "Your have used your space quota and cannot upload files anymore" : "Hai esaurito la tua quota di spazio e non puoi più caricare file", "You do not have permission to upload or create files here." : "Non hai l'autorizzazione per caricare o creare file qui.", - "Drag and drop files here to upload" : "Trascina i file qui per caricarli", + "Drag and drop files here to upload" : "Trascina e rilascia i file qui per caricarli", "Favorite" : "Preferito", "Back" : "Indietro", "Toggle selection for file \"{displayName}\"" : "Attiva/disattiva la selezione per il file \"{displayName}\"", @@ -129,6 +129,7 @@ OC.L10N.register( "Search globally by filename …" : "Cerca globalmente per nome file…", "Search here by filename …" : "Cerca qui per nome file…", "Search scope options" : "Opzioni nell'ambito di ricerca", + "Filter and search from this location" : "Filtra e cerca da questa posizione", "Search globally" : "Cerca globalmente", "{usedQuotaByte} used" : "{usedQuotaByte} usato", "{used} of {quota} used" : "{used} di {quota} utilizzati", @@ -141,6 +142,7 @@ OC.L10N.register( "Create new folder" : "Crea una nuova cartella", "This name is already in use." : "Questo nome è già utilizzato.", "Create" : "Crea", + "Files starting with a dot are hidden by default" : "I file che iniziano con un punto sono nascosti per impostazione predefinita", "Fill template fields" : "Compila i campi del modello", "Submitting fields …" : "Invio dei campi …", "Submit" : "Invia", @@ -212,6 +214,7 @@ OC.L10N.register( "Warnings" : "Avvertenze", "Prevent warning dialogs from open or reenable them." : "Impedire l'apertura delle finestre di dialogo di avviso o riattivarle.", "Show a warning dialog when changing a file extension." : "Mostra una finestra di dialogo di avviso quando si modifica l'estensione di un file.", + "Show a warning dialog when deleting files." : "Mostra un dialogo di avviso quando si cancellano dei file.", "Keyboard shortcuts" : "Scorciatoie da tastiera", "Speed up your Files experience with these quick shortcuts." : "Velocizza la tua esperienza con i File con queste rapide scorciatoie.", "Open the actions menu for a file" : "Aprire il menu delle azioni per un file", @@ -330,7 +333,7 @@ OC.L10N.register( "New template folder" : "Nuova cartella dei modelli", "In folder" : "Nella cartella", "Search in folder: {folder}" : "Cerca nella cartella: {folder}", - "One of the dropped files could not be processed" : "Impossibile elaborare uno dei file eliminati", + "One of the dropped files could not be processed" : "Impossibile elaborare uno dei file depositati", "Your browser does not support the Filesystem API. Directories will not be uploaded" : "Il tuo browser non supporta l'API del file system. Le directory non verranno caricate", "No files to upload" : "Nessun file da caricare", "Unable to create the directory {directory}" : "Impossibile creare la directory {directory}", diff --git a/apps/files/l10n/it.json b/apps/files/l10n/it.json index 40edb4b3f9a..ced369a54d6 100644 --- a/apps/files/l10n/it.json +++ b/apps/files/l10n/it.json @@ -80,7 +80,7 @@ "Current directory path" : "Percorso della cartella corrente", "Your have used your space quota and cannot upload files anymore" : "Hai esaurito la tua quota di spazio e non puoi più caricare file", "You do not have permission to upload or create files here." : "Non hai l'autorizzazione per caricare o creare file qui.", - "Drag and drop files here to upload" : "Trascina i file qui per caricarli", + "Drag and drop files here to upload" : "Trascina e rilascia i file qui per caricarli", "Favorite" : "Preferito", "Back" : "Indietro", "Toggle selection for file \"{displayName}\"" : "Attiva/disattiva la selezione per il file \"{displayName}\"", @@ -127,6 +127,7 @@ "Search globally by filename …" : "Cerca globalmente per nome file…", "Search here by filename …" : "Cerca qui per nome file…", "Search scope options" : "Opzioni nell'ambito di ricerca", + "Filter and search from this location" : "Filtra e cerca da questa posizione", "Search globally" : "Cerca globalmente", "{usedQuotaByte} used" : "{usedQuotaByte} usato", "{used} of {quota} used" : "{used} di {quota} utilizzati", @@ -139,6 +140,7 @@ "Create new folder" : "Crea una nuova cartella", "This name is already in use." : "Questo nome è già utilizzato.", "Create" : "Crea", + "Files starting with a dot are hidden by default" : "I file che iniziano con un punto sono nascosti per impostazione predefinita", "Fill template fields" : "Compila i campi del modello", "Submitting fields …" : "Invio dei campi …", "Submit" : "Invia", @@ -210,6 +212,7 @@ "Warnings" : "Avvertenze", "Prevent warning dialogs from open or reenable them." : "Impedire l'apertura delle finestre di dialogo di avviso o riattivarle.", "Show a warning dialog when changing a file extension." : "Mostra una finestra di dialogo di avviso quando si modifica l'estensione di un file.", + "Show a warning dialog when deleting files." : "Mostra un dialogo di avviso quando si cancellano dei file.", "Keyboard shortcuts" : "Scorciatoie da tastiera", "Speed up your Files experience with these quick shortcuts." : "Velocizza la tua esperienza con i File con queste rapide scorciatoie.", "Open the actions menu for a file" : "Aprire il menu delle azioni per un file", @@ -328,7 +331,7 @@ "New template folder" : "Nuova cartella dei modelli", "In folder" : "Nella cartella", "Search in folder: {folder}" : "Cerca nella cartella: {folder}", - "One of the dropped files could not be processed" : "Impossibile elaborare uno dei file eliminati", + "One of the dropped files could not be processed" : "Impossibile elaborare uno dei file depositati", "Your browser does not support the Filesystem API. Directories will not be uploaded" : "Il tuo browser non supporta l'API del file system. Le directory non verranno caricate", "No files to upload" : "Nessun file da caricare", "Unable to create the directory {directory}" : "Impossibile creare la directory {directory}", diff --git a/apps/files/l10n/zh_HK.js b/apps/files/l10n/zh_HK.js index b8a096abf15..cc7b7f20c44 100644 --- a/apps/files/l10n/zh_HK.js +++ b/apps/files/l10n/zh_HK.js @@ -142,7 +142,7 @@ OC.L10N.register( "Create new folder" : "新增資料夾", "This name is already in use." : "這個用戶名稱已經有人使用了。", "Create" : "創建", - "Files starting with a dot are hidden by default" : "檔案名稱以點開頭的檔案預設隱藏", + "Files starting with a dot are hidden by default" : "以點開頭的檔案默認為隱藏檔案", "Fill template fields" : "填寫模板欄位", "Submitting fields …" : "正在遞交欄位 …", "Submit" : "遞交", diff --git a/apps/files/l10n/zh_HK.json b/apps/files/l10n/zh_HK.json index c423b29cece..a5cc0829163 100644 --- a/apps/files/l10n/zh_HK.json +++ b/apps/files/l10n/zh_HK.json @@ -140,7 +140,7 @@ "Create new folder" : "新增資料夾", "This name is already in use." : "這個用戶名稱已經有人使用了。", "Create" : "創建", - "Files starting with a dot are hidden by default" : "檔案名稱以點開頭的檔案預設隱藏", + "Files starting with a dot are hidden by default" : "以點開頭的檔案默認為隱藏檔案", "Fill template fields" : "填寫模板欄位", "Submitting fields …" : "正在遞交欄位 …", "Submit" : "遞交", diff --git a/apps/files/src/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts index 9a8badb4eb7..f2d04fce3c7 100644 --- a/apps/files/src/newMenu/newFolder.ts +++ b/apps/files/src/newMenu/newFolder.ts @@ -43,8 +43,11 @@ export const entry = { id: 'newFolder', displayName: t('files', 'New folder'), enabled: (context: Folder) => Boolean(context.permissions & Permission.CREATE) && Boolean(context.permissions & Permission.READ), - iconSvgInline: FolderPlusSvg, + + // Make the svg icon color match the primary element color + iconSvgInline: FolderPlusSvg.replace(/viewBox/gi, 'style="color: var(--color-primary-element)" viewBox'), order: 0, + async handler(context: Folder, content: Node[]) { const name = await newNodeName(t('files', 'New folder'), content) if (name === null) { diff --git a/apps/files/src/views/favorites.spec.ts b/apps/files/src/views/favorites.spec.ts index 64c3df0500a..e73279f2b31 100644 --- a/apps/files/src/views/favorites.spec.ts +++ b/apps/files/src/views/favorites.spec.ts @@ -7,6 +7,7 @@ import type { Folder as CFolder, Navigation } from '@nextcloud/files' import * as filesUtils from '@nextcloud/files' +import * as filesDavUtils from '@nextcloud/files/dav' import { CancelablePromise } from 'cancelable-promise' import { basename } from 'path' import { beforeEach, describe, expect, test, vi } from 'vitest' @@ -43,7 +44,7 @@ describe('Favorites view definition', () => { test('Default empty favorite view', async () => { vi.spyOn(eventBus, 'subscribe') - vi.spyOn(filesUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) + vi.spyOn(filesDavUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) vi.spyOn(favoritesService, 'getContents').mockReturnValue(CancelablePromise.resolve({ folder: {} as CFolder, contents: [] })) await registerFavoritesView() @@ -89,8 +90,14 @@ describe('Favorites view definition', () => { source: 'http://nextcloud.local/remote.php/dav/files/admin/foo/bar', owner: 'admin', }), + new Folder({ + id: 4, + root: '/files/admin', + source: 'http://nextcloud.local/remote.php/dav/files/admin/foo/bar/yabadaba', + owner: 'admin', + }), ] - vi.spyOn(filesUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve(favoriteFolders)) + vi.spyOn(filesDavUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve(favoriteFolders)) vi.spyOn(favoritesService, 'getContents').mockReturnValue(CancelablePromise.resolve({ folder: {} as CFolder, contents: [] })) await registerFavoritesView() @@ -98,9 +105,12 @@ describe('Favorites view definition', () => { const favoriteFoldersViews = Navigation.views.filter(view => view.parent === 'favorites') // one main view and 3 children - expect(Navigation.views.length).toBe(4) + expect(Navigation.views.length).toBe(5) expect(favoritesView).toBeDefined() - expect(favoriteFoldersViews.length).toBe(3) + expect(favoriteFoldersViews.length).toBe(4) + + // Sorted by basename: bar, bar, foo + const expectedOrder = [2, 0, 1, 3] favoriteFolders.forEach((folder, index) => { const favoriteView = favoriteFoldersViews[index] @@ -108,7 +118,7 @@ describe('Favorites view definition', () => { expect(favoriteView?.id).toBeDefined() expect(favoriteView?.name).toBe(basename(folder.path)) expect(favoriteView?.icon).toMatch(/<svg.+<\/svg>/) - expect(favoriteView?.order).toBe(index) + expect(favoriteView?.order).toBe(expectedOrder[index]) expect(favoriteView?.params).toStrictEqual({ dir: folder.path, fileid: String(folder.fileid), @@ -132,7 +142,7 @@ describe('Dynamic update of favorite folders', () => { test('Add a favorite folder creates a new entry in the navigation', async () => { vi.spyOn(eventBus, 'emit') - vi.spyOn(filesUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) + vi.spyOn(filesDavUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) vi.spyOn(favoritesService, 'getContents').mockReturnValue(CancelablePromise.resolve({ folder: {} as CFolder, contents: [] })) await registerFavoritesView() @@ -160,7 +170,7 @@ describe('Dynamic update of favorite folders', () => { test('Remove a favorite folder remove the entry from the navigation column', async () => { vi.spyOn(eventBus, 'emit') - vi.spyOn(filesUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([ + vi.spyOn(filesDavUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([ new Folder({ id: 42, root: '/files/admin', @@ -211,7 +221,7 @@ describe('Dynamic update of favorite folders', () => { test('Renaming a favorite folder updates the navigation', async () => { vi.spyOn(eventBus, 'emit') - vi.spyOn(filesUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) + vi.spyOn(filesDavUtils, 'getFavoriteNodes').mockReturnValue(CancelablePromise.resolve([])) vi.spyOn(favoritesService, 'getContents').mockReturnValue(CancelablePromise.resolve({ folder: {} as CFolder, contents: [] })) await registerFavoritesView() diff --git a/apps/files/src/views/favorites.ts b/apps/files/src/views/favorites.ts index cadc7704e14..45cd96510a2 100644 --- a/apps/files/src/views/favorites.ts +++ b/apps/files/src/views/favorites.ts @@ -4,13 +4,15 @@ */ import type { Folder, Node } from '@nextcloud/files' +import { FileType, View, getNavigation } from '@nextcloud/files' +import { getCanonicalLocale, getLanguage, t } from '@nextcloud/l10n' +import { getFavoriteNodes } from '@nextcloud/files/dav' import { subscribe } from '@nextcloud/event-bus' -import { FileType, View, getFavoriteNodes, getNavigation } from '@nextcloud/files' -import { getLanguage, translate as t } from '@nextcloud/l10n' -import { client } from '../services/WebdavClient.ts' + import FolderSvg from '@mdi/svg/svg/folder.svg?raw' import StarSvg from '@mdi/svg/svg/star.svg?raw' +import { client } from '../services/WebdavClient.ts' import { getContents } from '../services/Favorites' import { hashCode } from '../utils/hashUtils' import logger from '../logger' @@ -118,7 +120,7 @@ export const registerFavoritesView = async () => { * update the order property of the existing views */ const updateAndSortViews = function() { - favoriteFolders.sort((a, b) => a.path.localeCompare(b.path, getLanguage(), { ignorePunctuation: true })) + favoriteFolders.sort((a, b) => a.basename.localeCompare(b.basename, [getLanguage(), getCanonicalLocale()], { ignorePunctuation: true, numeric: true, usage: 'sort' })) favoriteFolders.forEach((folder, index) => { const view = favoriteFoldersViews.find((view) => view.id === generateIdFromPath(folder.path)) if (view) { @@ -176,4 +178,6 @@ export const registerFavoritesView = async () => { removePathFromFavorites(favoriteFolder.path) addToFavorites(node) } + + updateAndSortViews() } |