void copySettingsToUserProfileDirectory(){ /* Since version 2.9.2 the settings database, query list and logs, and ctcp settings */ /* are located in the user's profile directory instead of TWS installation directory. */ /* This function is a compatibility layer: if the mentioned files are found in the */ /* previous location, they get moved to the new location: user's profile directory. */ QDir userProfile(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); QDir oldLocation(QApplication::applicationDirPath()); /* making the path to the new location */ QDir().mkpath(userProfile.absolutePath()); /* key: old relative location, value: new relative location */ QMap<QString,QString> paths; paths.insert("snpini/settings.sqlite3","settings.sqlite3"); paths.insert("snpini/ctcp.ini","ctcp.ini"); paths.insert("query/log2","log2"); paths.insert("query/querylist","querylist"); /* moving each file from the old location to the new one */ for(QMapIterator<QString,QString> it(paths);it.hasNext();){ it.next(); /* checking if a file exists in the previous location */ if(QFile::exists(oldLocation.absoluteFilePath(it.key()))) /* if the file doesn't exist in the new location already, */ if(!QFile::exists(userProfile.absoluteFilePath(it.value()))) /* moving it */ /* well, actually *copying* it, because we most likely do not have the */ /* write rights in the old location (that's why all this thing is) */ QFile::copy(oldLocation.absoluteFilePath(it.key()),userProfile.absoluteFilePath(it.value())); } }
void CLoginDlg::OnBnClickedOk() { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. CComm func; //환경파일 저장되는지 확인. CString plainTxt; m_cID.GetWindowText(m_strID); m_cPwd.GetWindowText(plainTxt); #ifdef _HTTPS CryptoPP::MD5 hash; byte digest[CryptoPP::MD5::DIGESTSIZE]; std::string message = func.Convert2string(plainTxt); hash.CalculateDigest(digest, (byte*)message.c_str(), message.length()); CryptoPP::HexEncoder encoder; std::string output; encoder.Attach(new CryptoPP::StringSink(output)); encoder.Put(digest, sizeof(digest)); encoder.MessageEnd(); //std::cout << output << std::endl; m_strPWD = output.c_str(); m_strPWD.MakeLower(); //OutputDebugString(m_strPWD); #else m_strPWD = plainTxt; #endif CString strFormData = L""; strFormData.Format(_T("email=%s&password=%s"), m_strID, m_strPWD); //로그인 DWORD dwRtn = login(SRV_URL, LGN_API, strFormData); if (dwRtn == HTTP_STATUS_FORBIDDEN){ MessageBox(L"ID or Password Error!"); m_cID.SetWindowText(L""); m_cPwd.SetWindowText(L""); m_cID.SetFocus(); return; }else if (dwRtn == HTTP_STATUS_DENIED){ //토큰 Expire AfxMessageBox(L"Token Expire or Not found!"); return; } else if (dwRtn != HTTP_STATUS_OK){ MessageBox(L"Login Fail"); m_cID.SetWindowText(L""); m_cPwd.SetWindowText(L""); m_cID.SetFocus(); return; } //사용자 프로파일 취득. // 성공일 경우 사용자 프로파일 취득. dwRtn = userProfile(SRV_URL, PROFILE); if (dwRtn != HTTP_STATUS_OK){ AfxMessageBox(L"Get User Profile Fail"); return; } CDialogEx::OnOK(); }
void QgsUserProfileManager::setDefaultFromActive() { setDefaultProfileName( userProfile()->name() ); }