diff --git a/Files/Dialogs/AddItemDialog.xaml.cs b/Files/Dialogs/AddItemDialog.xaml.cs index 014acc24fc3c..1e0fb2cfd90a 100644 --- a/Files/Dialogs/AddItemDialog.xaml.cs +++ b/Files/Dialogs/AddItemDialog.xaml.cs @@ -71,7 +71,7 @@ public static async void CreateFile(AddItemType fileType) { folder = await folderToCreateItem.CreateFolderAsync("New Folder", CreationCollisionOption.GenerateUniqueName); } - TabInstance.ViewModel.AddFileOrFolder(new ListedItem(folder.FolderRelativeId) { ItemName = folder.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = false, LoadFolderGlyph = true, LoadFileIcon = false, ItemType = "Folder", FileImage = null, ItemPath = folder.Path }); + TabInstance.ViewModel.AddFileOrFolder(new ListedItem(folder.FolderRelativeId) { PrimaryItemAttribute = StorageItemTypes.Folder, ItemName = folder.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = false, LoadFolderGlyph = true, LoadFileIcon = false, ItemType = "Folder", FileImage = null, ItemPath = folder.Path }); } else if (fileType == AddItemType.TextDocument) { @@ -84,7 +84,7 @@ public static async void CreateFile(AddItemType fileType) { item = await folderToCreateItem.CreateFileAsync("New Text Document" + ".txt", CreationCollisionOption.GenerateUniqueName); } - TabInstance.ViewModel.AddFileOrFolder(new ListedItem(item.FolderRelativeId) { ItemName = item.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = true, LoadFolderGlyph = false, LoadFileIcon = false, ItemType = item.DisplayType, FileImage = null, ItemPath = item.Path, FileExtension = item.FileType }); + TabInstance.ViewModel.AddFileOrFolder(new ListedItem(item.FolderRelativeId) { PrimaryItemAttribute = StorageItemTypes.File, ItemName = item.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = true, LoadFolderGlyph = false, LoadFileIcon = false, ItemType = item.DisplayType, FileImage = null, ItemPath = item.Path, FileExtension = item.FileType }); } else if (fileType == AddItemType.BitmapImage) { @@ -97,7 +97,7 @@ public static async void CreateFile(AddItemType fileType) { item = await folderToCreateItem.CreateFileAsync("New Bitmap Image" + ".bmp", CreationCollisionOption.GenerateUniqueName); } - TabInstance.ViewModel.AddFileOrFolder(new ListedItem(item.FolderRelativeId) { ItemName = item.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = true, LoadFolderGlyph = false, LoadFileIcon = false, ItemType = item.DisplayType, FileImage = null, ItemPath = item.Path, FileExtension = item.FileType }); + TabInstance.ViewModel.AddFileOrFolder(new ListedItem(item.FolderRelativeId) { PrimaryItemAttribute = StorageItemTypes.File, ItemName = item.DisplayName, ItemDateModifiedReal = DateTimeOffset.Now, LoadUnknownTypeGlyph = true, LoadFolderGlyph = false, LoadFileIcon = false, ItemType = item.DisplayType, FileImage = null, ItemPath = item.Path, FileExtension = item.FileType }); } } } diff --git a/Files/Interacts/Interaction.cs b/Files/Interacts/Interaction.cs index 004179ec1642..c1d0d59e97b5 100644 --- a/Files/Interacts/Interaction.cs +++ b/Files/Interacts/Interaction.cs @@ -33,6 +33,7 @@ using Windows.UI.WindowManagement.Preview; using Windows.UI; using Files.View_Models; +using GalaSoft.MvvmLight.Command; namespace Files.Interacts { @@ -906,9 +907,16 @@ public async void CopyItem_ClickAsync(object sender, RoutedEventArgs e) } + enum ImpossibleActionResponseTypes + { + Skip, + Abort + } + public async void PasteItem_ClickAsync(object sender, RoutedEventArgs e) { string destinationPath = CurrentInstance.ViewModel.WorkingDirectory; + var resourceLoader = Windows.ApplicationModel.Resources.ResourceLoader.GetForViewIndependentUse(); DataPackageView packageView = Clipboard.GetContent(); itemsToPaste = await packageView.GetStorageItemsAsync(); @@ -921,12 +929,36 @@ public async void PasteItem_ClickAsync(object sender, RoutedEventArgs e) foreach (IStorageItem item in itemsToPaste) { - if (item.IsOfType(StorageItemTypes.Folder)) { - StorageFolder pastedFolder = await CloneDirectoryAsync(item.Path, destinationPath, item.Name, false); - CurrentInstance.ViewModel.AddFolder(pastedFolder.Path); - pastedItemPaths.Add(pastedFolder.Path); + if (destinationPath.Contains(item.Path, StringComparison.OrdinalIgnoreCase)) + { + ImpossibleActionResponseTypes responseType = ImpossibleActionResponseTypes.Abort; + ContentDialog dialog = new ContentDialog() + { + Title = resourceLoader.GetString("ErrorDialogThisActionCannotBeDone"), + Content = resourceLoader.GetString("ErrorDialogTheDestinationFolder") + " (" + destinationPath.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries).Last() + ") " + resourceLoader.GetString("ErrorDialogIsASubfolder") + "(" + item.Name + ")", + PrimaryButtonText = resourceLoader.GetString("ErrorDialogSkip"), + CloseButtonText = resourceLoader.GetString("ErrorDialogCancel"), + PrimaryButtonCommand = new RelayCommand(() => { responseType = ImpossibleActionResponseTypes.Skip; }), + CloseButtonCommand = new RelayCommand(() => { responseType = ImpossibleActionResponseTypes.Abort; }) + }; + await dialog.ShowAsync(); + if (responseType == ImpossibleActionResponseTypes.Skip) + { + continue; + } + else if (responseType == ImpossibleActionResponseTypes.Abort) + { + return; + } + } + else + { + StorageFolder pastedFolder = await CloneDirectoryAsync(item.Path, destinationPath, item.Name, false); + CurrentInstance.ViewModel.AddFolder(pastedFolder.Path); + pastedItemPaths.Add(pastedFolder.Path); + } } else if (item.IsOfType(StorageItemTypes.File)) { diff --git a/Files/MultilingualResources/Files.de-DE.xlf b/Files/MultilingualResources/Files.de-DE.xlf index 69f407eac293..18ca7fc7963d 100644 --- a/Files/MultilingualResources/Files.de-DE.xlf +++ b/Files/MultilingualResources/Files.de-DE.xlf @@ -427,7 +427,27 @@ Settings Einstellungen + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + - + \ No newline at end of file diff --git a/Files/MultilingualResources/Files.es-ES.xlf b/Files/MultilingualResources/Files.es-ES.xlf index c76fadb3cf1c..af205684b0f1 100644 --- a/Files/MultilingualResources/Files.es-ES.xlf +++ b/Files/MultilingualResources/Files.es-ES.xlf @@ -426,7 +426,27 @@ Settings Ajustes + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + - + \ No newline at end of file diff --git a/Files/MultilingualResources/Files.fr-FR.xlf b/Files/MultilingualResources/Files.fr-FR.xlf index 95a2fa9d7d80..dc34f3b663a1 100644 --- a/Files/MultilingualResources/Files.fr-FR.xlf +++ b/Files/MultilingualResources/Files.fr-FR.xlf @@ -426,6 +426,26 @@ Settings Settings + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + diff --git a/Files/MultilingualResources/Files.nl-NL.xlf b/Files/MultilingualResources/Files.nl-NL.xlf index ac3aa50fa992..6c702ab8c824 100644 --- a/Files/MultilingualResources/Files.nl-NL.xlf +++ b/Files/MultilingualResources/Files.nl-NL.xlf @@ -426,6 +426,26 @@ Settings Settings + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + diff --git a/Files/MultilingualResources/Files.pl-PL.xlf b/Files/MultilingualResources/Files.pl-PL.xlf index e4aa55945587..6480ac95ad39 100644 --- a/Files/MultilingualResources/Files.pl-PL.xlf +++ b/Files/MultilingualResources/Files.pl-PL.xlf @@ -426,6 +426,26 @@ Settings Settings + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + diff --git a/Files/MultilingualResources/Files.zh-Hans.xlf b/Files/MultilingualResources/Files.zh-Hans.xlf index 8059547b407f..a8b4fd4a71ce 100644 --- a/Files/MultilingualResources/Files.zh-Hans.xlf +++ b/Files/MultilingualResources/Files.zh-Hans.xlf @@ -426,6 +426,26 @@ Settings Settings + + This action cannot be done + This action cannot be done + + + The destination folder + The destination folder + + + is a subfolder of the source folder + is a subfolder of the source folder + + + Skip + Skip + + + Cancel + Cancel + diff --git a/Files/Strings/de-DE/Resources.resw b/Files/Strings/de-DE/Resources.resw index 75aa664b0c1a..8c078585e8d4 100644 --- a/Files/Strings/de-DE/Resources.resw +++ b/Files/Strings/de-DE/Resources.resw @@ -157,7 +157,7 @@ Sind Sie sicher, dass sie die ausgewählten Dateien löschen möchten? - Dauerhaft löschen + Endgültig löschen Einen Bestätigungsdialog anzeigen bevor Dateien und Ordner gelöscht werden diff --git a/Files/Strings/en-US/Resources.resw b/Files/Strings/en-US/Resources.resw index a6b69c76397e..0633afd8a40b 100644 --- a/Files/Strings/en-US/Resources.resw +++ b/Files/Strings/en-US/Resources.resw @@ -183,6 +183,21 @@ Size: + + This action cannot be done + + + The destination folder + + + is a subfolder of the source folder + + + Skip + + + Cancel + Item type: diff --git a/Files/Strings/es-ES/Resources.resw b/Files/Strings/es-ES/Resources.resw index aaf07d7e072d..436c7b3e6576 100644 --- a/Files/Strings/es-ES/Resources.resw +++ b/Files/Strings/es-ES/Resources.resw @@ -141,4 +141,187 @@ Desanclar de la barra lateral + + Eliminar Archivo(s) + + + Cancelar + + + Eliminar + + + ¿Está seguro que desea eliminar el archivo seleccionado? + + + Eliminar permanentemente + + + Mostrar un diálogo de confirmación al borrar archivos o carpetas + + + Escritorio + + + Documentos + + + Descargas + + + Inicio + + + Música + + + Imágenes + + + Videos + + + Nueva Pestaña + + + Extraer Archivo Comprimido + + + Cancelar + + + Extraer + + + Elija una ubicación para extraer este archivo comprimido. Deberá permanecer en la carpeta actual hasta que hayamos terminado. Se abrirá una nueva pestaña con los elementos extraídos. + + + Examinar + + + Ordenar por + + + Nombre + + + Fecha de modificación + + + Tipo + + + Tamaño + + + Ascendente + + + Descendente + + + Actualizar + + + Pegar + + + Abrir en la Terminal... + + + Nuevo + + + Carpeta + + + Imagen Bitmap + + + Documento de Texto + + + Propiedades + + + Extraer + + + Abrir con... + + + Abrir en nueva pestaña + + + Abrir en nueva ventana + + + Establecer como fondo de escritorio + + + Compartir + + + Cortar + + + Copiar + + + Eliminar + + + Renombrar + + + Anclar a la barra lateral + + + Propiedades + + + QuickLook + + + Nueva Ventana + + + Copiar Ubicación + + + Pegar + + + Abrir en la Terminal... + + + Ingrese una ubicación + + + Buscar + + + Seleccionar Todo + + + Quitar Selección + + + Carpeta + + + Imagen Bitmap + + + Documento de Texto + + + Vista en Lista + + + Vista en Cuadrícula + + + Ajustes + \ No newline at end of file