author | zecke <zecke> | 2002-09-28 19:45:01 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-09-28 19:45:01 (UTC) |
commit | cb33923e1db6df3ead352f21c94b80a5785d70ca (patch) (unidiff) | |
tree | ac7816a66fe94c3d9d51411b458ee14dc117ce09 | |
parent | a52cf21d13cc26844adbce20b24287563a559d14 (diff) | |
download | opie-cb33923e1db6df3ead352f21c94b80a5785d70ca.zip opie-cb33923e1db6df3ead352f21c94b80a5785d70ca.tar.gz opie-cb33923e1db6df3ead352f21c94b80a5785d70ca.tar.bz2 |
make it possible in profileconfig
to iterate over the items in a group
-rw-r--r-- | noncore/apps/opie-console/profileconfig.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileconfig.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 5 |
3 files changed, 18 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/profileconfig.cpp b/noncore/apps/opie-console/profileconfig.cpp index 8b16920..bd089c8 100644 --- a/noncore/apps/opie-console/profileconfig.cpp +++ b/noncore/apps/opie-console/profileconfig.cpp | |||
@@ -12,24 +12,34 @@ QStringList ProfileConfig::groups()const { | |||
12 | QStringList list; | 12 | QStringList list; |
13 | QMap<QString, ConfigGroup>::ConstIterator it; | 13 | QMap<QString, ConfigGroup>::ConstIterator it; |
14 | it= Config::groups.begin(); | 14 | it= Config::groups.begin(); |
15 | 15 | ||
16 | for (; it != Config::groups.end(); ++it ) | 16 | for (; it != Config::groups.end(); ++it ) |
17 | list << it.key(); | 17 | list << it.key(); |
18 | 18 | ||
19 | 19 | ||
20 | return list; | 20 | return list; |
21 | 21 | ||
22 | } | 22 | } |
23 | void ProfileConfig::clearAll() { | 23 | void ProfileConfig::clearAll() { |
24 | QMap<QString, ConfigGroup>::ConstIterator it; | 24 | QMap<QString, ConfigGroup>::ConstIterator it; |
25 | it = Config::groups.begin(); | 25 | it = Config::groups.begin(); |
26 | 26 | ||
27 | for ( ; it != Config::groups.end(); ++it ) | 27 | for ( ; it != Config::groups.end(); ++it ) |
28 | clearGroup( it.key() ); | 28 | clearGroup( it.key() ); |
29 | } | 29 | } |
30 | void ProfileConfig::clearGroup( const QString& str ) { | 30 | void ProfileConfig::clearGroup( const QString& str ) { |
31 | QString cur =git.key(); | 31 | QString cur =git.key(); |
32 | setGroup( str ); | 32 | setGroup( str ); |
33 | Config::clearGroup(); | 33 | Config::clearGroup(); |
34 | setGroup( cur ); | 34 | setGroup( cur ); |
35 | } | 35 | } |
36 | QMap<QString, QString> ProfileConfig::items( const QString& group )const { | ||
37 | QMap<QString, QString> map; | ||
38 | QMap<QString, ConfigGroup>::ConstIterator it; | ||
39 | it = Config::groups.find( group ); | ||
40 | |||
41 | if (it != Config::groups.end() ) | ||
42 | map = it.data(); | ||
43 | |||
44 | return map; | ||
45 | } | ||
diff --git a/noncore/apps/opie-console/profileconfig.h b/noncore/apps/opie-console/profileconfig.h index e2e149c..f371ead 100644 --- a/noncore/apps/opie-console/profileconfig.h +++ b/noncore/apps/opie-console/profileconfig.h | |||
@@ -1,17 +1,21 @@ | |||
1 | 1 | ||
2 | #ifndef OPIE_PROFILE_CONFIG_H | 2 | #ifndef OPIE_PROFILE_CONFIG_H |
3 | #define OPIE_PROFILE_CONFIG_H | 3 | #define OPIE_PROFILE_CONFIG_H |
4 | 4 | ||
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | class ProfileConfig : public Config { | 8 | class ProfileConfig : public Config { |
9 | public: | 9 | public: |
10 | ProfileConfig( const QString& prof ); | 10 | ProfileConfig( const QString& prof ); |
11 | ~ProfileConfig(); | 11 | ~ProfileConfig(); |
12 | QStringList groups()const; | 12 | QStringList groups()const; |
13 | /** | ||
14 | * return the items in the group | ||
15 | */ | ||
16 | QMap<QString, QString> items(const QString& group)const; | ||
13 | void clearGroup( const QString& ); | 17 | void clearGroup( const QString& ); |
14 | void clearAll(); | 18 | void clearAll(); |
15 | 19 | ||
16 | }; | 20 | }; |
17 | #endif | 21 | #endif |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index db36686..54b184d 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -17,46 +17,49 @@ void ProfileManager::load() { | |||
17 | m_list.clear(); | 17 | m_list.clear(); |
18 | ProfileConfig conf("opie-console-profiles"); | 18 | ProfileConfig conf("opie-console-profiles"); |
19 | QStringList groups = conf.groups(); | 19 | QStringList groups = conf.groups(); |
20 | QStringList::Iterator it; | 20 | QStringList::Iterator it; |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * for each profile | 23 | * for each profile |
24 | */ | 24 | */ |
25 | /* | 25 | /* |
26 | * QAsciiDict Parsing FIXME | 26 | * QAsciiDict Parsing FIXME |
27 | */ | 27 | */ |
28 | for ( it = groups.begin(); it != groups.end(); ++it ) { | 28 | for ( it = groups.begin(); it != groups.end(); ++it ) { |
29 | conf.setGroup( (*it) ); | 29 | conf.setGroup( (*it) ); |
30 | Profile prof; | 30 | Profile prof; |
31 | prof.setName( conf.readEntry("name") ); | 31 | prof.setName( conf.readEntry("name") ); |
32 | prof.setIOLayer( conf.readEntry("iolayer") ); | 32 | prof.setIOLayer( conf.readEntry("iolayer") ); |
33 | prof.setBackground( conf.readNumEntry("back") ); | 33 | prof.setBackground( conf.readNumEntry("back") ); |
34 | prof.setForeground( conf.readNumEntry("fore") ); | 34 | prof.setForeground( conf.readNumEntry("fore") ); |
35 | prof.setTerminal( conf.readNumEntry("terminal") ); | 35 | prof.setTerminal( conf.readNumEntry("terminal") ); |
36 | 36 | ||
37 | m_list.append( prof ); | 37 | m_list.append( prof ); |
38 | } | 38 | } |
39 | 39 | ||
40 | } | 40 | } |
41 | void ProfileManager::clear() { | ||
42 | m_list.clear(); | ||
43 | } | ||
41 | Profile::ValueList ProfileManager::all()const { | 44 | Profile::ValueList ProfileManager::all()const { |
42 | return m_list; | 45 | return m_list; |
43 | } | 46 | } |
44 | Session* ProfileManager::fromProfile( const Profile& prof) { | 47 | Session* ProfileManager::fromProfile( const Profile& prof) { |
45 | Session* session = new Session(); | 48 | Session* session = new Session(); |
46 | session->setName( prof.name() ); | 49 | session->setName( prof.name() ); |
47 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), | 50 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), |
48 | prof) ); | 51 | prof) ); |
49 | /* | 52 | /* |
50 | * FIXME | 53 | * FIXME |
51 | * load emulation | 54 | * load emulation |
52 | * load widget | 55 | * load widget |
53 | * set colors + fonts | 56 | * set colors + fonts |
54 | */ | 57 | */ |
55 | return session; | 58 | return session; |
56 | } | 59 | } |
57 | void ProfileManager::save( ) { | 60 | void ProfileManager::save( ) { |
58 | m_list.clear(); | ||
59 | ProfileConfig conf("opie-console-profiles"); | 61 | ProfileConfig conf("opie-console-profiles"); |
62 | conf.clearAll(); | ||
60 | Session* se= 0l; | 63 | Session* se= 0l; |
61 | // FIXME save | 64 | // FIXME save |
62 | } | 65 | } |