summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/olister.cpp~64
-rw-r--r--libopie/ofileselector/olister.h~57
-rw-r--r--libopie/ofileselector/olister.obin24852 -> 0 bytes
-rw-r--r--libopie/ofileselector/olocallister.cpp~97
-rw-r--r--libopie/ofileselector/olocallister.h~14
-rw-r--r--libopie/ofileselector/olocallister.obin42280 -> 0 bytes
6 files changed, 0 insertions, 232 deletions
diff --git a/libopie/ofileselector/olister.cpp~ b/libopie/ofileselector/olister.cpp~
deleted file mode 100644
index 180422a..0000000
--- a/libopie/ofileselector/olister.cpp~
+++ b/dev/null
@@ -1,64 +0,0 @@
1#include "olister.h"
2#include "ofileview.h"
3#include "ofileselector.h"
4
5
6OLister::OLister( OFileSelector* view)
7 : m_view( view )
8{
9}
10OLister::~OLister() {
11}
12void OLister::addFile( const QString& mine,
13 QFileInfo* info,
14 bool isSymlink ) {
15 view()->currentView()->addFile( mine,
16 info,
17 isSymlink );
18}
19void OLister::addFile( const QString& mine,
20 const QString& path,
21 const QString& file,
22 bool isSymlink ) {
23 view()->currentView()->addFile( mine,
24 path,
25 file,
26 isSymlink );
27}
28void OLister::addDir( const QString& mine,
29 QFileInfo* info,
30 bool isSymlink ) {
31
32 view()->currentView()->addDir( mine,
33 info,
34 isSymlink );
35}
36void OLister::addDir( const QString& mine,
37 const QString& path,
38 const QString& dir,
39 bool isSymlink ) {
40 view()->currentView()->addDir( mine,
41 path,
42 dir,
43 isSymlink );
44}
45void OLister::addSymlink( const QString& mine,
46 QFileInfo* info,
47 bool isSymlink ) {
48 view()->currentView()->addSymlink( mine,
49 info,
50 isSymlink );
51}
52void OLister::addSymlink( const QString& mine,
53 const QString& path,
54 const QString& name,
55 bool isSymlink ) {
56 view()->currentView()->addSymlink( mine,
57 path,
58 name,
59 isSymlink );
60}
61OFileSelector* OLister::view() {
62 return m_view;
63}
64
diff --git a/libopie/ofileselector/olister.h~ b/libopie/ofileselector/olister.h~
deleted file mode 100644
index bb6304c..0000000
--- a/libopie/ofileselector/olister.h~
+++ b/dev/null
@@ -1,57 +0,0 @@
1#ifndef OPIE_FILE_LISTER_H
2#define OPIE_FILE_LISTER_H
3
4#include <qfileinfo.h>
5#include <qmap.h>
6#include <qstring.h>
7
8class OFileSelector;
9/**
10 * lister is something like KIO but very
11 * very basic and currently only for
12 * populating our views.
13 * This is a base class which needs to be implemented.
14 * @see OLocalLister for a filesystem based implementation
15 */
16class OLister {
17public:
18 OLister( OFileSelector* );
19 virtual ~OLister();
20 virtual void reparse(const QString& path) = 0;
21
22 /**
23 * return a list of available mimetypes
24 */
25 virtual QMap<QString, QString> mimeTypes( const QString& dir ) = 0;
26
27protected:
28
29 void addFile( const QString& mine,
30 QFileInfo*,
31 bool isSymlink = FALSE );
32 void addFile( const QString& mine,
33 const QString& path,
34 const QString& file,
35 bool isSymlink = FALSE );
36 void addDir( const QString& mine,
37 QFileInfo*,
38 bool isSymlink = FALSE );
39 void addDir( const QString& mine,
40 const QString& path,
41 const QString& dir,
42 bool isSymlink = FALSE );
43 void addSymlink( const QString& mine,
44 QFileInfo* info,
45 bool isSymlink = FALSE);
46 void addSymlink( const QString& mine,
47 const QString& path,
48 const QString& name,
49 bool isSymlink = FALSE );
50 OFileSelector* view();
51private:
52 OFileSelector* m_view;
53
54
55};
56
57#endif
diff --git a/libopie/ofileselector/olister.o b/libopie/ofileselector/olister.o
deleted file mode 100644
index ca58d6c..0000000
--- a/libopie/ofileselector/olister.o
+++ b/dev/null
Binary files differ
diff --git a/libopie/ofileselector/olocallister.cpp~ b/libopie/ofileselector/olocallister.cpp~
deleted file mode 100644
index b0e5410..0000000
--- a/libopie/ofileselector/olocallister.cpp~
+++ b/dev/null
@@ -1,97 +0,0 @@
1#include <qdir.h>
2#include <qfileinfo.h>
3#include <qmap.h>
4
5#include <qpe/mimetype.h>
6
7#include "ofileselector.h"
8#include "olocallister.h"
9
10OLocalLister::OLocalLister( OFileSelector* file )
11 : OLister( file )
12{
13}
14OLocalLister::~OLocalLister() {
15}
16
17QMap<QString, QString> OLocalLister::mimeTypes( const QString& curDir ) {
18 QMap<QString, QString> mimes;
19
20 // let's find possible mimetypes
21 QDir dir( curDir );
22 dir.setFilter( QDir::Files | QDir::Readable );
23 dir.setSorting( QDir::Size );
24
25 const QFileInfoList *list = dir.entryInfoList();
26 QFileInfoListIterator it( *list );
27 QFileInfo *fi;
28
29 while( (fi=it.current() ) ) {
30 if( fi->extension() == QString::fromLatin1("desktop") ){
31 ++it;
32 continue;
33 }
34 MimeType type( fi->absFilePath() );
35
36 if( !mimes.contains( type.id() ) ){
37 mimes.insert( type.id(), type.id() );
38 }
39
40 ++it;
41 }
42
43 return mimes;
44}
45void OLocalLister::reparse( const QString& path ) {
46 QString currentMimeType;
47 QDir dir( path );
48
49 dir.setSorting( view()->sorting() );
50 dir.setFilter( view()->filter() );
51
52 // now go through all files
53 const QFileInfoList *list = dir.entryInfoList();
54 QFileInfoListIterator it( *list );
55 QFileInfo *fi;
56
57 while( (fi=it.current() ) ){
58
59 if( fi->fileName() == QString::fromLatin1("..") ||
60 fi->fileName() == QString::fromLatin1(".") ){
61 ++it;
62 continue;
63 }
64 if( fi->isSymLink() ){
65 QString file = fi->dirPath( true ) + "/" + fi->readLink();
66 /*
67 * 5 tries to prevent dos attack
68 */
69 for( int i = 0; i<=4; i++) {
70 QFileInfo info( file );
71 if( !info.exists() ){
72 addSymlink( currentMimeType, fi, TRUE );
73 break;
74 }else if( info.isDir() ){
75 addDir( currentMimeType, fi,
76 TRUE );
77 break;
78 }else if( info.isFile() ){
79 addFile( currentMimeType, fi, TRUE );
80 break;
81 }else if( info.isSymLink() ){
82 file = info.dirPath(true ) + "/" + info.readLink() ;
83 break;
84 }else if( i == 4){
85 addSymlink( currentMimeType, fi );
86 }
87 }
88
89 }else if( fi->isDir() ){
90 addDir( currentMimeType, fi );
91 }else if( fi->isFile() ){
92 addFile( currentMimeType, fi );
93 }
94 ++it;
95 } // of while loop
96}
97
diff --git a/libopie/ofileselector/olocallister.h~ b/libopie/ofileselector/olocallister.h~
deleted file mode 100644
index a284b6e..0000000
--- a/libopie/ofileselector/olocallister.h~
+++ b/dev/null
@@ -1,14 +0,0 @@
1#ifndef OPIE_LOCAL_LISTER
2#define OPIE_LOCAL_LISTER
3
4#include "olister.h"
5
6class OLocalLister : public OLister {
7public:
8 OLocalLister( OFileSelector* );
9 ~OLocalLister();
10 void reparse( const QString& path );
11 QMap<QString, QString> mimeTypes(const QString& dir );
12};
13
14#endif
diff --git a/libopie/ofileselector/olocallister.o b/libopie/ofileselector/olocallister.o
deleted file mode 100644
index 1a4685d..0000000
--- a/libopie/ofileselector/olocallister.o
+++ b/dev/null
Binary files differ