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,6 +1,9 @@ | |||
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" |
@@ -10,7 +13,29 @@ | |||
10 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | 13 | OFileListView::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 | } |
15 | OFileListView::~OFileListView() { | 40 | OFileListView::~OFileListView() { |
16 | 41 | ||
@@ -123,3 +148,61 @@ QStringList OFileListView::selectedPaths()const { | |||
123 | int OFileListView::fileCount() { | 148 | int OFileListView::fileCount() { |
124 | return childCount(); | 149 | return childCount(); |
125 | } | 150 | } |
151 | void OFileListView::sort() { | ||
152 | QListView::sort(); | ||
153 | } | ||
154 | void OFileListView::slotSelectionChanged() { | ||
155 | |||
156 | } | ||
157 | void 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 | } | ||
176 | void 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 | } | ||
202 | void OFileListView::slotRightButton( int button, QListViewItem* item, | ||
203 | const QPoint&, int ) { | ||
204 | if (!item || (button != Qt::RightButton )) | ||
205 | return; | ||
206 | |||
207 | /* raise contextmenu */ | ||
208 | } | ||