-rw-r--r-- | libopie/ofileselector.cc | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 3a11032..0a6e595 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc @@ -44,65 +44,112 @@ #include <qcursor.h> #include <qstringlist.h> #include <qmessagebox.h> #include <qpe/qpeapplication.h> #include <qpe/fileselector.h> #include <qpe/applnk.h> #include <qpe/global.h> #include <qpe/mimetype.h> #include <qpe/resource.h> #include <qpe/storage.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include "ofileselector.h" QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; namespace { int indexByString( const QComboBox *box, const QString &str ){ int index= -1; 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()); m_selector = selector; m_currentDir = dirName; m_name = fileName; m_mimetypes = mimetypes; if( mimetypes.isEmpty() ) m_autoMime = true; qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); m_mode = mode; m_shTool = true; m_shPerm = true; m_shLne = true; m_shChooser = true; m_shYesNo = true; // for FILESELECTOR only view is interesting m_location = 0; m_homeButton = 0; m_docButton = 0; m_hideButton = 0; m_ok = 0; m_cancel = 0; m_reread = 0; |