author | zecke <zecke> | 2003-05-25 17:51:52 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-05-25 17:51:52 (UTC) |
commit | 7e1dce1560e45ef7fad91a8da2d0d96c1b166df9 (patch) (side-by-side diff) | |
tree | c896c8ab6129414fa80df712a3a5794fa933716f /libopie/ofileselector/olocallister.cpp | |
parent | f1773ad179cb68b8e7777f3d43667ed5ebf1968d (diff) | |
download | opie-7e1dce1560e45ef7fad91a8da2d0d96c1b166df9.zip opie-7e1dce1560e45ef7fad91a8da2d0d96c1b166df9.tar.gz opie-7e1dce1560e45ef7fad91a8da2d0d96c1b166df9.tar.bz2 |
die here too
Diffstat (limited to 'libopie/ofileselector/olocallister.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie/ofileselector/olocallister.cpp | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/libopie/ofileselector/olocallister.cpp b/libopie/ofileselector/olocallister.cpp deleted file mode 100644 index 4d36d64..0000000 --- a/libopie/ofileselector/olocallister.cpp +++ b/dev/null @@ -1,150 +0,0 @@ -#include <qdir.h> -#include <qfileinfo.h> -#include <qmap.h> - -#include <qpe/mimetype.h> - -#include "ofileselector.h" -#include "ofileview.h" -#include "olocallister.h" - -OLocalLister::OLocalLister( OFileSelector* file ) - : OLister( file ) -{ - m_dir = QDir::homeDirPath(); -} -OLocalLister::~OLocalLister() { -} - -QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) { - QMap<QString, QStringList> mimes; - - // let's find possible mimetypes - QDir dir( curDir ); - dir.setFilter( QDir::Files | QDir::Readable ); - dir.setSorting( QDir::Size ); - - const QFileInfoList *list = dir.entryInfoList(); - QFileInfoListIterator it( *list ); - QFileInfo *fi; - - while( (fi=it.current() ) ) { - /* skip .desktop */ - if( fi->extension() == QString::fromLatin1("desktop") ){ - ++it; - continue; - } - MimeType type( fi->absFilePath() ); - - if( !mimes.contains( type.id() ) ){ - mimes.insert( type.id(), type.id() ); - } - - ++it; - } - - return mimes; -} -/** - * FIXME mimecheck - * use mime check for that - * filter dirs - * filter filters - * filter files - * filter mimetypes - */ -void OLocalLister::reparse( const QString& pa ) { - if (!pa.isEmpty() ) - m_dir = pa; - - QString currentMimeType; - QDir dir( m_dir ); - - dir.setSorting( view()->sorting() ); - dir.setFilter( view()->filter() ); - - - const QFileInfoList *list = dir.entryInfoList(); - QFileInfoListIterator it( *list ); - QFileInfo *fi; - - while( (fi=it.current() ) ){ - - if( fi->fileName() == QString::fromLatin1("..") || - fi->fileName() == QString::fromLatin1(".") ){ - ++it; - continue; - } - if( fi->isSymLink() ){ - QString file = fi->dirPath( true ) + "/" + fi->readLink(); - /* - * 5 tries to prevent dos attack - */ - for( int i = 0; i<=4; i++) { - QFileInfo info( file ); - if( !info.exists() ){ - addSymlink( currentMimeType, fi, QString::null, TRUE ); - break; - }else if( info.isDir() ){ - if (!showDirs() ) - break; - - addDir( currentMimeType, fi, QString::null, - TRUE ); - break; - }else if( info.isFile() ){ - /* if not show files skip it */ - if (!showFiles() ) - break; - - /* check if we comply to the mimetype */ - MimeType type( info.absFilePath() ); - if (compliesMime( type.id() ) ) - addFile( currentMimeType, fi, QString::null, TRUE ); - - break; - }else if( info.isSymLink() ){ - file = info.dirPath(true ) + "/" + info.readLink() ; - break; - }else if( i == 4){ - addSymlink( currentMimeType, fi ); - } - } - - }else if( fi->isDir() ){ - if (showDirs() ) - addDir( currentMimeType, fi ); - }else if( fi->isFile() ){ - if ( showFiles() ) - addFile( currentMimeType, fi ); - } - ++it; - } // of while loop -} -/* more accepting it code */ -void OLocalLister::fileSelected( const QString& dir, const QString& file, const QString& ) { - internFileSelected( dir + "/" + file ); -} -void OLocalLister::changedDir( const QString& dir, const QString& file, const QString& ) { - internChangedDir( dir + "/" + file ); -} -/* - * assemble the the Url now - */ -QString OLocalLister::selectedName()const { - QString str = m_dir; - QString name = lineEdit(); - - if ( name.isEmpty() ) - name = view()->currentView()->selectedName(); - - str += "/" + name; - - return str; -} -QStringList OLocalLister::selectedNames()const { - QStringList list; - list << selectedName(); - - return list; -} |