summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console
Unidiff
Diffstat (limited to 'noncore/apps/opie-console') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profile.cpp47
-rw-r--r--noncore/apps/opie-console/profile.h1
2 files changed, 48 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp
index b730218..cdf595e 100644
--- a/noncore/apps/opie-console/profile.cpp
+++ b/noncore/apps/opie-console/profile.cpp
@@ -18,2 +18,7 @@ Profile::Profile( const Profile& prof )
18} 18}
19bool Profile::operator==( const Profile& prof ) {
20 if ( m_name == prof.m_name ) return true;
21
22 return false;
23}
19Profile &Profile::operator=( const Profile& prof ) { 24Profile &Profile::operator=( const Profile& prof ) {
@@ -24,2 +29,3 @@ Profile &Profile::operator=( const Profile& prof ) {
24 m_terminal = prof.m_terminal; 29 m_terminal = prof.m_terminal;
30 m_conf = prof.m_conf;
25 31
@@ -59 +65,42 @@ void Profile::setTerminal( int term ) {
59} 65}
66/* config stuff */
67void Profile::clearConf() {
68 m_conf.clear();
69}
70void Profile::writeEntry( const QString& key, const QString& value ) {
71 m_conf.replace( key, value );
72}
73void Profile::writeEntry( const QString& key, int num ) {
74 writeEntry( key, QString::number( num ) );
75}
76void Profile::writeEntry( const QString& key, bool b ) {
77 writeEntry( key, QString::number(b) );
78}
79void Profile::writeEntry( const QString& key, const QStringList& lis, const QChar& sep ) {
80 writeEntry( key, lis.join(sep) );
81}
82QString Profile::readEntry( const QString& key, const QString& deflt )const {
83 QMap<QString, QString>::ConstIterator it;
84 it = m_conf.find( key );
85
86 if ( it != m_conf.end() )
87 return it.data();
88
89 return deflt;
90}
91int Profile::readNumEntry( const QString& key, int def )const {
92 QMap<QString, QString>::ConstIterator it;
93 it = m_conf.find( key );
94
95 if ( it != m_conf.end() ) {
96 bool ok;
97 int val = it.data().toInt(&ok);
98
99 if (ok)
100 return val;
101 }
102 return def;
103}
104bool Profile::readBoolEntry( const QString& key, bool def )const {
105 return readNumEntry( key, def );
106}
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h
index 8adc0bd..eff2be1 100644
--- a/noncore/apps/opie-console/profile.h
+++ b/noncore/apps/opie-console/profile.h
@@ -30,2 +30,3 @@ public:
30 Profile &operator=( const Profile& ); 30 Profile &operator=( const Profile& );
31 bool operator==( const Profile& prof );
31 32