[BEHAVIOUR_MODIFIED] Change "Delete file" command to "Move to Recycle Bin".

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@992 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-12-07 01:33:08 +00:00
parent 8f1e8ccda6
commit cca224d2e4
6 changed files with 26 additions and 9 deletions

View File

@ -42,4 +42,4 @@ Author:
*******
Don Ho <don.h@free.fr>
http://notepad-plus-plus.org/author
http://notepad-plus-plus.org/contributors/author.html

View File

@ -254,7 +254,7 @@
<Item CMID="8" name="Filename to Clipboard"/>
<Item CMID="9" name="Current Dir. Path to Clipboard"/>
<Item CMID="10" name="Rename"/>
<Item CMID="11" name="Delete"/>
<Item CMID="11" name="Move to Recycle Bin"/>
<Item CMID="12" name="Read-Only"/>
<Item CMID="13" name="Clear Read-Only Flag"/>
<Item CMID="14" name="Move to New Instance"/>

View File

@ -1619,7 +1619,7 @@ int Notepad_plus::doCloseOrNot(const TCHAR *fn)
int Notepad_plus::doDeleteOrNot(const TCHAR *fn)
{
TCHAR pattern[128] = TEXT("The file \"%s\"\rwill be deleted from your disk and this document will be closed.\rContinue?");
TCHAR pattern[128] = TEXT("The file \"%s\"\rwill be moved to your Recycle Bin and this document will be closed.\rContinue?");
TCHAR phrase[512];
wsprintf(phrase, pattern, fn);
return doActionOrNot(TEXT("Delete file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
@ -5101,7 +5101,7 @@ struct Quote{
const char *_quote;
};
const int nbQuote = 98;
const int nbQuote = 99;
Quote quotes[nbQuote] = {
{"Notepad++", "Notepad++ is written in C++ and uses pure Win32 API and STL which ensures a higher execution speed and smaller program size.\nBy optimizing as many routines as possible without losing user friendliness, Notepad++ is trying to reduce the world carbon dioxide emissions. When using less CPU power, the PC can throttle down and reduce power consumption, resulting in a greener environment."},
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
@ -5195,6 +5195,7 @@ Quote quotes[nbQuote] = {
{"Anonymous #61", "Your mother is so fat,\nthe recursive function computing her mass causes a stack overflow."},
{"Anonymous #62", "Oral sex makes my day, but anal sex makes my hole weak."},
{"Anonymous #63", "I'm not saying I am Batman, I am just saying no one has ever seen me and Batman in the same room togather."},
{"Anonymous #64", "I took a taxi today.\nThe driver told me \"I love my job, I own this car, I've got my own business, I'm my own boss, NO ONE tells me what to do!\"\nI said \"TURN LEFT HERE\".\n"},
{"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company) to shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."},
{"Hustle Man", "Politicians are like sperm.\nOne in a million turn out to be an actual human being."},
{"Confucius", "It's good to meet girl in park.\nBut better to park meat in girl."},

View File

@ -206,7 +206,7 @@ BEGIN
MENUITEM "&Close", IDM_FILE_CLOSE
MENUITEM "Clos&e All", IDM_FILE_CLOSEALL
MENUITEM "Close All but Active Document", IDM_FILE_CLOSEALL_BUT_CURRENT
MENUITEM "Delete from Disk", IDM_FILE_DELETE
MENUITEM "Move to Recycle Bin", IDM_FILE_DELETE
MENUITEM SEPARATOR
MENUITEM "Load Session...", IDM_FILE_LOADSESSION
MENUITEM "Save Session...", IDM_FILE_SAVESESSION

View File

@ -318,7 +318,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVE, TEXT("Save")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_SAVEAS, TEXT("Save As...")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RENAME, TEXT("Rename")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_DELETE, TEXT("Delete")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_DELETE, TEXT("Move to Recycle Bin")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RELOAD, TEXT("Reload")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, TEXT("Print")));
itemUnitArray.push_back(MenuItemUnit(0, NULL));

View File

@ -575,10 +575,26 @@ bool FileManager::reloadBufferDeferred(BufferID id)
bool FileManager::deleteFile(BufferID id)
{
Buffer * buf = getBufferByID(id);
const TCHAR *fileNamePath = buf->getFullPathName();
if (!PathFileExists(fileNamePath))
generic_string fileNamePath = buf->getFullPathName();
// Make sure to form a string with double '\0' terminator.
fileNamePath.append(1, '\0');
if (!PathFileExists(fileNamePath.c_str()))
return false;
return ::DeleteFile(fileNamePath) != 0;
//return ::DeleteFile(fileNamePath) != 0;
SHFILEOPSTRUCT fileOpStruct = {0};
fileOpStruct.hwnd = NULL;
fileOpStruct.pFrom = fileNamePath.c_str();
fileOpStruct.pTo = NULL;
fileOpStruct.wFunc = FO_DELETE;
fileOpStruct.fFlags = FOF_ALLOWUNDO;
fileOpStruct.fAnyOperationsAborted = false;
fileOpStruct.hNameMappings = NULL;
fileOpStruct.lpszProgressTitle = NULL;
return SHFileOperation(&fileOpStruct) == 0;
}
bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)