-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 15 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 01a51a2..718f743 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -234,33 +234,30 @@ QWidget* ODocumentFileView::widget( QWidget* parent ) | |||
234 | return m_selector; | 234 | return m_selector; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * This is the file system view used | 238 | * This is the file system view used |
239 | * we use a QListView + QListViewItems for it | 239 | * we use a QListView + QListViewItems for it |
240 | */ | 240 | */ |
241 | 241 | ||
242 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 242 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
243 | const QString& path, const QString& date, | 243 | const QString& path, const QString& date, |
244 | const QString& size, const QString& dir, | 244 | const QString& size, const QString& dir, |
245 | bool isLocked, bool isDir ) | 245 | bool isLocked, bool isDir ) |
246 | : QListViewItem( view ) | 246 | : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) |
247 | { | 247 | { |
248 | setPixmap(0, pixmap ); | 248 | setPixmap(0, pixmap ); |
249 | setText(1, path ); | 249 | setText(1, path ); |
250 | setText(2, size ); | 250 | setText(2, size ); |
251 | setText(3, date ); | 251 | setText(3, date ); |
252 | m_isDir = isDir; | ||
253 | m_dir = dir; | ||
254 | m_locked = isLocked; | ||
255 | } | 252 | } |
256 | 253 | ||
257 | OFileSelectorItem::~OFileSelectorItem() | 254 | OFileSelectorItem::~OFileSelectorItem() |
258 | { | 255 | { |
259 | } | 256 | } |
260 | 257 | ||
261 | bool OFileSelectorItem::isLocked()const | 258 | bool OFileSelectorItem::isLocked()const |
262 | { | 259 | { |
263 | return m_locked; | 260 | return m_locked; |
264 | } | 261 | } |
265 | 262 | ||
266 | QString OFileSelectorItem::directory()const | 263 | QString OFileSelectorItem::directory()const |
@@ -272,39 +269,45 @@ bool OFileSelectorItem::isDir()const | |||
272 | { | 269 | { |
273 | return m_isDir; | 270 | return m_isDir; |
274 | } | 271 | } |
275 | 272 | ||
276 | QString OFileSelectorItem::path()const | 273 | QString OFileSelectorItem::path()const |
277 | { | 274 | { |
278 | return text( 1 ); | 275 | return text( 1 ); |
279 | } | 276 | } |
280 | 277 | ||
281 | QString OFileSelectorItem::key( int id, bool )const | 278 | QString OFileSelectorItem::key( int id, bool )const |
282 | { | 279 | { |
283 | QString ke; | 280 | QString ke; |
281 | |||
282 | /* | ||
283 | * id = 0 ||id == 1 : Sort By Name but Directories at Top | ||
284 | * id = 2 : Sort By Size: Prepend '0' to the key | ||
285 | */ | ||
284 | if( id == 0 || id == 1 ) | 286 | if( id == 0 || id == 1 ) |
285 | { // name | 287 | { // name |
286 | if( m_isDir ) | 288 | if( m_isDir ) |
287 | { | 289 | { |
288 | ke.append("0" ); | 290 | ke.append("0" ); |
289 | ke.append( text(1) ); | 291 | ke.append( text(1) ); |
290 | } | 292 | } |
291 | else | 293 | else |
292 | { | 294 | { |
293 | ke.append("1" ); | 295 | ke.append("1" ); |
294 | ke.append( text(1) ); | 296 | ke.append( text(1) ); |
295 | } | 297 | } |
296 | return ke; | 298 | return ke; |
297 | } | 299 | }else if(id == 2) { |
298 | else | 300 | return text(2).rightJustify(20, '0'); |
301 | }else | ||
299 | return text( id ); | 302 | return text( id ); |
300 | 303 | ||
301 | } | 304 | } |
302 | 305 | ||
303 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) | 306 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) |
304 | :QWidget( parent ), m_sel( sel ) | 307 | :QWidget( parent ), m_sel( sel ) |
305 | { | 308 | { |
306 | m_all = false; | 309 | m_all = false; |
307 | QVBoxLayout* lay = new QVBoxLayout( this ); | 310 | QVBoxLayout* lay = new QVBoxLayout( this ); |
308 | m_currentDir = startDir; | 311 | m_currentDir = startDir; |
309 | 312 | ||
310 | /* | 313 | /* |
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 790d2bd..15db916 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h | |||
@@ -128,27 +128,27 @@ public: | |||
128 | OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 128 | OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
129 | const QString& path, const QString& date, | 129 | const QString& path, const QString& date, |
130 | const QString& size, const QString& mDir, | 130 | const QString& size, const QString& mDir, |
131 | bool isLocked = false, bool isDir = false ); | 131 | bool isLocked = false, bool isDir = false ); |
132 | ~OFileSelectorItem(); | 132 | ~OFileSelectorItem(); |
133 | bool isLocked()const; | 133 | bool isLocked()const; |
134 | bool isDir()const; | 134 | bool isDir()const; |
135 | QString directory()const; | 135 | QString directory()const; |
136 | QString path()const; | 136 | QString path()const; |
137 | QString key(int id, bool )const; | 137 | QString key(int id, bool )const; |
138 | 138 | ||
139 | private: | 139 | private: |
140 | bool m_locked : 1; | ||
141 | bool m_isDir : 1; | ||
142 | QString m_dir; | 140 | QString m_dir; |
141 | bool m_isDir : 1; | ||
142 | bool m_locked : 1; | ||
143 | }; | 143 | }; |
144 | 144 | ||
145 | class OFileViewFileListView : public QWidget | 145 | class OFileViewFileListView : public QWidget |
146 | { | 146 | { |
147 | Q_OBJECT | 147 | Q_OBJECT |
148 | public: | 148 | public: |
149 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); | 149 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); |
150 | ~OFileViewFileListView(); | 150 | ~OFileViewFileListView(); |
151 | 151 | ||
152 | OFileSelectorItem* currentItem()const; | 152 | OFileSelectorItem* currentItem()const; |
153 | void reread( bool all = false ); | 153 | void reread( bool all = false ); |
154 | int fileCount()const; | 154 | int fileCount()const; |