author | zecke <zecke> | 2002-10-28 21:47:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-28 21:47:58 (UTC) |
commit | 98d46aa752026d53b4cf4ea8572fdf7c89f4c6c0 (patch) (side-by-side diff) | |
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 @@ +Hija, +dunno if that is to call a manifest but here is +an quick overview how the OFileSelector is implemented +and whats the whole purpose is. + +OFileSelector is meant to be extendable by design. It's divided +into a shell the class OFileSelector which is a dispatcher +between worlds and gives a common interface to the programmer. +Then there is the OLister class which is a lister of files. +It's responsible for taking care of a filesystem... but it's not limited +to local filesystem. You can have a FTP lister, Bluetooth Device Lister, +IrdaDevice Lister, Local Documents Lister, a PIM Lister an X-Ref lister... +they will operate on the level of filesystems.... + +A OFileView is the other part of the FileSelector it's responsible +for the things represented to the USER. +There is a ListView and a IconView and possible more views to come. + +Then there is a PixmapProvider which is responsible for providing pixmaps +for a mimetype. This can be used for something like a Pixmap preview.... + + +The lister is told to reparse() then it adds it things to the mainview +on selection the URL get's generated in more than one step. +1. The UI notifies the lister about activation +2. The Lister assembles the URL +3. the Lister notifies the OFileSelector +4. the OFileSelector emits a signal + 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 @@ +#!/bin/sh +# +# Configures to build the Qtopia Environment +# +# Copyright 1999-2000 Trolltech AS. All rights reserved. +# + +PLATFORM=generic +SHARING=shared +DEBUG= +QCONFIGARG= + +touch .test.qpe. +if [ '!' -f ${OPIEDIR}/.test.qpe. ]; +then + rm .test.qpe. + echo + echo + echo ' The environment variable $OPIEDIR is not set correctly. It is currently' + echo ' set to "'$OPIEDIR'", but it should be set to this directory,' + echo ' which is "'`pwd`'".' + echo + echo ' Please read the INSTALL file for instructions on how to set $OPIEDIR' + echo ' correctly. If you have set $OPIEDIR in your .profile or .login, you ' + echo ' will need to log out and log in again to make the setting effective.' + echo + echo + exit 1 +fi +rm .test.qpe. + +if [ '!' -f $TMAKEPATH/tmake.conf ] +then + # You have tmake. We'll regenerate the file for you... + echo ' The environment variable $TMAKEPATH is not set correclty. ' + echo ' It should be set to the tmake path' + echo + echo ' Please read the INSTALL file for instructions on how to set $TMAKEPATH' + echo ' to the environment variable correctly.' + exit 1 +fi + +VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\.[0-9]*\.[0-9]*.*".*/\1/p' <library/version.h) +VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.\([0-9]\)\.[0-9]*.*".*/\1/p' <library/version.h) +VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.[0-9]*\.\([0-9]*\).*".*/\1/p' <library/version.h) + +TOMAKE= + +if grep -q 'VERSION_STR.*"3' $QTDIR/include/qglobal.h +then + QT3=yes +else + QT3=no +fi + +# Parse the arguments, setting things to "yes" or "no". + +while [ -n "$1" ]; do + case $1 in + -platform|-xplatform) # No difference since we don't need to build moc, etc. + shift; PLATFORM=$1 + ;; + -release) + DEBUG= + ;; + -debug) + DEBUG=-debug + ;; + -shared) + SHARING=shared + ;; + -static) + SHARING=static + ;; + -qconfig) + # optional way to specify the qconfig-qpe.h is to pass -qconfig qpe + shift; QCONFIGARG=DEFINES+=QCONFIG='\"'$1'\"' # Don't quote me on that. + ;; + -make) + shift; TOMAKE="$TOMAKE $1" + ;; + -qt3) + QT3=yes + ;; + *) + HELP=yes;; + esac + shift +done + +TARGET=configs/$PLATFORM-$SHARING$DEBUG + +if [ '!' -f $TARGET ] +then + if [ -f configs/linux-$PLATFORM-g++-$SHARING$DEBUG ] + then + TARGET=configs/linux-$PLATFORM-g++-$SHARING$DEBUG + PLATFORM=linux-$PLATFORM-g++ + else + echo + echo ' The specified platform/compiler not supported: ' $TARGET + echo + exit 2 + fi +fi + +# Next, emit a usage message if something failed. + +if [ "$HELP" = "yes" ]; then + cat <<EOF +Usage: $0 [-debug] [-release] [-shared] [-static] [-qt3] [-platform ...] + +The defaults (*) are usually acceptable. Here is a short explanation of +each option: + + * -release ........... Compile and link Qt with debugging turned off. + -debug ............. Compile and link Qt with debugging turned on. + + * -shared ............ Create and use a shared Qt library (libqt.so) + -static ............ Create and use a static Qt library (libqt.a) + + -qt3 ............... Configure for use with Qt 3.x + + -platform target ... The platform you are building on ($PLATFORM) +EOF + exit 0; +fi + +CUSTOM=`echo $PLATFORM | sed -n -e "s/.*-\(.*\)-.*/\1/p"` + +if [ -f library/custom-$CUSTOM.h ] +then + rm -f library/custom.h + ln -s custom-$CUSTOM.h library/custom.h +fi + +mkdir -p include/qpe +( cd include/qpe && rm -f *.h; ln -s ../../library/*.h .; ln -s ../../library/backend/*.h .; rm -f *_p.h; ) +mkdir -p include/qtopia +( cd include/qtopia && rm -f *.h; ln -s ../../library/*.h .; ) +mkdir -p include/qtopia/private +( cd include/qtopia/private && rm -f *.h; ln -s ../../../library/backend/*.h .; ) +mkdir -p include/opie +( cd include/opie && rm -f *.h; ln -s ../../libopie/*.h .; rm -f *_p.h; ) +( cd include/opie && ln -s ../../libsql/*.h .; ) +( cd include/opie && ln -s ../../libopie/pim/*.h .; ) +( cd include/opie && ln -fs ../../libopie/ofileselector/*.h .; ) + +echo Creating makefiles... + +# Set version for library directly +# Version 1.5.0 right now for compat. +sed -e 's/^\(VERSION.*= \).*/\1'1.5.0.$VERSION_PAT/ <library/library.pro >library/library.pro-v +mv library/library.pro-v library/library.pro + +if [ "$QT3" = yes ] +then + VCONFIG="CONFIG+=qt3" +else + VCONFIG="CONFIG+=qt2" +fi + +if [ -f $TMAKEPATH/tmake.conf ] +then + # You have tmake. We'll regenerate the file for you... + echo "Makefiles will be regenerated." +fi + +H=`pwd` +if [ -z "$TOMAKE" ] +then + TOMAKE=`make showcomponents` +fi + +for a in $TOMAKE ; do + N=$a/Makefile + M=$a/Makefile.in + O=$a/Makefile.add + f=`basename $a` + + if [ -f "$TMAKEPATH/tmake.conf" -a -f "$a/$f.pro" ] + then + ( cd $a; + TMAKEPATH=$QTDIR/tmake:$TMAKEPATH \ + tmake $QCONFIGARG CONFIG+=embedded $VCONFIG \ + -t $H/qt/tmake/propagate.t $f.pro | + sed -e "s|$QTDIR|\$(QTDIR)|g" -e "s|$OPIEDIR|\$(OPIEDIR)|g" >Makefile.in; + ) + echo -n "." +# echo Building $N.. + appname=`grep '^TARGET' $a/$f.pro | sed 's/^TARGET.*=//' | tr -d " \t"` + translation=`grep '^TRANSLATION.*[^+]=.*' $a/$f.pro | sed 's,^TRANSL.*=.*i18n\/.*\/,,' | sed 's/ //g' | sed 's,\.ts.*,,' | sed 's,^lib,,' ` + if [ -n "$translation" -a -n "$appname" ] + then + if [ "$appname" != "$translation" ] + then + echo + echo "Warning: translation and appname disagree in $a/$f.pro" + fi + fi + + fi + + cat > $N <<EOF +############################################################################# +# Automatically generated from $M +# Build options from $1 +############################################################################# + +EOF + + SED= + PLATFORM_CFLAGS= + + if [ "$f" = "embeddedkonsole" ] + then + case $PLATFORM in + *x86*|*generic*|*ipaq*|*sharp*) + SED="$SED /^LIBS.*=/s/\$/ -lutil/;" + PLATFORM_CFLAGS="-DHAVE_OPENPTY" + ;; *) + SED= + esac + elif [ "$f" = "libmpeg3" ] + then + # Patch our Makefile.in file with the platform specifics for the libmpeg3 library + # Use the C++ compiler to compile the .c files (because the fixed-point classes are C++ code) + SED='s/\$(CC)/\$(CXX)/;' + case $PLATFORM + in + # For x86 turn on using floating point, compile mmx and css code + *x86*) + # "-funroll-loops -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -march=i486" + PLATFORM_CFLAGS="-DHAVE_MMX -DHAVE_CSS" + SED="$SED /SOURCES.*=/s/=/= video\\/mmxidct.S video\\/reconmmx.s\ /;" + # For generic turn on using floating point + ;; *generic*) + PLATFORM_CFLAGS="" + # For the ipaq use fixed point maths, don't compile the mmx or css code + ;; *ipaq*|*sharp*) + PLATFORM_CFLAGS="-DUSE_FIXED_POINT" + ;; *) + # For 'other platforms', turn off optimizations and use fixed point + PLATFORM_CFLAGS="-O -DUSE_FIXED_POINT" + esac + elif [ "$f" = "libmad" ] + then + # Patch our Makefile.in file with the platform specifics for the libmad library + case $PLATFORM + in + # For x86 use intel optimizations + *x86*) + PLATFORM_CFLAGS="-DFPM_INTEL" + # For the ipaq use ARM asm optimizations + ;; *ipaq*|*sharp*) + PLATFORM_CFLAGS="-DFPM_ARM" + SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;" + # For generic platforms use the C 64-bit implementation + ;; *generic*) + PLATFORM_CFLAGS="-DFPM_64BIT" + # For 'other platforms' use the ARM code + ;; *) + PLATFORM_CFLAGS="-DFPM_ARM" + SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;" + esac + fi + if [ -n "$PLATFORM_CFLAGS" ] + then + # Append the addition c-flags we have defined + SED="$SED /CFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;" + SED="$SED /CXXFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;" + fi + cat $TARGET >> $N + if [ -n "$SED" ] + then + sed -e "$SED" $M >> $N + else + cat $M >> $N + fi + + cat >> $N <<EOF + +lupdate: + lupdate $f.pro + +lrelease: + lrelease $f.pro + +EOF + if [ -f "$O" ] + then + cat >> $N $O + fi + +done + +MAKE=make +echo +echo "Opie is now configured for building. Just run $MAKE (or $MAKE single)." +echo "To reconfigure, run $MAKE clean and configure." +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 @@ +TEMPLATE = lib +CONFIG += qte warn_on release +HEADERS = ofontmenu.h \ + ocolorbutton.h \ + ofileselector/odefaultfactories.h \ + ofileselector/ofiledialog.h \ + ofileselector/ofilelistview.h \ + ofileselector/ofileselector.h \ + ofileselector/ofileselectoritem.h \ + ofileselector/ofileseleczormain.h \ + ofileselector/ofileview.h \ + ofileselector/olister.h \ + ofileselector/olocallister.h \ + ofileselector/opixmapprovider.h \ + tododb.h \ + ocheckitem.h todoevent.h todoresource.h \ + todovcalresource.h xmltree.h \ + colordialog.h colorpopupmenu.h \ + oclickablelabel.h oprocctrl.h \ + oprocess.h odevice.h \ + otimepicker.h otabwidget.h \ + otabbar.h otabinfo.h \ + ofontselector.h \ + pim/opimrecord.h \ + pim/otodo.h \ + pim/orecordlist.h \ + pim/opimaccesstemplate.h \ + pim/opimaccessbackend.h \ + pim/otodoaccess.h \ + pim/otodacessbackend.h \ + pim/ocontact.h \ + pim/ocontactaccess.h \ + pim/ocontactaccessbackend.h \ + pim/ocontactaccessbackend_xml.h \ + pim/obackendfactory.h \ + pim/opimcache.h \ + pim/otodoaccessvcal.h \ + pim/orecur.h \ + orecurrancewidget.h +# pim/otodoaccesssql.h \ + +SOURCES = ofontmenu.cc \ + ocolorbutton.cpp \ + ofileselector/odefaultfactories.cpp \ + ofileselector/ofiledialog.cpp \ + ofileselector/ofilefactory.cpp \ + ofileselector/ofilelistview.cpp \ + ofileselector/ofileselector.cpp \ + ofileselector/ofileselectoritem.cpp \ + ofileselector/ofileselectormain.cpp \ + ofileselector/ofileview.cpp \ + ofileselector/olister.cpp \ + ofileselector/olocallister.cpp \ + ofileselector/opixmapprovider.cpp \ + xmltree.cc \ + ocheckitem.cpp tododb.cpp todoevent.cpp \ + todovcalresource.cpp colordialog.cpp \ + colorpopupmenu.cpp oclickablelabel.cpp \ + oprocctrl.cpp oprocess.cpp \ + odevice.cpp otimepicker.cpp \ + otabwidget.cpp otabbar.cpp \ + ofontselector.cpp \ + pim/otodo.cpp \ + pim/opimrecord.cpp \ + pim/otodoaccess.cpp \ + pim/otodoaccessbackend.cpp \ + pim/otodoaccessxml.cpp \ + pim/ocontact.cpp \ + pim/ocontactaccess.cpp \ + pim/otodoaccessvcal.cpp \ + pim/orecur.cpp \ + orecurrancewidget.cpp +# pim/otodoaccesssql.cpp \ + +TARGET = opie +INCLUDEPATH += $(OPIEDIR)/include +DESTDIR = $(QTDIR)/lib$(PROJMAK) +#VERSION = 1.0.0 + +# LIBS += -lopiesql + +INTERFACES = otimepickerbase.ui orecurrancebase.ui + +TRANSLATIONS = ../i18n/de/libopie.ts \ + ../i18n/en/libopie.ts \ + ../i18n/es/libopie.ts \ + ../i18n/fr/libopie.ts \ + ../i18n/hu/libopie.ts \ + ../i18n/ja/libopie.ts \ + ../i18n/ko/libopie.ts \ + ../i18n/no/libopie.ts \ + ../i18n/pl/libopie.ts \ + ../i18n/pt/libopie.ts \ + ../i18n/pt_BR/libopie.ts \ + ../i18n/sl/libopie.ts \ + ../i18n/zh_CN/libopie.ts \ + ../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 @@ -47,5 +47,5 @@ void OFileListView::addFile( const QPixmap& pix, const QString&, QFileInfo* info, - const QString& /*extra*/, + const QString& extra, bool isSymlink ) { QString dir; @@ -68,5 +68,5 @@ void OFileListView::addFile( const QPixmap& pix, info->lastModified().toString(), QString::number( info->size() ), - dir, locked ); + dir, locked, extra ); } void OFileListView::addFile( const QPixmap&, @@ -79,5 +79,5 @@ void OFileListView::addFile( const QPixmap&, void OFileListView::addDir( const QPixmap& pix, const QString&, QFileInfo* info, - const QString& /*extra */, + const QString& extra , bool symlink ) { @@ -90,5 +90,5 @@ void OFileListView::addDir( const QPixmap& pix, const QString&, info->lastModified().toString(), QString::number( info->size() ), - info->dirPath( true ), locked, + info->dirPath( true ), locked, extra, true ); @@ -128,4 +128,11 @@ QString OFileListView::selectedName()const{ return item->text( 1 ); } +QString OFileListView::selectedExtra()const{ + QListViewItem* item = currentItem(); + if (!item) return QString::null; + OFileSelectorItem* fit = (OFileSelectorItem*)fit; + + return fit->extra(); +} QStringList OFileListView::selectedNames()const { QStringList list; @@ -138,5 +145,5 @@ QString OFileListView::selectedPath()const { QStringList OFileListView::selectedPaths()const { QStringList list; -b list << selectedPath(); + list << selectedPath(); return list; } @@ -162,8 +169,5 @@ void OFileListView::slotCurrentChanged( QListViewItem* item) { if (selector()->mode() == OFileSelector::Fileselector ) { QStringList str = QStringList::split("->", sel->text(1) ); - QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); - DocLnk lnk( path ); - fileSelected(lnk ); - fileSelected( path ); + fileSelected(sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); } } @@ -182,14 +186,8 @@ void OFileListView::slotClicked( int button, QListViewItem* item, QStringList str = QStringList::split("->", sel->text(1) ); if( sel->isDir() ){ - changedDir( sel->directory() + "/" + str[0].stripWhiteSpace() ); + changedDir( sel->directory(), str[0].stripWhiteSpace(),sel->extra() ); }else{ updateLine( str[0].stripWhiteSpace() ); - QString path = sel->directory(); - path += "/"; - path += str[0].stripWhiteSpace(); - - DocLnk lnk( path ); - fileSelected( path ); - fileSelected( lnk ); + fileSelected( sel->directory(),str[0].stripWhiteSpace(), sel->extra() ); } } 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 @@ -29,6 +29,7 @@ public: void addDir( const QPixmap&, const QString& mime, + QFileInfo* info, const QString& extra = QString::null, - QFileInfo* info, bool = FALSE ); + bool = FALSE ); void addDir( const QPixmap&, @@ -46,5 +47,5 @@ public: const QString& mine, const QString& path, const QString& file, - const QString& extra, + const QString& extra = QString::null, bool isSymlink = FALSE ); void cd( const QString& path ); @@ -57,4 +58,5 @@ public: QString selectedPath()const; QStringList selectedPaths()const; + QString selectedExtra()const; int fileCount(); private slots: 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 @@ -1037,4 +1037,6 @@ int OFileSelector::sorting() { void OFileSelector::internFileSelected( const QString& s) { emit fileSelected( s ); + DocLnk lnk( s ); + internFileSelected( lnk ); } void OFileSelector::internFileSelected( const DocLnk& 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 @@ -7,6 +7,6 @@ OFileSelectorItem::OFileSelectorItem( QListView*view, const QString& size, const QString& dir, - const QString& extra, bool isLocked, + const QString& extra, bool isDir ) : QListViewItem( view ) @@ -54,5 +54,5 @@ QString OFileSelectorItem::key( int id, bool ) { return ke; } -QString OFileSelector::extra()const { +QString OFileSelectorItem::extra()const { return m_extra; } 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 @@ -4,7 +4,9 @@ #include "ofileselector.h" +#include "olister.h" #include "ofileview.h" + OFileView::OFileView( OFileSelector* sel) : m_sel( sel ) 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 @@ -97,4 +97,5 @@ public: virtual QString selectedPath()const = 0; virtual QStringList selectedPaths()const = 0; + virtual QString selectedExtra()const = 0; virtual int fileCount() = 0; virtual void sort() =0; @@ -108,5 +109,5 @@ protected: * @param extra The extra information */ - void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::nulll); + void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::null); void contextMenu(); @@ -118,5 +119,4 @@ protected: */ void changedDir(const QString &dir, const QString& file, const QString& extra = QString::null); - void changedDir(const QDir & ); /* updates the file name line of the FileSelector */ 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 @@ -119,4 +119,10 @@ bool OLister::compliesMime( const QString& mime ) { return view()->compliesMime( mime ); } +void OLister::internFileSelected( const QString& dir ) { + view()->internFileSelected( dir ); +} +void OLister::internChangedDir( const QString& dir ) { + view()->internChangedDir( dir ); +} OListerCmbAccess* OLister::comboBox() { if (!m_acc ) @@ -127,5 +133,5 @@ OListerCmbAccess* OLister::comboBox() { -OListerCmbAccess::OListerCmbAccess(QComboBox* box ) +OListerCmbAccess::OListerCmbAccess(QComboBox* cmb ) : m_cmb( cmb ) {} @@ -143,8 +149,11 @@ void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { for ( int i = 0; i < m_cmb->count(); i++ ) { if ( m_cmb->text(i) == add ) { - bo->setCurrentItem( i ); + m_cmb->setCurrentItem( i ); return; } } + if (!FORCE_ADD ) return; + + m_cmb->insertItem(add ); m_cmb->setCurrentItem( c ); 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 @@ -34,6 +34,6 @@ public: /* some way a slot */ - void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; - void changeDir( const QString& dir, const QString& file, const QString& extra ) = 0; + virtual void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; + virtual void changedDir( const QString& dir, const QString& file, const QString& extra ) = 0; protected: /** @@ -61,4 +61,5 @@ protected: void addDir( const QString& mine, QFileInfo*, + const QString& extra = QString::null, bool isSymlink = FALSE ); void addDir( const QString& mine, @@ -78,4 +79,6 @@ protected: OFileSelector* view(); OPixmapProvider* provider(); + void internFileSelected( const QString& file ); + void internChangedDir( const QString& dir ); private: OFileSelector* m_view; 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 @@ -79,5 +79,5 @@ void OLocalLister::reparse( const QString& path ) { QFileInfo info( file ); if( !info.exists() ){ - addSymlink( currentMimeType, fi, TRUE ); + addSymlink( currentMimeType, fi, QString::null, TRUE ); break; }else if( info.isDir() ){ @@ -85,5 +85,5 @@ void OLocalLister::reparse( const QString& path ) { break; - addDir( currentMimeType, fi, + addDir( currentMimeType, fi, QString::null, TRUE ); break; @@ -96,5 +96,5 @@ void OLocalLister::reparse( const QString& path ) { MimeType type( info.absFilePath() ); if (compliesMime( type.id() ) ) - addFile( currentMimeType, fi, TRUE ); + addFile( currentMimeType, fi, QString::null, TRUE ); break; @@ -117,3 +117,9 @@ void OLocalLister::reparse( const QString& path ) { } // of while loop } - +/* more accepting it code */ +void OLocalLister::fileSelected( const QString& dir, const QString& file, const QString& ) { + internFileSelected( dir + "/" + file ); +} +void OLocalLister::changedDir( const QString& dir, const QString& file, const QString& ) { + internChangedDir( dir + "/" + file ); +} 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 @@ -10,4 +10,6 @@ public: void reparse( const QString& path ); QMap<QString, QStringList> mimeTypes(const QString& dir ); + void fileSelected( const QString& dir, const QString& file, const QString& ); + void changedDir( const QString& dir, const QString& file,const QString& ); }; |