diff src/delwhite.cpp @ 4:a505f7417742

v0.1 release
author pyon@macmini
date Thu, 06 Oct 2011 07:56:12 +0900
parents a5bddd859104
children
line wrap: on
line diff
--- a/src/delwhite.cpp	Tue Oct 04 07:43:08 2011 +0900
+++ b/src/delwhite.cpp	Thu Oct 06 07:56:12 2011 +0900
@@ -1,18 +1,9 @@
 // Filename   : delwhite.cpp
-// Last Change: 03-Oct-2011.
+// Last Change: 05-Oct-2011.
 //
 
 #include "delwhite.h"
 
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWidgets headers)
-#ifndef WX_PRECOMP
-    #include "wx/utils.h"
-    #include "wx/dir.h"
-    #include "wx/file.h"
-#endif
-
-
 // constructor
 FrameDelWhite::FrameDelWhite( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
 {
@@ -71,6 +62,22 @@
 
 void FrameDelWhite::DeleteImage(wxCommandEvent& WXUNUSED(event))
 {
+    wxDateTime now = wxDateTime::Now();
+    wxString trash = wxGetCwd() + wxFILE_SEP_PATH + wxT("trash") + wxFILE_SEP_PATH + now.Format(wxT("%Y%m%d%H%M%S"));
+    wxMkdir( trash );
+
+    long item = -1;
+    for ( ; ; ) {
+        item = m_listCtrl->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
+        if ( item == -1 )
+            break;
+        wxString file = m_listCtrl->GetItemText( item );
+        
+        wxString from = m_dir + wxFILE_SEP_PATH + file;
+        wxString to   = trash + wxFILE_SEP_PATH + file;
+        wxRenameFile( from, to, false );
+    }
+    LoadImages();
     return;
 }