Diffstat (limited to 'libopie/ofileselector/ofilelistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 7108a5b..bb15764 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp @@ -1,4 +1,7 @@ +#include <qheader.h> + #include <qpe/mimetype.h> #include <qpe/resource.h> +#include <qpe/qpeapplication.h> @@ -12,3 +15,25 @@ OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) { - + QPEApplication::setStylusOperation( viewport(), + QPEApplication::RightOnHold); + addColumn(" " ); + addColumn(tr("Name"), 135 ); + addColumn(tr("Size"), -1 ); + addColumn(tr("Date"), 60 ); + addColumn(tr("Mime Type"), -1 ); + QHeader *head = header(); + head->hide(); + setSorting( 1 ); + setAllColumnsShowFocus( TRUE ); + + connect(this, SIGNAL(selectionChanged() ), + this, SLOT(slotSelectionChanged() ) ); + + connect(this, SIGNAL(currentChanged(QListViewItem *) ), + this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); + + connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), + this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); + + connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), + this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); } @@ -125 +150,59 @@ int OFileListView::fileCount() { } +void OFileListView::sort() { + QListView::sort(); +} +void OFileListView::slotSelectionChanged() { + +} +void OFileListView::slotCurrentChanged( QListViewItem* item) { + if (!item ) + return; + + OFileSelectorItem* sel = (OFileSelectorItem*) item; + + qWarning("current changed"); + if(!sel->isDir() ){ + updateLine( sel->text(1) ); + + if (selector()->mode() == OFileSelector::Fileselector ) { + QStringList str = QStringList::split("->", sel->text(1) ); + QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); + DocLnk lnk( path ); + fileSelected(lnk ); + fileSelected( path ); + } + } +} +void OFileListView::slotClicked( int button, QListViewItem* item, + const QPoint&, int ) { + if ( !item ) + return; + + if( button != Qt::LeftButton ) + return; + + OFileSelectorItem *sel = (OFileSelectorItem*)item; + + if(!sel->isLocked() ){ + QStringList str = QStringList::split("->", sel->text(1) ); + if( sel->isDir() ){ + changedDir( sel->directory() + "/" + str[0].stripWhiteSpace() ); + }else{ + updateLine( str[0].stripWhiteSpace() ); + QString path = sel->directory(); + path += "/"; + path += str[0].stripWhiteSpace(); + + DocLnk lnk( path ); + fileSelected( path ); + fileSelected( lnk ); + } + } +} +void OFileListView::slotRightButton( int button, QListViewItem* item, + const QPoint&, int ) { + if (!item || (button != Qt::RightButton )) + return; + + /* raise contextmenu */ +} |