implement file copying

svn path=/trunk/; revision=15652
This commit is contained in:
Martin Fuchs 2005-05-29 08:47:23 +00:00
parent 2a46b799fc
commit 02fa1a2b59
17 changed files with 60 additions and 45 deletions

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Arkiv" {
MENUITEM "&Öppna\tEnter", ID_ACTIVATE
MENUITEM "&Flytta...\tF7", ID_FILE_MOVE
MENUITEM "&Kopiera...\tF8", 107
MENUITEM "&Kopiera...\tF8", ID_FILE_COPY
MENUITEM "&I urklipp...\tF9", 118
MENUITEM "&Ta bort\tDel", 108
MENUITEM "&Byt namn...", 109

View file

@ -30,7 +30,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Soubor" {
MENUITEM "&Otevøít\tEnter" , ID_ACTIVATE
MENUITEM "&Pøesunout...\tF7" , ID_FILE_MOVE
MENUITEM "&Kopírovat...\tF8" , 107
MENUITEM "&Kopírovat...\tF8" , ID_FILE_COPY
MENUITEM "&Ve schránce...\tF9" , 118
MENUITEM "&Smazat\tDel" , 108
MENUITEM "Pø&ejmenovat..." , 109

View file

@ -32,7 +32,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Datei" {
MENUITEM "Ö&ffnen\tEingabetaste" , ID_ACTIVATE
MENUITEM "&Verschieben...\tF7" , ID_FILE_MOVE
MENUITEM "&Kopieren...\tF8" , 107
MENUITEM "&Kopieren...\tF8" , ID_FILE_COPY
MENUITEM "&In Zwischenablage...\tF9" , 118
MENUITEM "&Löschen\tEntf" , 108
MENUITEM "&Umbenennen..." , 109

View file

@ -32,7 +32,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&File" {
MENUITEM "&Open\tEnter" , ID_ACTIVATE
MENUITEM "&Move...\tF7" , ID_FILE_MOVE
MENUITEM "&Copy...\tF8" , 107
MENUITEM "&Copy...\tF8" , ID_FILE_COPY
MENUITEM "&In Clipboard...\tF9" , 118
MENUITEM "&Delete\tDel" , 108
MENUITEM "Re&name..." , 109

View file

@ -28,7 +28,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Archivo" {
MENUITEM "&Abrir\tEnter" , ID_ACTIVATE
MENUITEM "Mo&ver...\tF7" , ID_FILE_MOVE
MENUITEM "&Copiar...\tF8" , 107
MENUITEM "&Copiar...\tF8" , ID_FILE_COPY
MENUITEM "E&n portapapeles...\tF9" , 118
MENUITEM "&Eliminar\tDel" , 108
MENUITEM "&Renombrar..." , 109

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Fichier" {
MENUITEM "&Ouvrir\tEntrée" , ID_ACTIVATE
MENUITEM "&Déplacer...\tF7" , ID_FILE_MOVE
MENUITEM "&Copier...\tF8" , 107
MENUITEM "&Copier...\tF8" , ID_FILE_COPY
MENUITEM "P&resse-Papiers...\tF9" , 118
MENUITEM "&Effacer\tDel" , 108
MENUITEM "Re&nommer..." , 109

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Fájl" {
MENUITEM "&Megynitás\tEnter" , ID_ACTIVATE
MENUITEM "Át&helyezés...\tF7" , ID_FILE_MOVE
MENUITEM "&Másolás...\tF8" , 107
MENUITEM "&Másolás...\tF8" , ID_FILE_COPY
MENUITEM "&Vágólapon...\tF9" , 118
MENUITEM "&Törlés\tDel" , 108
MENUITEM "Át&nevezés..." , 109

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&File" {
MENUITEM "&Apri\tInvio" , ID_ACTIVATE
MENUITEM "&Sposta...\tF7" , ID_FILE_MOVE
MENUITEM "&Copia...\tF8" , 107
MENUITEM "&Copia...\tF8" , ID_FILE_COPY
MENUITEM "&Negli Appunti...\tF9" , 118
MENUITEM "&Cancella\tDel" , 108
MENUITEM "Ri&nomina..." , 109

View file

@ -27,7 +27,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Bestand" {
MENUITEM "&Openen\tEnter" , ID_ACTIVATE
MENUITEM "&Verplaatsen...\tF7" , ID_FILE_MOVE
MENUITEM "&Kopiëren...\tF8" , 107
MENUITEM "&Kopiëren...\tF8" , ID_FILE_COPY
MENUITEM "Naar &klembord...\tF9" , 118
MENUITEM "Ver&wijderen\tDel" , 108
MENUITEM "&Naam wijzigen..." , 109

View file

@ -31,7 +31,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Plik" {
MENUITEM "&Otwórz\tEnter" , ID_ACTIVATE
MENUITEM "&Przenieœ...\tF7" , ID_FILE_MOVE
MENUITEM "&Kopiuj...\tF8" , 107
MENUITEM "&Kopiuj...\tF8" , ID_FILE_COPY
MENUITEM "W s&chowku...\tF9" , 118
MENUITEM "&Usuñ\tDel" , 108
MENUITEM "&Zmieñ nazwê..." , 109

View file

@ -30,7 +30,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Arquivo" {
MENUITEM "A&brir\tEnter" , ID_ACTIVATE
MENUITEM "&Mover...\tF7" , ID_FILE_MOVE
MENUITEM "&Copiar...\tF8" , 107
MENUITEM "&Copiar...\tF8" , ID_FILE_COPY
MENUITEM "&In Clipboard...\tF9" , 118
MENUITEM "E&xcluir\tDel" , 108
MENUITEM "Re&nomear..." , 109
@ -158,7 +158,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Ficheiro" {
MENUITEM "A&brir\tEnter" , ID_ACTIVATE
MENUITEM "&Mover...\tF7" , ID_FILE_MOVE
MENUITEM "&Copiar...\tF8" , 107
MENUITEM "&Copiar...\tF8" , ID_FILE_COPY
MENUITEM "&Na Area de Transferencia...\tF9" , 118
MENUITEM "E&xcluir\tDel" , 108
MENUITEM "Re&nomear..." , 109

View file

@ -43,6 +43,7 @@
#define ID_ACTIVATE 101
#define ID_EXECUTE 105
#define ID_FILE_MOVE 106
#define ID_FILE_COPY 107
#define ID_FILE_EXIT 115
#define ID_FORMAT_DISK 203
#define ID_CONNECT_NETWORK_DRIVE 252

View file

@ -21,6 +21,7 @@ IDA_WINEFILE ACCELERATORS DISCARDABLE
VK_F1, ID_HELP, VIRTKEY, NOINVERT
VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
VK_F7, ID_FILE_MOVE, VIRTKEY, NOINVERT
VK_F8, ID_FILE_COPY, VIRTKEY, NOINVERT
VK_RETURN, ID_ACTIVATE, VIRTKEY, NOINVERT
#ifndef _NO_EXTENSIONS
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT

View file

@ -27,7 +27,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&Ôàéë" {
MENUITEM "&Îòêðûòü\tEnter" , ID_ACTIVATE
MENUITEM "&Ïåðåìåñòèòü...\tF7" , ID_FILE_MOVE
MENUITEM "&Копировать...\tF8" , 107
MENUITEM "&Êîïèðîâàòü...\tF8" , ID_FILE_COPY
MENUITEM "&Â áóôåð îáìåíà...\tF9" , 118
MENUITEM "&Óäàëèòü\tDel" , 108
MENUITEM "Ïåðåèìåíîâàòü..." , 109

View file

@ -28,7 +28,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "&File" {
MENUITEM "&Open\tEnter" , ID_ACTIVATE
MENUITEM "&Move...\tF7" , ID_FILE_MOVE
MENUITEM "&Copy...\tF8" , 107
MENUITEM "&Copy...\tF8" , ID_FILE_COPY
MENUITEM "&In Clipboard...\tF9" , 118
MENUITEM "&Delete\tDel" , 108
MENUITEM "Re&name..." , 109

View file

@ -3811,6 +3811,33 @@ static void update_view_menu(ChildWnd* child)
}
BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
{
int len, ret;
get_path(pane->cur, target);
ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)target);
if (ret != IDOK)
return FALSE;
if (target[0]!='/' && target[1]!=':') {
get_path(pane->cur->up, source);
len = lstrlen(source);
if (source[len-1]!='\\' && source[len-1]!='/')
source[len++] = '/';
lstrcpy(source+len, target);
lstrcpy(target, source);
}
get_path(pane->cur, source);
return TRUE;
}
static IContextMenu2* s_pctxmenu2 = NULL;
#ifndef __MINGW32__ /* IContextMenu3 missing in MinGW (as of 6.2.2005) */
@ -4099,39 +4126,25 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
break;
case ID_FILE_MOVE: {
TCHAR new_name[BUFFER_LEN], old_name[BUFFER_LEN];
int len, ret;
TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
get_path(pane->cur, new_name);
ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), hwnd, DestinationDlgProc, (LPARAM)new_name);
if (ret != IDOK)
break;
if (new_name[0]!='/' && new_name[1]!=':') {
get_path(pane->cur->up, old_name);
len = lstrlen(old_name);
if (old_name[len-1]!='\\' && old_name[len-1]!='/')
old_name[len++] = '/';
lstrcpy(old_name+len, new_name);
lstrcpy(new_name, old_name);
}
get_path(pane->cur, old_name);
if (MoveFileEx(old_name, new_name, MOVEFILE_COPY_ALLOWED)) {
if (pane->treePane) {
pane->root->scanned = FALSE;
pane->cur = pane->root;
activate_entry(child, pane, hwnd);
}
else
if (prompt_target(pane, source, target)) {
if (MoveFileEx(source, target, MOVEFILE_COPY_ALLOWED))
refresh_child(child);
}
else
display_error(hwnd, GetLastError());
}
break;}
case ID_FILE_COPY: {
TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
if (prompt_target(pane, source, target)) {
if (CopyFileEx(source, target, NULL, NULL, NULL, COPY_FILE_RESTARTABLE|COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
refresh_child(child);
else
display_error(hwnd, GetLastError());
}
break;}
case ID_VIEW_SORT_NAME:

View file

@ -28,7 +28,7 @@ IDM_WINEFILE MENU FIXED IMPURE
POPUP "文件(&F" {
MENUITEM "打开(&O\tEnter" , ID_ACTIVATE
MENUITEM "移动(&M...\tF7" , ID_FILE_MOVE
MENUITEM "复制(&C...\tF8" , 107
MENUITEM "复制(&C...\tF8" , ID_FILE_COPY
MENUITEM "位于剪贴板(&I...\tF9" , 118
MENUITEM "删除(&D\tDel" , 108
MENUITEM "改名(&N..." , 109