void HelpModeCB( Widget w, caddr_t client_data, caddr_t call_data ) { Widget widget; switch(DtHelpReturnSelectedWidgetId(style.shell, (Cursor)NULL, &widget)) { /* * There are additional cases (e.g. user aborts request) but I * don't feel they warrant an error dialog. */ case DtHELP_SELECT_VALID: while (!XtIsShell(widget)) { if (XtHasCallbacks(widget, XmNhelpCallback) == XtCallbackHasSome) { XtCallCallbacks(widget, XmNhelpCallback, (XtPointer)NULL); return; } widget = XtParent(widget); } break; case DtHELP_SELECT_INVALID: ErrDialog((char *)GETMESSAGE(2, 8, "You must select an item\nwithin the Style Manager."), style.shell); break; } }
void CBaseDialog::OnNotificationsOn() { HRESULT hRes = S_OK; if (m_lpBaseAdviseSink || !m_lpMapiObjects) return; LPMDB lpMDB = m_lpMapiObjects->GetMDB(); // do not release LPMAPISESSION lpMAPISession = m_lpMapiObjects->GetSession(); // do not release LPADRBOOK lpAB = m_lpMapiObjects->GetAddrBook(false); // do not release CEditor MyData( this, IDS_NOTIFICATIONS, IDS_NOTIFICATIONSPROMPT, 3, CEDITOR_BUTTON_OK | CEDITOR_BUTTON_CANCEL); MyData.SetPromptPostFix(AllFlagsToString(flagNotifEventType, true)); MyData.InitPane(0, CreateSingleLinePane(IDS_EID, NULL, false)); MyData.InitPane(1, CreateSingleLinePane(IDS_ULEVENTMASK, NULL, false)); MyData.SetHex(1, fnevNewMail); UINT uidDropDown[] = { IDS_DDMESSAGESTORE, IDS_DDSESSION, IDS_DDADDRESSBOOK }; MyData.InitPane(2, CreateDropDownPane(IDS_OBJECTFORADVISE, _countof(uidDropDown), uidDropDown, true)); WC_H(MyData.DisplayDialog()); if (S_OK == hRes) { if ((0 == MyData.GetDropDown(2) && !lpMDB) || (1 == MyData.GetDropDown(2) && !lpMAPISession) || (2 == MyData.GetDropDown(2) && !lpAB)) { ErrDialog(__FILE__, __LINE__, IDS_EDADVISE); return; } LPENTRYID lpEntryID = NULL; size_t cbBin = NULL; WC_H(MyData.GetEntryID(0, false, &cbBin, &lpEntryID)); // don't actually care if the returning lpEntryID is NULL - Advise can work with that m_lpBaseAdviseSink = new CAdviseSink(m_hWnd, NULL); if (m_lpBaseAdviseSink) { switch (MyData.GetDropDown(2)) { case 0: EC_MAPI(lpMDB->Advise( (ULONG)cbBin, lpEntryID, MyData.GetHex(1), (IMAPIAdviseSink *)m_lpBaseAdviseSink, &m_ulBaseAdviseConnection)); m_lpBaseAdviseSink->SetAdviseTarget(lpMDB); m_ulBaseAdviseObjectType = MAPI_STORE; break; case 1: EC_MAPI(lpMAPISession->Advise( (ULONG)cbBin, lpEntryID, MyData.GetHex(1), (IMAPIAdviseSink *)m_lpBaseAdviseSink, &m_ulBaseAdviseConnection)); m_ulBaseAdviseObjectType = MAPI_SESSION; break; case 2: EC_MAPI(lpAB->Advise( (ULONG)cbBin, lpEntryID, MyData.GetHex(1), (IMAPIAdviseSink *)m_lpBaseAdviseSink, &m_ulBaseAdviseConnection)); m_lpBaseAdviseSink->SetAdviseTarget(lpAB); m_ulBaseAdviseObjectType = MAPI_ADDRBOOK; break; } if (SUCCEEDED(hRes)) { if (0 == MyData.GetDropDown(2) && lpMDB) { // Try to trigger some RPC to get the notifications going LPSPropValue lpProp = NULL; WC_MAPI(HrGetOneProp( lpMDB, PR_TEST_LINE_SPEED, &lpProp)); if (MAPI_E_NOT_FOUND == hRes) { // We're not on an Exchange server. We don't need to generate RPC after all. hRes = S_OK; } MAPIFreeBuffer(lpProp); } } else // if we failed to advise, then we don't need the advise sink object { if (m_lpBaseAdviseSink) m_lpBaseAdviseSink->Release(); m_lpBaseAdviseSink = NULL; m_ulBaseAdviseObjectType = NULL; m_ulBaseAdviseConnection = NULL; } } delete[] lpEntryID; } } // CBaseDialog::OnNotificationsOn
void CBaseDialog::OnCompareEntryIDs() { HRESULT hRes = S_OK; if (!m_lpMapiObjects) return; LPMDB lpMDB = m_lpMapiObjects->GetMDB(); // do not release LPMAPISESSION lpMAPISession = m_lpMapiObjects->GetSession(); // do not release LPADRBOOK lpAB = m_lpMapiObjects->GetAddrBook(false); // do not release CEditor MyEIDs( this, IDS_COMPAREEIDS, IDS_COMPAREEIDSPROMPTS, 4, CEDITOR_BUTTON_OK | CEDITOR_BUTTON_CANCEL); MyEIDs.InitPane(0, CreateSingleLinePane(IDS_EID1, NULL, false)); MyEIDs.InitPane(1, CreateSingleLinePane(IDS_EID2, NULL, false)); UINT uidDropDown[] = { IDS_DDMESSAGESTORE, IDS_DDSESSION, IDS_DDADDRESSBOOK }; MyEIDs.InitPane(2, CreateDropDownPane(IDS_OBJECTFORCOMPAREEID, _countof(uidDropDown), uidDropDown, true)); MyEIDs.InitPane(3, CreateCheckPane(IDS_EIDBASE64ENCODED, false, false)); WC_H(MyEIDs.DisplayDialog()); if (S_OK != hRes) return; if ((0 == MyEIDs.GetDropDown(2) && !lpMDB) || (1 == MyEIDs.GetDropDown(2) && !lpMAPISession) || (2 == MyEIDs.GetDropDown(2) && !lpAB)) { ErrDialog(__FILE__, __LINE__, IDS_EDCOMPAREEID); return; } // Get the entry IDs as a binary LPENTRYID lpEntryID1 = NULL; size_t cbBin1 = NULL; EC_H(MyEIDs.GetEntryID(0, MyEIDs.GetCheck(3), &cbBin1, &lpEntryID1)); LPENTRYID lpEntryID2 = NULL; size_t cbBin2 = NULL; EC_H(MyEIDs.GetEntryID(1, MyEIDs.GetCheck(3), &cbBin2, &lpEntryID2)); ULONG ulResult = NULL; switch (MyEIDs.GetDropDown(2)) { case 0: // Message Store EC_MAPI(lpMDB->CompareEntryIDs((ULONG)cbBin1, lpEntryID1, (ULONG)cbBin2, lpEntryID2, NULL, &ulResult)); break; case 1: // Session EC_MAPI(lpMAPISession->CompareEntryIDs((ULONG)cbBin1, lpEntryID1, (ULONG)cbBin2, lpEntryID2, NULL, &ulResult)); break; case 2: // Address Book EC_MAPI(lpAB->CompareEntryIDs((ULONG)cbBin1, lpEntryID1, (ULONG)cbBin2, lpEntryID2, NULL, &ulResult)); break; } if (SUCCEEDED(hRes)) { CString szRet; CString szResult; EC_B(szResult.LoadString(ulResult ? IDS_TRUE : IDS_FALSE)); szRet.FormatMessage(IDS_COMPAREEIDBOOL, ulResult, szResult); CEditor Result( this, IDS_COMPAREEIDSRESULT, NULL, (ULONG)0, CEDITOR_BUTTON_OK); Result.SetPromptPostFix(szRet); (void)Result.DisplayDialog(); } delete[] lpEntryID2; delete[] lpEntryID1; } // CBaseDialog::OnCompareEntryIDs
void _DtI18nErrorDialog( int err ) { char *err_str; switch(err) { case ErrNoHome: err_str = GETMESSAGE(19, 30, "The environment variable HOME is not defined."); break; case ErrNoLocale: err_str = GETMESSAGE(19, 31, "The environment variable LANG is not defined."); break; case ErrNoCDELocale: err_str = GETMESSAGE(19, 32, "This locale is not supported by the desktop."); break; /* File I/O */ case ErrFileCreate: err_str = GETMESSAGE(19, 33, "Cannot create the user Input Method Selection file"); break; /* Selection */ case ErrNoSelectionFile: err_str = GETMESSAGE(19, 34, "Cannot find the user Input Method Selection file."); break; case ErrSaveSelection: err_str = GETMESSAGE(19, 35, "Cannot save the user Input Method Selection file."); break; /* Remote */ case ErrUnknownHost: err_str = GETMESSAGE(19, 36, "Unknown host"); break; case ErrNoDtimsstart: err_str = GETMESSAGE(19, 37, "dtimsstart was not found.\nPerhaps the desktop environment\nis not properly installed."); break; case ErrRemoteFailed: err_str = GETMESSAGE(19, 38, "Remote execution failed on\n the selected host."); /* Pipe */ case ErrNoPopen: err_str = GETMESSAGE(19, 39, "Cannot initialize remote execution"); break; case ErrTimeOut: err_str = GETMESSAGE(19, 40, "Getting the Input Method on the \nselected host is taking too long"); break; default: err_str = GETMESSAGE(19, 41, "Unknown error"); break; } ErrDialog(err_str, style.i18nDialog); }