shell32[3/3]: allow overwriting files in SHFileOperation(FO_COPY) (with confirmation dialogs, fixes bug #7046)

James Hawkins truiken at gmail.com
Fri Feb 9 15:39:45 CST 2007


On 2/9/07, Mikołaj Zalewski <mikolaj at zalewski.pl> wrote:
> The return codes when the user cancelled the operation as in Vista, as
> they are more logical and easier to implement than the XP ones. If
> Microsoft changed them there are probably not many apps that would
> depend on it. With this change the program in bug #7046 works fine.
>
> From 799ff7b7cc6092fbd3e2030c7b4eb84d829b9842 Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?Miko=C5=82aj_Zalewski?= <mikolaj at zalewski.pl>
> Date: Fri, 9 Feb 2007 16:43:06 +0100
> Subject: [PATCH] shell32: allow overwriting files in SHFileOperation(FO_COPY) (with confirmation dialogs)
>
> ---
>  dlls/shell32/shell32_Bg.rc     |    6 ++-
>  dlls/shell32/shell32_Cs.rc     |    8 ++-
>  dlls/shell32/shell32_De.rc     |    6 ++-
>  dlls/shell32/shell32_En.rc     |    8 ++-
>  dlls/shell32/shell32_Eo.rc     |    6 ++-
>  dlls/shell32/shell32_Es.rc     |    6 ++-
>  dlls/shell32/shell32_Fi.rc     |    6 ++-
>  dlls/shell32/shell32_Fr.rc     |    6 ++-
>  dlls/shell32/shell32_It.rc     |    6 ++-
>  dlls/shell32/shell32_Ko.rc     |    6 ++-
>  dlls/shell32/shell32_No.rc     |    6 ++-
>  dlls/shell32/shell32_Pl.rc     |    6 ++-
>  dlls/shell32/shell32_Pt.rc     |    6 ++-
>  dlls/shell32/shell32_Ru.rc     |    6 ++-
>  dlls/shell32/shell32_Tr.rc     |    6 ++-
>  dlls/shell32/shell32_Uk.rc     |    6 ++-
>  dlls/shell32/shell32_main.h    |    3 +-
>  dlls/shell32/shfldr_unixfs.c   |    2 +-
>  dlls/shell32/shlfileop.c       |  128 +++++++++++++++++++++++++++++++---------
>  dlls/shell32/shresdef.h        |    1 +
>  dlls/shell32/tests/shlfileop.c |   55 +++++++++++++++++
>  21 files changed, 241 insertions(+), 48 deletions(-)
>
> diff --git a/dlls/shell32/shell32_Bg.rc b/dlls/shell32/shell32_Bg.rc
> index 100b9b6..4c4d16b 100644
> --- a/dlls/shell32/shell32_Bg.rc
> +++ b/dlls/shell32/shell32_Bg.rc
> @@ -165,8 +165,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEITEM_TEXT "Наистина ли искате да изтриете '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Наистина ли искате да изтриете тези %1 елемента?"
>         IDS_DELETESELECTED_TEXT "Наистина ли искате да изтриете избраните елементи?"
> -       IDS_OVERWRITEFILE_TEXT "Наистина ли искате да презапишете %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Потвърдете презаписа на файла"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Рестартиране"
> diff --git a/dlls/shell32/shell32_Cs.rc b/dlls/shell32/shell32_Cs.rc
> index 6451dbb..8790db4 100644
> --- a/dlls/shell32/shell32_Cs.rc
> +++ b/dlls/shell32/shell32_Cs.rc
> @@ -163,10 +163,14 @@ STRINGTABLE DISCARDABLE
>         IDS_CREATEFOLDER_CAPTION "Chyba pшi pokusu vytvoшit novэ adresбш"
>         IDS_DELETEITEM_CAPTION "Potvrdit odstranмnн souboru"
>         IDS_DELETEFOLDER_CAPTION "Potvrdit odstranмnн adresбшe"
> -       IDS_OVERWRITEFILE_CAPTION "Potvrdit pшepsбnн souboru"
>         IDS_DELETEITEM_TEXT "Opravdu chcete odstranit '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Opravdu chcete odstranit tмchto %1 poloћek?"
> -       IDS_OVERWRITEFILE_TEXT "Pшejete si pшepsat soubor '%1'?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
> +       IDS_OVERWRITEFILE_CAPTION "Potvrdit pшepsбnн souboru"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>  }
>
>  /*     columns in the shellview        */
> diff --git a/dlls/shell32/shell32_De.rc b/dlls/shell32/shell32_De.rc
> index bde62bf..d6cb815 100644
> --- a/dlls/shell32/shell32_De.rc
> +++ b/dlls/shell32/shell32_De.rc
> @@ -173,8 +173,12 @@ STRINGTABLE DISCARDABLE
>         IDS_TRASHFOLDER_TEXT "Sind Sie sich sicher, dass Sie '%1' und seinen Inhalt in den Mьll verschieben mцchten?"
>         IDS_TRASHMULTIPLE_TEXT "Sind Sie sich sicher, dass Sie diese %1 Dateien in den Mьll verschieben mцchten?"
>         IDS_CANTTRASH_TEXT "Das Objekt '%1' kann nicht in den Mьll verschoben werden. Mцchten Sie es stattdessen lцschen?"
> -       IDS_OVERWRITEFILE_TEXT "Mцchten Sie, dass die Datei '%1' ьberschrieben wird ?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Bestдtigung: Datei ьberschreiben"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Neustarten"
> diff --git a/dlls/shell32/shell32_En.rc b/dlls/shell32/shell32_En.rc
> index 09530c6..a67cc8a 100644
> --- a/dlls/shell32/shell32_En.rc
> +++ b/dlls/shell32/shell32_En.rc
> @@ -185,8 +185,12 @@ STRINGTABLE DISCARDABLE
>         IDS_TRASHFOLDER_TEXT "Are you sure that you want to send '%1' and all it's content to the Trash?"
>         IDS_TRASHMULTIPLE_TEXT "Are you sure that you want to send these %1 items to the Trash?"
>         IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?"
> -       IDS_OVERWRITEFILE_TEXT "OverWrite File %1?"
> -       IDS_OVERWRITEFILE_CAPTION "Confirm File OverWrite"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
> +       IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Restart"
> diff --git a/dlls/shell32/shell32_Eo.rc b/dlls/shell32/shell32_Eo.rc
> index e8fa407..3bfca07 100644
> --- a/dlls/shell32/shell32_Eo.rc
> +++ b/dlls/shell32/shell32_Eo.rc
> @@ -163,8 +163,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Konfirmu forigon de dosierujo"
>         IDS_DELETEITEM_TEXT "Жu vi estas certa pri forigo de '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Жu vi estas certa pri forigo de жi tiuj %1 komponantoj?"
> -       IDS_OVERWRITEFILE_TEXT "Жu vi supreskribas la dosieron %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Konfirmu supreskribiton de dosieron"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>  }
>
>  /*     columns in the shellview        */
> diff --git a/dlls/shell32/shell32_Es.rc b/dlls/shell32/shell32_Es.rc
> index dd83a6e..c3d2f4c 100644
> --- a/dlls/shell32/shell32_Es.rc
> +++ b/dlls/shell32/shell32_Es.rc
> @@ -162,8 +162,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Confirmar eliminaciуn de carpeta"
>         IDS_DELETEITEM_TEXT "їSeguro que desea eliminar '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "їSeguro que desea eliminar estos %1 elementos?"
> -       IDS_OVERWRITEFILE_TEXT "їSobreescribir el archivo '%1'?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Confirmar sobreescritura de archivo"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>  }
>
>  /*     columns in the shellview        */
> diff --git a/dlls/shell32/shell32_Fi.rc b/dlls/shell32/shell32_Fi.rc
> index e842bbd..e43a94e 100644
> --- a/dlls/shell32/shell32_Fi.rc
> +++ b/dlls/shell32/shell32_Fi.rc
> @@ -164,8 +164,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Vahvista kansion tuhoaminen"
>         IDS_DELETEITEM_TEXT "Haluatko varmasti tuhota '%1':n?"
>         IDS_DELETEMULTIPLE_TEXT "Haluatko varmasti tuhota nдmд %1?"
> -       IDS_OVERWRITEFILE_TEXT "Ylikirjoita tiedosto %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Vahvista tiedoston ylikirjoitus"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Kдynnistд uudelleen"
> diff --git a/dlls/shell32/shell32_Fr.rc b/dlls/shell32/shell32_Fr.rc
> index 043c66c..246045c 100644
> --- a/dlls/shell32/shell32_Fr.rc
> +++ b/dlls/shell32/shell32_Fr.rc
> @@ -176,8 +176,12 @@ STRINGTABLE DISCARDABLE
>         IDS_TRASHFOLDER_TEXT "Кtes-vous sыr de vouloir mettre «%1» et tout ce qu'il contient dans la corbeille?"
>         IDS_TRASHMULTIPLE_TEXT "Кtes-vous sыr de vouloir mettre ces %1 йlйments dans la corbeille?"
>         IDS_CANTTRASH_TEXT "L'йlйment «%1» ne peut pas кtre mis dans la corbeille. Souhaitez-vous le supprimer а la place?"
> -       IDS_OVERWRITEFILE_TEXT "Йcraser le fichier %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Confirmer l'йcrasement du fichier"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>         IDS_RESTART_TITLE       "Redйmarrer"
> diff --git a/dlls/shell32/shell32_It.rc b/dlls/shell32/shell32_It.rc
> index 809f44a..19f7339 100644
> --- a/dlls/shell32/shell32_It.rc
> +++ b/dlls/shell32/shell32_It.rc
> @@ -164,8 +164,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Confermare la cancellazione della cartella"
>         IDS_DELETEITEM_TEXT "Sei sicuro di voler cancellare '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Sei sicuro di voler cancellare questi %1 elementi?"
> -       IDS_OVERWRITEFILE_TEXT "Sovrascrivere il File %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Confermare la sovrascrizione del File"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>         /* message box strings */
>         IDS_RESTART_TITLE       "Riavvia"
> diff --git a/dlls/shell32/shell32_Ko.rc b/dlls/shell32/shell32_Ko.rc
> index 413ad7b..bb00f83 100644
> --- a/dlls/shell32/shell32_Ko.rc
> +++ b/dlls/shell32/shell32_Ko.rc
> @@ -173,8 +173,12 @@ IDS_TRASHITEM_TEXT "ґзЅЕАє '%1' А»(ё¦) ИЮБцЕлАё·О єёі»±вё¦ №Щ¶шґП±о?"
>  IDS_TRASHFOLDER_TEXT "ґзЅЕАє '%1' °ъ ±Ч ѕИАЗ і»їлА» ИЮБцЕлАё·О єёі»±вё¦ №Щ¶шґП±о?"
>  IDS_TRASHMULTIPLE_TEXT "ґзЅЕАє '%1' µйА»(ё¦) ИЮБцЕлАё·О єёі»±вё¦ №Щ¶шґП±о?"
>  IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?"
> -IDS_OVERWRITEFILE_TEXT "ЖДАП %1А» µ¤ѕоѕІ°ЪЅАґП±о?"
> +IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>  IDS_OVERWRITEFILE_CAPTION "ЖДАП µ¤ѕоѕІ±в И(r)АО"
> +IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>  /* message box strings */
>  IDS_RESTART_TITLE       "ґЩЅГ ЅГАЫ"
> diff --git a/dlls/shell32/shell32_No.rc b/dlls/shell32/shell32_No.rc
> index a7ad4f4..c7ec269 100644
> --- a/dlls/shell32/shell32_No.rc
> +++ b/dlls/shell32/shell32_No.rc
> @@ -172,8 +172,12 @@ STRINGTABLE DISCARDABLE
>         IDS_TRASHFOLDER_TEXT "Virkelig legge «%1» og alt innholdet i papirkurven?"
>         IDS_TRASHMULTIPLE_TEXT "Virkelig legge disse %1 valgte elementene i papirkurven?"
>         IDS_CANTTRASH_TEXT "Elementet «%1» kan ikke legges i papirkurven. Vil du slette det i stedet?"
> -       IDS_OVERWRITEFILE_TEXT "Overskrive filen «%1»?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Bekreft overskriving av fil"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Starte pе nytt"
> diff --git a/dlls/shell32/shell32_Pl.rc b/dlls/shell32/shell32_Pl.rc
> index 60b6a75..d6139e7 100644
> --- a/dlls/shell32/shell32_Pl.rc
> +++ b/dlls/shell32/shell32_Pl.rc
> @@ -173,8 +173,12 @@ STRINGTABLE DISCARDABLE
>         IDS_TRASHFOLDER_TEXT "Czy jesteњ pewien, їe chcesz umieњciж folder '%1' i caі№ jego zawartoњж w koszu"
>         IDS_TRASHMULTIPLE_TEXT "Elementуw: %1 - czy na pewno chcesz je umieњciж w Koszu?"
>         IDS_CANTTRASH_TEXT "Nie mogк przenieњж elementu '%1' do Kosza. Czy chcesz go zamiast tego usun№ж?"
> -       IDS_OVERWRITEFILE_TEXT "Zast№piж plik %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Potwierdџ zast№pienie pliku"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Uruchom ponownie"
> diff --git a/dlls/shell32/shell32_Pt.rc b/dlls/shell32/shell32_Pt.rc
> index 1826162..0a6a274 100644
> --- a/dlls/shell32/shell32_Pt.rc
> +++ b/dlls/shell32/shell32_Pt.rc
> @@ -256,8 +256,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Confirmar exclusгo de pasta"
>         IDS_DELETEITEM_TEXT "Vocк tem certeza que deseja excluir '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Vocк tem certeza que deseja excluir estes %1 itens?"
> -       IDS_OVERWRITEFILE_TEXT "Sobreescrever arquivo %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Confirmar sobreescrever arquivo"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>         IDS_RESTART_TITLE       "Reiniciar"
> diff --git a/dlls/shell32/shell32_Ru.rc b/dlls/shell32/shell32_Ru.rc
> index a3c5da8..65fa824 100644
> --- a/dlls/shell32/shell32_Ru.rc
> +++ b/dlls/shell32/shell32_Ru.rc
> @@ -165,8 +165,12 @@ STRINGTABLE DISCARDABLE
>      IDS_DELETEFOLDER_CAPTION   "Подтверждение удаления папки"
>      IDS_DELETEITEM_TEXT                "Удалить '%1'?"
>      IDS_DELETEMULTIPLE_TEXT    "Удалить эти обьекты (%1?"
> -    IDS_OVERWRITEFILE_TEXT     "Заменить файл(ы) %1?"
> +    IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>      IDS_OVERWRITEFILE_CAPTION  "Подтверждение замены файла"
> +    IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>      /* message box strings */
>      IDS_RESTART_TITLE          "Перезагрузить"
> diff --git a/dlls/shell32/shell32_Tr.rc b/dlls/shell32/shell32_Tr.rc
> index b41be53..197562c 100644
> --- a/dlls/shell32/shell32_Tr.rc
> +++ b/dlls/shell32/shell32_Tr.rc
> @@ -172,8 +172,12 @@ STRINGTABLE DISCARDABLE
>          IDS_TRASHFOLDER_TEXT "'%1' adlэ црeyi ve tьm iзeriрini зцpe gцndermek istediрinizden emin misiniz?"
>          IDS_TRASHMULTIPLE_TEXT "Bu %1 црeyi зцpe gцndermek istediрinizden emin misiniz?"
>          IDS_CANTTRASH_TEXT "'%1' adlэ црe зцpe gцnderilemiyor. Tamamen silmek ister misiniz?"
> -       IDS_OVERWRITEFILE_TEXT "%1 dosyasэnэn ьzerine yazmak istiyor musunuz?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Dosya Ьzerine Yazmayэ Onayla"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>
>          /* message box strings */
>          IDS_RESTART_TITLE       "Yeniden Baюlat"
> diff --git a/dlls/shell32/shell32_Uk.rc b/dlls/shell32/shell32_Uk.rc
> index c535ba9..a4cf564 100644
> --- a/dlls/shell32/shell32_Uk.rc
> +++ b/dlls/shell32/shell32_Uk.rc
> @@ -161,8 +161,12 @@ STRINGTABLE DISCARDABLE
>         IDS_DELETEFOLDER_CAPTION "Підтвердження вилучення теки"
>         IDS_DELETEITEM_TEXT "Ви впевнені, що хочете вилучити '%1'?"
>         IDS_DELETEMULTIPLE_TEXT "Ви впевнені, що хочете вилучити ці %1 елементи(ів)?"
> -       IDS_OVERWRITEFILE_TEXT "Переписати Файл %1?"
> +       IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?"
>         IDS_OVERWRITEFILE_CAPTION "Підтвердження Перезапису Файлу"
> +       IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\
> +           "If the files in the destination folder have the same names as files in the\n"\
> +           "selected folder they will be replaced. Do you still want to move or copy\n"\
> +           "the folder?"
>  }
>
>  /*     columns in the shellview        */
> diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
> index a17eec4..2937065 100644
> --- a/dlls/shell32/shell32_main.h
> +++ b/dlls/shell32/shell32_main.h
> @@ -153,9 +153,10 @@ void FreeChangeNotifications(void);
>  #define ASK_TRASH_FOLDER          8
>  #define ASK_TRASH_MULTIPLE_ITEM   9
>  #define ASK_CANT_TRASH_ITEM      10
> +#define ASK_OVERWRITE_FOLDER     11
>
>  BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pwszDir, BOOL bShowUI);
> -BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);
> +BOOL SHELL_ConfirmYesNoW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);
>
>  /* 16-bit functions */
>  void        WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b);
> diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
> index 4668afe..a4f4ade 100644
> --- a/dlls/shell32/shfldr_unixfs.c
> +++ b/dlls/shell32/shfldr_unixfs.c
> @@ -1829,7 +1829,7 @@ static HRESULT UNIXFS_delete_with_syscalls(UnixFolder *This, UINT cidl, LPCITEMI
>      static const WCHAR empty[] = {0};
>      int i;
>
> -    if (!SHELL_ConfirmDialogW(GetActiveWindow(), ASK_DELETE_SELECTED, empty))
> +    if (!SHELL_ConfirmYesNoW(GetActiveWindow(), ASK_DELETE_SELECTED, empty))
>          return S_OK;
>
>      lstrcpyA(szAbsolute, This->m_pszPath);
> diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
> index d1ea475..b245e00 100644
> --- a/dlls/shell32/shlfileop.c
> +++ b/dlls/shell32/shlfileop.c
> @@ -27,6 +27,7 @@
>  #include <stdarg.h>
>  #include <string.h>
>  #include <ctype.h>
> +#include <assert.h>
>
>  #include "windef.h"
>  #include "winbase.h"
> @@ -65,6 +66,14 @@ static DWORD SHNotifyMoveFileW(LPCWSTR src, LPCWSTR dest);
>  static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists);
>  static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly);
>
> +typedef struct
> +{
> +    SHFILEOPSTRUCTW *req;
> +    DWORD dwYesToAllMask;
> +    BOOL bManyItems;
> +    BOOL bCancelled;
> +} FILE_OPERATION;
> +
>  /* Confirm dialogs with an optional "Yes To All" as used in file operations confirmations
>   */
>  static const WCHAR CONFIRM_MSG_PROP[] = {'W','I','N','E','_','C','O','N','F','I','R','M','E',0};
> @@ -250,22 +259,32 @@ static BOOL SHELL_ConfirmIDs(int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
>              ids->icon_resource_id = IDI_WARNING;
>             ids->caption_resource_id  = IDS_OVERWRITEFILE_CAPTION;
>             ids->text_resource_id  = IDS_OVERWRITEFILE_TEXT;
> -           return TRUE;
> +            return TRUE;
> +         case ASK_OVERWRITE_FOLDER:
> +            ids->hIconInstance = NULL;
> +            ids->icon_resource_id = IDI_WARNING;
> +            ids->caption_resource_id  = IDS_OVERWRITEFILE_CAPTION;
> +            ids->text_resource_id  = IDS_OVERWRITEFOLDER_TEXT;
> +            return TRUE;
>           default:
>             FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
>         }
>         return FALSE;
>  }
>
> -BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir)
> +static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FILE_OPERATION *op)
>  {
>         WCHAR szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
>         SHELL_ConfirmIDstruc ids;
>         DWORD_PTR args[1];
>         HICON hIcon;
> +       int ret;
>
> -       if (!SHELL_ConfirmIDs(nKindOfDialog, &ids))
> -         return FALSE;
> +        assert(nKindOfDialog >= 0 && nKindOfDialog < 32);
> +        if (op && (op->dwYesToAllMask & (1 << nKindOfDialog)))
> +            return IDYES;
> +
> +       assert(SHELL_ConfirmIDs(nKindOfDialog, &ids));
>
>         LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
>         LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
> @@ -275,7 +294,23 @@ BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir)
>                        szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)args);
>          hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
>
> -        return (IDYES == SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, FALSE));
> +        ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
> +        if (op) {
> +            if (ret == IDD_YESTOALL) {
> +                op->dwYesToAllMask |= (1 << nKindOfDialog);
> +                ret = IDYES;
> +            }
> +            if (ret == IDCANCEL)
> +                op->bCancelled = TRUE;
> +            if (ret != IDYES)
> +                op->req->fAnyOperationsAborted = TRUE;
> +        }
> +        return ret == IDYES;
> +}
>

You need to conform to the style of the rest of the file, e.g.,

        if (IsAttribDir(entryToCopy->attributes) && bCancelIfAnyDirectories)
            return ERROR_CANCELLED;

        create_dest_dirs(fileDest->szDirectory);

        if (!lstrcmpiW(entryToCopy->szFullPath, fileDest->szFullPath))
        {
            if (IsAttribFile(entryToCopy->attributes))
                return ERROR_NO_MORE_SEARCH_HANDLES;
            else
                return ERROR_SUCCESS;
        }

4 space indentation, empty lines between logical pieces of code,
brackets underneath.

-- 
James Hawkins


More information about the wine-devel mailing list