Changeset 2062 for trunk/eraser


Ignore:
Timestamp:
5/4/2010 8:54:59 AM (4 years ago)
Author:
lowjoel
Message:

Implemented the Context menu half of the Secure Move function.

Location:
trunk/eraser
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser/Eraser.Shell/CtxMenu.cpp

    r2060 r2062  
    274274        if (applicableActions & ACTION_SECURE_MOVE) 
    275275        { 
    276             InsertSeparator(hSubmenu); 
     276            //Insert the separator if we aren't the only menu item 
     277            if (applicableActions != ACTION_SECURE_MOVE) 
     278                InsertSeparator(hSubmenu); 
     279 
    277280            InsertMenu(hSubmenu, ACTION_SECURE_MOVE, MF_BYPOSITION, uID++, 
    278281                LoadString(IDS_ACTION_SECUREMOVE).c_str());         //Secure Move 
     
    511514            break; 
    512515 
     516        case ACTION_SECURE_MOVE: 
     517            //Securely move the file/folder. If the DragDropDestinationDirectory member 
     518            //is blank, query the user for a path to copy the items to 
     519            if (DragDropDestinationDirectory.empty()) 
     520            { 
     521                BROWSEINFO info; 
     522                ::ZeroMemory(&info, sizeof(info)); 
     523 
     524                //Set the title of the dialog. 
     525                std::wstring title(LoadString(IDS_MESSAGE_SELECT_MOVE_DESTINATION)); 
     526                std::vector<wchar_t> titleBuffer(title.length() + 1); 
     527                wcscpy_s(&titleBuffer.front(), title.length() + 1, title.c_str()); 
     528 
     529                //Then set the display settings. 
     530                info.lpszTitle = &titleBuffer.front(); 
     531                info.ulFlags = BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS | BIF_USENEWUI | BIF_SHAREABLE; 
     532 
     533                //Display the dialog. 
     534                PIDLIST_ABSOLUTE pidl = SHBrowseForFolder(&info); 
     535 
     536                wchar_t buffer[MAX_PATH]; 
     537                bool pathSucceeded = SHGetPathFromIDList(pidl, buffer); 
     538                ILFree(pidl); 
     539                if (pathSucceeded) 
     540                    DragDropDestinationDirectory = buffer; 
     541                else 
     542                    return E_ABORT; 
     543            } 
     544 
     545            commandLine += L"\"/destination=" + DragDropDestinationDirectory + L"\""; 
     546            break; 
     547 
    513548        default: 
    514549            if (!(pCmdInfo->fMask & CMIC_MASK_FLAG_NO_UI)) 
     
    559594        case INVOKEREASON_FILEFOLDER: 
    560595            result |= ACTION_ERASE | ACTION_ERASE_ON_RESTART | ACTION_ERASE_UNUSED_SPACE; 
    561 #if 0 
    562596        case INVOKEREASON_DRAGDROP: 
    563597            result |= ACTION_SECURE_MOVE; 
    564 #endif 
    565598        } 
    566599 
     
    815848            finalParameters += L"/action=EraseUnusedSpace "; 
    816849            break; 
     850        case ACTION_SECURE_MOVE: 
     851            finalParameters += L"/action=SecureMove "; 
     852            break; 
    817853        default: 
    818854            return; 
  • trunk/eraser/Eraser.Shell/Eraser.Shell.rc

    r2008 r2062  
    221221END 
    222222 
     223STRINGTABLE  
     224BEGIN 
     225    IDS_MESSAGE_SELECT_MOVE_DESTINATION  
     226                            "Select the destination of the selected items" 
     227END 
     228 
    223229#endif    // English (Neutral) resources 
    224230///////////////////////////////////////////////////////////////////////////// 
  • trunk/eraser/Eraser.Shell/resource.h

    r2006 r2062  
    11//{{NO_DEPENDENCIES}} 
    22// Microsoft Visual C++ generated include file. 
    3 // Used by ShellExt.rc 
     3// Used by Eraser.Shell.rc 
    44// 
    55#define IDS_PROJNAME                    100 
     
    2222#define IDS_ERROR_MISC                  405 
    2323#define IDS_ERROR_CANNOT_GENERATE_TEMP_FILE 406 
     24#define IDS_MESSAGE_SELECT_MOVE_DESTINATION 500 
    2425 
    2526// Next default values for new objects 
  • trunk/eraser/Eraser/Program.cs

    r2051 r2062  
    115115            [Arg("recycleBin", "The recycle bin as an erasure target", typeof(string), false, null, null)] 
    116116            public bool RecycleBin { get; set; } 
     117 
     118            /// <summary> 
     119            /// The destination for secure move operations, only valid when 
     120            /// <see cref="ShellAction"/> is <see cref="ShellActions.SecureMove"/> 
     121            /// </summary> 
     122            [Arg("destination", "The destination for secure move operations", typeof(string), false, null, null)] 
     123            public string Destination { get; set; } 
    117124        } 
    118125 
     
    132139            /// Erase the unused space on the drive. 
    133140            /// </summary> 
    134             EraseUnusedSpace 
     141            EraseUnusedSpace, 
     142 
     143            /// <summary> 
     144            /// Securely moves a file from one drive to another (simple rename if the source and 
     145            /// destination drives are the same) 
     146            /// </summary> 
     147            SecureMove 
    135148        } 
    136149 
Note: See TracChangeset for help on using the changeset viewer.