OSDN Git Service

書庫を複製する機能を追加。
[tpi/lychee.git] / src / lychee / dlg_process.cpp
index 45a269b..c95d544 100644 (file)
@@ -63,6 +63,8 @@ void ProcessDialog::OnInit(wxInitDialogEvent &)
        this->gFile             = XRCCTRL(* this, "gFile",        wxGauge);\r
        this->gArchive          = XRCCTRL(* this, "gArchive",     wxGauge);\r
        this->fCancel           = false;\r
+       this->nOverwriteMode    = wxID_OK;\r
+       this->Update();\r
        g_procDlg = this;\r
 \r
        ::wxXmlResource::Get()->Unload(L_DIR_S_XRC wxT("dlg_process.xrc"));\r
@@ -131,6 +133,7 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                        this->ebSource->ChangeValue(piInfo->fiInfo.fnFileName.GetFullPath());\r
                        this->gArchive->SetRange(piInfo->fiInfo.nUnpackedSize);\r
                        this->gArchive->SetValue(0);\r
+                       this->Update();\r
                        s_nInterval = piInfo->fiInfo.nUnpackedSize / 10;\r
                        break;\r
                case 0x1001:\r
@@ -174,8 +177,7 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                }\r
                case TPI_PARAM_NEXTVOLUME:\r
                {\r
-                       wxFileDialog fd(this, _("Select next volume of: ") + piInfo->fiInfo.fnFileName.GetFullName());\r
-                       fd.SetWindowStyleFlag(wxFD_FILE_MUST_EXIST);\r
+                       wxFileDialog fd(this, _("Choose next volume of: ") + piInfo->fiInfo.fnFileName.GetFullName(), piInfo->fiInfo.fnFileName.GetPath(), wxEmptyString, wxFileSelectorDefaultWildcardStr, wxFD_OPEN | wxFD_FILE_MUST_EXIST);\r
                        if (fd.ShowModal() == wxID_CANCEL)\r
                        {\r
                                this->fCancel = true;\r
@@ -187,19 +189,22 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                        if (piInfo->fnDestination.FileExists() || ::wxDirExists(piInfo->fnDestination.GetFullPath()))\r
                        {\r
                                // 上書き確認を行う。\r
-                               static int nMode = wxID_OK;\r
                                bool bPerm = false;\r
-                               if (nMode == wxID_OK)\r
+                               if (this->nOverwriteMode == wxID_OK)\r
                                {\r
                                        OverwriteDialog odDlg;\r
                                        odDlg.fnExist = & piInfo->fnDestination;\r
                                        odDlg.tmWrite = & piInfo->fiInfo.tmModified;\r
                                        odDlg.nWriteSize = piInfo->fiInfo.nUnpackedSize;\r
 \r
-                                       nMode = odDlg.ShowModal();\r
+                                       this->nOverwriteMode = odDlg.ShowModal();\r
                                        bPerm = odDlg.cbApplyAll->IsChecked();\r
                                }\r
-                               switch (nMode)\r
+                               else\r
+                               {\r
+                                       bPerm = true;\r
+                               }\r
+                               switch (this->nOverwriteMode)\r
                                {\r
                                case wxID_CANCEL:\r
                                        this->fCancel = true;\r
@@ -213,7 +218,7 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                                        else if (::wxDirExists(piInfo->fnDestination.GetFullPath()))\r
                                        {\r
                                                // TODO: 再帰削除。\r
-                                               ::wxRmDir(piInfo->fnDestination.GetFullPath());\r
+                                               ::wxRmdir(piInfo->fnDestination.GetFullPath());\r
                                        }\r
                                        break;\r
                                case 1:\r
@@ -226,7 +231,7 @@ int ProcessDialog::CallbackProc(unsigned int _uMsg, void * _pStructure)
                                }\r
                                if (! bPerm)\r
                                {\r
-                                       nMode = wxID_OK;\r
+                                       this->nOverwriteMode = wxID_OK;\r
                                }\r
                        }\r
                        break;\r
@@ -280,7 +285,7 @@ void OverwriteDialog::OnInit(wxInitDialogEvent &)
        XRCCTRL(* this, "stExistTime", wxStaticText)->SetLabel(this->fnExist->GetModificationTime().Format(_("%Y/%m/%d %H:%M:%S modified, ")));\r
        XRCCTRL(* this, "stExistSize", wxStaticText)->SetLabel(this->fnExist->GetHumanReadableSize());\r
        XRCCTRL(* this, "stWriteTime", wxStaticText)->SetLabel(this->tmWrite->Format(_("%Y/%m/%d %H:%M:%S modified, ")));\r
-       XRCCTRL(* this, "stWriteSize", wxStaticText)->SetLabel(wxFileName::GetHumanReadableSize(this->nWriteSize));\r
+       XRCCTRL(* this, "stWriteSize", wxStaticText)->SetLabel(wxFileName::GetHumanReadableSize((wxULongLong) this->nWriteSize));\r
        XRCCTRL(* this, "sbIcon", wxStaticBitmap)->SetIcon(GetFileTypeIcon(* this->fnExist));\r
 }\r
 \r
@@ -316,9 +321,8 @@ void OverwriteDialog::OnBtnAuto(wxCommandEvent&)
 \r
 void OverwriteDialog::OnBtnBrowse(wxCommandEvent&)\r
 {\r
-       wxFileDialog fd(this);\r
-       fd.SetWindowStyleFlag(wxFD_SAVE | wxFD_OVERWRITE_PROMPT);\r
-       fd.SetPath(this->ebTarget->GetValue());\r
+       wxFileName fn(this->ebTarget->GetValue());\r
+       wxFileDialog fd(this, _("Choose a file"), fn.GetPath(), fn.GetFullName(), wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);\r
        if (fd.ShowModal() == wxID_OK)\r
        {\r
                this->ebTarget->SetValue(fd.GetPath());\r