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 | |||
@@ -46,7 +46,7 @@ void OFileListView::clear() { | |||
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; |
@@ -67,7 +67,7 @@ void OFileListView::addFile( const QPixmap& pix, | |||
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*/, |
@@ -78,7 +78,7 @@ void OFileListView::addFile( const QPixmap&, | |||
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; |
@@ -89,7 +89,7 @@ void OFileListView::addDir( const QPixmap& pix, const QString&, | |||
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 | } |
@@ -127,6 +127,13 @@ QString OFileListView::selectedName()const{ | |||
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(); |
@@ -137,7 +144,7 @@ QString OFileListView::selectedPath()const { | |||
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() { |
@@ -161,10 +168,7 @@ void OFileListView::slotCurrentChanged( QListViewItem* item) { | |||
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 | } |
@@ -181,16 +185,10 @@ void OFileListView::slotClicked( int button, QListViewItem* item, | |||
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 | } |
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 | |||
@@ -28,8 +28,9 @@ public: | |||
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, |
@@ -45,7 +46,7 @@ public: | |||
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(); |
@@ -56,6 +57,7 @@ public: | |||
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(); |
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 | |||
@@ -1036,6 +1036,8 @@ int OFileSelector::sorting() { | |||
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 ); |
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 | |||
@@ -6,8 +6,8 @@ OFileSelectorItem::OFileSelectorItem( QListView*view, | |||
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 | { |
@@ -53,6 +53,6 @@ QString OFileSelectorItem::key( int id, bool ) { | |||
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 | |||
@@ -3,9 +3,11 @@ | |||
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 | { |
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 | |||
@@ -96,6 +96,7 @@ public: | |||
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 | ||
@@ -107,7 +108,7 @@ protected: | |||
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 | /** |
@@ -117,7 +118,6 @@ protected: | |||
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& ); |
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 | |||
@@ -118,6 +118,12 @@ OPixmapProvider* OLister::provider() { | |||
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 ); |
@@ -126,7 +132,7 @@ OListerCmbAccess* OLister::comboBox() { | |||
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() { |
@@ -142,10 +148,13 @@ void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { | |||
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 | } |
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 | |||
@@ -33,8 +33,8 @@ public: | |||
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 |
@@ -60,6 +60,7 @@ protected: | |||
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, |
@@ -77,6 +78,8 @@ protected: | |||
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; |
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 | |||
@@ -78,13 +78,13 @@ void OLocalLister::reparse( const QString& path ) { | |||
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() ){ |
@@ -95,7 +95,7 @@ void OLocalLister::reparse( const QString& path ) { | |||
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() ){ |
@@ -116,4 +116,10 @@ void OLocalLister::reparse( const QString& path ) { | |||
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 | |||
@@ -9,6 +9,8 @@ public: | |||
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 |