22 #include "customproperties.h"
33 : mProperties(cp.mProperties)
37 CustomProperties::~CustomProperties()
43 if ( mProperties.count() != other.mProperties.count() )
return false;
44 TQMap<TQCString, TQString>::ConstIterator it;
45 for( it = mProperties.begin(); it != mProperties.end(); ++it ) {
46 TQMap<TQCString, TQString>::ConstIterator itOther =
47 other.mProperties.find( it.key() );
49 if ( itOther == other.mProperties.end() ) {
52 if ( itOther.data() != it.data() )
return false;
59 const TQString &value)
61 if (value.isNull() || key.isEmpty() || app.isEmpty())
63 TQCString
property =
"X-KDE-" + app +
"-" + key;
64 if (!checkName(property))
66 mProperties[property] = value;
82 if (value.isNull() || !checkName(name))
84 mProperties[name] = value;
90 TQMap<TQCString, TQString>::Iterator it = mProperties.find(name);
91 if (it != mProperties.end()) {
92 mProperties.remove(it);
99 TQMap<TQCString, TQString>::ConstIterator it = mProperties.find(name);
100 if (it == mProperties.end())
107 bool changed =
false;
108 for (TQMap<TQCString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it) {
110 if (checkName(it.key())) {
111 mProperties[it.key()] = it.data().isNull() ? TQString(
"") : it.data();
124 bool CustomProperties::checkName(
const TQCString &name)
128 const char* n = name;
129 int len = name.length();
130 if (len < 2 || n[0] !=
'X' || n[1] !=
'-')
132 for (
int i = 2; i < len; ++i) {
134 if (ch >=
'A' && ch <=
'Z'
135 || ch >=
'a' && ch <=
'z'
136 || ch >=
'0' && ch <=
'9'