| 136 | } |
| 137 | |
| 138 | void RedisConfigUI::DoApplyData() |
| 139 | { |
| 140 | CEditUI exampleEditUI; |
| 141 | CComboUI exampleComboUI; |
| 142 | |
| 143 | RedisClient::TDicConfig::const_iterator it = m_dicConfig.begin(); |
| 144 | RedisClient::TDicConfig::const_iterator itend = m_dicConfig.end(); |
| 145 | RedisClient::TDicConfig config; |
| 146 | for ( ; it!=itend; ++it) |
| 147 | { |
| 148 | CDuiString name = _T("redisconfig_"); |
| 149 | CDuiString key = Base::CharacterSet::ANSIToUnicode(it->first).c_str(); |
| 150 | name.Append(key); |
| 151 | CControlUI* pCtl = GetPaintMgr()->FindControl(name); |
| 152 | if (pCtl == NULL) continue; |
| 153 | string val ; |
| 154 | if (pCtl->GetClass() == exampleEditUI.GetClass()) |
| 155 | { |
| 156 | CEditUI* pEdit = static_cast<CEditUI*> (pCtl); |
| 157 | val = Base::CharacterSet::UnicodeToANSI(pEdit->GetText().GetData()); |
| 158 | } |
| 159 | else if (pCtl->GetClass() == exampleComboUI.GetClass()) |
| 160 | { |
| 161 | CComboUI* pCombo = static_cast<CComboUI*> (pCtl); |
| 162 | int idx = pCombo->GetCurSel(); |
| 163 | if (it->first == "loglevel") |
| 164 | { |
| 165 | if (idx == 0) val = "debug"; |
| 166 | else if (idx == 1) val = "verbose"; |
| 167 | else if (idx == 2) val = "notice"; |
| 168 | else if (idx == 3) val = "warning"; |
| 169 | } |
| 170 | else |
| 171 | { |
| 172 | if (idx == 0) val = "yes"; |
| 173 | else if (idx == 1) val = "no"; |
| 174 | } |
| 175 | } |
| 176 | if (val != it->second) |
| 177 | { |
| 178 | config.insert(std::make_pair(it->first, val)); |
| 179 | } |
| 180 | } |
| 181 | if (SetConfig(config) && GetConfig()) |
| 182 | { |
| 183 | DoFillData(); |
| 184 | } |
| 185 | } |