-rw-r--r-- | libopie/ofileselector.cc | 49 | ||||
-rw-r--r-- | libopie/ofileselector.h | 49 |
2 files changed, 49 insertions, 49 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 3a11032..0a6e595 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -68,17 +68,64 @@ namespace { for(int i= 0; i < box->count(); i++ ){ if( str == box->text(i ) ){ index= i; break; } } return index; } - + 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 ): QListViewItem(view) { + setPixmap(0, pixmap ); + setText(1, path ); + setText(2, size ); + setText(3, date ); + //setText(4, mDir ); + m_dir = mDir; + dir = isDir; + mLocked = isLocked; + } + bool isLocked() const{ + return mLocked; + } + QString directory()const{ + return m_dir; + } + bool isDir()const{ + return dir; + } + QString path()const{ + return text(1 ); + } + QString key(int id, bool )const { + QString ke; + if( id == 0 || id == 1 ){ // name + if( dir ){ + ke.append("0" ); + ke.append( text(1) ); + }else{ + ke.append("1" ); + ke.append( text(1) ); + } + }else if( id == 2 ){ // size + return text(2); + }else if( id == 3 ){ // date + return text(3); + } + return ke; + }; + private: + bool mLocked:1; + bool dir:1; + QString m_dir; + }; }; OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) { if(wid!=0) resize(wid->width(),wid->height()); diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index babe09f..8173d76 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h @@ -59,64 +59,17 @@ class QGridLayout; class QLineEdit; class QLabel; class QWidgetStack; class QHBoxLayout; class QVBoxLayout; class QPopupMenu; class QFileInfo; // -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 ): QListViewItem(view) { - setPixmap(0, pixmap ); - setText(1, path ); - setText(2, size ); - setText(3, date ); - //setText(4, mDir ); - m_dir = mDir; - dir = isDir; - mLocked = isLocked; - } - bool isLocked() const{ - return mLocked; - } - QString directory()const{ - return m_dir; - } - bool isDir()const{ - return dir; - } - QString path()const{ - return text(1 ); - } - QString key(int id, bool )const { - QString ke; - if( id == 0 || id == 1 ){ // name - if( dir ){ - ke.append("0" ); - ke.append( text(1) ); - }else{ - ke.append("1" ); - ke.append( text(1) ); - } - }else if( id == 2 ){ // size - return text(2); - }else if( id == 3 ){ // date - return text(3); - } - return ke; - }; - private: - bool mLocked:1; - bool dir:1; - QString m_dir; -}; + class OFileSelector : public QWidget { Q_OBJECT public: enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList &mimetypes = QStringList() ); |