syncsettings.cpp
来自「funambol window mobile客户端源代码」· C++ 代码 · 共 1,160 行 · 第 1/3 页
CPP
1,160 行
HBRUSH CSyncSettings::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;
}
void CSyncSettings::OnSetfocusSyncContacts()
{
if(checkContacts.GetCheck() == BST_CHECKED) {
source=TEXT("contacts");
}
}
void CSyncSettings::OnBnClickedSyncContacts()
{
if(checkContacts.GetCheck() == BST_CHECKED) {
source=TEXT("contacts");
}
bool flag = true;
if (checkContacts.GetCheck() == BST_UNCHECKED &&
checkCalendar.GetCheck() == BST_UNCHECKED &&
checkTasks.GetCheck() == BST_UNCHECKED ) {
flag = false;
}
if (showBriefcaseSource) {
// if (!getRegConfig()->getIsPortal()){
if(checkBriefcase.GetCheck() == BST_CHECKED){
flag = true;
}
}
if (showNoteSource) {
#if defined(WIN32_PLATFORM_PSPC)
if(checkNotes.GetCheck() == BST_CHECKED){
flag = true;
}
#endif
}
butPimOptions.EnableWindow(flag);
}
void CSyncSettings::OnBnSetfocusSyncCalendar()
{
if(checkCalendar.GetCheck() == BST_CHECKED) {
source=TEXT("calendar");
}
}
void CSyncSettings::OnBnSetfocusSyncTasks()
{
if(checkTasks.GetCheck() == BST_CHECKED) {
source=TEXT("tasks");
}
}
void CSyncSettings::OnBnSetfocusSyncMail()
{
if(checkMail.GetCheck() == BST_CHECKED) {
source=TEXT("mail");
}
}
void CSyncSettings::OnBnSetfocusSyncBriefcase()
{
if(checkBriefcase.GetCheck() == BST_CHECKED) {
source=TEXT("briefcase");
}
}
void CSyncSettings::OnBnClickedSyncCalendar()
{
if(checkCalendar.GetCheck() == BST_CHECKED) {
source=TEXT("calendar");
}
bool flag = true;
if (checkContacts.GetCheck() == BST_UNCHECKED &&
checkCalendar.GetCheck() == BST_UNCHECKED &&
checkTasks.GetCheck() == BST_UNCHECKED ) {
flag = false;
}
if (showBriefcaseSource) {
//if (!getRegConfig()->getIsPortal()){
if(checkBriefcase.GetCheck() == BST_CHECKED){
flag = true;
}
}
if (showNoteSource) {
#if defined(WIN32_PLATFORM_PSPC)
if(checkNotes.GetCheck() == BST_CHECKED){
flag = true;
}
#endif
}
butPimOptions.EnableWindow(flag);
}
void CSyncSettings::OnBnClickedSyncTasks()
{
if(checkTasks.GetCheck() == BST_CHECKED) {
source=TEXT("tasks");
}
bool flag = true;
if (checkContacts.GetCheck() == BST_UNCHECKED &&
checkCalendar.GetCheck() == BST_UNCHECKED &&
checkTasks.GetCheck() == BST_UNCHECKED ) {
flag = false;
}
if (showBriefcaseSource) {
//if (!getRegConfig()->getIsPortal()){
if(checkBriefcase.GetCheck() == BST_CHECKED){
flag = true;
}
}
if (showNoteSource) {
#if defined(WIN32_PLATFORM_PSPC)
if(checkNotes.GetCheck() == BST_CHECKED){
flag = true;
}
#endif
}
butPimOptions.EnableWindow(flag);
}
void CSyncSettings::OnBnClickedSyncMail()
{
if(checkMail.GetCheck() == BST_UNCHECKED)
butMail.EnableWindow(FALSE);
else
butMail.EnableWindow(TRUE);
if(checkMail.GetCheck() == BST_CHECKED) {
source=TEXT("mail");
}
}
void CSyncSettings::OnBnClickedSyncBriefcase()
{
// if(checkBriefcase.GetCheck() == BST_UNCHECKED)
// butBriefcase.EnableWindow(FALSE);
// else
// butBriefcase.EnableWindow(TRUE);
if(checkBriefcase.GetCheck() == BST_CHECKED) {
source=TEXT("briefcase");
}
bool flag = true;
if (checkContacts.GetCheck() == BST_UNCHECKED &&
checkCalendar.GetCheck() == BST_UNCHECKED &&
checkTasks.GetCheck() == BST_UNCHECKED ) {
flag = false;
}
if (showBriefcaseSource) {
// if (!getRegConfig()->getIsPortal()){
if(checkBriefcase.GetCheck() == BST_CHECKED){
flag = true;
}
}
if (showNoteSource) {
#if defined(WIN32_PLATFORM_PSPC)
if(checkNotes.GetCheck() == BST_CHECKED){
flag = true;
}
#endif
}
butPimOptions.EnableWindow(flag);
}
void CSyncSettings::OnAdvanced(){
CSyncSettingsAdvanced wnd;
INT_PTR result = wnd.DoModal();
}
void CSyncSettings::showAdvanced()
{
if(source == "pim"){
CPIMSettings wndPimSettings;
INT_PTR result = wndPimSettings.DoModal();
if(result == IDOK) {
advanced |= ADVANCED_PIM;
}
butPimOptions.SetFocus();
}
if(source == "mail"){
CMailSettings wndSett;
INT_PTR result = wndSett.DoModal();
if(result == IDOK)
advanced |= ADVANCED_MAIL;
butMail.SetFocus();
}
if(source == "briefcase"){
CBriefcaseSettings wndSett;
INT_PTR result = wndSett.DoModal();
if(result == IDOK)
advanced |= ADVANCED_BRIEFCASE;
//butBriefcase.SetFocus();
}
#if defined(WIN32_PLATFORM_PSPC)
if(source == "note"){
CNotesSettings wndSett;
INT_PTR result = wndSett.DoModal();
if(result == IDOK)
advanced |= ADVANCED_NOTES;
// butNotes.SetFocus();
}
#endif
}
void CSyncSettings::OnOK(){
ClientSettings* cs = getRegConfig();
BOOL dirtyFlag=FALSE;
if(checkStartSync()){
CDialog::OnOK();
}
if( (checkContacts.GetCheck() == BST_UNCHECKED)){
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("contact","sync"),"none")!=0){
cs->setConfigSourcesParameter("contact", "sync","none");
dirtyFlag=TRUE;
}
}
else{
if( ( ~advanced | ADVANCED_CONTACTS) &&
(!strcmp(cs->getConfigSourcesParameter("contact", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("contact","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("contact", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
if( (checkCalendar.GetCheck() == BST_UNCHECKED))
{
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("calendar","sync"),"none")!=0){
cs->setConfigSourcesParameter("calendar", "sync","none");
dirtyFlag=TRUE;
}
}
else
{
if( (! (advanced & ADVANCED_CALENDAR)) &&
(!strcmp(cs->getConfigSourcesParameter("calendar", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("calendar","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("calendar", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
if((checkTasks.GetCheck() == BST_UNCHECKED))
{
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("task","sync"),"none")!=0){
cs->setConfigSourcesParameter("task", "sync","none");
dirtyFlag=TRUE;
}
}
else
{
if( (! (advanced & ADVANCED_TASKS)) &&
(!strcmp(cs->getConfigSourcesParameter("task", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("task","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("task", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
if( (checkMail.GetCheck() == BST_UNCHECKED || !doesFunambolAccountExist()))
{
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("mail","sync"),"none")!=0){
cs->setConfigSourcesParameter("mail", "sync","none");
dirtyFlag=TRUE;
}
}
else
{
// There's no (! (advanced & ADVANCED_MAIL)) condition in this if because
// in the mail advance settings there's no a sync type setting to set
if( (!strcmp(cs->getConfigSourcesParameter("mail", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("mail","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("mail", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
if( (checkBriefcase.GetCheck() == BST_UNCHECKED))
{
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("briefcase","sync"),"none")!=0){
cs->setConfigSourcesParameter("briefcase", "sync","none");
dirtyFlag=TRUE;
}
}
else
{
if( (! (advanced & ADVANCED_BRIEFCASE)) &&
(!strcmp(cs->getConfigSourcesParameter("briefcase", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("briefcase","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("briefcase", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
#if defined(WIN32_PLATFORM_PSPC)
if( (checkNotes.GetCheck() == BST_UNCHECKED))
{
// save 'none'
if(strcmp(cs->getConfigSourcesParameter("note","sync"),"none")!=0){
cs->setConfigSourcesParameter("note", "sync","none");
dirtyFlag=TRUE;
}
}
else
{
if( (! (advanced & ADVANCED_NOTES)) &&
(!strcmp(cs->getConfigSourcesParameter("note", "sync"),"none")) )
{
// save 'two-way'
if(strcmp(cs->getConfigSourcesParameter("note","sync"),"two-way")!=0){
cs->setConfigSourcesParameter("note", "sync","two-way");
dirtyFlag=TRUE;
}
}
}
#endif
//getRegConfig()->setDirty(CS_DIRTY_SOURCE_ALL);
if(dirtyFlag){
getRegConfig()->setDirty(CS_DIRTY_SOURCE_ENABLED);
getRegConfig()->saveDirty();
}
CDialog::OnOK();
}
#if defined(_DEVICE_RESOLUTION_AWARE)
void CSyncSettings::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/){
CString s1;
s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_SYNC_METHOD_ABB);
#if defined(WIN32_PLATFORM_PSPC)
int resId;
BOOL showScroll = FALSE;
if(s1.GetLength()>13){
paddingVal = 130;
}else{
paddingVal = 100;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?