X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f59d80ca00e0ef9963c771a26decd605a85d5596..64d78265d0256eb00ae59b717aa97e4c5786e003:/src/generic/filedlgg.cpp diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index a39a066ea5..909355ded6 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -133,6 +133,7 @@ wxFileData::wxFileData( const wxString &name, const wxString &fname ) m_month = t->tm_mon+1; m_day = t->tm_mday; m_year = t->tm_year; + m_year += 1900; m_permissions.sprintf( wxT("%c%c%c"), ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? wxT('r') : wxT('-')), @@ -181,30 +182,37 @@ wxString wxFileData::GetEntry( int num ) switch (num) { case 0: + { s = m_name; - break; + } + break; case 1: + { if (m_isDir) s = _(""); else if (m_isLink) s = _(""); else s = LongToString( m_size ); - break; + } + break; case 2: + { if (m_day < 10) s = wxT("0"); else s = wxT(""); s += IntToString( m_day ); s += wxT("."); if (m_month < 10) s += wxT("0"); s += IntToString( m_month ); s += wxT("."); - if (m_year < 10) s += wxT("0"); // this should happen real soon... s += IntToString( m_year ); - break; + } + break; case 3: + { if (m_hour < 10) s = wxT("0"); else s = wxT(""); s += IntToString( m_hour ); s += wxT(":"); if (m_minute < 10) s += wxT("0"); s += IntToString( m_minute ); break; + } case 4: s = m_permissions; break; @@ -339,7 +347,7 @@ void wxFileCtrl::Update() { InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, 130 ); InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, 60 ); - InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT, 55 ); + InsertColumn( 2, _("Date"), wxLIST_FORMAT_LEFT, 70 ); InsertColumn( 3, _("Time"), wxLIST_FORMAT_LEFT, 50 ); InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, 120 ); } @@ -388,6 +396,10 @@ void wxFileCtrl::Update() } SortItems( ListCompare, 0 ); + + SetColumnWidth( 2, wxLIST_AUTOSIZE ); + SetColumnWidth( 3, wxLIST_AUTOSIZE ); + SetColumnWidth( 4, wxLIST_AUTOSIZE ); } void wxFileCtrl::SetWild( const wxString &wild ) @@ -431,7 +443,7 @@ void wxFileCtrl::MakeDir() wxListItem item; item.m_itemId = 0; item.m_col = 0; - int id = Add( fd, item ); + long id = Add( fd, item ); if (id != -1) { @@ -450,7 +462,7 @@ void wxFileCtrl::GoToParentDir() m_dirName = wxPathOnly( m_dirName ); if (m_dirName.IsEmpty()) m_dirName = wxT("/"); Update(); - int id = FindItem( 0, fname ); + long id = FindItem( 0, fname ); if (id != -1) { SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); @@ -715,9 +727,10 @@ wxFileDialog::~wxFileDialog() void wxFileDialog::OnChoice( wxCommandEvent &event ) { - wxString *str = (wxString*) m_choice->GetClientData( event.GetInt() ); + int index = (int)event.GetInt(); + wxString *str = (wxString*) m_choice->GetClientData( index ); m_list->SetWild( *str ); - m_filterIndex = event.GetInt(); + m_filterIndex = index; } void wxFileDialog::OnCheck( wxCommandEvent &event )