-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 @@ -230,85 +230,88 @@ QWidget* ODocumentFileView::widget( QWidget* parent ) QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), selector(), SIGNAL(newSelected(const DocLnk&) ) ); } return m_selector; } /* * This is the file system view used * we use a QListView + QListViewItems for it */ OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, const QString& path, const QString& date, const QString& size, const QString& dir, bool isLocked, bool isDir ) - : QListViewItem( view ) + : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) { setPixmap(0, pixmap ); setText(1, path ); setText(2, size ); setText(3, date ); - m_isDir = isDir; - m_dir = dir; - m_locked = isLocked; } OFileSelectorItem::~OFileSelectorItem() { } bool OFileSelectorItem::isLocked()const { return m_locked; } QString OFileSelectorItem::directory()const { return m_dir; } bool OFileSelectorItem::isDir()const { return m_isDir; } QString OFileSelectorItem::path()const { return text( 1 ); } QString OFileSelectorItem::key( int id, bool )const { QString ke; + + /* + * id = 0 ||id == 1 : Sort By Name but Directories at Top + * id = 2 : Sort By Size: Prepend '0' to the key + */ if( id == 0 || id == 1 ) { // name if( m_isDir ) { ke.append("0" ); ke.append( text(1) ); } else { ke.append("1" ); ke.append( text(1) ); } return ke; - } - else + }else if(id == 2) { + return text(2).rightJustify(20, '0'); + }else return text( id ); } OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) :QWidget( parent ), m_sel( sel ) { m_all = false; QVBoxLayout* lay = new QVBoxLayout( this ); m_currentDir = startDir; /* * now we add a special bar * One Button For Up * Home * Doc 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 @@ -124,35 +124,35 @@ private: class OFileSelectorItem : public QListViewItem { public: OFileSelectorItem( QListView* view, const QPixmap& pixmap, const QString& path, const QString& date, const QString& size, const QString& mDir, bool isLocked = false, bool isDir = false ); ~OFileSelectorItem(); bool isLocked()const; bool isDir()const; QString directory()const; QString path()const; QString key(int id, bool )const; private: - bool m_locked : 1; - bool m_isDir : 1; QString m_dir; + bool m_isDir : 1; + bool m_locked : 1; }; class OFileViewFileListView : public QWidget { Q_OBJECT public: OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); ~OFileViewFileListView(); OFileSelectorItem* currentItem()const; void reread( bool all = false ); int fileCount()const; QString currentDir()const; protected: bool eventFilter (QObject *o, QEvent *e); private slots: |