MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / setUser

Method setUser

src/WizLoginDialog.cpp:275–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275void WizLoginDialog::setUser(const QString &strUserGuid)
276{
277 m_newRegisterAccount = false;
278
279 if (strUserGuid.isEmpty())
280 return;
281
282 QString strAccountFolder;
283 QString strUserId;
284 for (WizLocalUser user : m_userList)
285 {
286 if (user.strGuid == strUserGuid)
287 {
288 strAccountFolder = user.strDataFolderName;
289 strUserId = user.strUserId;
290 break;
291 }
292 }
293
294 if (strAccountFolder.isEmpty())
295 {
296 qWarning() << "can not found user guid in local users : " << strUserGuid;
297 return;
298 }
299
300 WizUserSettings userSettings(strAccountFolder);
301 QString strPassword = userSettings.password();
302 QString strUserName = userSettings.get("ACCOUNT", "USERNAME");
303 strUserName = strUserName.isEmpty() ? strUserId : strUserName;
304
305 m_loginUserGuid = strUserGuid;
306 m_lineEditUserName->setText(strUserName);
307 if (strPassword.isEmpty())
308 {
309 m_lineEditPassword->clear();
310 ui->cbx_remberPassword->setCheckState(Qt::Unchecked);
311 }
312 else
313 {
314 m_lineEditPassword->setText(strPassword);
315 ui->cbx_remberPassword->setCheckState(Qt::Checked);
316 }
317
318 //
319 m_currentUserServerType = userSettings.serverType();
320 qDebug() << "set user , user type : " << m_currentUserServerType;
321 if (m_currentUserServerType == EnterpriseServer)
322 {
323 m_lineEditServer->setText(userSettings.enterpriseServerIP());
324 WizCommonApiEntry::setEnterpriseServerIP(userSettings.enterpriseServerIP());
325 // update oem settings
326 downloadOEMSettingsFromWizBox();
327 }
328 else if ((m_currentUserServerType == NoServer && !userSettings.myWizMail().isEmpty()) ||
329 m_currentUserServerType == WizServer)
330 {
331 m_currentUserServerType = WizServer;
332 WizCommonApiEntry::setEnterpriseServerIP(WIZNOTE_API_SERVER);

Callers 2

setApplicationProxyMethod · 0.80
mainCoreFunction · 0.80

Calls 8

isEmptyMethod · 0.80
enterpriseServerIPMethod · 0.80
myWizMailMethod · 0.80
passwordMethod · 0.45
getMethod · 0.45
setTextMethod · 0.45
clearMethod · 0.45
serverTypeMethod · 0.45

Tested by

no test coverage detected