- implement commands 'copy' and 'delete'
- fix 'move' command for the left pane
This commit is contained in:
parent
e2511e195e
commit
0a0fffa5eb
|
@ -31,9 +31,9 @@ IDM_WINEFILE MENU FIXED IMPURE
|
|||
POPUP "&Soubor" {
|
||||
MENUITEM "&Otevøít\tEnter" , ID_ACTIVATE
|
||||
MENUITEM "Pøe&sunout...\tF7" , ID_FILE_MOVE
|
||||
MENUITEM "&Kopírovat...\tF8" , 107
|
||||
MENUITEM "&Kopírovat...\tF8" , ID_FILE_COPY
|
||||
MENUITEM "&Do schránky...\tF9" , 118
|
||||
MENUITEM "&Smazat\tDel" , 108
|
||||
MENUITEM "&Smazat\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Pøejme&novat..." , 109
|
||||
MENUITEM "Vlastnost&i...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -30,9 +30,9 @@ 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 "&Löschen\tEntf" , ID_FILE_DELETE
|
||||
MENUITEM "&Umbenennen..." , 109
|
||||
MENUITEM "&Eigenschaften...\tAlt+Eingabetaste" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -30,9 +30,9 @@ 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 "&Delete\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Re&name..." , 109
|
||||
MENUITEM "Propert&ies...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -28,9 +28,9 @@ 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 "&Eliminar\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "&Renombrar..." , 109
|
||||
MENUITEM "&Propiedades...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -31,9 +31,9 @@ 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 "&Effacer\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Re&nommer..." , 109
|
||||
MENUITEM "&Propriétés...\tAlt+Entree" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -31,9 +31,9 @@ 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örlés\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Át&nevezés..." , 109
|
||||
MENUITEM "T&ulajdonságok...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -31,9 +31,9 @@ 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 "&Cancella\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Ri&nomina..." , 109
|
||||
MENUITEM "Propri&età...\tAlt+Invio" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -27,9 +27,9 @@ 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 "Ver&wijderen\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "&Naam wijzigen..." , 109
|
||||
MENUITEM "&Eigenschappen...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -31,9 +31,9 @@ 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 "&Usuñ\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "&Zmieñ nazwê..." , 109
|
||||
MENUITEM "Ustawie&nia...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -30,9 +30,9 @@ 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 "E&xcluir\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Re&nomear..." , 109
|
||||
MENUITEM "&Propriedades...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
@ -157,9 +157,9 @@ 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 "E&xcluir\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Re&nomear..." , 109
|
||||
MENUITEM "&Propriedades...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -27,9 +27,9 @@ 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 "&Óäàëèòü\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Ïåðåèìåíîâàòü..." , 109
|
||||
MENUITEM "Ñâîéñòâà...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -28,9 +28,9 @@ 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 "&Delete\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "Re&name..." , 109
|
||||
MENUITEM "Propert&ies...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -31,9 +31,9 @@ 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 "&Ta bort\tDel", ID_FILE_DELETE
|
||||
MENUITEM "&Byt namn...", 109
|
||||
MENUITEM "&Egenskaper...\tAlt+Enter", ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -28,9 +28,9 @@ 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 "删除(&D)\tDel" , ID_FILE_DELETE
|
||||
MENUITEM "改名(&N)..." , 109
|
||||
MENUITEM "属性(&I)...\tAlt+Enter" , ID_EDIT_PROPERTIES
|
||||
MENUITEM SEPARATOR
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
#define ID_ACTIVATE 101
|
||||
#define ID_EXECUTE 105
|
||||
#define ID_FILE_MOVE 106
|
||||
#define ID_FILE_COPY 107
|
||||
#define ID_FILE_DELETE 108
|
||||
#define ID_FILE_EXIT 115
|
||||
#define ID_FORMAT_DISK 203
|
||||
#define ID_CONNECT_NETWORK_DRIVE 252
|
||||
|
|
|
@ -21,6 +21,8 @@ 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_DELETE, ID_FILE_DELETE, VIRTKEY, NOINVERT
|
||||
VK_RETURN, ID_ACTIVATE, VIRTKEY, NOINVERT
|
||||
#ifndef _NO_EXTENSIONS
|
||||
"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT
|
||||
|
|
|
@ -3747,6 +3747,55 @@ static void update_view_menu(ChildWnd* child)
|
|||
}
|
||||
|
||||
|
||||
static BOOL is_directory(LPCTSTR target)
|
||||
{
|
||||
/*TODO correctly handle UNIX paths */
|
||||
DWORD target_attr = GetFileAttributes(target);
|
||||
|
||||
if (target_attr == INVALID_FILE_ATTRIBUTES)
|
||||
return FALSE;
|
||||
|
||||
return target_attr&FILE_ATTRIBUTE_DIRECTORY? TRUE: FALSE;
|
||||
}
|
||||
|
||||
static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
int len;
|
||||
|
||||
get_path(pane->cur, path);
|
||||
|
||||
if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)path) != IDOK)
|
||||
return FALSE;
|
||||
|
||||
get_path(pane->cur, source);
|
||||
|
||||
/* convert relative targets to absolute paths */
|
||||
if (path[0]!='/' && path[1]!=':') {
|
||||
get_path(pane->cur->up, target);
|
||||
len = lstrlen(target);
|
||||
|
||||
if (target[len-1]!='\\' && target[len-1]!='/')
|
||||
target[len++] = '/';
|
||||
|
||||
lstrcpy(target+len, path);
|
||||
} else
|
||||
lstrcpy(target, path);
|
||||
|
||||
/* If the target already exists as directory, create a new target below this. */
|
||||
if (is_directory(path)) {
|
||||
TCHAR fname[_MAX_FNAME], ext[_MAX_EXT];
|
||||
const static TCHAR sAppend[] = {'%','s','/','%','s','%','s','\0'};
|
||||
|
||||
_tsplitpath(source, NULL, NULL, fname, ext);
|
||||
|
||||
wsprintf(target, sAppend, path, fname, ext);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static IContextMenu2* s_pctxmenu2 = NULL;
|
||||
static IContextMenu3* s_pctxmenu3 = NULL;
|
||||
|
||||
|
@ -4023,39 +4072,43 @@ 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);
|
||||
if (prompt_target(pane, source, target)) {
|
||||
SHFILEOPSTRUCT shfo = {hwnd, FO_MOVE, source, target};
|
||||
|
||||
ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), hwnd, DestinationDlgProc, (LPARAM)new_name);
|
||||
if (ret != IDOK)
|
||||
break;
|
||||
source[lstrlen(source)+1] = '\0';
|
||||
target[lstrlen(target)+1] = '\0';
|
||||
|
||||
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 (!SHFileOperation(&shfo))
|
||||
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)) {
|
||||
SHFILEOPSTRUCT shfo = {hwnd, FO_COPY, source, target};
|
||||
|
||||
source[lstrlen(source)+1] = '\0';
|
||||
target[lstrlen(target)+1] = '\0';
|
||||
|
||||
if (!SHFileOperation(&shfo))
|
||||
refresh_child(child);
|
||||
}
|
||||
break;}
|
||||
|
||||
case ID_FILE_DELETE: {
|
||||
TCHAR path[BUFFER_LEN];
|
||||
SHFILEOPSTRUCT shfo = {hwnd, FO_DELETE, path};
|
||||
|
||||
get_path(pane->cur, path);
|
||||
|
||||
path[lstrlen(path)+1] = '\0';
|
||||
|
||||
if (!SHFileOperation(&shfo))
|
||||
refresh_child(child);
|
||||
break;}
|
||||
|
||||
case ID_VIEW_SORT_NAME:
|
||||
|
|
Loading…
Reference in New Issue