Diffstat (limited to 'noncore/apps/opie-console/metafactory.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/metafactory.cpp | 74 |
1 files changed, 56 insertions, 18 deletions
diff --git a/noncore/apps/opie-console/metafactory.cpp b/noncore/apps/opie-console/metafactory.cpp index b69d6da..077b418 100644 --- a/noncore/apps/opie-console/metafactory.cpp +++ b/noncore/apps/opie-console/metafactory.cpp | |||
@@ -1,46 +1,64 @@ | |||
1 | #include <qpe/config.h> | 1 | #include <qpe/config.h> |
2 | #include "metafactory.h" | 2 | #include "metafactory.h" |
3 | 3 | ||
4 | MetaFactory::MetaFactory() { | 4 | MetaFactory::MetaFactory() { |
5 | } | 5 | } |
6 | MetaFactory::~MetaFactory() { | 6 | MetaFactory::~MetaFactory() { |
7 | 7 | ||
8 | } | 8 | } |
9 | void MetaFactory::addConfigWidgetFactory( const QString& str, | 9 | void MetaFactory::addConnectionWidgetFactory( const QCString& name, |
10 | const QString& name, | 10 | const QString& str, |
11 | configWidget wid) { | 11 | configWidget wid) { |
12 | m_namemap.insert ( str, name ); | 12 | m_strings.insert( str, name ); |
13 | m_confFact.insert( str, wid ); | 13 | m_conFact.insert( str, wid ); |
14 | } | 14 | } |
15 | void MetaFactory::addIOLayerFactory( const QString& str, | 15 | void MetaFactory::addTerminalWidgetFactory( const QCString& name, |
16 | const QString& str, | ||
17 | configWidget wid ) { | ||
18 | m_strings.insert( str, name ); | ||
19 | m_termFact.insert( str, wid ); | ||
20 | } | ||
21 | void MetaFactory::addIOLayerFactory( const QCString& name, | ||
22 | const QString& str, | ||
16 | iolayer lay) { | 23 | iolayer lay) { |
24 | m_strings.insert( str, name ); | ||
17 | m_layerFact.insert( str, lay ); | 25 | m_layerFact.insert( str, lay ); |
18 | } | 26 | } |
19 | void MetaFactory::addFileTransferLayer( const QString& str, | 27 | void MetaFactory::addFileTransferLayer( const QCString& name, |
28 | const QString& str, | ||
20 | filelayer lay) { | 29 | filelayer lay) { |
30 | m_strings.insert(str, name ); | ||
21 | m_fileFact.insert( str, lay ); | 31 | m_fileFact.insert( str, lay ); |
22 | } | 32 | } |
23 | QStringList MetaFactory::ioLayers()const { | 33 | QStringList MetaFactory::ioLayers()const { |
24 | QStringList list; | 34 | QStringList list; |
25 | QMap<QString, iolayer>::ConstIterator it; | 35 | QMap<QString, iolayer>::ConstIterator it; |
26 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { | 36 | for (it = m_layerFact.begin(); it != m_layerFact.end(); ++it ) { |
27 | list << it.key(); | 37 | list << it.key(); |
28 | } | 38 | } |
29 | return list; | 39 | return list; |
30 | } | 40 | } |
31 | QStringList MetaFactory::configWidgets()const { | 41 | QStringList MetaFactory::connectionWidgets()const { |
42 | QStringList list; | ||
43 | QMap<QString, configWidget>::ConstIterator it; | ||
44 | for ( it = m_conFact.begin(); it != m_conFact.end(); ++it ) { | ||
45 | list << it.key(); | ||
46 | } | ||
47 | return list; | ||
48 | } | ||
49 | QStringList MetaFactory::terminalWidgets()const { | ||
32 | QStringList list; | 50 | QStringList list; |
33 | QMap<QString, configWidget>::ConstIterator it; | 51 | QMap<QString, configWidget>::ConstIterator it; |
34 | for ( it = m_confFact.begin(); it != m_confFact.end(); ++it ) { | 52 | for ( it = m_termFact.begin(); it != m_termFact.end(); ++it ) { |
35 | list << it.key(); | 53 | list << it.key(); |
36 | } | 54 | } |
37 | return list; | 55 | return list; |
38 | } | 56 | } |
39 | QStringList MetaFactory::fileTransferLayers()const { | 57 | QStringList MetaFactory::fileTransferLayers()const { |
40 | QStringList list; | 58 | QStringList list; |
41 | QMap<QString, filelayer>::ConstIterator it; | 59 | QMap<QString, filelayer>::ConstIterator it; |
42 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { | 60 | for ( it = m_fileFact.begin(); it != m_fileFact.end(); ++it ) { |
43 | list << it.key(); | 61 | list << it.key(); |
44 | } | 62 | } |
45 | return list; | 63 | return list; |
46 | } | 64 | } |
@@ -51,26 +69,46 @@ IOLayer* MetaFactory::newIOLayer( const QString& str,const Profile& prof ) { | |||
51 | QMap<QString, iolayer>::Iterator it; | 69 | QMap<QString, iolayer>::Iterator it; |
52 | it = m_layerFact.find( str ); | 70 | it = m_layerFact.find( str ); |
53 | if ( it != m_layerFact.end() ) { | 71 | if ( it != m_layerFact.end() ) { |
54 | lay = (*(it.data()))(prof); | 72 | lay = (*(it.data()))(prof); |
55 | /* | 73 | /* |
56 | iolayer laye = it.data(); | 74 | iolayer laye = it.data(); |
57 | lay = (*laye )(conf);*/ | 75 | lay = (*laye )(conf);*/ |
58 | } | 76 | } |
59 | 77 | ||
60 | return lay; | 78 | return lay; |
61 | } | 79 | } |
62 | 80 | ||
63 | ProfileEditorPlugin *MetaFactory::newConfigPlugin ( const QString& str, QWidget *parent, Profile *prof) { | 81 | ProfileDialogWidget *MetaFactory::newConnectionPlugin ( const QString& str, QWidget *parent) { |
64 | ProfileEditorPlugin *p = NULL; | 82 | ProfileDialogWidget* wid = 0l; |
65 | configWidget c; | ||
66 | 83 | ||
67 | c = m_confFact[str]; | 84 | QMap<QString, configWidget>::Iterator it; |
68 | if(c) p = c(parent, prof); | 85 | it = m_conFact.find( str ); |
69 | 86 | if ( it != m_conFact.end() ) { | |
70 | return p; | 87 | wid = (*(it.data() ) )(str,parent); |
71 | } | 88 | } |
72 | 89 | return wid; | |
73 | QString MetaFactory::name( const QString& str ) { | ||
74 | return m_namemap[str]; | ||
75 | } | 90 | } |
91 | ProfileDialogWidget *MetaFactory::newTerminalPlugin( const QString& str, QWidget *parent) { | ||
92 | if (str.isEmpty() ) | ||
93 | return 0l; | ||
94 | ProfileDialogWidget* wid = 0l; | ||
95 | qWarning("new terminalPlugin %s %l", str.latin1(), parent ); | ||
76 | 96 | ||
97 | QMap<QString, configWidget>::Iterator it; | ||
98 | it = m_termFact.find( str ); | ||
99 | if ( it != m_conFact.end() ) { | ||
100 | wid = (*(it.data() ) )(str,parent); | ||
101 | } | ||
102 | return wid; | ||
103 | } | ||
104 | QCString MetaFactory::internal( const QString& str )const { | ||
105 | return m_strings[str]; | ||
106 | } | ||
107 | QString MetaFactory::external( const QCString& str )const { | ||
108 | QMap<QString, QCString>::ConstIterator it; | ||
109 | for ( it = m_strings.begin(); it != m_strings.end(); ++it ) { | ||
110 | if ( it.data() == str ) | ||
111 | return it.key(); | ||
112 | } | ||
113 | return QString::null; | ||
114 | } | ||