author | zecke <zecke> | 2002-10-28 21:47:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-28 21:47:58 (UTC) |
commit | 98d46aa752026d53b4cf4ea8572fdf7c89f4c6c0 (patch) (unidiff) | |
tree | 3e4a873011de405e5402d7eb53ae1c5c2867246a | |
parent | b963230163fc8069731374a19390fd0e5cb42532 (diff) | |
download | opie-98d46aa752026d53b4cf4ea8572fdf7c89f4c6c0.zip opie-98d46aa752026d53b4cf4ea8572fdf7c89f4c6c0.tar.gz opie-98d46aa752026d53b4cf4ea8572fdf7c89f4c6c0.tar.bz2 |
Almost done with the new data flow
only OFileSelector needs to adapt it now...
Besides that make it compile with the new api
Add a configure and a libopie.pro to actually build ofileselector
and a MANIFEST to explain some basics of the now a days
a bit bigger interface
-rw-r--r-- | libopie/ofileselector/MANIFEST | 29 | ||||
-rwxr-xr-x | libopie/ofileselector/configure | 301 | ||||
-rw-r--r-- | libopie/ofileselector/libopie.pro | 97 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 32 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.h | 6 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 2 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselectoritem.cpp | 4 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.cpp | 2 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.h | 4 | ||||
-rw-r--r-- | libopie/ofileselector/olister.cpp | 13 | ||||
-rw-r--r-- | libopie/ofileselector/olister.h | 7 | ||||
-rw-r--r-- | libopie/ofileselector/olocallister.cpp | 14 | ||||
-rw-r--r-- | libopie/ofileselector/olocallister.h | 2 |
13 files changed, 482 insertions, 31 deletions
diff --git a/libopie/ofileselector/MANIFEST b/libopie/ofileselector/MANIFEST new file mode 100644 index 0000000..2730a1c --- a/dev/null +++ b/libopie/ofileselector/MANIFEST | |||
@@ -0,0 +1,29 @@ | |||
1 | Hija, | ||
2 | dunno if that is to call a manifest but here is | ||
3 | an quick overview how the OFileSelector is implemented | ||
4 | and whats the whole purpose is. | ||
5 | |||
6 | OFileSelector is meant to be extendable by design. It's divided | ||
7 | into a shell the class OFileSelector which is a dispatcher | ||
8 | between worlds and gives a common interface to the programmer. | ||
9 | Then there is the OLister class which is a lister of files. | ||
10 | It's responsible for taking care of a filesystem... but it's not limited | ||
11 | to local filesystem. You can have a FTP lister, Bluetooth Device Lister, | ||
12 | IrdaDevice Lister, Local Documents Lister, a PIM Lister an X-Ref lister... | ||
13 | they will operate on the level of filesystems.... | ||
14 | |||
15 | A OFileView is the other part of the FileSelector it's responsible | ||
16 | for the things represented to the USER. | ||
17 | There is a ListView and a IconView and possible more views to come. | ||
18 | |||
19 | Then there is a PixmapProvider which is responsible for providing pixmaps | ||
20 | for a mimetype. This can be used for something like a Pixmap preview.... | ||
21 | |||
22 | |||
23 | The lister is told to reparse() then it adds it things to the mainview | ||
24 | on selection the URL get's generated in more than one step. | ||
25 | 1. The UI notifies the lister about activation | ||
26 | 2. The Lister assembles the URL | ||
27 | 3. the Lister notifies the OFileSelector | ||
28 | 4. the OFileSelector emits a signal | ||
29 | |||
diff --git a/libopie/ofileselector/configure b/libopie/ofileselector/configure new file mode 100755 index 0000000..c66fd82 --- a/dev/null +++ b/libopie/ofileselector/configure | |||
@@ -0,0 +1,301 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Configures to build the Qtopia Environment | ||
4 | # | ||
5 | # Copyright 1999-2000 Trolltech AS. All rights reserved. | ||
6 | # | ||
7 | |||
8 | PLATFORM=generic | ||
9 | SHARING=shared | ||
10 | DEBUG= | ||
11 | QCONFIGARG= | ||
12 | |||
13 | touch .test.qpe. | ||
14 | if [ '!' -f ${OPIEDIR}/.test.qpe. ]; | ||
15 | then | ||
16 | rm .test.qpe. | ||
17 | echo | ||
18 | echo | ||
19 | echo ' The environment variable $OPIEDIR is not set correctly. It is currently' | ||
20 | echo ' set to "'$OPIEDIR'", but it should be set to this directory,' | ||
21 | echo ' which is "'`pwd`'".' | ||
22 | echo | ||
23 | echo ' Please read the INSTALL file for instructions on how to set $OPIEDIR' | ||
24 | echo ' correctly. If you have set $OPIEDIR in your .profile or .login, you ' | ||
25 | echo ' will need to log out and log in again to make the setting effective.' | ||
26 | echo | ||
27 | echo | ||
28 | exit 1 | ||
29 | fi | ||
30 | rm .test.qpe. | ||
31 | |||
32 | if [ '!' -f $TMAKEPATH/tmake.conf ] | ||
33 | then | ||
34 | # You have tmake. We'll regenerate the file for you... | ||
35 | echo ' The environment variable $TMAKEPATH is not set correclty. ' | ||
36 | echo ' It should be set to the tmake path' | ||
37 | echo | ||
38 | echo ' Please read the INSTALL file for instructions on how to set $TMAKEPATH' | ||
39 | echo ' to the environment variable correctly.' | ||
40 | exit 1 | ||
41 | fi | ||
42 | |||
43 | VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\.[0-9]*\.[0-9]*.*".*/\1/p' <library/version.h) | ||
44 | VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.\([0-9]\)\.[0-9]*.*".*/\1/p' <library/version.h) | ||
45 | VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.[0-9]*\.\([0-9]*\).*".*/\1/p' <library/version.h) | ||
46 | |||
47 | TOMAKE= | ||
48 | |||
49 | if grep -q 'VERSION_STR.*"3' $QTDIR/include/qglobal.h | ||
50 | then | ||
51 | QT3=yes | ||
52 | else | ||
53 | QT3=no | ||
54 | fi | ||
55 | |||
56 | # Parse the arguments, setting things to "yes" or "no". | ||
57 | |||
58 | while [ -n "$1" ]; do | ||
59 | case $1 in | ||
60 | -platform|-xplatform) # No difference since we don't need to build moc, etc. | ||
61 | shift; PLATFORM=$1 | ||
62 | ;; | ||
63 | -release) | ||
64 | DEBUG= | ||
65 | ;; | ||
66 | -debug) | ||
67 | DEBUG=-debug | ||
68 | ;; | ||
69 | -shared) | ||
70 | SHARING=shared | ||
71 | ;; | ||
72 | -static) | ||
73 | SHARING=static | ||
74 | ;; | ||
75 | -qconfig) | ||
76 | # optional way to specify the qconfig-qpe.h is to pass -qconfig qpe | ||
77 | shift; QCONFIGARG=DEFINES+=QCONFIG='\"'$1'\"' # Don't quote me on that. | ||
78 | ;; | ||
79 | -make) | ||
80 | shift; TOMAKE="$TOMAKE $1" | ||
81 | ;; | ||
82 | -qt3) | ||
83 | QT3=yes | ||
84 | ;; | ||
85 | *) | ||
86 | HELP=yes;; | ||
87 | esac | ||
88 | shift | ||
89 | done | ||
90 | |||
91 | TARGET=configs/$PLATFORM-$SHARING$DEBUG | ||
92 | |||
93 | if [ '!' -f $TARGET ] | ||
94 | then | ||
95 | if [ -f configs/linux-$PLATFORM-g++-$SHARING$DEBUG ] | ||
96 | then | ||
97 | TARGET=configs/linux-$PLATFORM-g++-$SHARING$DEBUG | ||
98 | PLATFORM=linux-$PLATFORM-g++ | ||
99 | else | ||
100 | echo | ||
101 | echo ' The specified platform/compiler not supported: ' $TARGET | ||
102 | echo | ||
103 | exit 2 | ||
104 | fi | ||
105 | fi | ||
106 | |||
107 | # Next, emit a usage message if something failed. | ||
108 | |||
109 | if [ "$HELP" = "yes" ]; then | ||
110 | cat <<EOF | ||
111 | Usage: $0 [-debug] [-release] [-shared] [-static] [-qt3] [-platform ...] | ||
112 | |||
113 | The defaults (*) are usually acceptable. Here is a short explanation of | ||
114 | each option: | ||
115 | |||
116 | * -release ........... Compile and link Qt with debugging turned off. | ||
117 | -debug ............. Compile and link Qt with debugging turned on. | ||
118 | |||
119 | * -shared ............ Create and use a shared Qt library (libqt.so) | ||
120 | -static ............ Create and use a static Qt library (libqt.a) | ||
121 | |||
122 | -qt3 ............... Configure for use with Qt 3.x | ||
123 | |||
124 | -platform target ... The platform you are building on ($PLATFORM) | ||
125 | EOF | ||
126 | exit 0; | ||
127 | fi | ||
128 | |||
129 | CUSTOM=`echo $PLATFORM | sed -n -e "s/.*-\(.*\)-.*/\1/p"` | ||
130 | |||
131 | if [ -f library/custom-$CUSTOM.h ] | ||
132 | then | ||
133 | rm -f library/custom.h | ||
134 | ln -s custom-$CUSTOM.h library/custom.h | ||
135 | fi | ||
136 | |||
137 | mkdir -p include/qpe | ||
138 | ( cd include/qpe && rm -f *.h; ln -s ../../library/*.h .; ln -s ../../library/backend/*.h .; rm -f *_p.h; ) | ||
139 | mkdir -p include/qtopia | ||
140 | ( cd include/qtopia && rm -f *.h; ln -s ../../library/*.h .; ) | ||
141 | mkdir -p include/qtopia/private | ||
142 | ( cd include/qtopia/private && rm -f *.h; ln -s ../../../library/backend/*.h .; ) | ||
143 | mkdir -p include/opie | ||
144 | ( cd include/opie && rm -f *.h; ln -s ../../libopie/*.h .; rm -f *_p.h; ) | ||
145 | ( cd include/opie && ln -s ../../libsql/*.h .; ) | ||
146 | ( cd include/opie && ln -s ../../libopie/pim/*.h .; ) | ||
147 | ( cd include/opie && ln -fs ../../libopie/ofileselector/*.h .; ) | ||
148 | |||
149 | echo Creating makefiles... | ||
150 | |||
151 | # Set version for library directly | ||
152 | # Version 1.5.0 right now for compat. | ||
153 | sed -e 's/^\(VERSION.*= \).*/\1'1.5.0.$VERSION_PAT/ <library/library.pro >library/library.pro-v | ||
154 | mv library/library.pro-v library/library.pro | ||
155 | |||
156 | if [ "$QT3" = yes ] | ||
157 | then | ||
158 | VCONFIG="CONFIG+=qt3" | ||
159 | else | ||
160 | VCONFIG="CONFIG+=qt2" | ||
161 | fi | ||
162 | |||
163 | if [ -f $TMAKEPATH/tmake.conf ] | ||
164 | then | ||
165 | # You have tmake. We'll regenerate the file for you... | ||
166 | echo "Makefiles will be regenerated." | ||
167 | fi | ||
168 | |||
169 | H=`pwd` | ||
170 | if [ -z "$TOMAKE" ] | ||
171 | then | ||
172 | TOMAKE=`make showcomponents` | ||
173 | fi | ||
174 | |||
175 | for a in $TOMAKE ; do | ||
176 | N=$a/Makefile | ||
177 | M=$a/Makefile.in | ||
178 | O=$a/Makefile.add | ||
179 | f=`basename $a` | ||
180 | |||
181 | if [ -f "$TMAKEPATH/tmake.conf" -a -f "$a/$f.pro" ] | ||
182 | then | ||
183 | ( cd $a; | ||
184 | TMAKEPATH=$QTDIR/tmake:$TMAKEPATH \ | ||
185 | tmake $QCONFIGARG CONFIG+=embedded $VCONFIG \ | ||
186 | -t $H/qt/tmake/propagate.t $f.pro | | ||
187 | sed -e "s|$QTDIR|\$(QTDIR)|g" -e "s|$OPIEDIR|\$(OPIEDIR)|g" >Makefile.in; | ||
188 | ) | ||
189 | echo -n "." | ||
190 | #echo Building $N.. | ||
191 | appname=`grep '^TARGET' $a/$f.pro | sed 's/^TARGET.*=//' | tr -d " \t"` | ||
192 | translation=`grep '^TRANSLATION.*[^+]=.*' $a/$f.pro | sed 's,^TRANSL.*=.*i18n\/.*\/,,' | sed 's/ //g' | sed 's,\.ts.*,,' | sed 's,^lib,,' ` | ||
193 | if [ -n "$translation" -a -n "$appname" ] | ||
194 | then | ||
195 | if [ "$appname" != "$translation" ] | ||
196 | then | ||
197 | echo | ||
198 | echo "Warning: translation and appname disagree in $a/$f.pro" | ||
199 | fi | ||
200 | fi | ||
201 | |||
202 | fi | ||
203 | |||
204 | cat > $N <<EOF | ||
205 | ############################################################################# | ||
206 | # Automatically generated from $M | ||
207 | # Build options from $1 | ||
208 | ############################################################################# | ||
209 | |||
210 | EOF | ||
211 | |||
212 | SED= | ||
213 | PLATFORM_CFLAGS= | ||
214 | |||
215 | if [ "$f" = "embeddedkonsole" ] | ||
216 | then | ||
217 | case $PLATFORM in | ||
218 | *x86*|*generic*|*ipaq*|*sharp*) | ||
219 | SED="$SED /^LIBS.*=/s/\$/ -lutil/;" | ||
220 | PLATFORM_CFLAGS="-DHAVE_OPENPTY" | ||
221 | ;; *) | ||
222 | SED= | ||
223 | esac | ||
224 | elif [ "$f" = "libmpeg3" ] | ||
225 | then | ||
226 | # Patch our Makefile.in file with the platform specifics for the libmpeg3 library | ||
227 | # Use the C++ compiler to compile the .c files (because the fixed-point classes are C++ code) | ||
228 | SED='s/\$(CC)/\$(CXX)/;' | ||
229 | case $PLATFORM | ||
230 | in | ||
231 | # For x86 turn on using floating point, compile mmx and css code | ||
232 | *x86*) | ||
233 | # "-funroll-loops -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -march=i486" | ||
234 | PLATFORM_CFLAGS="-DHAVE_MMX -DHAVE_CSS" | ||
235 | SED="$SED /SOURCES.*=/s/=/= video\\/mmxidct.S video\\/reconmmx.s\ /;" | ||
236 | # For generic turn on using floating point | ||
237 | ;; *generic*) | ||
238 | PLATFORM_CFLAGS="" | ||
239 | # For the ipaq use fixed point maths, don't compile the mmx or css code | ||
240 | ;; *ipaq*|*sharp*) | ||
241 | PLATFORM_CFLAGS="-DUSE_FIXED_POINT" | ||
242 | ;; *) | ||
243 | # For 'other platforms', turn off optimizations and use fixed point | ||
244 | PLATFORM_CFLAGS="-O -DUSE_FIXED_POINT" | ||
245 | esac | ||
246 | elif [ "$f" = "libmad" ] | ||
247 | then | ||
248 | # Patch our Makefile.in file with the platform specifics for the libmad library | ||
249 | case $PLATFORM | ||
250 | in | ||
251 | # For x86 use intel optimizations | ||
252 | *x86*) | ||
253 | PLATFORM_CFLAGS="-DFPM_INTEL" | ||
254 | # For the ipaq use ARM asm optimizations | ||
255 | ;; *ipaq*|*sharp*) | ||
256 | PLATFORM_CFLAGS="-DFPM_ARM" | ||
257 | SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;" | ||
258 | # For generic platforms use the C 64-bit implementation | ||
259 | ;; *generic*) | ||
260 | PLATFORM_CFLAGS="-DFPM_64BIT" | ||
261 | # For 'other platforms' use the ARM code | ||
262 | ;; *) | ||
263 | PLATFORM_CFLAGS="-DFPM_ARM" | ||
264 | SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;" | ||
265 | esac | ||
266 | fi | ||
267 | if [ -n "$PLATFORM_CFLAGS" ] | ||
268 | then | ||
269 | # Append the addition c-flags we have defined | ||
270 | SED="$SED /CFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;" | ||
271 | SED="$SED /CXXFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;" | ||
272 | fi | ||
273 | cat $TARGET >> $N | ||
274 | if [ -n "$SED" ] | ||
275 | then | ||
276 | sed -e "$SED" $M >> $N | ||
277 | else | ||
278 | cat $M >> $N | ||
279 | fi | ||
280 | |||
281 | cat >> $N <<EOF | ||
282 | |||
283 | lupdate: | ||
284 | lupdate $f.pro | ||
285 | |||
286 | lrelease: | ||
287 | lrelease $f.pro | ||
288 | |||
289 | EOF | ||
290 | if [ -f "$O" ] | ||
291 | then | ||
292 | cat >> $N $O | ||
293 | fi | ||
294 | |||
295 | done | ||
296 | |||
297 | MAKE=make | ||
298 | echo | ||
299 | echo "Opie is now configured for building. Just run $MAKE (or $MAKE single)." | ||
300 | echo "To reconfigure, run $MAKE clean and configure." | ||
301 | echo | ||
diff --git a/libopie/ofileselector/libopie.pro b/libopie/ofileselector/libopie.pro new file mode 100644 index 0000000..0fa43fc --- a/dev/null +++ b/libopie/ofileselector/libopie.pro | |||
@@ -0,0 +1,97 @@ | |||
1 | TEMPLATE = lib | ||
2 | CONFIG += qte warn_on release | ||
3 | HEADERS = ofontmenu.h \ | ||
4 | ocolorbutton.h \ | ||
5 | ofileselector/odefaultfactories.h \ | ||
6 | ofileselector/ofiledialog.h \ | ||
7 | ofileselector/ofilelistview.h \ | ||
8 | ofileselector/ofileselector.h \ | ||
9 | ofileselector/ofileselectoritem.h \ | ||
10 | ofileselector/ofileseleczormain.h \ | ||
11 | ofileselector/ofileview.h \ | ||
12 | ofileselector/olister.h \ | ||
13 | ofileselector/olocallister.h \ | ||
14 | ofileselector/opixmapprovider.h \ | ||
15 | tododb.h \ | ||
16 | ocheckitem.h todoevent.h todoresource.h \ | ||
17 | todovcalresource.h xmltree.h \ | ||
18 | colordialog.h colorpopupmenu.h \ | ||
19 | oclickablelabel.h oprocctrl.h \ | ||
20 | oprocess.h odevice.h \ | ||
21 | otimepicker.h otabwidget.h \ | ||
22 | otabbar.h otabinfo.h \ | ||
23 | ofontselector.h \ | ||
24 | pim/opimrecord.h \ | ||
25 | pim/otodo.h \ | ||
26 | pim/orecordlist.h \ | ||
27 | pim/opimaccesstemplate.h \ | ||
28 | pim/opimaccessbackend.h \ | ||
29 | pim/otodoaccess.h \ | ||
30 | pim/otodacessbackend.h \ | ||
31 | pim/ocontact.h \ | ||
32 | pim/ocontactaccess.h \ | ||
33 | pim/ocontactaccessbackend.h \ | ||
34 | pim/ocontactaccessbackend_xml.h \ | ||
35 | pim/obackendfactory.h \ | ||
36 | pim/opimcache.h \ | ||
37 | pim/otodoaccessvcal.h \ | ||
38 | pim/orecur.h \ | ||
39 | orecurrancewidget.h | ||
40 | # pim/otodoaccesssql.h \ | ||
41 | |||
42 | SOURCES = ofontmenu.cc \ | ||
43 | ocolorbutton.cpp \ | ||
44 | ofileselector/odefaultfactories.cpp \ | ||
45 | ofileselector/ofiledialog.cpp \ | ||
46 | ofileselector/ofilefactory.cpp \ | ||
47 | ofileselector/ofilelistview.cpp \ | ||
48 | ofileselector/ofileselector.cpp \ | ||
49 | ofileselector/ofileselectoritem.cpp \ | ||
50 | ofileselector/ofileselectormain.cpp \ | ||
51 | ofileselector/ofileview.cpp \ | ||
52 | ofileselector/olister.cpp \ | ||
53 | ofileselector/olocallister.cpp \ | ||
54 | ofileselector/opixmapprovider.cpp \ | ||
55 | xmltree.cc \ | ||
56 | ocheckitem.cpp tododb.cpp todoevent.cpp \ | ||
57 | todovcalresource.cpp colordialog.cpp \ | ||
58 | colorpopupmenu.cpp oclickablelabel.cpp \ | ||
59 | oprocctrl.cpp oprocess.cpp \ | ||
60 | odevice.cpp otimepicker.cpp \ | ||
61 | otabwidget.cpp otabbar.cpp \ | ||
62 | ofontselector.cpp \ | ||
63 | pim/otodo.cpp \ | ||
64 | pim/opimrecord.cpp \ | ||
65 | pim/otodoaccess.cpp \ | ||
66 | pim/otodoaccessbackend.cpp \ | ||
67 | pim/otodoaccessxml.cpp \ | ||
68 | pim/ocontact.cpp \ | ||
69 | pim/ocontactaccess.cpp \ | ||
70 | pim/otodoaccessvcal.cpp \ | ||
71 | pim/orecur.cpp \ | ||
72 | orecurrancewidget.cpp | ||
73 | # pim/otodoaccesssql.cpp \ | ||
74 | |||
75 | TARGET = opie | ||
76 | INCLUDEPATH += $(OPIEDIR)/include | ||
77 | DESTDIR = $(QTDIR)/lib$(PROJMAK) | ||
78 | #VERSION = 1.0.0 | ||
79 | |||
80 | # LIBS += -lopiesql | ||
81 | |||
82 | INTERFACES = otimepickerbase.ui orecurrancebase.ui | ||
83 | |||
84 | TRANSLATIONS = ../i18n/de/libopie.ts \ | ||
85 | ../i18n/en/libopie.ts \ | ||
86 | ../i18n/es/libopie.ts \ | ||
87 | ../i18n/fr/libopie.ts \ | ||
88 | ../i18n/hu/libopie.ts \ | ||
89 | ../i18n/ja/libopie.ts \ | ||
90 | ../i18n/ko/libopie.ts \ | ||
91 | ../i18n/no/libopie.ts \ | ||
92 | ../i18n/pl/libopie.ts \ | ||
93 | ../i18n/pt/libopie.ts \ | ||
94 | ../i18n/pt_BR/libopie.ts \ | ||
95 | ../i18n/sl/libopie.ts \ | ||
96 | ../i18n/zh_CN/libopie.ts \ | ||
97 | ../i18n/zh_TW/libopie.ts | ||
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 9cfdc48..fe8acf0 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -1,203 +1,201 @@ | |||
1 | 1 | ||
2 | #include <qheader.h> | 2 | #include <qheader.h> |
3 | 3 | ||
4 | #include <qpe/mimetype.h> | 4 | #include <qpe/mimetype.h> |
5 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | 7 | ||
8 | #include "ofileselector.h" | 8 | #include "ofileselector.h" |
9 | #include "ofileselectoritem.h" | 9 | #include "ofileselectoritem.h" |
10 | #include "ofilelistview.h" | 10 | #include "ofilelistview.h" |
11 | 11 | ||
12 | 12 | ||
13 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | 13 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) |
14 | : QListView( parent ), OFileView( sel ) | 14 | : QListView( parent ), OFileView( sel ) |
15 | { | 15 | { |
16 | QPEApplication::setStylusOperation( viewport(), | 16 | QPEApplication::setStylusOperation( viewport(), |
17 | QPEApplication::RightOnHold); | 17 | QPEApplication::RightOnHold); |
18 | addColumn(" " ); | 18 | addColumn(" " ); |
19 | addColumn(tr("Name"), 135 ); | 19 | addColumn(tr("Name"), 135 ); |
20 | addColumn(tr("Size"), -1 ); | 20 | addColumn(tr("Size"), -1 ); |
21 | addColumn(tr("Date"), 60 ); | 21 | addColumn(tr("Date"), 60 ); |
22 | addColumn(tr("Mime Type"), -1 ); | 22 | addColumn(tr("Mime Type"), -1 ); |
23 | QHeader *head = header(); | 23 | QHeader *head = header(); |
24 | head->hide(); | 24 | head->hide(); |
25 | setSorting( 1 ); | 25 | setSorting( 1 ); |
26 | setAllColumnsShowFocus( TRUE ); | 26 | setAllColumnsShowFocus( TRUE ); |
27 | 27 | ||
28 | connect(this, SIGNAL(selectionChanged() ), | 28 | connect(this, SIGNAL(selectionChanged() ), |
29 | this, SLOT(slotSelectionChanged() ) ); | 29 | this, SLOT(slotSelectionChanged() ) ); |
30 | 30 | ||
31 | connect(this, SIGNAL(currentChanged(QListViewItem *) ), | 31 | connect(this, SIGNAL(currentChanged(QListViewItem *) ), |
32 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | 32 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); |
33 | 33 | ||
34 | connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | 34 | connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), |
35 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | 35 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); |
36 | 36 | ||
37 | connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | 37 | connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), |
38 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | 38 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); |
39 | } | 39 | } |
40 | OFileListView::~OFileListView() { | 40 | OFileListView::~OFileListView() { |
41 | 41 | ||
42 | } | 42 | } |
43 | void OFileListView::clear() { | 43 | void OFileListView::clear() { |
44 | QListView::clear(); | 44 | QListView::clear(); |
45 | } | 45 | } |
46 | void OFileListView::addFile( const QPixmap& pix, | 46 | void OFileListView::addFile( const QPixmap& pix, |
47 | const QString&, | 47 | const QString&, |
48 | QFileInfo* info, | 48 | QFileInfo* info, |
49 | const QString& /*extra*/, | 49 | const QString& extra, |
50 | bool isSymlink ) { | 50 | bool isSymlink ) { |
51 | QString dir; | 51 | QString dir; |
52 | QString name; | 52 | QString name; |
53 | bool locked = false; | 53 | bool locked = false; |
54 | 54 | ||
55 | dir = info->dirPath( true ); | 55 | dir = info->dirPath( true ); |
56 | 56 | ||
57 | if( isSymlink ) | 57 | if( isSymlink ) |
58 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 58 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
59 | else { | 59 | else { |
60 | name = info->fileName(); | 60 | name = info->fileName(); |
61 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | 61 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
62 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | 62 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
63 | 63 | ||
64 | locked = true; | 64 | locked = true; |
65 | } | 65 | } |
66 | } | 66 | } |
67 | new OFileSelectorItem( this, pix, name, | 67 | new OFileSelectorItem( this, pix, name, |
68 | info->lastModified().toString(), | 68 | info->lastModified().toString(), |
69 | QString::number( info->size() ), | 69 | QString::number( info->size() ), |
70 | dir, locked ); | 70 | dir, locked, extra ); |
71 | } | 71 | } |
72 | void OFileListView::addFile( const QPixmap&, | 72 | void OFileListView::addFile( const QPixmap&, |
73 | const QString& /*mime*/, const QString& /*dir*/, | 73 | const QString& /*mime*/, const QString& /*dir*/, |
74 | const QString& /*file*/, | 74 | const QString& /*file*/, |
75 | const QString& /*extra*/, | 75 | const QString& /*extra*/, |
76 | bool /*isSyml*/ ) { | 76 | bool /*isSyml*/ ) { |
77 | 77 | ||
78 | } | 78 | } |
79 | void OFileListView::addDir( const QPixmap& pix, const QString&, | 79 | void OFileListView::addDir( const QPixmap& pix, const QString&, |
80 | QFileInfo* info, | 80 | QFileInfo* info, |
81 | const QString& /*extra */, | 81 | const QString& extra , |
82 | bool symlink ) { | 82 | bool symlink ) { |
83 | 83 | ||
84 | bool locked = false; | 84 | bool locked = false; |
85 | QString name; | 85 | QString name; |
86 | 86 | ||
87 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 87 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
88 | 88 | ||
89 | new OFileSelectorItem( this, pix, name, | 89 | new OFileSelectorItem( this, pix, name, |
90 | info->lastModified().toString(), | 90 | info->lastModified().toString(), |
91 | QString::number( info->size() ), | 91 | QString::number( info->size() ), |
92 | info->dirPath( true ), locked, | 92 | info->dirPath( true ), locked, extra, |
93 | true ); | 93 | true ); |
94 | 94 | ||
95 | } | 95 | } |
96 | void OFileListView::addDir( const QPixmap&, | 96 | void OFileListView::addDir( const QPixmap&, |
97 | const QString& /*mime*/, const QString& /*dir*/, | 97 | const QString& /*mime*/, const QString& /*dir*/, |
98 | const QString& /*file*/, | 98 | const QString& /*file*/, |
99 | const QString& /*extra*/, | 99 | const QString& /*extra*/, |
100 | bool ) { | 100 | bool ) { |
101 | 101 | ||
102 | } | 102 | } |
103 | void OFileListView::addSymlink( const QPixmap&, | 103 | void OFileListView::addSymlink( const QPixmap&, |
104 | const QString& /*mime*/, | 104 | const QString& /*mime*/, |
105 | QFileInfo* /*info*/, | 105 | QFileInfo* /*info*/, |
106 | const QString& /*extra*/, | 106 | const QString& /*extra*/, |
107 | bool /*isSym*/ ) { | 107 | bool /*isSym*/ ) { |
108 | 108 | ||
109 | } | 109 | } |
110 | void OFileListView::addSymlink(const QPixmap&, | 110 | void OFileListView::addSymlink(const QPixmap&, |
111 | const QString& /*m*/, const QString& /*path*/, | 111 | const QString& /*m*/, const QString& /*path*/, |
112 | const QString& /*file*/, | 112 | const QString& /*file*/, |
113 | const QString& /*extra*/, | 113 | const QString& /*extra*/, |
114 | bool /*isSym*/ ) { | 114 | bool /*isSym*/ ) { |
115 | 115 | ||
116 | } | 116 | } |
117 | void OFileListView::cd( const QString& ) { | 117 | void OFileListView::cd( const QString& ) { |
118 | 118 | ||
119 | } | 119 | } |
120 | QWidget* OFileListView::widget() { | 120 | QWidget* OFileListView::widget() { |
121 | return this; | 121 | return this; |
122 | } | 122 | } |
123 | QString OFileListView::selectedName()const{ | 123 | QString OFileListView::selectedName()const{ |
124 | QListViewItem *item = currentItem(); | 124 | QListViewItem *item = currentItem(); |
125 | if (!item ) | 125 | if (!item ) |
126 | return QString::null; | 126 | return QString::null; |
127 | 127 | ||
128 | return item->text( 1 ); | 128 | return item->text( 1 ); |
129 | } | 129 | } |
130 | QString OFileListView::selectedExtra()const{ | ||
131 | QListViewItem* item = currentItem(); | ||
132 | if (!item) return QString::null; | ||
133 | OFileSelectorItem* fit = (OFileSelectorItem*)fit; | ||
134 | |||
135 | return fit->extra(); | ||
136 | } | ||
130 | QStringList OFileListView::selectedNames()const { | 137 | QStringList OFileListView::selectedNames()const { |
131 | QStringList list; | 138 | QStringList list; |
132 | list << selectedName(); | 139 | list << selectedName(); |
133 | return list; | 140 | return list; |
134 | } | 141 | } |
135 | QString OFileListView::selectedPath()const { | 142 | QString OFileListView::selectedPath()const { |
136 | return QString::null; | 143 | return QString::null; |
137 | } | 144 | } |
138 | QStringList OFileListView::selectedPaths()const { | 145 | QStringList OFileListView::selectedPaths()const { |
139 | QStringList list; | 146 | QStringList list; |
140 | b list << selectedPath(); | 147 | list << selectedPath(); |
141 | return list; | 148 | return list; |
142 | } | 149 | } |
143 | int OFileListView::fileCount() { | 150 | int OFileListView::fileCount() { |
144 | return childCount(); | 151 | return childCount(); |
145 | } | 152 | } |
146 | void OFileListView::sort() { | 153 | void OFileListView::sort() { |
147 | QListView::sort(); | 154 | QListView::sort(); |
148 | } | 155 | } |
149 | void OFileListView::slotSelectionChanged() { | 156 | void OFileListView::slotSelectionChanged() { |
150 | 157 | ||
151 | } | 158 | } |
152 | void OFileListView::slotCurrentChanged( QListViewItem* item) { | 159 | void OFileListView::slotCurrentChanged( QListViewItem* item) { |
153 | if (!item ) | 160 | if (!item ) |
154 | return; | 161 | return; |
155 | 162 | ||
156 | OFileSelectorItem* sel = (OFileSelectorItem*) item; | 163 | OFileSelectorItem* sel = (OFileSelectorItem*) item; |
157 | 164 | ||
158 | qWarning("current changed"); | 165 | qWarning("current changed"); |
159 | if(!sel->isDir() ){ | 166 | if(!sel->isDir() ){ |
160 | updateLine( sel->text(1) ); | 167 | updateLine( sel->text(1) ); |
161 | 168 | ||
162 | if (selector()->mode() == OFileSelector::Fileselector ) { | 169 | if (selector()->mode() == OFileSelector::Fileselector ) { |
163 | QStringList str = QStringList::split("->", sel->text(1) ); | 170 | QStringList str = QStringList::split("->", sel->text(1) ); |
164 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); | 171 | fileSelected(sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); |
165 | DocLnk lnk( path ); | ||
166 | fileSelected(lnk ); | ||
167 | fileSelected( path ); | ||
168 | } | 172 | } |
169 | } | 173 | } |
170 | } | 174 | } |
171 | void OFileListView::slotClicked( int button, QListViewItem* item, | 175 | void OFileListView::slotClicked( int button, QListViewItem* item, |
172 | const QPoint&, int ) { | 176 | const QPoint&, int ) { |
173 | if ( !item ) | 177 | if ( !item ) |
174 | return; | 178 | return; |
175 | 179 | ||
176 | if( button != Qt::LeftButton ) | 180 | if( button != Qt::LeftButton ) |
177 | return; | 181 | return; |
178 | 182 | ||
179 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 183 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
180 | 184 | ||
181 | if(!sel->isLocked() ){ | 185 | if(!sel->isLocked() ){ |
182 | QStringList str = QStringList::split("->", sel->text(1) ); | 186 | QStringList str = QStringList::split("->", sel->text(1) ); |
183 | if( sel->isDir() ){ | 187 | if( sel->isDir() ){ |
184 | changedDir( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 188 | changedDir( sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); |
185 | }else{ | 189 | }else{ |
186 | updateLine( str[0].stripWhiteSpace() ); | 190 | updateLine( str[0].stripWhiteSpace() ); |
187 | QString path = sel->directory(); | 191 | fileSelected( sel->directory(),str[0].stripWhiteSpace(), sel->extra() ); |
188 | path += "/"; | ||
189 | path += str[0].stripWhiteSpace(); | ||
190 | |||
191 | DocLnk lnk( path ); | ||
192 | fileSelected( path ); | ||
193 | fileSelected( lnk ); | ||
194 | } | 192 | } |
195 | } | 193 | } |
196 | } | 194 | } |
197 | void OFileListView::slotRightButton( int button, QListViewItem* item, | 195 | void OFileListView::slotRightButton( int button, QListViewItem* item, |
198 | const QPoint&, int ) { | 196 | const QPoint&, int ) { |
199 | if (!item || (button != Qt::RightButton )) | 197 | if (!item || (button != Qt::RightButton )) |
200 | return; | 198 | return; |
201 | 199 | ||
202 | /* raise contextmenu */ | 200 | /* raise contextmenu */ |
203 | } | 201 | } |
diff --git a/libopie/ofileselector/ofilelistview.h b/libopie/ofileselector/ofilelistview.h index 0f625ec..f2eac57 100644 --- a/libopie/ofileselector/ofilelistview.h +++ b/libopie/ofileselector/ofilelistview.h | |||
@@ -1,67 +1,69 @@ | |||
1 | #ifndef OPIE_FILE_LIST_VIEW_H | 1 | #ifndef OPIE_FILE_LIST_VIEW_H |
2 | #define OPIE_FILE_LIST_VIEW_H | 2 | #define OPIE_FILE_LIST_VIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qpixmap.h> | 5 | #include <qpixmap.h> |
6 | 6 | ||
7 | #include "ofileview.h" | 7 | #include "ofileview.h" |
8 | 8 | ||
9 | class OFileListView : public QListView, public OFileView { | 9 | class OFileListView : public QListView, public OFileView { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | public: | 11 | public: |
12 | OFileListView( QWidget* parent, OFileSelector* ); | 12 | OFileListView( QWidget* parent, OFileSelector* ); |
13 | ~OFileListView(); | 13 | ~OFileListView(); |
14 | 14 | ||
15 | void clear(); | 15 | void clear(); |
16 | void addFile( const QPixmap&, | 16 | void addFile( const QPixmap&, |
17 | const QString& mine, | 17 | const QString& mine, |
18 | QFileInfo* info, | 18 | QFileInfo* info, |
19 | const QString& extra = QString::null, | 19 | const QString& extra = QString::null, |
20 | bool isSymlink = FALSE ); | 20 | bool isSymlink = FALSE ); |
21 | 21 | ||
22 | void addFile( const QPixmap&, | 22 | void addFile( const QPixmap&, |
23 | const QString& mime, | 23 | const QString& mime, |
24 | const QString& dir, | 24 | const QString& dir, |
25 | const QString& file, | 25 | const QString& file, |
26 | const QString& extra = QString::null, | 26 | const QString& extra = QString::null, |
27 | bool = false ); | 27 | bool = false ); |
28 | 28 | ||
29 | void addDir( const QPixmap&, | 29 | void addDir( const QPixmap&, |
30 | const QString& mime, | 30 | const QString& mime, |
31 | QFileInfo* info, | ||
31 | const QString& extra = QString::null, | 32 | const QString& extra = QString::null, |
32 | QFileInfo* info, bool = FALSE ); | 33 | bool = FALSE ); |
33 | 34 | ||
34 | void addDir( const QPixmap&, | 35 | void addDir( const QPixmap&, |
35 | const QString& mime, const QString& dir, | 36 | const QString& mime, const QString& dir, |
36 | const QString& file, | 37 | const QString& file, |
37 | const QString& extra = QString::null, | 38 | const QString& extra = QString::null, |
38 | bool = FALSE ); | 39 | bool = FALSE ); |
39 | 40 | ||
40 | void addSymlink( const QPixmap&, | 41 | void addSymlink( const QPixmap&, |
41 | const QString& mime, | 42 | const QString& mime, |
42 | QFileInfo* info, | 43 | QFileInfo* info, |
43 | const QString& extra = QString::null, | 44 | const QString& extra = QString::null, |
44 | bool = FALSE ); | 45 | bool = FALSE ); |
45 | void addSymlink( const QPixmap&, | 46 | void addSymlink( const QPixmap&, |
46 | const QString& mine, const QString& path, | 47 | const QString& mine, const QString& path, |
47 | const QString& file, | 48 | const QString& file, |
48 | const QString& extra, | 49 | const QString& extra = QString::null, |
49 | bool isSymlink = FALSE ); | 50 | bool isSymlink = FALSE ); |
50 | void cd( const QString& path ); | 51 | void cd( const QString& path ); |
51 | QWidget* widget(); | 52 | QWidget* widget(); |
52 | void sort(); | 53 | void sort(); |
53 | 54 | ||
54 | QString selectedName()const ; | 55 | QString selectedName()const ; |
55 | QStringList selectedNames()const; | 56 | QStringList selectedNames()const; |
56 | 57 | ||
57 | QString selectedPath()const; | 58 | QString selectedPath()const; |
58 | QStringList selectedPaths()const; | 59 | QStringList selectedPaths()const; |
60 | QString selectedExtra()const; | ||
59 | int fileCount(); | 61 | int fileCount(); |
60 | private slots: | 62 | private slots: |
61 | void slotSelectionChanged(); | 63 | void slotSelectionChanged(); |
62 | void slotCurrentChanged(QListViewItem* ); | 64 | void slotCurrentChanged(QListViewItem* ); |
63 | void slotClicked( int, QListViewItem*, const QPoint&, int ); | 65 | void slotClicked( int, QListViewItem*, const QPoint&, int ); |
64 | void slotRightButton(int, QListViewItem*, const QPoint&, int ); | 66 | void slotRightButton(int, QListViewItem*, const QPoint&, int ); |
65 | }; | 67 | }; |
66 | 68 | ||
67 | #endif | 69 | #endif |
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 0ccb3cb..255e79e 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -943,157 +943,159 @@ void OFileSelector::setLister(const QString& lister) { | |||
943 | } | 943 | } |
944 | m_listerName = lister; | 944 | m_listerName = lister; |
945 | } | 945 | } |
946 | void OFileSelector::setView( const QString& lis ) { | 946 | void OFileSelector::setView( const QString& lis ) { |
947 | qWarning("setView "); | 947 | qWarning("setView "); |
948 | fillList(); | 948 | fillList(); |
949 | if ( lis == tr("Documents") ) { | 949 | if ( lis == tr("Documents") ) { |
950 | m_selector = Normal; | 950 | m_selector = Normal; |
951 | delete m_lister; | 951 | delete m_lister; |
952 | delete m_fileView; | 952 | delete m_fileView; |
953 | m_lister = 0l; | 953 | m_lister = 0l; |
954 | m_fileView = 0l; | 954 | m_fileView = 0l; |
955 | initializeOldSelector(); | 955 | initializeOldSelector(); |
956 | }else { | 956 | }else { |
957 | qWarning("lis %s", lis.latin1() ); | 957 | qWarning("lis %s", lis.latin1() ); |
958 | QString list; | 958 | QString list; |
959 | 959 | ||
960 | delete m_lister; | 960 | delete m_lister; |
961 | delete m_fileView; | 961 | delete m_fileView; |
962 | delete m_select; | 962 | delete m_select; |
963 | m_lister =0l; | 963 | m_lister =0l; |
964 | m_fileView = 0l; | 964 | m_fileView = 0l; |
965 | m_select = 0l; | 965 | m_select = 0l; |
966 | if ( lis.startsWith("All") ) { | 966 | if ( lis.startsWith("All") ) { |
967 | m_selector = ExtendedAll; | 967 | m_selector = ExtendedAll; |
968 | list = lis.mid(4 ).stripWhiteSpace(); | 968 | list = lis.mid(4 ).stripWhiteSpace(); |
969 | } else{ | 969 | } else{ |
970 | list = lis; | 970 | list = lis; |
971 | m_selector = Extended; | 971 | m_selector = Extended; |
972 | } | 972 | } |
973 | setLister(m_listerName); | 973 | setLister(m_listerName); |
974 | m_fileView = factory()->view( list, this, m_mainView ); | 974 | m_fileView = factory()->view( list, this, m_mainView ); |
975 | m_mainView->setWidget( m_fileView->widget() ); | 975 | m_mainView->setWidget( m_fileView->widget() ); |
976 | reparse(); | 976 | reparse(); |
977 | } | 977 | } |
978 | } | 978 | } |
979 | /* | 979 | /* |
980 | * the factory | 980 | * the factory |
981 | */ | 981 | */ |
982 | void OFileSelector::initFactory() { | 982 | void OFileSelector::initFactory() { |
983 | m_fileFactory = new OFileFactory(); | 983 | m_fileFactory = new OFileFactory(); |
984 | m_fileFactory->addLister(tr("Files"), newLocalLister ); | 984 | m_fileFactory->addLister(tr("Files"), newLocalLister ); |
985 | m_fileFactory->addView(tr("List View"), newFileListView ); | 985 | m_fileFactory->addView(tr("List View"), newFileListView ); |
986 | /* the factory is just a dummy */ | 986 | /* the factory is just a dummy */ |
987 | m_fileFactory->addView(tr("Documents"), newFileListView ); | 987 | m_fileFactory->addView(tr("Documents"), newFileListView ); |
988 | } | 988 | } |
989 | void OFileSelector::fillList() { | 989 | void OFileSelector::fillList() { |
990 | qWarning("fill list"); | 990 | qWarning("fill list"); |
991 | if (!m_viewCheck ) | 991 | if (!m_viewCheck ) |
992 | return; | 992 | return; |
993 | 993 | ||
994 | m_viewCheck->clear(); | 994 | m_viewCheck->clear(); |
995 | QStringList list = factory()->views(); | 995 | QStringList list = factory()->views(); |
996 | qWarning("views: " + list.join(";") ); | 996 | qWarning("views: " + list.join(";") ); |
997 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 997 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
998 | qWarning( (*it) ); | 998 | qWarning( (*it) ); |
999 | if ( (*it) == tr("Documents") ) { | 999 | if ( (*it) == tr("Documents") ) { |
1000 | m_viewCheck->insertItem( (*it) ); | 1000 | m_viewCheck->insertItem( (*it) ); |
1001 | }else{ | 1001 | }else{ |
1002 | m_viewCheck->insertItem( (*it) ); | 1002 | m_viewCheck->insertItem( (*it) ); |
1003 | m_viewCheck->insertItem( tr("All ") + (*it) ); | 1003 | m_viewCheck->insertItem( tr("All ") + (*it) ); |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | } | 1006 | } |
1007 | OFileFactory* OFileSelector::factory() { | 1007 | OFileFactory* OFileSelector::factory() { |
1008 | return m_fileFactory; | 1008 | return m_fileFactory; |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | 1011 | ||
1012 | OFileView* OFileSelector::currentView() { | 1012 | OFileView* OFileSelector::currentView() { |
1013 | return m_fileView; | 1013 | return m_fileView; |
1014 | } | 1014 | } |
1015 | OFileView* OFileSelector::currentView() const{ | 1015 | OFileView* OFileSelector::currentView() const{ |
1016 | return m_fileView; | 1016 | return m_fileView; |
1017 | } | 1017 | } |
1018 | int OFileSelector::filter() { | 1018 | int OFileSelector::filter() { |
1019 | int filter; | 1019 | int filter; |
1020 | if ( m_selector == ExtendedAll ) | 1020 | if ( m_selector == ExtendedAll ) |
1021 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 1021 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
1022 | else | 1022 | else |
1023 | filter = QDir::Files | QDir::Dirs | QDir::All ; | 1023 | filter = QDir::Files | QDir::Dirs | QDir::All ; |
1024 | 1024 | ||
1025 | return filter; | 1025 | return filter; |
1026 | } | 1026 | } |
1027 | int OFileSelector::sorting() { | 1027 | int OFileSelector::sorting() { |
1028 | int sort; | 1028 | int sort; |
1029 | 1029 | ||
1030 | if (m_case ) | 1030 | if (m_case ) |
1031 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 1031 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
1032 | else | 1032 | else |
1033 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 1033 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
1034 | 1034 | ||
1035 | return sort; | 1035 | return sort; |
1036 | } | 1036 | } |
1037 | void OFileSelector::internFileSelected( const QString& s) { | 1037 | void OFileSelector::internFileSelected( const QString& s) { |
1038 | emit fileSelected( s ); | 1038 | emit fileSelected( s ); |
1039 | DocLnk lnk( s ); | ||
1040 | internFileSelected( lnk ); | ||
1039 | } | 1041 | } |
1040 | void OFileSelector::internFileSelected( const DocLnk& d ) { | 1042 | void OFileSelector::internFileSelected( const DocLnk& d ) { |
1041 | emit fileSelected( d ); | 1043 | emit fileSelected( d ); |
1042 | } | 1044 | } |
1043 | void OFileSelector::internContextMenu() { | 1045 | void OFileSelector::internContextMenu() { |
1044 | emit contextMenu(); | 1046 | emit contextMenu(); |
1045 | } | 1047 | } |
1046 | void OFileSelector::internChangedDir( const QString& s) { | 1048 | void OFileSelector::internChangedDir( const QString& s) { |
1047 | emit dirSelected( s ); | 1049 | emit dirSelected( s ); |
1048 | cd(s ); | 1050 | cd(s ); |
1049 | } | 1051 | } |
1050 | void OFileSelector::internChangedDir( const QDir& s) { | 1052 | void OFileSelector::internChangedDir( const QDir& s) { |
1051 | emit dirSelected( s ); | 1053 | emit dirSelected( s ); |
1052 | } | 1054 | } |
1053 | QPixmap OFileSelector::pixmap( const QString& s ) { | 1055 | QPixmap OFileSelector::pixmap( const QString& s ) { |
1054 | 1056 | ||
1055 | return (*m_pixmaps)[s]; | 1057 | return (*m_pixmaps)[s]; |
1056 | } | 1058 | } |
1057 | OLister* OFileSelector::currentLister()const { | 1059 | OLister* OFileSelector::currentLister()const { |
1058 | return m_lister; | 1060 | return m_lister; |
1059 | } | 1061 | } |
1060 | void OFileSelector::initializeOldSelector() { | 1062 | void OFileSelector::initializeOldSelector() { |
1061 | qWarning("initializeOldSelector"); | 1063 | qWarning("initializeOldSelector"); |
1062 | 1064 | ||
1063 | delete m_select; | 1065 | delete m_select; |
1064 | 1066 | ||
1065 | // we need to initialize but keep the selected mimetype | 1067 | // we need to initialize but keep the selected mimetype |
1066 | /* we default not to show close and new buttons */ | 1068 | /* we default not to show close and new buttons */ |
1067 | QString mime = currentMimeType(); | 1069 | QString mime = currentMimeType(); |
1068 | qWarning("MimeType " + mime ); | 1070 | qWarning("MimeType " + mime ); |
1069 | m_select = new FileSelector( mime , | 1071 | m_select = new FileSelector( mime , |
1070 | m_mainView, "fileselector", | 1072 | m_mainView, "fileselector", |
1071 | FALSE, FALSE); | 1073 | FALSE, FALSE); |
1072 | m_select->setCategorySelectVisible( FALSE ); | 1074 | m_select->setCategorySelectVisible( FALSE ); |
1073 | m_select->setTypeComboVisible( FALSE ); | 1075 | m_select->setTypeComboVisible( FALSE ); |
1074 | 1076 | ||
1075 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 1077 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
1076 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 1078 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
1077 | connect(m_select, SIGNAL(closeMe() ), | 1079 | connect(m_select, SIGNAL(closeMe() ), |
1078 | this, SIGNAL(closeMe() ) ); | 1080 | this, SIGNAL(closeMe() ) ); |
1079 | //connect to close me and other signals as well | 1081 | //connect to close me and other signals as well |
1080 | m_mainView->setWidget( m_select ); | 1082 | m_mainView->setWidget( m_select ); |
1081 | } | 1083 | } |
1082 | /* | 1084 | /* |
1083 | * initialize the listview | 1085 | * initialize the listview |
1084 | * we will call fillList | 1086 | * we will call fillList |
1085 | * setLister | 1087 | * setLister |
1086 | * with QString::null to get the default | 1088 | * with QString::null to get the default |
1087 | * setView with either Files or All Files | 1089 | * setView with either Files or All Files |
1088 | * depending on Extended | 1090 | * depending on Extended |
1089 | */ | 1091 | */ |
1090 | void OFileSelector::initializeView() { | 1092 | void OFileSelector::initializeView() { |
1091 | setLister(QString::null); | 1093 | setLister(QString::null); |
1092 | fillList(); | 1094 | fillList(); |
1093 | if (m_selector == Extended ) { | 1095 | if (m_selector == Extended ) { |
1094 | setView( tr("List View") ); | 1096 | setView( tr("List View") ); |
1095 | }else{ | 1097 | }else{ |
1096 | setView( tr("All List View") ); | 1098 | setView( tr("All List View") ); |
1097 | } | 1099 | } |
1098 | } | 1100 | } |
1099 | 1101 | ||
diff --git a/libopie/ofileselector/ofileselectoritem.cpp b/libopie/ofileselector/ofileselectoritem.cpp index d31046b..4ef8fe3 100644 --- a/libopie/ofileselector/ofileselectoritem.cpp +++ b/libopie/ofileselector/ofileselectoritem.cpp | |||
@@ -1,58 +1,58 @@ | |||
1 | #include "ofileselectoritem.h" | 1 | #include "ofileselectoritem.h" |
2 | 2 | ||
3 | OFileSelectorItem::OFileSelectorItem( QListView*view, | 3 | OFileSelectorItem::OFileSelectorItem( QListView*view, |
4 | const QPixmap& pix, | 4 | const QPixmap& pix, |
5 | const QString& path, | 5 | const QString& path, |
6 | const QString& date, | 6 | const QString& date, |
7 | const QString& size, | 7 | const QString& size, |
8 | const QString& dir, | 8 | const QString& dir, |
9 | const QString& extra, | ||
10 | bool isLocked, | 9 | bool isLocked, |
10 | const QString& extra, | ||
11 | bool isDir ) | 11 | bool isDir ) |
12 | : QListViewItem( view ) | 12 | : QListViewItem( view ) |
13 | { | 13 | { |
14 | setPixmap( 0, pix ); | 14 | setPixmap( 0, pix ); |
15 | setText( 1, path ); | 15 | setText( 1, path ); |
16 | setText( 2, size ); | 16 | setText( 2, size ); |
17 | setText( 3, date ); | 17 | setText( 3, date ); |
18 | m_dir = isDir; | 18 | m_dir = isDir; |
19 | m_locked = isLocked; | 19 | m_locked = isLocked; |
20 | m_dirStr = dir; | 20 | m_dirStr = dir; |
21 | m_extra = extra; | 21 | m_extra = extra; |
22 | } | 22 | } |
23 | OFileSelectorItem::~OFileSelectorItem() { | 23 | OFileSelectorItem::~OFileSelectorItem() { |
24 | } | 24 | } |
25 | bool OFileSelectorItem::isLocked()const { | 25 | bool OFileSelectorItem::isLocked()const { |
26 | return m_locked; | 26 | return m_locked; |
27 | } | 27 | } |
28 | QString OFileSelectorItem::directory()const { | 28 | QString OFileSelectorItem::directory()const { |
29 | return m_dirStr; | 29 | return m_dirStr; |
30 | } | 30 | } |
31 | bool OFileSelectorItem::isDir()const { | 31 | bool OFileSelectorItem::isDir()const { |
32 | return m_dir; | 32 | return m_dir; |
33 | } | 33 | } |
34 | QString OFileSelectorItem::path() const { | 34 | QString OFileSelectorItem::path() const { |
35 | return text(1); | 35 | return text(1); |
36 | } | 36 | } |
37 | QString OFileSelectorItem::key( int id, bool ) { | 37 | QString OFileSelectorItem::key( int id, bool ) { |
38 | QString ke; | 38 | QString ke; |
39 | 39 | ||
40 | if( id == 0 || id == 1 ){ // name | 40 | if( id == 0 || id == 1 ){ // name |
41 | if( m_dir ){ | 41 | if( m_dir ){ |
42 | ke.append("0" ); | 42 | ke.append("0" ); |
43 | ke.append( text(1) ); | 43 | ke.append( text(1) ); |
44 | }else{ | 44 | }else{ |
45 | ke.append("1" ); | 45 | ke.append("1" ); |
46 | ke.append( text(1) ); | 46 | ke.append( text(1) ); |
47 | } | 47 | } |
48 | }else if( id == 2 ){ // size | 48 | }else if( id == 2 ){ // size |
49 | return text(2); | 49 | return text(2); |
50 | }else if( id == 3 ){ // date | 50 | }else if( id == 3 ){ // date |
51 | return text(3); | 51 | return text(3); |
52 | } | 52 | } |
53 | 53 | ||
54 | return ke; | 54 | return ke; |
55 | } | 55 | } |
56 | QString OFileSelector::extra()const { | 56 | QString OFileSelectorItem::extra()const { |
57 | return m_extra; | 57 | return m_extra; |
58 | } | 58 | } |
diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp index 72d2f60..4203ca3 100644 --- a/libopie/ofileselector/ofileview.cpp +++ b/libopie/ofileselector/ofileview.cpp | |||
@@ -1,30 +1,32 @@ | |||
1 | #include <qlineedit.h> | 1 | #include <qlineedit.h> |
2 | 2 | ||
3 | #include <qpe/applnk.h> | 3 | #include <qpe/applnk.h> |
4 | 4 | ||
5 | #include "ofileselector.h" | 5 | #include "ofileselector.h" |
6 | #include "olister.h" | ||
6 | #include "ofileview.h" | 7 | #include "ofileview.h" |
7 | 8 | ||
8 | 9 | ||
10 | |||
9 | OFileView::OFileView( OFileSelector* sel) | 11 | OFileView::OFileView( OFileSelector* sel) |
10 | : m_sel( sel ) | 12 | : m_sel( sel ) |
11 | { | 13 | { |
12 | } | 14 | } |
13 | OFileView::~OFileView() { | 15 | OFileView::~OFileView() { |
14 | } | 16 | } |
15 | void OFileView::fileSelected( const QString& dir,const QString& file,const QString& extra ) { | 17 | void OFileView::fileSelected( const QString& dir,const QString& file,const QString& extra ) { |
16 | m_sel->currentLister()->fileSelected( dir,file,extra ); | 18 | m_sel->currentLister()->fileSelected( dir,file,extra ); |
17 | } | 19 | } |
18 | void OFileView::contextMenu() { | 20 | void OFileView::contextMenu() { |
19 | m_sel->internContextMenu(); | 21 | m_sel->internContextMenu(); |
20 | } | 22 | } |
21 | void OFileView::changedDir( const QString& s, const QString& file, const QString& extra) { | 23 | void OFileView::changedDir( const QString& s, const QString& file, const QString& extra) { |
22 | m_sel->currentLister()->changedDir( s, file,extra ); | 24 | m_sel->currentLister()->changedDir( s, file,extra ); |
23 | } | 25 | } |
24 | OFileSelector* OFileView::selector() const { | 26 | OFileSelector* OFileView::selector() const { |
25 | return m_sel; | 27 | return m_sel; |
26 | } | 28 | } |
27 | void OFileView::updateLine( const QString& str ) { | 29 | void OFileView::updateLine( const QString& str ) { |
28 | if (m_sel->m_shLne ) | 30 | if (m_sel->m_shLne ) |
29 | m_sel->m_edit->setText( str ); | 31 | m_sel->m_edit->setText( str ); |
30 | } | 32 | } |
diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h index 808587f..e84a3e1 100644 --- a/libopie/ofileselector/ofileview.h +++ b/libopie/ofileselector/ofileview.h | |||
@@ -3,138 +3,138 @@ | |||
3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef ofileview_h | 29 | #ifndef ofileview_h |
30 | #define ofileview_h | 30 | #define ofileview_h |
31 | 31 | ||
32 | #include <qobject.h> | 32 | #include <qobject.h> |
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | 35 | ||
36 | class QFileInfo; | 36 | class QFileInfo; |
37 | class QDir; | 37 | class QDir; |
38 | class DocLnk; | 38 | class DocLnk; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * A OFileView is a specialised View for the | 41 | * A OFileView is a specialised View for the |
42 | * OFileSelector | 42 | * OFileSelector |
43 | * With a View you can chage the user visible | 43 | * With a View you can chage the user visible |
44 | * representation of a OFileLister | 44 | * representation of a OFileLister |
45 | * OFileView is just a basic interface which helps you to | 45 | * OFileView is just a basic interface which helps you to |
46 | * write new views | 46 | * write new views |
47 | */ | 47 | */ |
48 | class OFileSelector; | 48 | class OFileSelector; |
49 | class OFileView { | 49 | class OFileView { |
50 | public: | 50 | public: |
51 | OFileView( OFileSelector* ); | 51 | OFileView( OFileSelector* ); |
52 | OFileView(); | 52 | OFileView(); |
53 | virtual ~OFileView(); | 53 | virtual ~OFileView(); |
54 | 54 | ||
55 | virtual void clear() = 0; | 55 | virtual void clear() = 0; |
56 | virtual void addFile(const QPixmap&, | 56 | virtual void addFile(const QPixmap&, |
57 | const QString &mine, | 57 | const QString &mine, |
58 | QFileInfo *info, | 58 | QFileInfo *info, |
59 | const QString& extra = QString::null, | 59 | const QString& extra = QString::null, |
60 | bool isSymlink = FALSE ) = 0; | 60 | bool isSymlink = FALSE ) = 0; |
61 | 61 | ||
62 | virtual void addFile(const QPixmap&, | 62 | virtual void addFile(const QPixmap&, |
63 | const QString& mine, const QString& dir, | 63 | const QString& mine, const QString& dir, |
64 | const QString& file, | 64 | const QString& file, |
65 | const QString& extra = QString::null, | 65 | const QString& extra = QString::null, |
66 | bool = FALSE ) = 0; | 66 | bool = FALSE ) = 0; |
67 | 67 | ||
68 | virtual void addDir (const QPixmap&, | 68 | virtual void addDir (const QPixmap&, |
69 | const QString &mine, | 69 | const QString &mine, |
70 | QFileInfo *info, | 70 | QFileInfo *info, |
71 | const QString& extra = QString::null, | 71 | const QString& extra = QString::null, |
72 | bool isSymlink = FALSE ) = 0; | 72 | bool isSymlink = FALSE ) = 0; |
73 | virtual void addDir (const QPixmap&, | 73 | virtual void addDir (const QPixmap&, |
74 | const QString& mine, const QString& dir, | 74 | const QString& mine, const QString& dir, |
75 | const QString& file, | 75 | const QString& file, |
76 | const QString& extra = QString::null, | 76 | const QString& extra = QString::null, |
77 | bool = FALSE) = 0; | 77 | bool = FALSE) = 0; |
78 | 78 | ||
79 | virtual void addSymlink(const QPixmap&, | 79 | virtual void addSymlink(const QPixmap&, |
80 | const QString &mime, | 80 | const QString &mime, |
81 | QFileInfo *info, | 81 | QFileInfo *info, |
82 | const QString& extra = QString::null, | 82 | const QString& extra = QString::null, |
83 | bool isSymlink = FALSE ) = 0; | 83 | bool isSymlink = FALSE ) = 0; |
84 | 84 | ||
85 | virtual void addSymlink(const QPixmap&, | 85 | virtual void addSymlink(const QPixmap&, |
86 | const QString& mine, | 86 | const QString& mine, |
87 | const QString& path, | 87 | const QString& path, |
88 | const QString& file, | 88 | const QString& file, |
89 | const QString& extra = QString::null, | 89 | const QString& extra = QString::null, |
90 | bool isSymlink = FALSE ) = 0; | 90 | bool isSymlink = FALSE ) = 0; |
91 | 91 | ||
92 | virtual void cd(const QString &path ) = 0; | 92 | virtual void cd(const QString &path ) = 0; |
93 | virtual QWidget* widget() = 0; | 93 | virtual QWidget* widget() = 0; |
94 | 94 | ||
95 | virtual QString selectedName()const = 0; | 95 | virtual QString selectedName()const = 0; |
96 | virtual QStringList selectedNames()const = 0; | 96 | virtual QStringList selectedNames()const = 0; |
97 | virtual QString selectedPath()const = 0; | 97 | virtual QString selectedPath()const = 0; |
98 | virtual QStringList selectedPaths()const = 0; | 98 | virtual QStringList selectedPaths()const = 0; |
99 | virtual QString selectedExtra()const = 0; | ||
99 | virtual int fileCount() = 0; | 100 | virtual int fileCount() = 0; |
100 | virtual void sort() =0; | 101 | virtual void sort() =0; |
101 | 102 | ||
102 | /*signals:*/ | 103 | /*signals:*/ |
103 | protected: | 104 | protected: |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * @param dir The dir name | 107 | * @param dir The dir name |
107 | * @param file The file name | 108 | * @param file The file name |
108 | * @param extra The extra information | 109 | * @param extra The extra information |
109 | */ | 110 | */ |
110 | void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::nulll); | 111 | void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::null); |
111 | void contextMenu(); | 112 | void contextMenu(); |
112 | 113 | ||
113 | /** | 114 | /** |
114 | * | 115 | * |
115 | * @param dir The dir name | 116 | * @param dir The dir name |
116 | * @param file The file name | 117 | * @param file The file name |
117 | * @param extra The extra informations | 118 | * @param extra The extra informations |
118 | */ | 119 | */ |
119 | void changedDir(const QString &dir, const QString& file, const QString& extra = QString::null); | 120 | void changedDir(const QString &dir, const QString& file, const QString& extra = QString::null); |
120 | void changedDir(const QDir & ); | ||
121 | 121 | ||
122 | /* updates the file name line of the FileSelector */ | 122 | /* updates the file name line of the FileSelector */ |
123 | void updateLine( const QString& ); | 123 | void updateLine( const QString& ); |
124 | OFileSelector* selector()const; | 124 | OFileSelector* selector()const; |
125 | 125 | ||
126 | private: | 126 | private: |
127 | OFileSelector* m_sel; | 127 | OFileSelector* m_sel; |
128 | }; | 128 | }; |
129 | 129 | ||
130 | class OFileViewFactory { | 130 | class OFileViewFactory { |
131 | public: | 131 | public: |
132 | OFileViewFactory() {} ; | 132 | OFileViewFactory() {} ; |
133 | virtual ~OFileViewFactory() = 0; | 133 | virtual ~OFileViewFactory() = 0; |
134 | 134 | ||
135 | OFileView* newView(QWidget *parent, const char *name ); | 135 | OFileView* newView(QWidget *parent, const char *name ); |
136 | QString name()const; | 136 | QString name()const; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | 139 | ||
140 | #endif | 140 | #endif |
diff --git a/libopie/ofileselector/olister.cpp b/libopie/ofileselector/olister.cpp index 378c69d..ea09940 100644 --- a/libopie/ofileselector/olister.cpp +++ b/libopie/ofileselector/olister.cpp | |||
@@ -25,138 +25,147 @@ bool OLister::showDirs()const { | |||
25 | return m_view->showDirs(); | 25 | return m_view->showDirs(); |
26 | } | 26 | } |
27 | void OLister::addFile( const QString& mine, | 27 | void OLister::addFile( const QString& mine, |
28 | QFileInfo* info, | 28 | QFileInfo* info, |
29 | const QString& extra, | 29 | const QString& extra, |
30 | bool isSymlink ) { | 30 | bool isSymlink ) { |
31 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : | 31 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : |
32 | OPixmapProvider::File; | 32 | OPixmapProvider::File; |
33 | QPixmap pix = provider()->pixmap(t, mine, | 33 | QPixmap pix = provider()->pixmap(t, mine, |
34 | info); | 34 | info); |
35 | view()->currentView()->addFile( pix, | 35 | view()->currentView()->addFile( pix, |
36 | mine, | 36 | mine, |
37 | info, | 37 | info, |
38 | extra, | 38 | extra, |
39 | isSymlink ); | 39 | isSymlink ); |
40 | } | 40 | } |
41 | void OLister::addFile( const QString& mine, | 41 | void OLister::addFile( const QString& mine, |
42 | const QString& path, | 42 | const QString& path, |
43 | const QString& file, | 43 | const QString& file, |
44 | const QString& extra, | 44 | const QString& extra, |
45 | bool isSymlink ) { | 45 | bool isSymlink ) { |
46 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : | 46 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : |
47 | OPixmapProvider::File; | 47 | OPixmapProvider::File; |
48 | 48 | ||
49 | QPixmap pix = provider()->pixmap(t, mine, path, file ); | 49 | QPixmap pix = provider()->pixmap(t, mine, path, file ); |
50 | view()->currentView()->addFile( pix, | 50 | view()->currentView()->addFile( pix, |
51 | mine, | 51 | mine, |
52 | path, | 52 | path, |
53 | file, | 53 | file, |
54 | extra, | 54 | extra, |
55 | isSymlink ); | 55 | isSymlink ); |
56 | } | 56 | } |
57 | void OLister::addDir( const QString& mine, | 57 | void OLister::addDir( const QString& mine, |
58 | QFileInfo* info, | 58 | QFileInfo* info, |
59 | const QString& extra, | 59 | const QString& extra, |
60 | bool isSymlink ) { | 60 | bool isSymlink ) { |
61 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : | 61 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : |
62 | OPixmapProvider::Dir; | 62 | OPixmapProvider::Dir; |
63 | QPixmap pix = provider()->pixmap(t, mine, info ); | 63 | QPixmap pix = provider()->pixmap(t, mine, info ); |
64 | view()->currentView()->addDir( pix, | 64 | view()->currentView()->addDir( pix, |
65 | mine, | 65 | mine, |
66 | info, | 66 | info, |
67 | extra, | 67 | extra, |
68 | isSymlink ); | 68 | isSymlink ); |
69 | } | 69 | } |
70 | void OLister::addDir( const QString& mine, | 70 | void OLister::addDir( const QString& mine, |
71 | const QString& path, | 71 | const QString& path, |
72 | const QString& dir, | 72 | const QString& dir, |
73 | const QString& extra, | 73 | const QString& extra, |
74 | bool isSymlink ) { | 74 | bool isSymlink ) { |
75 | 75 | ||
76 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : | 76 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : |
77 | OPixmapProvider::Dir; | 77 | OPixmapProvider::Dir; |
78 | QPixmap pix = provider()->pixmap(t, mine, path, dir ); | 78 | QPixmap pix = provider()->pixmap(t, mine, path, dir ); |
79 | 79 | ||
80 | view()->currentView()->addDir( pix, | 80 | view()->currentView()->addDir( pix, |
81 | mine, | 81 | mine, |
82 | path, | 82 | path, |
83 | dir, | 83 | dir, |
84 | extra, | 84 | extra, |
85 | isSymlink ); | 85 | isSymlink ); |
86 | } | 86 | } |
87 | void OLister::addSymlink( const QString& mine, | 87 | void OLister::addSymlink( const QString& mine, |
88 | QFileInfo* info, | 88 | QFileInfo* info, |
89 | const QString& extra, | 89 | const QString& extra, |
90 | bool isSymlink ) { | 90 | bool isSymlink ) { |
91 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info ); | 91 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info ); |
92 | view()->currentView()->addSymlink( pix, | 92 | view()->currentView()->addSymlink( pix, |
93 | mine, | 93 | mine, |
94 | info, | 94 | info, |
95 | extra, | 95 | extra, |
96 | isSymlink ); | 96 | isSymlink ); |
97 | } | 97 | } |
98 | void OLister::addSymlink( const QString& mine, | 98 | void OLister::addSymlink( const QString& mine, |
99 | const QString& path, | 99 | const QString& path, |
100 | const QString& name, | 100 | const QString& name, |
101 | const QString& extra, | 101 | const QString& extra, |
102 | bool isSymlink ) { | 102 | bool isSymlink ) { |
103 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, | 103 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, |
104 | path, name ); | 104 | path, name ); |
105 | view()->currentView()->addSymlink( pix, | 105 | view()->currentView()->addSymlink( pix, |
106 | mine, | 106 | mine, |
107 | path, | 107 | path, |
108 | name, | 108 | name, |
109 | extra, | 109 | extra, |
110 | isSymlink ); | 110 | isSymlink ); |
111 | } | 111 | } |
112 | OFileSelector* OLister::view() { | 112 | OFileSelector* OLister::view() { |
113 | return m_view; | 113 | return m_view; |
114 | } | 114 | } |
115 | OPixmapProvider* OLister::provider() { | 115 | OPixmapProvider* OLister::provider() { |
116 | return m_prov; | 116 | return m_prov; |
117 | } | 117 | } |
118 | bool OLister::compliesMime( const QString& mime ) { | 118 | bool OLister::compliesMime( const QString& mime ) { |
119 | return view()->compliesMime( mime ); | 119 | return view()->compliesMime( mime ); |
120 | } | 120 | } |
121 | void OLister::internFileSelected( const QString& dir ) { | ||
122 | view()->internFileSelected( dir ); | ||
123 | } | ||
124 | void OLister::internChangedDir( const QString& dir ) { | ||
125 | view()->internChangedDir( dir ); | ||
126 | } | ||
121 | OListerCmbAccess* OLister::comboBox() { | 127 | OListerCmbAccess* OLister::comboBox() { |
122 | if (!m_acc ) | 128 | if (!m_acc ) |
123 | m_acc = new OListerCmbAccess( view()->m_location ); | 129 | m_acc = new OListerCmbAccess( view()->m_location ); |
124 | 130 | ||
125 | return m_acc; | 131 | return m_acc; |
126 | } | 132 | } |
127 | 133 | ||
128 | 134 | ||
129 | OListerCmbAccess::OListerCmbAccess(QComboBox* box ) | 135 | OListerCmbAccess::OListerCmbAccess(QComboBox* cmb ) |
130 | : m_cmb( cmb ) | 136 | : m_cmb( cmb ) |
131 | {} | 137 | {} |
132 | OListerCmbAccess::~OListerCmbAccess() { | 138 | OListerCmbAccess::~OListerCmbAccess() { |
133 | } | 139 | } |
134 | void OListerCmbAccess::clear() { | 140 | void OListerCmbAccess::clear() { |
135 | if ( m_cmb ) | 141 | if ( m_cmb ) |
136 | m_cmb->clear(); | 142 | m_cmb->clear(); |
137 | } | 143 | } |
138 | void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { | 144 | void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { |
139 | if ( !m_cmb ) return; | 145 | if ( !m_cmb ) return; |
140 | 146 | ||
141 | 147 | ||
142 | int c = m_cmb->count(); | 148 | int c = m_cmb->count(); |
143 | for ( int i = 0; i < m_cmb->count(); i++ ) { | 149 | for ( int i = 0; i < m_cmb->count(); i++ ) { |
144 | if ( m_cmb->text(i) == add ) { | 150 | if ( m_cmb->text(i) == add ) { |
145 | bo->setCurrentItem( i ); | 151 | m_cmb->setCurrentItem( i ); |
146 | return; | 152 | return; |
147 | } | 153 | } |
148 | } | 154 | } |
155 | if (!FORCE_ADD ) return; | ||
156 | |||
157 | |||
149 | m_cmb->insertItem(add ); | 158 | m_cmb->insertItem(add ); |
150 | m_cmb->setCurrentItem( c ); | 159 | m_cmb->setCurrentItem( c ); |
151 | } | 160 | } |
152 | void OListerCmbAccess::insert( const QString& str ) { | 161 | void OListerCmbAccess::insert( const QString& str ) { |
153 | if ( m_cmb ) | 162 | if ( m_cmb ) |
154 | m_cmb->insertItem( str ); | 163 | m_cmb->insertItem( str ); |
155 | } | 164 | } |
156 | QString OListerCmbAccess::currentText()const { | 165 | QString OListerCmbAccess::currentText()const { |
157 | QString str; | 166 | QString str; |
158 | if (m_cmb ) | 167 | if (m_cmb ) |
159 | str = m_cmb->currentText(); | 168 | str = m_cmb->currentText(); |
160 | 169 | ||
161 | return str; | 170 | return str; |
162 | } | 171 | } |
diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h index 79d5409..cd84316 100644 --- a/libopie/ofileselector/olister.h +++ b/libopie/ofileselector/olister.h | |||
@@ -1,125 +1,128 @@ | |||
1 | #ifndef OPIE_FILE_LISTER_H | 1 | #ifndef OPIE_FILE_LISTER_H |
2 | #define OPIE_FILE_LISTER_H | 2 | #define OPIE_FILE_LISTER_H |
3 | 3 | ||
4 | #include <qfileinfo.h> | 4 | #include <qfileinfo.h> |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | 8 | ||
9 | class QComboBox; | 9 | class QComboBox; |
10 | class OPixmapProvider; | 10 | class OPixmapProvider; |
11 | class OFileSelector; | 11 | class OFileSelector; |
12 | 12 | ||
13 | class OListerCmbAccess; | 13 | class OListerCmbAccess; |
14 | /** | 14 | /** |
15 | * lister is something like KIO but very | 15 | * lister is something like KIO but very |
16 | * very basic and currently only for | 16 | * very basic and currently only for |
17 | * populating our views. | 17 | * populating our views. |
18 | * This is a base class which needs to be implemented. | 18 | * This is a base class which needs to be implemented. |
19 | * @see OLocalLister for a filesystem based implementation | 19 | * @see OLocalLister for a filesystem based implementation |
20 | */ | 20 | */ |
21 | 21 | ||
22 | class OLister { | 22 | class OLister { |
23 | public: | 23 | public: |
24 | OLister( OFileSelector* ); | 24 | OLister( OFileSelector* ); |
25 | virtual ~OLister(); | 25 | virtual ~OLister(); |
26 | virtual void reparse(const QString& path) = 0; | 26 | virtual void reparse(const QString& path) = 0; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * return a list of available mimetypes | 29 | * return a list of available mimetypes |
30 | */ | 30 | */ |
31 | virtual QMap<QString, QStringList> mimeTypes( const QString& dir ) = 0; | 31 | virtual QMap<QString, QStringList> mimeTypes( const QString& dir ) = 0; |
32 | void setPixmapProvider( OPixmapProvider* ); | 32 | void setPixmapProvider( OPixmapProvider* ); |
33 | 33 | ||
34 | 34 | ||
35 | /* some way a slot */ | 35 | /* some way a slot */ |
36 | void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; | 36 | virtual void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; |
37 | void changeDir( const QString& dir, const QString& file, const QString& extra ) = 0; | 37 | virtual void changedDir( const QString& dir, const QString& file, const QString& extra ) = 0; |
38 | protected: | 38 | protected: |
39 | /** | 39 | /** |
40 | * I hate too big classes | 40 | * I hate too big classes |
41 | * this is a way to group | 41 | * this is a way to group |
42 | * access to a ComboBox | 42 | * access to a ComboBox |
43 | * which might exist or | 43 | * which might exist or |
44 | * not in a secure way | 44 | * not in a secure way |
45 | */ | 45 | */ |
46 | OListerCmbAccess* comboBox(); | 46 | OListerCmbAccess* comboBox(); |
47 | 47 | ||
48 | bool showFiles()const; | 48 | bool showFiles()const; |
49 | bool showDirs()const; | 49 | bool showDirs()const; |
50 | bool compliesMime( const QString& mime ); | 50 | bool compliesMime( const QString& mime ); |
51 | void addFile( const QString& mine, | 51 | void addFile( const QString& mine, |
52 | QFileInfo*, | 52 | QFileInfo*, |
53 | const QString& extra = QString::null, | 53 | const QString& extra = QString::null, |
54 | bool isSymlink = FALSE ); | 54 | bool isSymlink = FALSE ); |
55 | 55 | ||
56 | void addFile( const QString& mine, | 56 | void addFile( const QString& mine, |
57 | const QString& path, | 57 | const QString& path, |
58 | const QString& file, | 58 | const QString& file, |
59 | const QString& extra = QString::null, | 59 | const QString& extra = QString::null, |
60 | bool isSymlink = FALSE ); | 60 | bool isSymlink = FALSE ); |
61 | void addDir( const QString& mine, | 61 | void addDir( const QString& mine, |
62 | QFileInfo*, | 62 | QFileInfo*, |
63 | const QString& extra = QString::null, | ||
63 | bool isSymlink = FALSE ); | 64 | bool isSymlink = FALSE ); |
64 | void addDir( const QString& mine, | 65 | void addDir( const QString& mine, |
65 | const QString& path, | 66 | const QString& path, |
66 | const QString& dir, | 67 | const QString& dir, |
67 | const QString& extra = QString::null, | 68 | const QString& extra = QString::null, |
68 | bool isSymlink = FALSE ); | 69 | bool isSymlink = FALSE ); |
69 | void addSymlink( const QString& mine, | 70 | void addSymlink( const QString& mine, |
70 | QFileInfo* info, | 71 | QFileInfo* info, |
71 | const QString& extra = QString::null, | 72 | const QString& extra = QString::null, |
72 | bool isSymlink = FALSE); | 73 | bool isSymlink = FALSE); |
73 | void addSymlink( const QString& mine, | 74 | void addSymlink( const QString& mine, |
74 | const QString& path, | 75 | const QString& path, |
75 | const QString& name, | 76 | const QString& name, |
76 | const QString& extra = QString::null, | 77 | const QString& extra = QString::null, |
77 | bool isSymlink = FALSE ); | 78 | bool isSymlink = FALSE ); |
78 | OFileSelector* view(); | 79 | OFileSelector* view(); |
79 | OPixmapProvider* provider(); | 80 | OPixmapProvider* provider(); |
81 | void internFileSelected( const QString& file ); | ||
82 | void internChangedDir( const QString& dir ); | ||
80 | private: | 83 | private: |
81 | OFileSelector* m_view; | 84 | OFileSelector* m_view; |
82 | OPixmapProvider* m_prov; | 85 | OPixmapProvider* m_prov; |
83 | OListerCmbAccess* m_acc; | 86 | OListerCmbAccess* m_acc; |
84 | 87 | ||
85 | class Private; | 88 | class Private; |
86 | Private *d; | 89 | Private *d; |
87 | }; | 90 | }; |
88 | 91 | ||
89 | class OListerCmbAccess { | 92 | class OListerCmbAccess { |
90 | friend class OLister; | 93 | friend class OLister; |
91 | public: | 94 | public: |
92 | OListerCmbAccess( QComboBox* = 0l); | 95 | OListerCmbAccess( QComboBox* = 0l); |
93 | ~OListerCmbAccess(); | 96 | ~OListerCmbAccess(); |
94 | 97 | ||
95 | /** | 98 | /** |
96 | * clears the combobox | 99 | * clears the combobox |
97 | */ | 100 | */ |
98 | void clear(); | 101 | void clear(); |
99 | 102 | ||
100 | /** | 103 | /** |
101 | * set's @param add to be the current Item | 104 | * set's @param add to be the current Item |
102 | * if the item is not present it'll be removed | 105 | * if the item is not present it'll be removed |
103 | */ | 106 | */ |
104 | void setCurrentItem( const QString& add, bool FORECE_ADD = TRUE ); | 107 | void setCurrentItem( const QString& add, bool FORECE_ADD = TRUE ); |
105 | 108 | ||
106 | /** | 109 | /** |
107 | * inserts the the String at | 110 | * inserts the the String at |
108 | * a non predictable position... The position is determined | 111 | * a non predictable position... The position is determined |
109 | * by the QComboBox code | 112 | * by the QComboBox code |
110 | */ | 113 | */ |
111 | void insert( const QString& ); | 114 | void insert( const QString& ); |
112 | 115 | ||
113 | /** | 116 | /** |
114 | * | 117 | * |
115 | */ | 118 | */ |
116 | QString currentText()const; | 119 | QString currentText()const; |
117 | 120 | ||
118 | private: | 121 | private: |
119 | class Private; | 122 | class Private; |
120 | Private* d; | 123 | Private* d; |
121 | QComboBox* m_cmb; | 124 | QComboBox* m_cmb; |
122 | 125 | ||
123 | }; | 126 | }; |
124 | 127 | ||
125 | #endif | 128 | #endif |
diff --git a/libopie/ofileselector/olocallister.cpp b/libopie/ofileselector/olocallister.cpp index 2306b14..5d7884d 100644 --- a/libopie/ofileselector/olocallister.cpp +++ b/libopie/ofileselector/olocallister.cpp | |||
@@ -1,119 +1,125 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | #include <qfileinfo.h> | 2 | #include <qfileinfo.h> |
3 | #include <qmap.h> | 3 | #include <qmap.h> |
4 | 4 | ||
5 | #include <qpe/mimetype.h> | 5 | #include <qpe/mimetype.h> |
6 | 6 | ||
7 | #include "ofileselector.h" | 7 | #include "ofileselector.h" |
8 | #include "olocallister.h" | 8 | #include "olocallister.h" |
9 | 9 | ||
10 | OLocalLister::OLocalLister( OFileSelector* file ) | 10 | OLocalLister::OLocalLister( OFileSelector* file ) |
11 | : OLister( file ) | 11 | : OLister( file ) |
12 | { | 12 | { |
13 | } | 13 | } |
14 | OLocalLister::~OLocalLister() { | 14 | OLocalLister::~OLocalLister() { |
15 | } | 15 | } |
16 | 16 | ||
17 | QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) { | 17 | QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) { |
18 | QMap<QString, QStringList> mimes; | 18 | QMap<QString, QStringList> mimes; |
19 | 19 | ||
20 | // let's find possible mimetypes | 20 | // let's find possible mimetypes |
21 | QDir dir( curDir ); | 21 | QDir dir( curDir ); |
22 | dir.setFilter( QDir::Files | QDir::Readable ); | 22 | dir.setFilter( QDir::Files | QDir::Readable ); |
23 | dir.setSorting( QDir::Size ); | 23 | dir.setSorting( QDir::Size ); |
24 | 24 | ||
25 | const QFileInfoList *list = dir.entryInfoList(); | 25 | const QFileInfoList *list = dir.entryInfoList(); |
26 | QFileInfoListIterator it( *list ); | 26 | QFileInfoListIterator it( *list ); |
27 | QFileInfo *fi; | 27 | QFileInfo *fi; |
28 | 28 | ||
29 | while( (fi=it.current() ) ) { | 29 | while( (fi=it.current() ) ) { |
30 | /* skip .desktop */ | 30 | /* skip .desktop */ |
31 | if( fi->extension() == QString::fromLatin1("desktop") ){ | 31 | if( fi->extension() == QString::fromLatin1("desktop") ){ |
32 | ++it; | 32 | ++it; |
33 | continue; | 33 | continue; |
34 | } | 34 | } |
35 | MimeType type( fi->absFilePath() ); | 35 | MimeType type( fi->absFilePath() ); |
36 | 36 | ||
37 | if( !mimes.contains( type.id() ) ){ | 37 | if( !mimes.contains( type.id() ) ){ |
38 | mimes.insert( type.id(), type.id() ); | 38 | mimes.insert( type.id(), type.id() ); |
39 | } | 39 | } |
40 | 40 | ||
41 | ++it; | 41 | ++it; |
42 | } | 42 | } |
43 | 43 | ||
44 | return mimes; | 44 | return mimes; |
45 | } | 45 | } |
46 | /** | 46 | /** |
47 | * FIXME mimecheck | 47 | * FIXME mimecheck |
48 | * use mime check for that | 48 | * use mime check for that |
49 | * filter dirs | 49 | * filter dirs |
50 | * filter filters | 50 | * filter filters |
51 | * filter files | 51 | * filter files |
52 | * filter mimetypes | 52 | * filter mimetypes |
53 | */ | 53 | */ |
54 | void OLocalLister::reparse( const QString& path ) { | 54 | void OLocalLister::reparse( const QString& path ) { |
55 | QString currentMimeType; | 55 | QString currentMimeType; |
56 | QDir dir( path ); | 56 | QDir dir( path ); |
57 | 57 | ||
58 | dir.setSorting( view()->sorting() ); | 58 | dir.setSorting( view()->sorting() ); |
59 | dir.setFilter( view()->filter() ); | 59 | dir.setFilter( view()->filter() ); |
60 | 60 | ||
61 | 61 | ||
62 | const QFileInfoList *list = dir.entryInfoList(); | 62 | const QFileInfoList *list = dir.entryInfoList(); |
63 | QFileInfoListIterator it( *list ); | 63 | QFileInfoListIterator it( *list ); |
64 | QFileInfo *fi; | 64 | QFileInfo *fi; |
65 | 65 | ||
66 | while( (fi=it.current() ) ){ | 66 | while( (fi=it.current() ) ){ |
67 | 67 | ||
68 | if( fi->fileName() == QString::fromLatin1("..") || | 68 | if( fi->fileName() == QString::fromLatin1("..") || |
69 | fi->fileName() == QString::fromLatin1(".") ){ | 69 | fi->fileName() == QString::fromLatin1(".") ){ |
70 | ++it; | 70 | ++it; |
71 | continue; | 71 | continue; |
72 | } | 72 | } |
73 | if( fi->isSymLink() ){ | 73 | if( fi->isSymLink() ){ |
74 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 74 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); |
75 | /* | 75 | /* |
76 | * 5 tries to prevent dos attack | 76 | * 5 tries to prevent dos attack |
77 | */ | 77 | */ |
78 | for( int i = 0; i<=4; i++) { | 78 | for( int i = 0; i<=4; i++) { |
79 | QFileInfo info( file ); | 79 | QFileInfo info( file ); |
80 | if( !info.exists() ){ | 80 | if( !info.exists() ){ |
81 | addSymlink( currentMimeType, fi, TRUE ); | 81 | addSymlink( currentMimeType, fi, QString::null, TRUE ); |
82 | break; | 82 | break; |
83 | }else if( info.isDir() ){ | 83 | }else if( info.isDir() ){ |
84 | if (!showDirs() ) | 84 | if (!showDirs() ) |
85 | break; | 85 | break; |
86 | 86 | ||
87 | addDir( currentMimeType, fi, | 87 | addDir( currentMimeType, fi, QString::null, |
88 | TRUE ); | 88 | TRUE ); |
89 | break; | 89 | break; |
90 | }else if( info.isFile() ){ | 90 | }else if( info.isFile() ){ |
91 | /* if not show files skip it */ | 91 | /* if not show files skip it */ |
92 | if (!showFiles() ) | 92 | if (!showFiles() ) |
93 | break; | 93 | break; |
94 | 94 | ||
95 | /* check if we comply to the mimetype */ | 95 | /* check if we comply to the mimetype */ |
96 | MimeType type( info.absFilePath() ); | 96 | MimeType type( info.absFilePath() ); |
97 | if (compliesMime( type.id() ) ) | 97 | if (compliesMime( type.id() ) ) |
98 | addFile( currentMimeType, fi, TRUE ); | 98 | addFile( currentMimeType, fi, QString::null, TRUE ); |
99 | 99 | ||
100 | break; | 100 | break; |
101 | }else if( info.isSymLink() ){ | 101 | }else if( info.isSymLink() ){ |
102 | file = info.dirPath(true ) + "/" + info.readLink() ; | 102 | file = info.dirPath(true ) + "/" + info.readLink() ; |
103 | break; | 103 | break; |
104 | }else if( i == 4){ | 104 | }else if( i == 4){ |
105 | addSymlink( currentMimeType, fi ); | 105 | addSymlink( currentMimeType, fi ); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | }else if( fi->isDir() ){ | 109 | }else if( fi->isDir() ){ |
110 | if (showDirs() ) | 110 | if (showDirs() ) |
111 | addDir( currentMimeType, fi ); | 111 | addDir( currentMimeType, fi ); |
112 | }else if( fi->isFile() ){ | 112 | }else if( fi->isFile() ){ |
113 | if ( showFiles() ) | 113 | if ( showFiles() ) |
114 | addFile( currentMimeType, fi ); | 114 | addFile( currentMimeType, fi ); |
115 | } | 115 | } |
116 | ++it; | 116 | ++it; |
117 | } // of while loop | 117 | } // of while loop |
118 | } | 118 | } |
119 | 119 | /* more accepting it code */ | |
120 | void OLocalLister::fileSelected( const QString& dir, const QString& file, const QString& ) { | ||
121 | internFileSelected( dir + "/" + file ); | ||
122 | } | ||
123 | void OLocalLister::changedDir( const QString& dir, const QString& file, const QString& ) { | ||
124 | internChangedDir( dir + "/" + file ); | ||
125 | } | ||
diff --git a/libopie/ofileselector/olocallister.h b/libopie/ofileselector/olocallister.h index 0a06102..01e6f3c 100644 --- a/libopie/ofileselector/olocallister.h +++ b/libopie/ofileselector/olocallister.h | |||
@@ -1,14 +1,16 @@ | |||
1 | #ifndef OPIE_LOCAL_LISTER | 1 | #ifndef OPIE_LOCAL_LISTER |
2 | #define OPIE_LOCAL_LISTER | 2 | #define OPIE_LOCAL_LISTER |
3 | 3 | ||
4 | #include "olister.h" | 4 | #include "olister.h" |
5 | 5 | ||
6 | class OLocalLister : public OLister { | 6 | class OLocalLister : public OLister { |
7 | public: | 7 | public: |
8 | OLocalLister( OFileSelector* ); | 8 | OLocalLister( OFileSelector* ); |
9 | ~OLocalLister(); | 9 | ~OLocalLister(); |
10 | void reparse( const QString& path ); | 10 | void reparse( const QString& path ); |
11 | QMap<QString, QStringList> mimeTypes(const QString& dir ); | 11 | QMap<QString, QStringList> mimeTypes(const QString& dir ); |
12 | void fileSelected( const QString& dir, const QString& file, const QString& ); | ||
13 | void changedDir( const QString& dir, const QString& file,const QString& ); | ||
12 | }; | 14 | }; |
13 | 15 | ||
14 | #endif | 16 | #endif |