Diffstat (limited to 'libopie/ofileselector/ofilelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp deleted file mode 100644 index fe8acf0..0000000 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/dev/null | |||
@@ -1,201 +0,0 @@ | |||
1 | |||
2 | #include <qheader.h> | ||
3 | |||
4 | #include <qpe/mimetype.h> | ||
5 | #include <qpe/resource.h> | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
8 | #include "ofileselector.h" | ||
9 | #include "ofileselectoritem.h" | ||
10 | #include "ofilelistview.h" | ||
11 | |||
12 | |||
13 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | ||
14 | : QListView( parent ), OFileView( sel ) | ||
15 | { | ||
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 ) ) ); | ||
39 | } | ||
40 | OFileListView::~OFileListView() { | ||
41 | |||
42 | } | ||
43 | void OFileListView::clear() { | ||
44 | QListView::clear(); | ||
45 | } | ||
46 | void OFileListView::addFile( const QPixmap& pix, | ||
47 | const QString&, | ||
48 | QFileInfo* info, | ||
49 | const QString& extra, | ||
50 | bool isSymlink ) { | ||
51 | QString dir; | ||
52 | QString name; | ||
53 | bool locked = false; | ||
54 | |||
55 | dir = info->dirPath( true ); | ||
56 | |||
57 | if( isSymlink ) | ||
58 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | ||
59 | else { | ||
60 | name = info->fileName(); | ||
61 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | ||
62 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | ||
63 | |||
64 | locked = true; | ||
65 | } | ||
66 | } | ||
67 | new OFileSelectorItem( this, pix, name, | ||
68 | info->lastModified().toString(), | ||
69 | QString::number( info->size() ), | ||
70 | dir, locked, extra ); | ||
71 | } | ||
72 | void OFileListView::addFile( const QPixmap&, | ||
73 | const QString& /*mime*/, const QString& /*dir*/, | ||
74 | const QString& /*file*/, | ||
75 | const QString& /*extra*/, | ||
76 | bool /*isSyml*/ ) { | ||
77 | |||
78 | } | ||
79 | void OFileListView::addDir( const QPixmap& pix, const QString&, | ||
80 | QFileInfo* info, | ||
81 | const QString& extra , | ||
82 | bool symlink ) { | ||
83 | |||
84 | bool locked = false; | ||
85 | QString name; | ||
86 | |||
87 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | ||
88 | |||
89 | new OFileSelectorItem( this, pix, name, | ||
90 | info->lastModified().toString(), | ||
91 | QString::number( info->size() ), | ||
92 | info->dirPath( true ), locked, extra, | ||
93 | true ); | ||
94 | |||
95 | } | ||
96 | void OFileListView::addDir( const QPixmap&, | ||
97 | const QString& /*mime*/, const QString& /*dir*/, | ||
98 | const QString& /*file*/, | ||
99 | const QString& /*extra*/, | ||
100 | bool ) { | ||
101 | |||
102 | } | ||
103 | void OFileListView::addSymlink( const QPixmap&, | ||
104 | const QString& /*mime*/, | ||
105 | QFileInfo* /*info*/, | ||
106 | const QString& /*extra*/, | ||
107 | bool /*isSym*/ ) { | ||
108 | |||
109 | } | ||
110 | void OFileListView::addSymlink(const QPixmap&, | ||
111 | const QString& /*m*/, const QString& /*path*/, | ||
112 | const QString& /*file*/, | ||
113 | const QString& /*extra*/, | ||
114 | bool /*isSym*/ ) { | ||
115 | |||
116 | } | ||
117 | void OFileListView::cd( const QString& ) { | ||
118 | |||
119 | } | ||
120 | QWidget* OFileListView::widget() { | ||
121 | return this; | ||
122 | } | ||
123 | QString OFileListView::selectedName()const{ | ||
124 | QListViewItem *item = currentItem(); | ||
125 | if (!item ) | ||
126 | return QString::null; | ||
127 | |||
128 | return item->text( 1 ); | ||
129 | } | ||
130 | QString OFileListView::selectedExtra()const{ | ||
131 | QListViewItem* item = currentItem(); | ||
132 | if (!item) return QString::null; | ||
133 | OFileSelectorItem* fit = (OFileSelectorItem*)fit; | ||
134 | |||
135 | return fit->extra(); | ||
136 | } | ||
137 | QStringList OFileListView::selectedNames()const { | ||
138 | QStringList list; | ||
139 | list << selectedName(); | ||
140 | return list; | ||
141 | } | ||
142 | QString OFileListView::selectedPath()const { | ||
143 | return QString::null; | ||
144 | } | ||
145 | QStringList OFileListView::selectedPaths()const { | ||
146 | QStringList list; | ||
147 | list << selectedPath(); | ||
148 | return list; | ||
149 | } | ||
150 | int OFileListView::fileCount() { | ||
151 | return childCount(); | ||
152 | } | ||
153 | void OFileListView::sort() { | ||
154 | QListView::sort(); | ||
155 | } | ||
156 | void OFileListView::slotSelectionChanged() { | ||
157 | |||
158 | } | ||
159 | void OFileListView::slotCurrentChanged( QListViewItem* item) { | ||
160 | if (!item ) | ||
161 | return; | ||
162 | |||
163 | OFileSelectorItem* sel = (OFileSelectorItem*) item; | ||
164 | |||
165 | qWarning("current changed"); | ||
166 | if(!sel->isDir() ){ | ||
167 | updateLine( sel->text(1) ); | ||
168 | |||
169 | if (selector()->mode() == OFileSelector::Fileselector ) { | ||
170 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
171 | fileSelected(sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | void OFileListView::slotClicked( int button, QListViewItem* item, | ||
176 | const QPoint&, int ) { | ||
177 | if ( !item ) | ||
178 | return; | ||
179 | |||
180 | if( button != Qt::LeftButton ) | ||
181 | return; | ||
182 | |||
183 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | ||
184 | |||
185 | if(!sel->isLocked() ){ | ||
186 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
187 | if( sel->isDir() ){ | ||
188 | changedDir( sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); | ||
189 | }else{ | ||
190 | updateLine( str[0].stripWhiteSpace() ); | ||
191 | fileSelected( sel->directory(),str[0].stripWhiteSpace(), sel->extra() ); | ||
192 | } | ||
193 | } | ||
194 | } | ||
195 | void OFileListView::slotRightButton( int button, QListViewItem* item, | ||
196 | const QPoint&, int ) { | ||
197 | if (!item || (button != Qt::RightButton )) | ||
198 | return; | ||
199 | |||
200 | /* raise contextmenu */ | ||
201 | } | ||