author | zecke <zecke> | 2002-09-15 21:22:18 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-15 21:22:18 (UTC) |
commit | 568c816cc66f1566b8be6ff8d246e7b1465ae61e (patch) (side-by-side diff) | |
tree | 3c1d1f9ac7421ae27b18f580670ac1e1b8bf8a92 /libopie/ofileselector/ofilelistview.cpp | |
parent | f2594358208bb2ea826bbea6afb0b3aa35947378 (diff) | |
download | opie-568c816cc66f1566b8be6ff8d246e7b1465ae61e.zip opie-568c816cc66f1566b8be6ff8d246e7b1465ae61e.tar.gz opie-568c816cc66f1566b8be6ff8d246e7b1465ae61e.tar.bz2 |
ok basicly all old functions are available again
what's now missing is the code switching Listers
and views
toggling the toolbar
filter
Diffstat (limited to 'libopie/ofileselector/ofilelistview.cpp') (more/less context) (ignore 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,19 +1,44 @@ +#include <qheader.h> + #include <qpe/mimetype.h> #include <qpe/resource.h> +#include <qpe/qpeapplication.h> #include "ofileselector.h" #include "ofileselectoritem.h" #include "ofilelistview.h" OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) : QListView( parent ), OFileView( 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 ) ) ); } OFileListView::~OFileListView() { } void OFileListView::clear() { QListView::clear(); @@ -120,6 +145,64 @@ QStringList OFileListView::selectedPaths()const { list << selectedPath(); return list; } int OFileListView::fileCount() { return childCount(); } +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 */ +} |