-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <pwd.h>
-#include <grp.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "wx/generic/home.xpm"
-#include "wx/generic/listview.xpm"
-#include "wx/generic/repview.xpm"
-#include "wx/generic/new_dir.xpm"
-#include "wx/generic/dir_up.xpm"
-
-/* XPM */
-static char * folder_xpm[] = {
-/* width height ncolors chars_per_pixel */
-"16 16 6 1",
-/* colors */
-" s None c None",
-". c #000000",
-"+ c #c0c0c0",
-"@ c #808080",
-"# c #ffff00",
-"$ c #ffffff",
-/* pixels */
-" ",
-" @@@@@ ",
-" @#+#+#@ ",
-" @#+#+#+#@@@@@@ ",
-" @$$$$$$$$$$$$@.",
-" @$#+#+#+#+#+#@.",
-" @$+#+#+#+#+#+@.",
-" @$#+#+#+#+#+#@.",
-" @$+#+#+#+#+#+@.",
-" @$#+#+#+#+#+#@.",
-" @$+#+#+#+#+#+@.",
-" @$#+#+#+#+#+#@.",
-" @@@@@@@@@@@@@@.",
-" ..............",
-" ",
-" "};
-
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
-
-static
-int ListCompare( long data1, long data2, long WXUNUSED(data) )
-{
- wxFileData *fd1 = (wxFileData*)data1 ;
- wxFileData *fd2 = (wxFileData*)data2 ;
- if (fd1->GetName() == wxT("..")) return -1;
- if (fd2->GetName() == wxT("..")) return 1;
- if (fd1->IsDir() && !fd2->IsDir()) return -1;
- if (fd2->IsDir() && !fd1->IsDir()) return 1;
- return strcmp( fd1->GetName(), fd2->GetName() );
-}
-
-//-----------------------------------------------------------------------------
-// wxFileData
-//-----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxFileData,wxObject);
-
-wxFileData::wxFileData( const wxString &name, const wxString &fname )
-{
- m_name = name;
- m_fileName = fname;
-
- struct stat buff;
- stat( m_fileName.GetData(), &buff );
- struct stat lbuff;
- lstat( m_fileName.GetData(), &lbuff );
-
- struct tm *t = localtime( &lbuff.st_mtime );
-// struct passwd *user = getpwuid( buff.st_uid );
-// struct group *grp = getgrgid( buff.st_gid );
-
- m_isDir = S_ISDIR( buff.st_mode );
- m_isLink = S_ISLNK( lbuff.st_mode );
- m_isExe = ((buff.st_mode & S_IXUSR ) == S_IXUSR );
-
- m_size = buff.st_size;
-
- m_hour = t->tm_hour;
- m_minute = t->tm_min;
- m_month = t->tm_mon+1;
- m_day = t->tm_mday;
- m_year = t->tm_year;
-
- m_permissions.sprintf( "%c%c%c",
- ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? 'r' : '-'),
- ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? 'w' : '-'),
- ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? 'x' : '-') );
-}
-
-wxString wxFileData::GetName() const
-{
- return m_name;
-}
-
-wxString wxFileData::GetFullName() const
-{
- return m_fileName;
-}
-
-wxString wxFileData::GetHint() const
-{
- wxString s = m_fileName;
- s += " ";
- if (m_isDir) s += _("<DIR> ");
- else if (m_isLink) s += _("<LINK> ");
- else
- {
- s += LongToString( m_size );
- s += _(" bytes ");
- }
- s += IntToString( m_day );
- s += wxT(".");
- s += IntToString( m_month );
- s += wxT(".");
- s += IntToString( m_year );
- s += wxT(" ");
- s += IntToString( m_hour );
- s += wxT(":");
- s += IntToString( m_minute );
- s += wxT(" ");
- s += m_permissions;
- return s;
-};
-
-wxString wxFileData::GetEntry( int num )
-{
- wxString s;
- switch (num)
- {
- case 0:
- s = m_name;
- break;
- case 1:
- if (m_isDir) s = _("<DIR>");
- else if (m_isLink) s = _("<LINK>");
- else s = LongToString( m_size );
- 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;
- 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;
- default:
- s = wxT("No entry");
- break;
- }
- return s;
-}
-
-bool wxFileData::IsDir()
-{
- return m_isDir;
-}