author | zecke <zecke> | 2002-10-05 20:49:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-05 20:49:38 (UTC) |
commit | 19c0a4610292a95281a64655cef9c2d695a214dc (patch) (unidiff) | |
tree | dde4afda2629a6e10d545d9492ada7b43e431ee7 /libopie/ofileselector/ofilelistview.cpp | |
parent | d7f9d00fcc9261db9c4af4f1b4afde9d50e8a2a2 (diff) | |
download | opie-19c0a4610292a95281a64655cef9c2d695a214dc.zip opie-19c0a4610292a95281a64655cef9c2d695a214dc.tar.gz opie-19c0a4610292a95281a64655cef9c2d695a214dc.tar.bz2 |
more steps to make ofileselector modular
We now got the API for a factory so switching should work in future
and we now got a OPixmapProvider which provides us with pixmaps....
So an ImageViewer could install a differen OPixmapProvider
and a different OFileView to make Previewing
work
Diffstat (limited to 'libopie/ofileselector/ofilelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index bb15764..691bf42 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -43,18 +43,14 @@ OFileListView::~OFileListView() { | |||
43 | void OFileListView::clear() { | 43 | void OFileListView::clear() { |
44 | QListView::clear(); | 44 | QListView::clear(); |
45 | } | 45 | } |
46 | void OFileListView::addFile( const QString&, | 46 | void OFileListView::addFile( const QPixmap& pix, |
47 | const QString&, | ||
47 | QFileInfo* info, | 48 | QFileInfo* info, |
48 | bool isSymlink ) { | 49 | bool isSymlink ) { |
49 | MimeType type( info->absFilePath() ); | ||
50 | QPixmap pix = type.pixmap(); | ||
51 | QString dir; | 50 | QString dir; |
52 | QString name; | 51 | QString name; |
53 | bool locked = false; | 52 | bool locked = false; |
54 | 53 | ||
55 | if( pix.isNull() ) | ||
56 | pix = Resource::loadPixmap( "UnknownDocument-14"); | ||
57 | |||
58 | dir = info->dirPath( true ); | 54 | dir = info->dirPath( true ); |
59 | 55 | ||
60 | if( isSymlink ) | 56 | if( isSymlink ) |
@@ -64,7 +60,7 @@ void OFileListView::addFile( const QString&, | |||
64 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | 60 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
65 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | 61 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
66 | 62 | ||
67 | locked = true; pix = Resource::loadPixmap("locked"); | 63 | locked = true; |
68 | } | 64 | } |
69 | } | 65 | } |
70 | new OFileSelectorItem( this, pix, name, | 66 | new OFileSelectorItem( this, pix, name, |
@@ -72,30 +68,16 @@ void OFileListView::addFile( const QString&, | |||
72 | QString::number( info->size() ), | 68 | QString::number( info->size() ), |
73 | dir, locked ); | 69 | dir, locked ); |
74 | } | 70 | } |
75 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, | 71 | void OFileListView::addFile( const QPixmap&, |
72 | const QString& /*mime*/, const QString& /*dir*/, | ||
76 | const QString& /*file*/, bool /*isSyml*/ ) { | 73 | const QString& /*file*/, bool /*isSyml*/ ) { |
77 | 74 | ||
78 | } | 75 | } |
79 | void OFileListView::addDir( const QString&, | 76 | void OFileListView::addDir( const QPixmap& pix, const QString&, |
80 | QFileInfo* info, bool symlink ) { | 77 | QFileInfo* info, bool symlink ) { |
81 | 78 | ||
82 | bool locked = false; | 79 | bool locked = false; |
83 | QString name; | 80 | QString name; |
84 | QPixmap pix; | ||
85 | |||
86 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | ||
87 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | ||
88 | |||
89 | locked = true; | ||
90 | |||
91 | if( symlink ) | ||
92 | pix = selector()->pixmap("symlinkedlocked"); | ||
93 | else | ||
94 | pix = Resource::loadPixmap("lockedfolder"); | ||
95 | |||
96 | }else { // readable | ||
97 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; | ||
98 | } | ||
99 | 81 | ||
100 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 82 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
101 | 83 | ||
@@ -106,17 +88,20 @@ void OFileListView::addDir( const QString&, | |||
106 | true ); | 88 | true ); |
107 | 89 | ||
108 | } | 90 | } |
109 | void OFileListView::addDir( const QString& /*mime*/, const QString& /*dir*/, | 91 | void OFileListView::addDir( const QPixmap&, |
92 | const QString& /*mime*/, const QString& /*dir*/, | ||
110 | const QString& /*file*/, bool ) { | 93 | const QString& /*file*/, bool ) { |
111 | 94 | ||
112 | } | 95 | } |
113 | void OFileListView::addSymlink( const QString& /*mime*/, | 96 | void OFileListView::addSymlink( const QPixmap&, |
97 | const QString& /*mime*/, | ||
114 | QFileInfo* /*info*/, | 98 | QFileInfo* /*info*/, |
115 | bool /*isSym*/ ) { | 99 | bool /*isSym*/ ) { |
116 | 100 | ||
117 | } | 101 | } |
118 | void OFileListView::addSymlink( const QString& /*mime*/, const QString& /*path*/, | 102 | void OFileListView::addSymlink(const QPixmap&, |
119 | const QString& /*file*/, bool /*isSym*/ ) { | 103 | const QString& /*m*/, const QString& /*path*/, |
104 | const QString& /*file*/, bool /*isSym*/ ) { | ||
120 | 105 | ||
121 | } | 106 | } |
122 | void OFileListView::cd( const QString& ) { | 107 | void OFileListView::cd( const QString& ) { |