author | zecke <zecke> | 2002-09-15 17:52:30 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-15 17:52:30 (UTC) |
commit | 1c5780f34ec9b4dc004714488b46997fe1a0909b (patch) (unidiff) | |
tree | 524719fe92e4738dbcebf4bc792d6901cf215df9 /libopie/ofileselector/ofilelistview.cpp | |
parent | 8c161a2699a842e527ade4410189fd18964d1c31 (diff) | |
download | opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.zip opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.tar.gz opie-1c5780f34ec9b4dc004714488b46997fe1a0909b.tar.bz2 |
Ok the demand for filters, listers and views were great so I'm currently
implementing it
This OFileSelector will be in a different subdir but it'll be still
linked into libopie. This makes it more easy to find all files which
belong to the OFileSelector
an OLister is able to list
for example files and dirs ( OLocalLister )
a ftp lister
a bluetooth lister whcich would show available devices
a DocLnkSet lister for the Documents Tab
a CrossReference lister
a View is responsible for showing files to the user...
and I renamed *.cc to *.cpp
Diffstat (limited to 'libopie/ofileselector/ofilelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp new file mode 100644 index 0000000..0c7d45b --- a/dev/null +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -0,0 +1,118 @@ | |||
1 | |||
2 | #include "ofileselector.h" | ||
3 | #include "ofileselectoritem.h" | ||
4 | #include "ofilelistview.h" | ||
5 | |||
6 | |||
7 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | ||
8 | : QListView( parent ), OFileView( sel ) | ||
9 | { | ||
10 | |||
11 | } | ||
12 | OFileListView::~OFileListView() { | ||
13 | |||
14 | } | ||
15 | void OFileListView::clear() { | ||
16 | QListView::clear(); | ||
17 | } | ||
18 | void OFileListView::addFile( const QString& mime, | ||
19 | QFileInfo* info, | ||
20 | bool isSymlink ) { | ||
21 | MimeType type( info->absFilePath() ); | ||
22 | QPixmap pix = type.pixmap(); | ||
23 | QString dir; | ||
24 | QString name; | ||
25 | bool locked = false; | ||
26 | |||
27 | if( pix.isNull() ) | ||
28 | pix = Resource::loadPixmap( "UnknownDocument-14"); | ||
29 | |||
30 | dir = info->dirPath( true ); | ||
31 | |||
32 | if( isSymlink ) | ||
33 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | ||
34 | else { | ||
35 | name = info->fileName(); | ||
36 | if( ( selector()->mode() == Open && !info->isReadable() )|| | ||
37 | ( selector()->mode() == Save && !info->isWritable() ) ){ | ||
38 | |||
39 | locked = true; pix = Resource::loadPixmap("locked"); | ||
40 | } | ||
41 | } | ||
42 | new OFileSelectorItem( this, pix, name, | ||
43 | info->lastModified().toString(), | ||
44 | QString::number( info->size() ), | ||
45 | dir, locked ); | ||
46 | } | ||
47 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, | ||
48 | const QString& /*file*/, bool /*isSyml*/ ) { | ||
49 | |||
50 | } | ||
51 | void OFileListView::addDir( const QString& mime, | ||
52 | QFileInfo* info, bool isSym ) { | ||
53 | |||
54 | bool locked = false; | ||
55 | QString name; | ||
56 | QPixmap pix; | ||
57 | |||
58 | if( ( selector()->mode() == Open && !info->isReadable() ) || | ||
59 | ( selector()->mode() == Save && !info->isWritable() ) ){ | ||
60 | |||
61 | locked = true; | ||
62 | |||
63 | if( symlink ) | ||
64 | pix = selector()->pixmap("symlinkedlocked"); | ||
65 | else | ||
66 | pix = Resource::loadPixmap("lockedfolder"); | ||
67 | |||
68 | }else { // readable | ||
69 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; | ||
70 | } | ||
71 | |||
72 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | ||
73 | |||
74 | new OFileSelectorItem( this, pix, name, | ||
75 | info->lastModified().toString(), | ||
76 | QString::number( info->size() ), | ||
77 | info->dirPath( true ), locked, | ||
78 | true ); | ||
79 | |||
80 | } | ||
81 | void OFileListView::addDir( const QString& mime, const QString& dir, | ||
82 | const QString& file, bool ) { | ||
83 | |||
84 | } | ||
85 | void OFileListView::addSymlink( const QString& mime, | ||
86 | QFileInfo* info, | ||
87 | bool isSym ) { | ||
88 | |||
89 | } | ||
90 | void OFileListView::addSymlink( const QString& mime, const QString& path, | ||
91 | const QString& file, bool isSym ) { | ||
92 | |||
93 | } | ||
94 | void OFileListView::cd( const QString& ) { | ||
95 | |||
96 | } | ||
97 | QWidget* OFileListView::widget() { | ||
98 | return this; | ||
99 | } | ||
100 | QString OFileListView::selectedName()const{ | ||
101 | QListViewItem *item = currentItem(); | ||
102 | if (!item ) | ||
103 | return QString::null; | ||
104 | |||
105 | return item->text( 1 ); | ||
106 | } | ||
107 | QStringList OFileListView::selectedNames()const { | ||
108 | |||
109 | } | ||
110 | QString OFileListView::selectedPath()const { | ||
111 | |||
112 | } | ||
113 | QString OFileListView::selectedPaths()const { | ||
114 | |||
115 | } | ||
116 | int OFileListView::fileCount() { | ||
117 | return childCount(); | ||
118 | } | ||