summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/MANIFEST29
-rwxr-xr-xlibopie/ofileselector/configure301
-rw-r--r--libopie/ofileselector/libopie.pro97
-rw-r--r--libopie/ofileselector/ofilelistview.cpp32
-rw-r--r--libopie/ofileselector/ofilelistview.h6
-rw-r--r--libopie/ofileselector/ofileselector.cpp2
-rw-r--r--libopie/ofileselector/ofileselectoritem.cpp4
-rw-r--r--libopie/ofileselector/ofileview.cpp2
-rw-r--r--libopie/ofileselector/ofileview.h4
-rw-r--r--libopie/ofileselector/olister.cpp13
-rw-r--r--libopie/ofileselector/olister.h7
-rw-r--r--libopie/ofileselector/olocallister.cpp14
-rw-r--r--libopie/ofileselector/olocallister.h2
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 @@
1Hija,
2dunno if that is to call a manifest but here is
3an quick overview how the OFileSelector is implemented
4and whats the whole purpose is.
5
6OFileSelector is meant to be extendable by design. It's divided
7into a shell the class OFileSelector which is a dispatcher
8between worlds and gives a common interface to the programmer.
9Then there is the OLister class which is a lister of files.
10It's responsible for taking care of a filesystem... but it's not limited
11to local filesystem. You can have a FTP lister, Bluetooth Device Lister,
12IrdaDevice Lister, Local Documents Lister, a PIM Lister an X-Ref lister...
13they will operate on the level of filesystems....
14
15A OFileView is the other part of the FileSelector it's responsible
16for the things represented to the USER.
17There is a ListView and a IconView and possible more views to come.
18
19Then there is a PixmapProvider which is responsible for providing pixmaps
20for a mimetype. This can be used for something like a Pixmap preview....
21
22
23The lister is told to reparse() then it adds it things to the mainview
24on selection the URL get's generated in more than one step.
251. The UI notifies the lister about activation
262. The Lister assembles the URL
273. the Lister notifies the OFileSelector
284. 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
8PLATFORM=generic
9SHARING=shared
10DEBUG=
11QCONFIGARG=
12
13touch .test.qpe.
14if [ '!' -f ${OPIEDIR}/.test.qpe. ];
15then
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
29fi
30rm .test.qpe.
31
32if [ '!' -f $TMAKEPATH/tmake.conf ]
33then
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
41fi
42
43VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\.[0-9]*\.[0-9]*.*".*/\1/p' <library/version.h)
44VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.\([0-9]\)\.[0-9]*.*".*/\1/p' <library/version.h)
45VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.[0-9]*\.\([0-9]*\).*".*/\1/p' <library/version.h)
46
47TOMAKE=
48
49if grep -q 'VERSION_STR.*"3' $QTDIR/include/qglobal.h
50then
51 QT3=yes
52else
53 QT3=no
54fi
55
56# Parse the arguments, setting things to "yes" or "no".
57
58while [ -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
89done
90
91TARGET=configs/$PLATFORM-$SHARING$DEBUG
92
93if [ '!' -f $TARGET ]
94then
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
105fi
106
107# Next, emit a usage message if something failed.
108
109if [ "$HELP" = "yes" ]; then
110 cat <<EOF
111Usage: $0 [-debug] [-release] [-shared] [-static] [-qt3] [-platform ...]
112
113The defaults (*) are usually acceptable. Here is a short explanation of
114each 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)
125EOF
126 exit 0;
127fi
128
129CUSTOM=`echo $PLATFORM | sed -n -e "s/.*-\(.*\)-.*/\1/p"`
130
131if [ -f library/custom-$CUSTOM.h ]
132then
133 rm -f library/custom.h
134 ln -s custom-$CUSTOM.h library/custom.h
135fi
136
137mkdir -p include/qpe
138( cd include/qpe && rm -f *.h; ln -s ../../library/*.h .; ln -s ../../library/backend/*.h .; rm -f *_p.h; )
139mkdir -p include/qtopia
140( cd include/qtopia && rm -f *.h; ln -s ../../library/*.h .; )
141mkdir -p include/qtopia/private
142( cd include/qtopia/private && rm -f *.h; ln -s ../../../library/backend/*.h .; )
143mkdir -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
149echo Creating makefiles...
150
151# Set version for library directly
152# Version 1.5.0 right now for compat.
153sed -e 's/^\(VERSION.*= \).*/\1'1.5.0.$VERSION_PAT/ <library/library.pro >library/library.pro-v
154mv library/library.pro-v library/library.pro
155
156if [ "$QT3" = yes ]
157then
158 VCONFIG="CONFIG+=qt3"
159else
160 VCONFIG="CONFIG+=qt2"
161fi
162
163if [ -f $TMAKEPATH/tmake.conf ]
164then
165 # You have tmake. We'll regenerate the file for you...
166 echo "Makefiles will be regenerated."
167fi
168
169H=`pwd`
170if [ -z "$TOMAKE" ]
171then
172 TOMAKE=`make showcomponents`
173fi
174
175for 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
210EOF
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
283lupdate:
284 lupdate $f.pro
285
286lrelease:
287 lrelease $f.pro
288
289EOF
290 if [ -f "$O" ]
291 then
292 cat >> $N $O
293 fi
294
295done
296
297MAKE=make
298echo
299echo "Opie is now configured for building. Just run $MAKE (or $MAKE single)."
300echo "To reconfigure, run $MAKE clean and configure."
301echo
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 @@
1TEMPLATE = lib
2CONFIG += qte warn_on release
3HEADERS = 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
42SOURCES = 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
75TARGET = opie
76INCLUDEPATH += $(OPIEDIR)/include
77DESTDIR = $(QTDIR)/lib$(PROJMAK)
78#VERSION = 1.0.0
79
80# LIBS += -lopiesql
81
82INTERFACES = otimepickerbase.ui orecurrancebase.ui
83
84TRANSLATIONS = ../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
@@ -41,17 +41,17 @@ OFileListView::~OFileListView() {
41 41
42} 42}
43void OFileListView::clear() { 43void OFileListView::clear() {
44 QListView::clear(); 44 QListView::clear();
45} 45}
46void OFileListView::addFile( const QPixmap& pix, 46void 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 )
@@ -62,39 +62,39 @@ void OFileListView::addFile( const QPixmap& pix,
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}
72void OFileListView::addFile( const QPixmap&, 72void 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}
79void OFileListView::addDir( const QPixmap& pix, const QString&, 79void 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}
96void OFileListView::addDir( const QPixmap&, 96void 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 ) {
@@ -122,27 +122,34 @@ QWidget* OFileListView::widget() {
122} 122}
123QString OFileListView::selectedName()const{ 123QString 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}
130QString OFileListView::selectedExtra()const{
131 QListViewItem* item = currentItem();
132 if (!item) return QString::null;
133 OFileSelectorItem* fit = (OFileSelectorItem*)fit;
134
135 return fit->extra();
136}
130QStringList OFileListView::selectedNames()const { 137QStringList OFileListView::selectedNames()const {
131 QStringList list; 138 QStringList list;
132 list << selectedName(); 139 list << selectedName();
133 return list; 140 return list;
134} 141}
135QString OFileListView::selectedPath()const { 142QString OFileListView::selectedPath()const {
136 return QString::null; 143 return QString::null;
137} 144}
138QStringList OFileListView::selectedPaths()const { 145QStringList OFileListView::selectedPaths()const {
139 QStringList list; 146 QStringList list;
140b list << selectedPath(); 147 list << selectedPath();
141 return list; 148 return list;
142} 149}
143int OFileListView::fileCount() { 150int OFileListView::fileCount() {
144 return childCount(); 151 return childCount();
145} 152}
146void OFileListView::sort() { 153void OFileListView::sort() {
147 QListView::sort(); 154 QListView::sort();
148} 155}
@@ -156,46 +163,37 @@ void OFileListView::slotCurrentChanged( QListViewItem* item) {
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}
171void OFileListView::slotClicked( int button, QListViewItem* item, 175void 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}
197void OFileListView::slotRightButton( int button, QListViewItem* item, 195void 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
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
@@ -23,44 +23,46 @@ public:
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();
60private slots: 62private 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
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
@@ -1031,16 +1031,18 @@ int OFileSelector::sorting() {
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}
1037void OFileSelector::internFileSelected( const QString& s) { 1037void OFileSelector::internFileSelected( const QString& s) {
1038 emit fileSelected( s ); 1038 emit fileSelected( s );
1039 DocLnk lnk( s );
1040 internFileSelected( lnk );
1039} 1041}
1040void OFileSelector::internFileSelected( const DocLnk& d ) { 1042void OFileSelector::internFileSelected( const DocLnk& d ) {
1041 emit fileSelected( d ); 1043 emit fileSelected( d );
1042} 1044}
1043void OFileSelector::internContextMenu() { 1045void OFileSelector::internContextMenu() {
1044 emit contextMenu(); 1046 emit contextMenu();
1045} 1047}
1046void OFileSelector::internChangedDir( const QString& s) { 1048void OFileSelector::internChangedDir( const QString& s) {
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,18 +1,18 @@
1#include "ofileselectoritem.h" 1#include "ofileselectoritem.h"
2 2
3OFileSelectorItem::OFileSelectorItem( QListView*view, 3OFileSelectorItem::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;
@@ -48,11 +48,11 @@ QString OFileSelectorItem::key( int id, bool ) {
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}
56QString OFileSelector::extra()const { 56QString 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,16 +1,18 @@
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
9OFileView::OFileView( OFileSelector* sel) 11OFileView::OFileView( OFileSelector* sel)
10 : m_sel( sel ) 12 : m_sel( sel )
11{ 13{
12} 14}
13OFileView::~OFileView() { 15OFileView::~OFileView() {
14} 16}
15void OFileView::fileSelected( const QString& dir,const QString& file,const QString& extra ) { 17void 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 );
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
@@ -91,38 +91,38 @@ public:
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:*/
103protected: 104protected:
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
126private: 126private:
127 OFileSelector* m_sel; 127 OFileSelector* m_sel;
128}; 128};
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
@@ -113,44 +113,53 @@ OFileSelector* OLister::view() {
113 return m_view; 113 return m_view;
114} 114}
115OPixmapProvider* OLister::provider() { 115OPixmapProvider* OLister::provider() {
116 return m_prov; 116 return m_prov;
117} 117}
118bool OLister::compliesMime( const QString& mime ) { 118bool OLister::compliesMime( const QString& mime ) {
119 return view()->compliesMime( mime ); 119 return view()->compliesMime( mime );
120} 120}
121void OLister::internFileSelected( const QString& dir ) {
122 view()->internFileSelected( dir );
123}
124void OLister::internChangedDir( const QString& dir ) {
125 view()->internChangedDir( dir );
126}
121OListerCmbAccess* OLister::comboBox() { 127OListerCmbAccess* 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
129OListerCmbAccess::OListerCmbAccess(QComboBox* box ) 135OListerCmbAccess::OListerCmbAccess(QComboBox* cmb )
130 : m_cmb( cmb ) 136 : m_cmb( cmb )
131{} 137{}
132OListerCmbAccess::~OListerCmbAccess() { 138OListerCmbAccess::~OListerCmbAccess() {
133} 139}
134void OListerCmbAccess::clear() { 140void OListerCmbAccess::clear() {
135 if ( m_cmb ) 141 if ( m_cmb )
136 m_cmb->clear(); 142 m_cmb->clear();
137} 143}
138void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { 144void 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}
152void OListerCmbAccess::insert( const QString& str ) { 161void 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}
156QString OListerCmbAccess::currentText()const { 165QString OListerCmbAccess::currentText()const {
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
@@ -28,18 +28,18 @@ public:
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;
38protected: 38protected:
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 */
@@ -55,16 +55,17 @@ protected:
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,
@@ -72,16 +73,18 @@ protected:
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 );
80private: 83private:
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};
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
@@ -73,34 +73,34 @@ void OLocalLister::reparse( const QString& path ) {
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 }
@@ -111,9 +111,15 @@ void OLocalLister::reparse( const QString& path ) {
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 */
120void OLocalLister::fileSelected( const QString& dir, const QString& file, const QString& ) {
121 internFileSelected( dir + "/" + file );
122}
123void 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
@@ -4,11 +4,13 @@
4#include "olister.h" 4#include "olister.h"
5 5
6class OLocalLister : public OLister { 6class OLocalLister : public OLister {
7public: 7public:
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