author | zecke <zecke> | 2002-10-08 23:13:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-08 23:13:17 (UTC) |
commit | 8c353ec8b86ee8f82cc25172fb69dd5fee65e848 (patch) (unidiff) | |
tree | a4549bcba962689edb9c40efcb23114cae5fcda2 /noncore/apps/opie-console/profilemanager.cpp | |
parent | ca0c224318a50c6618691fb30f39aa1d9b0b8a4f (diff) | |
download | opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.zip opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.gz opie-8c353ec8b86ee8f82cc25172fb69dd5fee65e848.tar.bz2 |
default I dunno
IOLayerBase the return values for speed()/parity()/flow() added
MainWindow debug code :(
opie-console.pro addition of serialconfigwidget.*
ProfileManager fix removing of Profiles quite rude way of doing it
Configure stuff is done and roughly tested
The migration is done!
TO WAZLAF: you might want to adjust Parity stuff for your needs!
Diffstat (limited to 'noncore/apps/opie-console/profilemanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index 6ad08b5..e66ebcc 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -1,93 +1,98 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | #include <qfile.h> | ||
1 | 5 | ||
2 | #include <qpe/config.h> | 6 | #include <qpe/config.h> |
3 | 7 | ||
4 | #include "metafactory.h" | 8 | #include "metafactory.h" |
5 | #include "profileconfig.h" | 9 | #include "profileconfig.h" |
6 | #include "profilemanager.h" | 10 | #include "profilemanager.h" |
7 | 11 | ||
8 | ProfileManager::ProfileManager( MetaFactory* fact ) | 12 | ProfileManager::ProfileManager( MetaFactory* fact ) |
9 | : m_fact( fact ) | 13 | : m_fact( fact ) |
10 | { | 14 | { |
11 | 15 | ||
12 | } | 16 | } |
13 | ProfileManager::~ProfileManager() { | 17 | ProfileManager::~ProfileManager() { |
14 | 18 | ||
15 | } | 19 | } |
16 | void ProfileManager::load() { | 20 | void ProfileManager::load() { |
17 | m_list.clear(); | 21 | m_list.clear(); |
18 | qWarning("load"); | 22 | qWarning("load"); |
19 | ProfileConfig conf("opie-console-profiles"); | 23 | ProfileConfig conf("opie-console-profiles"); |
20 | QStringList groups = conf.groups(); | 24 | QStringList groups = conf.groups(); |
21 | QStringList::Iterator it; | 25 | QStringList::Iterator it; |
22 | 26 | ||
23 | /* | 27 | /* |
24 | * for each profile | 28 | * for each profile |
25 | */ | 29 | */ |
26 | for ( it = groups.begin(); it != groups.end(); ++it ) { | 30 | for ( it = groups.begin(); it != groups.end(); ++it ) { |
27 | qWarning("group " + (*it) ); | 31 | qWarning("group " + (*it) ); |
28 | conf.setGroup( (*it) ); | 32 | conf.setGroup( (*it) ); |
29 | Profile prof; | 33 | Profile prof; |
30 | prof.setName( conf.readEntry("name") ); | 34 | prof.setName( conf.readEntry("name") ); |
31 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); | 35 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); |
32 | prof.setTerminalName( conf.readEntry("term").utf8() ); | 36 | prof.setTerminalName( conf.readEntry("term").utf8() ); |
37 | qWarning(" %s %s", conf.readEntry("iolayer").latin1(), prof.ioLayerName().data() ); | ||
33 | prof.setBackground( conf.readNumEntry("back") ); | 38 | prof.setBackground( conf.readNumEntry("back") ); |
34 | prof.setForeground( conf.readNumEntry("fore") ); | 39 | prof.setForeground( conf.readNumEntry("fore") ); |
35 | prof.setTerminal( conf.readNumEntry("terminal") ); | 40 | prof.setTerminal( conf.readNumEntry("terminal") ); |
36 | prof.setConf( conf.items( (*it) ) ); | 41 | prof.setConf( conf.items( (*it) ) ); |
37 | 42 | ||
38 | /* now add it */ | 43 | /* now add it */ |
39 | m_list.append( prof ); | 44 | m_list.append( prof ); |
40 | } | 45 | } |
41 | 46 | ||
42 | } | 47 | } |
43 | void ProfileManager::clear() { | 48 | void ProfileManager::clear() { |
44 | m_list.clear(); | 49 | m_list.clear(); |
45 | } | 50 | } |
46 | Profile::ValueList ProfileManager::all()const { | 51 | Profile::ValueList ProfileManager::all()const { |
47 | return m_list; | 52 | return m_list; |
48 | } | 53 | } |
49 | Session* ProfileManager::fromProfile( const Profile& prof) { | 54 | Session* ProfileManager::fromProfile( const Profile& prof) { |
50 | Session* session = new Session(); | 55 | Session* session = new Session(); |
51 | session->setName( prof.name() ); | 56 | session->setName( prof.name() ); |
52 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), | 57 | session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), |
53 | prof) ); | 58 | prof) ); |
54 | /* | 59 | /* |
55 | * FIXME | 60 | * FIXME |
56 | * load emulation | 61 | * load emulation |
57 | * load widget? | 62 | * load widget? |
58 | * set colors + fonts | 63 | * set colors + fonts |
59 | */ | 64 | */ |
60 | return session; | 65 | return session; |
61 | } | 66 | } |
62 | void ProfileManager::save( ) { | 67 | void ProfileManager::save( ) { |
68 | QFile::remove( (QString(getenv("HOME") )+ "/Settings/opie-console-profiles.conf" ) ); | ||
63 | ProfileConfig conf("opie-console-profiles"); | 69 | ProfileConfig conf("opie-console-profiles"); |
64 | conf.clearAll(); | ||
65 | Profile::ValueList::Iterator it; | 70 | Profile::ValueList::Iterator it; |
66 | for (it = m_list.begin(); it != m_list.end(); ++it ) { | 71 | for (it = m_list.begin(); it != m_list.end(); ++it ) { |
67 | conf.setGroup( (*it).name() ); | 72 | conf.setGroup( (*it).name() ); |
68 | conf.writeEntry( "name", (*it).name() ); | 73 | conf.writeEntry( "name", (*it).name() ); |
69 | conf.writeEntry( "ioplayer", QString::fromUtf8( (*it).ioLayerName() ) ); | 74 | conf.writeEntry( "iolayer", QString::fromUtf8( (*it).ioLayerName() ) ); |
70 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); | 75 | conf.writeEntry( "term", QString::fromUtf8( (*it).terminalName() ) ); |
71 | conf.writeEntry( "back", (*it).background() ); | 76 | conf.writeEntry( "back", (*it).background() ); |
72 | conf.writeEntry( "fore", (*it).foreground() ); | 77 | conf.writeEntry( "fore", (*it).foreground() ); |
73 | conf.writeEntry( "terminal", (*it).terminal() ); | 78 | conf.writeEntry( "terminal", (*it).terminal() ); |
74 | /* now the config stuff */ | 79 | /* now the config stuff */ |
75 | QMap<QString, QString> map = (*it).conf(); | 80 | QMap<QString, QString> map = (*it).conf(); |
76 | QMap<QString, QString>::Iterator it; | 81 | QMap<QString, QString>::Iterator it; |
77 | for ( it = map.begin(); it != map.end(); ++it ) { | 82 | for ( it = map.begin(); it != map.end(); ++it ) { |
78 | conf.writeEntry( it.key(), it.data() ); | 83 | conf.writeEntry( it.key(), it.data() ); |
79 | } | 84 | } |
80 | } | 85 | } |
81 | } | 86 | } |
82 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { | 87 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { |
83 | m_list = list; | 88 | m_list = list; |
84 | }; | 89 | }; |
85 | Profile ProfileManager::profile( const QString& name )const { | 90 | Profile ProfileManager::profile( const QString& name )const { |
86 | Profile prof; | 91 | Profile prof; |
87 | Profile::ValueList::ConstIterator it; | 92 | Profile::ValueList::ConstIterator it; |
88 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { | 93 | for ( it = m_list.begin(); it != m_list.end(); ++it ) { |
89 | if ( name == (*it).name() ) { | 94 | if ( name == (*it).name() ) { |
90 | prof = (*it); | 95 | prof = (*it); |
91 | break; | 96 | break; |
92 | } | 97 | } |
93 | } | 98 | } |