summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profile.cpp6
-rw-r--r--noncore/apps/opie-console/profile.h3
-rw-r--r--noncore/apps/opie-console/profilemanager.cpp23
3 files changed, 26 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
index cdf595e..c8f5eb0 100644
--- a/noncore/apps/opie-console/profile.cpp
+++ b/noncore/apps/opie-console/profile.cpp
@@ -30,12 +30,15 @@ Profile &Profile::operator=( const Profile& prof ) {
30 m_conf = prof.m_conf; 30 m_conf = prof.m_conf;
31 31
32 return *this; 32 return *this;
33} 33}
34Profile::~Profile() { 34Profile::~Profile() {
35} 35}
36QMap<QString, QString> Profile::conf()const {
37 return m_conf;
38}
36QString Profile::name()const { 39QString Profile::name()const {
37 return m_name; 40 return m_name;
38} 41}
39QString Profile::ioLayerName()const { 42QString Profile::ioLayerName()const {
40 return m_ioLayer; 43 return m_ioLayer;
41} 44}
@@ -101,6 +104,9 @@ int Profile::readNumEntry( const QString& key, int def )const {
101 } 104 }
102 return def; 105 return def;
103} 106}
104bool Profile::readBoolEntry( const QString& key, bool def )const { 107bool Profile::readBoolEntry( const QString& key, bool def )const {
105 return readNumEntry( key, def ); 108 return readNumEntry( key, def );
106} 109}
110void Profile::setConf( const QMap<QString, QString>& conf ) {
111 m_conf = conf;
112};
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index eff2be1..9956bdb 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -37,13 +37,13 @@ public:
37 int background()const; 37 int background()const;
38 int terminal()const; 38 int terminal()const;
39 39
40 /* 40 /*
41 * config stuff 41 * config stuff
42 */ 42 */
43 QMap<QString, QString> conf(); 43 QMap<QString, QString> conf()const;
44 void clearConf(); 44 void clearConf();
45 void writeEntry( const QString& key, const QString& value ); 45 void writeEntry( const QString& key, const QString& value );
46 void writeEntry( const QString& key, int num ); 46 void writeEntry( const QString& key, int num );
47 void writeEntry( const QString& key, bool b ); 47 void writeEntry( const QString& key, bool b );
48 void writeEntry( const QString& key, const QStringList&, const QChar& ); 48 void writeEntry( const QString& key, const QStringList&, const QChar& );
49 QString readEntry( const QString& key, const QString& deflt = QString::null)const; 49 QString readEntry( const QString& key, const QString& deflt = QString::null)const;
@@ -52,12 +52,13 @@ public:
52 52
53 void setName( const QString& ); 53 void setName( const QString& );
54 void setIOLayer( const QString& ); 54 void setIOLayer( const QString& );
55 void setBackground( int back ); 55 void setBackground( int back );
56 void setForeground( int fore ); 56 void setForeground( int fore );
57 void setTerminal( int term ); 57 void setTerminal( int term );
58 void setConf( const QMap<QString, QString>& );
58private: 59private:
59 QMap<QString, QString> m_conf; 60 QMap<QString, QString> m_conf;
60 QString m_name; 61 QString m_name;
61 QString m_ioLayer; 62 QString m_ioLayer;
62 int m_back; 63 int m_back;
63 int m_fore; 64 int m_fore;
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp
index 54b184d..c8a4db5 100644
--- a/noncore/apps/opie-console/profilemanager.cpp
+++ b/noncore/apps/opie-console/profilemanager.cpp
@@ -19,24 +19,23 @@ void ProfileManager::load() {
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 /*
26 * QAsciiDict Parsing FIXME
27 */
28 for ( it = groups.begin(); it != groups.end(); ++it ) { 25 for ( it = groups.begin(); it != groups.end(); ++it ) {
29 conf.setGroup( (*it) ); 26 conf.setGroup( (*it) );
30 Profile prof; 27 Profile prof;
31 prof.setName( conf.readEntry("name") ); 28 prof.setName( conf.readEntry("name") );
32 prof.setIOLayer( conf.readEntry("iolayer") ); 29 prof.setIOLayer( conf.readEntry("iolayer") );
33 prof.setBackground( conf.readNumEntry("back") ); 30 prof.setBackground( conf.readNumEntry("back") );
34 prof.setForeground( conf.readNumEntry("fore") ); 31 prof.setForeground( conf.readNumEntry("fore") );
35 prof.setTerminal( conf.readNumEntry("terminal") ); 32 prof.setTerminal( conf.readNumEntry("terminal") );
33 prof.setConf( conf.items( (*it) ) );
36 34
35 /* now add it */
37 m_list.append( prof ); 36 m_list.append( prof );
38 } 37 }
39 38
40} 39}
41void ProfileManager::clear() { 40void ProfileManager::clear() {
42 m_list.clear(); 41 m_list.clear();
@@ -49,17 +48,31 @@ Session* ProfileManager::fromProfile( const Profile& prof) {
49 session->setName( prof.name() ); 48 session->setName( prof.name() );
50 session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(), 49 session->setIOLayer(m_fact->newIOLayer(prof.ioLayerName(),
51 prof) ); 50 prof) );
52 /* 51 /*
53 * FIXME 52 * FIXME
54 * load emulation 53 * load emulation
55 * load widget 54 * load widget?
56 * set colors + fonts 55 * set colors + fonts
57 */ 56 */
58 return session; 57 return session;
59} 58}
60void ProfileManager::save( ) { 59void ProfileManager::save( ) {
61 ProfileConfig conf("opie-console-profiles"); 60 ProfileConfig conf("opie-console-profiles");
62 conf.clearAll(); 61 conf.clearAll();
63 Session* se= 0l; 62 Profile::ValueList::Iterator it;
63 for (it = m_list.begin(); it != m_list.end(); ++it ) {
64 conf.setGroup( (*it).name() );
65 conf.writeEntry( "name", (*it).name() );
66 conf.writeEntry( "ioplayer", (*it).ioLayerName() );
67 conf.writeEntry( "back", (*it).background() );
68 conf.writeEntry( "fore", (*it).foreground() );
69 conf.writeEntry( "terminal", (*it).terminal() );
70 /* now the config stuff */
71 QMap<QString, QString> map = (*it).conf();
72 QMap<QString, QString>::Iterator it;
73 for ( it = map.begin(); it != map.end(); ++it ) {
74 conf.writeEntry( it.key(), it.data() );
75 }
76 }
64 // FIXME save 77 // FIXME save
65} 78}