syncsettingsadvanced.cpp
来自「funambol window mobile客户端源代码」· C++ 代码 · 共 763 行 · 第 1/2 页
CPP
763 行
cs->setConfigSourcesParameter("briefcase","encryption","des");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("note","encryption"),"des") != 0){
cs->setConfigSourcesParameter("note","encryption","des");
dirtyFlag = TRUE;
}
} else {
if(strcmp(cs->getConfigSourcesParameter("mail","encryption"),"0") != 0){
cs->setConfigSourcesParameter("mail","encryption","0");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("calendar","encryption"),"0") != 0){
cs->setConfigSourcesParameter("calendar","encryption","0");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("contact","encryption"),"0") != 0){
cs->setConfigSourcesParameter("contact","encryption","0");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("task","encryption"),"0") != 0){
cs->setConfigSourcesParameter("task","encryption","0");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("briefcase","encryption"),"0") != 0){
cs->setConfigSourcesParameter("briefcase","encryption","0");
dirtyFlag = TRUE;
}
if(strcmp(cs->getConfigSourcesParameter("note","encryption"),"0") != 0){
cs->setConfigSourcesParameter("note","encryption","0");
dirtyFlag = TRUE;
}
}
CString s1,s2;
GetDlgItemText(IDC_EDIT_MAIL, s1);
s2 = cs->getWinSyncSourceConfig("mail")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("mail")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
GetDlgItemText(IDC_EDIT_CONTACT, s1);
s2 = cs->getWinSyncSourceConfig("contact")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("contact")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
GetDlgItemText(IDC_EDIT_CALENDAR, s1);
s2 = cs->getWinSyncSourceConfig("calendar")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("calendar")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
GetDlgItemText(IDC_EDIT_TASK, s1);
s2 = cs->getWinSyncSourceConfig("task")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("task")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
// if(!(cs->getIsPortal())){
if (showNoteSource) {
#if defined(WIN32_PLATFORM_PSPC)
GetDlgItemText(IDC_EDIT_NOTE, s1);
s2 = cs->getWinSyncSourceConfig("note")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("note")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
#endif
}
if (showBriefcaseSource) {
GetDlgItemText(IDC_EDIT_BRIEFCASE, s1);
s2 = cs->getWinSyncSourceConfig("briefcase")->getURI();
if(!(s1==s2)){
wstring s((LPCTSTR)s1);
char* tmp = toMultibyte(s.c_str());
cs->getWinSyncSourceConfig("briefcase")->setURI(tmp);
dirtyFlag = TRUE;
if (tmp){
delete [] tmp;
tmp = NULL;
}
}
}
if(radioContactSIF.GetCheck() == BST_CHECKED){
cs->getWinSyncSourceConfig("contact")->setUseSif("1");
dirtyFlag = TRUE;
}else{
cs->getWinSyncSourceConfig("contact")->setUseSif("0");
dirtyFlag = TRUE;
}
if(radioCalendarSIF.GetCheck() == BST_CHECKED){
cs->getWinSyncSourceConfig("calendar")->setUseSif("1");
dirtyFlag = TRUE;
}else{
cs->getWinSyncSourceConfig("calendar")->setUseSif("0");
dirtyFlag = TRUE;
}
if(radioTaskSIF.GetCheck() == BST_CHECKED){
cs->getWinSyncSourceConfig("task")->setUseSif("1");
dirtyFlag = TRUE;
}else{
cs->getWinSyncSourceConfig("task")->setUseSif("0");
dirtyFlag = TRUE;
}
#if defined(WIN32_PLATFORM_PSPC)
if(radioNoteSIF.GetCheck() == BST_CHECKED){
cs->getWinSyncSourceConfig("note")->setUseSif("1");
dirtyFlag = TRUE;
}else{
cs->getWinSyncSourceConfig("note")->setUseSif("0");
dirtyFlag = TRUE;
}
#endif
// Read current selections and initial selections
if(dirtyFlag){
getRegConfig()->setDirty(CS_DIRTY_SOURCE_ALL);
getRegConfig()->setDirty(CS_DIRTY_ROOT_CONFIG);
getRegConfig()->saveDirty();
}
CDialog::OnOK();
}
// CSyncSettingsAdvanced message handlers
HBRUSH CSyncSettingsAdvanced::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) {
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// set ppc header text color
#if defined(WIN32_PLATFORM_PSPC)
if(pWnd->GetDlgCtrlID() == IDC_HEADER_STATIC) {
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(PPC_HEADER_TEXT_COLOR);
}
#endif
return hbr;
}
/**
* Called when vertical scrollbar is touched.
* Manages the window scrolling.
*/
void CSyncSettingsAdvanced::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int nDelta;
int nMaxPos = dlgMaxHeight - dlgCurrentHeight;
// Calculate the offset to scroll (nDelta)
switch (nSBCode)
{
case SB_LINEDOWN:
if (scrollbarPosition >= nMaxPos)
return;
nDelta = 2;
break;
case SB_LINEUP:
if (scrollbarPosition <= 0)
return;
nDelta = -2;
break;
case SB_THUMBPOSITION:
nDelta = (int)nPos - scrollbarPosition;
break;
case SB_PAGEDOWN:
if (scrollbarPosition >= nMaxPos)
return;
nDelta = min(nMaxPos/10, nMaxPos - scrollbarPosition);
break;
case SB_PAGEUP:
if (scrollbarPosition <= 0) {
return;
}
nDelta = -min(nMaxPos/10, scrollbarPosition);
break;
case SB_THUMBTRACK:
if (LOBYTE(nSBCode) == SB_THUMBTRACK) {
nDelta = nPos - scrollbarPosition;
}
break;
default:
// Don't handle other commands...
return;
}
// Move the scrollbar
scrollbarPosition += nDelta;
SetScrollPos(SB_VERT, scrollbarPosition, TRUE);
// Scroll the dialog window
ScrollWindowEx(0, -nDelta, NULL, &dlgRect, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE);
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
/**
* Called when window size changes. We have to redefine the scrollbar
* parameters.
*/
void CSyncSettingsAdvanced::OnSize(UINT nType, int cx, int cy)
{
#if defined(WIN32_PLATFORM_WFSP)
::SendMessage(GetSafeHwnd(), DM_RESETSCROLL, TRUE, TRUE);
#endif
CDialog::OnSize(nType, cx, cy);
dlgCurrentHeight = cy;
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_PAGE; // Set only the new nPage = cy
si.nPage = cy;
si.nPos = 0;
SetScrollInfo(SB_VERT, &si, TRUE);
}
#ifdef WIN32_PLATFORM_WFSP
LRESULT CSyncSettingsAdvanced::OnHotkey(WPARAM wParam, LPARAM lParam)
{
if (HIWORD(lParam) == VK_TBACK)
SHSendBackToFocusWindow(WM_HOTKEY, wParam, lParam);
return 0;
}
#endif
#if defined(WIN32_PLATFORM_PSPC)
void CSyncSettingsAdvanced::setScrollOnFocus(int objectIDC){
CRect dRect;
CRect textRect;
GetWindowRect(&dRect);
GetDlgItem(objectIDC)->GetWindowRect(&textRect);
int delta = textRect.bottom - (dRect.Height() / 2);
int oldScrollbarPosition = scrollbarPosition;
scrollbarPosition += delta;
if (scrollbarPosition<0){
scrollbarPosition = 0;
}
if (scrollbarPosition > dlgMaxHeight - dRect.Height()){
scrollbarPosition = dlgMaxHeight - dRect.Height();
}
delta = scrollbarPosition - oldScrollbarPosition;
// Move the scrollbar
SetScrollPos(SB_VERT, scrollbarPosition, TRUE);
// Scroll the dialog window
ScrollWindowEx(0, -delta, NULL, &dRect, NULL, NULL, SW_SCROLLCHILDREN | SW_INVALIDATE);
}
void CSyncSettingsAdvanced::OnBnSetfocusEncryption()
{
setScrollOnFocus(IDC_ENCRYPTION);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditMail()
{
setScrollOnFocus(IDC_EDIT_MAIL);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditContact()
{
setScrollOnFocus(IDC_EDIT_CONTACT);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditCalendar()
{
setScrollOnFocus(IDC_EDIT_CALENDAR);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditTask()
{
setScrollOnFocus(IDC_EDIT_TASK);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditNote()
{
setScrollOnFocus(IDC_EDIT_NOTE);
}
void CSyncSettingsAdvanced::OnEnSetfocusEditBriefcase()
{
setScrollOnFocus(IDC_EDIT_BRIEFCASE);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioContactSif()
{
setScrollOnFocus(IDC_RADIO_CONTACT_SIF);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioContactVcard()
{
setScrollOnFocus(IDC_RADIO_CONTACT_VCARD);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioCalendarSif()
{
setScrollOnFocus(IDC_RADIO_CALENDAR_SIF);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioCalendarVcard()
{
setScrollOnFocus(IDC_RADIO_CALENDAR_VCARD);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioTaskSif()
{
setScrollOnFocus(IDC_RADIO_TASK_SIF);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioTaskVcard()
{
setScrollOnFocus(IDC_RADIO_TASK_VCARD);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioNoteSif()
{
setScrollOnFocus(IDC_RADIO_NOTE_SIF);
}
void CSyncSettingsAdvanced::OnBnSetfocusRadioNoteVcard()
{
setScrollOnFocus(IDC_RADIO_NOTE_VCARD);
}
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?