qtmobility/src/publishsubscribe/contextkitlayer.cpp
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
   127 }
   127 }
   128 
   128 
   129 ContextKitHandle::ContextKitHandle (ContextKitHandle *parent, const QString &path)
   129 ContextKitHandle::ContextKitHandle (ContextKitHandle *parent, const QString &path)
   130 {
   130 {
   131     QString key = path;
   131     QString key = path;
   132     if (key.startsWith("/"))
   132     if (key.startsWith(QLatin1Char('/')))
   133         key = key.mid(1);
   133         key = key.mid(1);
   134     key = key.replace('/', '.');
   134     key = key.replace(QLatin1Char('/'), QLatin1Char('.'));
   135     if (parent)
   135     if (parent)
   136         key = parent->prefix + key;
   136         key = parent->prefix + key;
   137 
   137 
   138     prefix = (key == "")? "" : key + ".";
   138     if (!key.isEmpty())
       
   139         prefix = key + QLatin1Char('.');
       
   140 
   139     foreach (const QString &k, ContextRegistryInfo::instance()->listKeys())
   141     foreach (const QString &k, ContextRegistryInfo::instance()->listKeys())
   140     {
   142     {
   141         if (k == key)
   143         if (k == key)
   142             insert ("", k);
   144             insert(QString(), k);
   143         else if (k.startsWith (prefix))
   145         else if (k.startsWith(prefix))
   144             insert (k.mid(prefix.length()).replace ('.', '/'), k);
   146             insert(k.mid(prefix.length()).replace (QLatin1Char('.'), QLatin1Char('/')), k);
   145     }
   147     }
   146 }
   148 }
   147 
   149 
   148 ContextKitHandle::~ContextKitHandle ()
   150 ContextKitHandle::~ContextKitHandle ()
   149 {
   151 {