Well, I can't be sure it's not my own files, but would one of you experts take a look at this code and see if there is cause for a segmentation fault. I have tried tracing it do the cerr statements but the fault seems to occur on the return of the call to down(QListViewItem* lvi, const QPoint& p, int col).
Code:
#include "FileView.h"
#include <iostream>
QFileView::QFileView()
{
lv = new QListView(this);
lv->addColumn( "File" );
lv->addColumn( "Owner" );
lv->addColumn( "Group" );
lv->addColumn( "Permissions" );
populate();
bup = new QPushButton("Up", this);
connect(bup, SIGNAL(clicked()), this, SLOT(up()) );
connect(lv, SIGNAL(doubleClicked( QListViewItem*, const QPoint &, int)), this, SLOT(down(QListViewItem*, const QPoint &, int)) );
}
void QFileView::resizeEvent(QResizeEvent* re)
{
lv->move(0, bup->height() );
lv->resize(re->size().width(), re->size().height() - bup->height() );
}
void QFileView::populate()
{
fi.open();
while( fi.nextFile())
{
if ( !fi.isHidden() )
new QListViewItem( lv, fi.getName().c_str(), fi.getOwner().c_str(), fi.getGroup().c_str(), fi.getPermissions().c_str() );
}
fi.close();
}
void QFileView::up()
{
fi.up();
lv->clear();
populate();
}
void QFileView::down(QListViewItem* lvi, const QPoint& p, int col)
{
if(fi.isDir(lvi->text(0)))
{
fi.down(lvi->text(0));
lv->clear();
populate();
}
}