void WFileList::UpdateItem(unsigned int sfid) { Enctain::Container cnt = wmain->container; const std::string& filetype = cnt.GetSubFileProperty(sfid, "Filetype"); int filetypeimage = 0; if (filetype == "text") { filetypeimage = 1; } SetItemImage(sfid, filetypeimage); UpdateItemColumns(sfid); wmain->UpdateSubFileCaption(sfid); }
void WFileList::ResetItems() { DeleteAllItems(); Enctain::Container cnt = wmain->container; for (unsigned int fi = 0; fi < cnt.CountSubFile(); ++fi) { const std::string& filetype = cnt.GetSubFileProperty(fi, "Filetype"); int filetypeimage = 0; if (filetype == "text") { filetypeimage = 1; } InsertItem(fi, filetypeimage); UpdateItemColumns(fi); } }
void WFileList::UpdateItemColumns(unsigned int fi) { Enctain::Container cnt = wmain->container; if (displaymode == 2) { static const wxString choiceCompression_choices[] = { _("None"), _("ZLib"), _("BZ2") }; static const wxString choiceEncryption_choices[] = { _("None"), _("Serpent") }; int col = 0; if (metasettings.show_filename >= 0) { SetItem(fi, col++, strSTL2WX(cnt.GetSubFileProperty(fi, "Name"))); } if (metasettings.show_size >= 0) { SetItem(fi, col++, wxString::Format(_T("%u"), cnt.GetSubFileSize(fi))); } if (metasettings.show_compressed >= 0) { SetItem(fi, col++, wxString::Format(_T("%u"), cnt.GetSubFileStorageSize(fi))); } if (metasettings.show_compression >= 0) { unsigned int comp = cnt.GetSubFileCompression(fi); if (comp < sizeof(choiceCompression_choices)) SetItem(fi, col++, choiceCompression_choices[comp]); else SetItem(fi, col++, _("<unknown>")); } if (metasettings.show_encryption >= 0) { unsigned int encr = cnt.GetSubFileEncryption(fi); if (encr < sizeof(choiceEncryption_choices)) SetItem(fi, col++, choiceEncryption_choices[encr]); else SetItem(fi, col++, _("<unknown>")); } if (metasettings.show_mtime >= 0) { std::string timestr = cnt.GetSubFileProperty(fi, "MTime"); if (timestr.size() == sizeof(time_t)) { wxDateTime ctime(*(time_t*)timestr.data()); SetItem(fi, col++, ctime.Format(_("%c"))); } } if (metasettings.show_ctime >= 0) { std::string timestr = cnt.GetSubFileProperty(fi, "CTime"); if (timestr.size() == sizeof(time_t)) { wxDateTime ctime(*(time_t*)timestr.data()); SetItem(fi, col++, ctime.Format(_("%c"))); } } if (metasettings.show_author >= 0) { SetItem(fi, col++, strSTL2WX(cnt.GetSubFileProperty(fi, "Author"))); } if (metasettings.show_subject >= 0) { SetItem(fi, col++, strSTL2WX(cnt.GetSubFileProperty(fi, "Subject"))); } } else { SetItem(fi, 0, strSTL2WX(cnt.GetSubFileProperty(fi, "Name"))); } }
WFileProperties::WFileProperties(WCryptoTE* parent, int _subfileid, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long WXUNUSED(style)) : wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxTHICK_FRAME), wmain(parent), subfileid(_subfileid) { SetMinSize(wxSize(350, 0)); // begin wxGlade: WFileProperties::WFileProperties textIdentifier = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); textFilename = new wxTextCtrl(this, wxID_ANY, wxEmptyString); textAuthor = new wxTextCtrl(this, wxID_ANY, wxEmptyString); textSize = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); textCompressed = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); textCTime = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); textMTime = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY); const wxString choiceType_choices[] = { _("Binary Data"), _("Text File"), _("Image File") }; choiceType = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3, choiceType_choices, 0); const wxString choiceCompression_choices[] = { _("None"), _("ZLib"), _("BZ2") }; choiceCompression = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 3, choiceCompression_choices, 0); const wxString choiceEncryption_choices[] = { _("None (Don't Use)"), _("Serpent 256 keybits") }; choiceEncryption = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 2, choiceEncryption_choices, 0); textSubject = new wxTextCtrl(this, wxID_ANY, wxEmptyString); textDescription = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); buttonOK = new wxButton(this, wxID_OK, wxEmptyString); buttonCancel = new wxButton(this, wxID_CANCEL, wxEmptyString); set_properties(); do_layout(); // end wxGlade Enctain::Container cnt = wmain->container; if (subfileid < 0) return; textIdentifier->SetValue(wxString::Format(_T("%u"), subfileid)); SetTitle(wxString::Format(_("Properties of SubFile %u"), subfileid)); textFilename->SetValue(strSTL2WX(cnt.GetSubFileProperty(subfileid, "Name"))); textAuthor->SetValue(strSTL2WX(cnt.GetSubFileProperty(subfileid, "Author"))); textSize->SetValue(wxString::Format(_T("%u"), cnt.GetSubFileSize(subfileid))); textCompressed->SetValue(wxString::Format(_T("%u"), cnt.GetSubFileStorageSize(subfileid))); std::string timestr = cnt.GetSubFileProperty(subfileid, "CTime"); if (timestr.size() == sizeof(time_t)) { wxDateTime ctime(*(time_t*)timestr.data()); textCTime->SetValue(ctime.Format(_("%c"))); } timestr = cnt.GetSubFileProperty(subfileid, "MTime"); if (timestr.size() == sizeof(time_t)) { wxDateTime mtime(*(time_t*)timestr.data()); textMTime->SetValue(mtime.Format(_("%c"))); } const std::string& filetype = cnt.GetSubFileProperty(subfileid, "Filetype"); if (filetype == "text") { choiceType->SetSelection(1); } else { choiceType->SetSelection(0); } choiceCompression->SetSelection(cnt.GetSubFileCompression(subfileid)); choiceEncryption->SetSelection(cnt.GetSubFileEncryption(subfileid)); textSubject->SetValue(strSTL2WX(cnt.GetSubFileProperty(subfileid, "Subject"))); textDescription->SetValue(strSTL2WX(cnt.GetSubFileProperty(subfileid, "Description"))); textFilename->SetFocus(); }