summaryrefslogtreecommitdiff
path: root/libopie/ofileselector/ofilelistview.cpp
authorzecke <zecke>2002-09-15 21:22:18 (UTC)
committer zecke <zecke>2002-09-15 21:22:18 (UTC)
commit568c816cc66f1566b8be6ff8d246e7b1465ae61e (patch) (unidiff)
tree3c1d1f9ac7421ae27b18f580670ac1e1b8bf8a92 /libopie/ofileselector/ofilelistview.cpp
parentf2594358208bb2ea826bbea6afb0b3aa35947378 (diff)
downloadopie-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.cpp85
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 @@
1 1
2#include <qheader.h>
3
2#include <qpe/mimetype.h> 4#include <qpe/mimetype.h>
3#include <qpe/resource.h> 5#include <qpe/resource.h>
6#include <qpe/qpeapplication.h>
4 7
5#include "ofileselector.h" 8#include "ofileselector.h"
6#include "ofileselectoritem.h" 9#include "ofileselectoritem.h"
7#include "ofilelistview.h" 10#include "ofilelistview.h"
8 11
9 12
10OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) 13OFileListView::OFileListView( QWidget* parent, OFileSelector* sel)
11 : QListView( parent ), OFileView( sel ) 14 : QListView( parent ), OFileView( sel )
12{ 15{
13 16 QPEApplication::setStylusOperation( viewport(),
17 QPEApplication::RightOnHold);
18 addColumn(" " );
19 addColumn(tr("Name"), 135 );
20 addColumn(tr("Size"), -1 );
21 addColumn(tr("Date"), 60 );
22 addColumn(tr("Mime Type"), -1 );
23 QHeader *head = header();
24 head->hide();
25 setSorting( 1 );
26 setAllColumnsShowFocus( TRUE );
27
28 connect(this, SIGNAL(selectionChanged() ),
29 this, SLOT(slotSelectionChanged() ) );
30
31 connect(this, SIGNAL(currentChanged(QListViewItem *) ),
32 this, SLOT(slotCurrentChanged(QListViewItem * ) ) );
33
34 connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
35 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
36
37 connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
38 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
14} 39}
15OFileListView::~OFileListView() { 40OFileListView::~OFileListView() {
16 41
17} 42}
18void OFileListView::clear() { 43void OFileListView::clear() {
19 QListView::clear(); 44 QListView::clear();
@@ -120,6 +145,64 @@ QStringList OFileListView::selectedPaths()const {
120 list << selectedPath(); 145 list << selectedPath();
121 return list; 146 return list;
122} 147}
123int OFileListView::fileCount() { 148int OFileListView::fileCount() {
124 return childCount(); 149 return childCount();
125} 150}
151void OFileListView::sort() {
152 QListView::sort();
153}
154void OFileListView::slotSelectionChanged() {
155
156}
157void OFileListView::slotCurrentChanged( QListViewItem* item) {
158 if (!item )
159 return;
160
161 OFileSelectorItem* sel = (OFileSelectorItem*) item;
162
163 qWarning("current changed");
164 if(!sel->isDir() ){
165 updateLine( sel->text(1) );
166
167 if (selector()->mode() == OFileSelector::Fileselector ) {
168 QStringList str = QStringList::split("->", sel->text(1) );
169 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
170 DocLnk lnk( path );
171 fileSelected(lnk );
172 fileSelected( path );
173 }
174 }
175}
176void OFileListView::slotClicked( int button, QListViewItem* item,
177 const QPoint&, int ) {
178 if ( !item )
179 return;
180
181 if( button != Qt::LeftButton )
182 return;
183
184 OFileSelectorItem *sel = (OFileSelectorItem*)item;
185
186 if(!sel->isLocked() ){
187 QStringList str = QStringList::split("->", sel->text(1) );
188 if( sel->isDir() ){
189 changedDir( sel->directory() + "/" + str[0].stripWhiteSpace() );
190 }else{
191 updateLine( str[0].stripWhiteSpace() );
192 QString path = sel->directory();
193 path += "/";
194 path += str[0].stripWhiteSpace();
195
196 DocLnk lnk( path );
197 fileSelected( path );
198 fileSelected( lnk );
199 }
200 }
201}
202void OFileListView::slotRightButton( int button, QListViewItem* item,
203 const QPoint&, int ) {
204 if (!item || (button != Qt::RightButton ))
205 return;
206
207 /* raise contextmenu */
208}