Commit 426e82b3 authored by Michael Reeves's avatar Michael Reeves

Use the same separator everywhere in our code.

Seriously how did this ever work.
*Scrat unneeded KReplacement check.
parent 77c8fc5b
......@@ -209,8 +209,8 @@ void ValueMap::writeEntry( const QString& k, const char* v ) {
m_map[k] = v;
}
void ValueMap::writeEntry( const QString& k, const QStringList& v, char separator ) {
m_map[k] = safeStringJoin( v, separator );
void ValueMap::writeEntry( const QString& k, const QStringList& v ) {
m_map[k] = safeStringJoin( v );
}
......@@ -293,12 +293,12 @@ QString ValueMap::readStringEntry( const QString& k, const QString& sDefault ) {
return sval;
}
QStringList ValueMap::readListEntry( const QString& k, const QStringList& defaultVal, char separator ) {
QStringList ValueMap::readListEntry( const QString& k, const QStringList& defaultVal ) {
QStringList strList;
std::map<QString, QString>::iterator i = m_map.find( k );
if( i != m_map.end() ) {
strList = safeStringSplit( i->second, separator );
strList = safeStringSplit( i->seconds );
return strList;
}
else
......@@ -329,6 +329,6 @@ bool ValueMap::readEntry( const QString& s, bool bDefault ) {
int ValueMap::readEntry( const QString& s, int iDefault ) {
return readNumEntry( s, iDefault );
}
QStringList ValueMap::readEntry( const QString& s, const QStringList& defaultVal, char separator ) {
return readListEntry( s, defaultVal, separator );
QStringList ValueMap::readEntry( const QString& s, const QStringList& defaultVal ) {
return readListEntry( s, defaultVal );
}
......@@ -94,7 +94,7 @@ public:
virtual void writeEntry(const QString&, const QPoint& );
virtual void writeEntry(const QString&, int );
virtual void writeEntry(const QString&, bool );
virtual void writeEntry(const QString&, const QStringList&, char separator='|' );
virtual void writeEntry(const QString&, const QStringList& );
virtual void writeEntry(const QString&, const QString& );
virtual void writeEntry(const QString&, const char* );
......@@ -104,7 +104,7 @@ public:
virtual QPoint readPointEntry(const QString&, const QPoint* defaultVal );
virtual bool readBoolEntry (const QString&, bool bDefault );
virtual int readNumEntry (const QString&, int iDefault );
virtual QStringList readListEntry (const QString&, const QStringList& defaultVal, char separator='|' );
virtual QStringList readListEntry (const QString&, const QStringList& defaultVal );
virtual QString readStringEntry(const QString&, const QString& );
QString readEntry (const QString& s, const QString& defaultVal );
......@@ -115,10 +115,10 @@ public:
QPoint readEntry(const QString& s, const QPoint defaultVal );
bool readEntry (const QString& s, bool bDefault );
int readEntry (const QString& s, int iDefault );
QStringList readEntry (const QString& s, const QStringList& defaultVal, char separator='|' );
QStringList readEntry (const QString& s, const QStringList& defaultVal);
};
QStringList safeStringSplit(const QString& s, char sepChar=',', char metaChar='\\' );
QString safeStringJoin(const QStringList& sl, char sepChar=',', char metaChar='\\' );
QStringList safeStringSplit(const QString& s, char sepChar=';', char metaChar='\\' );
QString safeStringJoin(const QStringList& sl, char sepChar=';', char metaChar='\\' );
#endif
......@@ -58,7 +58,7 @@ void initialiseCmdLineArgs( ) {
}
}
}
//support our own old preferances this is obsolete
QStringList sl = ignorableOptionsLine.split( ',' );
if( !sl.isEmpty() ) {
......
......@@ -50,7 +50,7 @@
#include "optiondialog.h"
#include "diff.h"
#include "smalldialogs.h"
//FIXME: Verifiy which includes are needed only for kde and why.
#ifndef KREPLACEMENTS_H
#include <KConfigGroup>
#include <QDialogButtonBox>
......@@ -206,7 +206,7 @@ template <class T> void writeEntry( ValueMap* vm, const QString& saveName, const
vm->writeEntry( saveName, v );
}
static void writeEntry( ValueMap* vm, const QString& saveName, const QStringList& v ) {
vm->writeEntry( saveName, v, '|' );
vm->writeEntry( saveName, v);
}
//static void readEntry(ValueMap* vm, const QString& saveName, bool& v ) { v = vm->readBoolEntry( saveName, v ); }
......@@ -298,10 +298,10 @@ class OptionLineEdit : public QComboBox, public OptionItemT<QString> {
insertText();
}
void write( ValueMap* config ) {
config->writeEntry( m_saveName, m_list, '|' );
config->writeEntry( m_saveName, m_list );
}
void read( ValueMap* config ) {
m_list = config->readListEntry( m_saveName, QStringList( m_defaultVal ), '|' );
m_list = config->readListEntry( m_saveName, QStringList( m_defaultVal ) );
if( !m_list.empty() ) *m_pVar = m_list.front();
clear();
insertItems( 0, m_list );
......@@ -1863,21 +1863,13 @@ class ConfigValueMap : public ValueMap {
QString readStringEntry( const QString& s, const QString& defaultVal ) {
return m_config.readEntry( s, defaultVal );
}
#ifdef KREPLACEMENTS_H
void writeEntry( const QString& s, const QStringList& v, char separator ) {
m_config.writeEntry( s, v, separator );
}
QStringList readListEntry( const QString& s, const QStringList& def, char separator ) {
return m_config.readEntry( s, def , separator );
}
#else
void writeEntry( const QString& s, const QStringList& v, char /*separator*/ ) {
void writeEntry( const QString& s, const QStringList& v ) {
m_config.writeEntry( s, v );
}
QStringList readListEntry( const QString& s, const QStringList& def, char /*separator*/ ) {
QStringList readListEntry( const QString& s, const QStringList& def) {
return m_config.readEntry( s, def );
}
#endif
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment