author | zecke <zecke> | 2002-10-05 21:20:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-05 21:20:45 (UTC) |
commit | d0c61661d694574dfaf18162e015c493cd1d571c (patch) (unidiff) | |
tree | 7761e3c8d503534e7e9ca43e0019251d56ff58bb /libopie | |
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 | 44 |
1 files changed, 31 insertions, 13 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 | |||
@@ -8,33 +8,51 @@ QStringList OFileFactory::lister()const { | |||
8 | QStringList list; | 8 | QStringList list; |
9 | QMap<QString, listerFact>::ConstIterator it; | 9 | QMap<QString, listerFact>::ConstIterator it; |
10 | for ( it = m_lister.begin(); it != m_lister.end(); ++it ) { | 10 | for ( it = m_lister.begin(); it != m_lister.end(); ++it ) { |
11 | list << (*it); | 11 | list << it.key(); |
12 | } | 12 | } |
13 | return list; | 13 | return list; |
14 | } | 14 | } |
15 | QStringList OFileFactory::views()const { | 15 | QStringList OFileFactory::views()const { |
16 | QStringList list; | 16 | QStringList list; |
17 | 17 | QMap<QString, viewFact>::ConstIterator it; | |
18 | for (it = m_view.begin(); it != m_view.end(); ++it ) { | ||
19 | list << it.key(); | ||
20 | } | ||
18 | 21 | ||
19 | return list; | 22 | return list; |
20 | } | 23 | } |
21 | OFileView* OFileFactory::view( const QString& name, | 24 | OFileView* OFileFactory::view( const QString& name, |
22 | OFileSelector*, QWidget* ) { | 25 | OFileSelector* sel, QWidget* par) { |
23 | 26 | OFileView* vie= 0l; | |
24 | } | ||
25 | OLister* OFileFactory::lister(const QString&, OFileSelector*) { | ||
26 | 27 | ||
27 | } | 28 | QMap<QString, viewFact>::Iterator it; |
28 | void OFileFactory::addLister( const QString&, listerFact fact ) { | 29 | it = m_view.find( name ); |
29 | 30 | ||
31 | if ( it != m_view.end() ) { | ||
32 | vie = (*(it.data() ) )(sel, par); | ||
33 | } | ||
34 | return vie; | ||
30 | } | 35 | } |
31 | void OFileFactory::addView( const QString&, viewFact fact ) { | 36 | OLister* OFileFactory::lister(const QString& name, OFileSelector* sel) { |
37 | OLister* lis = 0l; | ||
32 | 38 | ||
39 | QMap<QString, listerFact>::Iterator it; | ||
40 | it = m_lister.find( name ); | ||
41 | if ( it != m_lister.end() ) { | ||
42 | lis = (*(it.data() ) )(sel); | ||
43 | } | ||
33 | 44 | ||
45 | return lis; | ||
34 | } | 46 | } |
35 | void OFileFactory::removeLister( const QString& ) { | 47 | void OFileFactory::addLister( const QString& name, listerFact fact ) { |
36 | 48 | m_lister.insert( name, fact ); | |
37 | } | 49 | } |
38 | void OFileFactory::removeView( const QString& ) { | 50 | void OFileFactory::addView( const QString& name, viewFact fact ) { |
39 | 51 | m_view.insert( name, fact ); | |
52 | } | ||
53 | void OFileFactory::removeLister( const QString& name) { | ||
54 | m_lister.remove( name ); | ||
55 | } | ||
56 | void OFileFactory::removeView( const QString& name) { | ||
57 | m_view.remove( name ); | ||
40 | } | 58 | } |