forked from mia/Aegisub
Disable the Delete and Extract buttons in the attachment dialog after deleting the selected attachments
Originally committed to SVN as r6041.
This commit is contained in:
parent
38e2403001
commit
384d2bc9c2
1 changed files with 20 additions and 22 deletions
|
@ -226,32 +226,28 @@ void DialogAttachments::OnAttachGraphics(wxCommandEvent &) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogAttachments::OnExtract(wxCommandEvent &) {
|
void DialogAttachments::OnExtract(wxCommandEvent &) {
|
||||||
// Check if there's a selection
|
|
||||||
int i = listView->GetFirstSelected();
|
int i = listView->GetFirstSelected();
|
||||||
|
if (i == -1) return;
|
||||||
|
|
||||||
// Get path
|
wxString path;
|
||||||
if (i != -1) {
|
bool fullPath = false;
|
||||||
wxString path;
|
|
||||||
bool fullPath = false;
|
|
||||||
|
|
||||||
// Multiple or single?
|
// Multiple or single?
|
||||||
if (listView->GetNextSelected(i) != -1) path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
|
if (listView->GetNextSelected(i) != -1)
|
||||||
else {
|
path = wxDirSelector(_("Select the path to save the files to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString())) + "/";
|
||||||
// Default path
|
else {
|
||||||
wxString defPath = ((AssAttachment*) wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
|
// Default path
|
||||||
path = wxFileSelector(_("Select the path to save the file to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()),defPath);
|
wxString defPath = ((AssAttachment*)wxUIntToPtr(listView->GetItemData(i)))->GetFileName();
|
||||||
fullPath = true;
|
path = wxFileSelector(_("Select the path to save the file to:"),lagi_wxString(OPT_GET("Path/Fonts Collector Destination")->GetString()),defPath);
|
||||||
}
|
fullPath = true;
|
||||||
if (path.IsEmpty()) return;
|
}
|
||||||
|
if (!path) return;
|
||||||
|
|
||||||
// Loop through items in list
|
// Loop through items in list
|
||||||
while (i != -1) {
|
while (i != -1) {
|
||||||
AssAttachment *attach = (AssAttachment*) wxUIntToPtr(listView->GetItemData(i));
|
AssAttachment *attach = (AssAttachment*)wxUIntToPtr(listView->GetItemData(i));
|
||||||
wxString filename = path;
|
attach->Extract(fullPath ? path : path + attach->GetFileName());
|
||||||
if (!fullPath) filename += attach->GetFileName();
|
i = listView->GetNextSelected(i);
|
||||||
attach->Extract(filename);
|
|
||||||
i = listView->GetNextSelected(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,6 +262,8 @@ void DialogAttachments::OnDelete(wxCommandEvent &) {
|
||||||
ass->Commit(_("remove attachment"), AssFile::COMMIT_ATTACHMENT);
|
ass->Commit(_("remove attachment"), AssFile::COMMIT_ATTACHMENT);
|
||||||
|
|
||||||
UpdateList();
|
UpdateList();
|
||||||
|
extractButton->Enable(false);
|
||||||
|
deleteButton->Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogAttachments::OnListClick(wxListEvent &) {
|
void DialogAttachments::OnListClick(wxListEvent &) {
|
||||||
|
|
Loading…
Reference in a new issue