author | zecke <zecke> | 2002-10-05 21:20:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-05 21:20:45 (UTC) |
commit | d0c61661d694574dfaf18162e015c493cd1d571c (patch) (side-by-side diff) | |
tree | 7761e3c8d503534e7e9ca43e0019251d56ff58bb | |
parent | 6e217b24b1eb09d922e35dc5126fa5ec578915b8 (diff) | |
download | opie-d0c61661d694574dfaf18162e015c493cd1d571c.zip opie-d0c61661d694574dfaf18162e015c493cd1d571c.tar.gz opie-d0c61661d694574dfaf18162e015c493cd1d571c.tar.bz2 |
Implemented the factory
now I can finally do switching
-rw-r--r-- | libopie/ofileselector/ofilefactory.cpp | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/libopie/ofileselector/ofilefactory.cpp b/libopie/ofileselector/ofilefactory.cpp index f752149..aa143b4 100644 --- a/libopie/ofileselector/ofilefactory.cpp +++ b/libopie/ofileselector/ofilefactory.cpp @@ -1,40 +1,58 @@ #include "ofilefactory.h" OFileFactory::OFileFactory() { } OFileFactory::~OFileFactory() { } QStringList OFileFactory::lister()const { QStringList list; QMap<QString, listerFact>::ConstIterator it; for ( it = m_lister.begin(); it != m_lister.end(); ++it ) { - list << (*it); + list << it.key(); } return list; } QStringList OFileFactory::views()const { QStringList list; - + QMap<QString, viewFact>::ConstIterator it; + for (it = m_view.begin(); it != m_view.end(); ++it ) { + list << it.key(); + } return list; } OFileView* OFileFactory::view( const QString& name, - OFileSelector*, QWidget* ) { + OFileSelector* sel, QWidget* par) { + OFileView* vie= 0l; -} -OLister* OFileFactory::lister(const QString&, OFileSelector*) { + QMap<QString, viewFact>::Iterator it; + it = m_view.find( name ); + if ( it != m_view.end() ) { + vie = (*(it.data() ) )(sel, par); } -void OFileFactory::addLister( const QString&, listerFact fact ) { - + return vie; } -void OFileFactory::addView( const QString&, viewFact fact ) { - +OLister* OFileFactory::lister(const QString& name, OFileSelector* sel) { + OLister* lis = 0l; + QMap<QString, listerFact>::Iterator it; + it = m_lister.find( name ); + if ( it != m_lister.end() ) { + lis = (*(it.data() ) )(sel); } -void OFileFactory::removeLister( const QString& ) { + return lis; } -void OFileFactory::removeView( const QString& ) { - +void OFileFactory::addLister( const QString& name, listerFact fact ) { + m_lister.insert( name, fact ); +} +void OFileFactory::addView( const QString& name, viewFact fact ) { + m_view.insert( name, fact ); +} +void OFileFactory::removeLister( const QString& name) { + m_lister.remove( name ); +} +void OFileFactory::removeView( const QString& name) { + m_view.remove( name ); } |