//--------------------------------------------------------------------------- unsigned int __fastcall ExceptionMessageDialog(Exception * E, TQueryType Type, const UnicodeString MessageFormat, unsigned int Answers, UnicodeString HelpKeyword, const TMessageParams * Params) { TStrings * MoreMessages = NULL; ExtException * EE = dynamic_cast<ExtException *>(E); if (EE != NULL) { MoreMessages = EE->MoreMessages; } UnicodeString Message; // this is always called from within ExceptionMessage check, // so it should never fail here CHECK(ExceptionMessageFormatted(E, Message)); HelpKeyword = MergeHelpKeyword(HelpKeyword, GetExceptionHelpKeyword(E)); std::unique_ptr<TStrings> OwnedMoreMessages; if (AppendExceptionStackTraceAndForget(MoreMessages)) { OwnedMoreMessages.reset(MoreMessages); } return MoreMessageDialog( FORMAT(MessageFormat.IsEmpty() ? UnicodeString(L"%s") : MessageFormat, (Message)), MoreMessages, Type, Answers, HelpKeyword, Params); }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeDialog::StartButtonClick(TObject * /*Sender*/) { bool Synchronize; bool Continue = true; if (SynchronizeSynchronizeCheck->State == cbGrayed) { TMessageParams Params(mpNeverAskAgainCheck); switch (MoreMessageDialog(LoadStr(SYNCHRONISE_BEFORE_KEEPUPTODATE2), NULL, qtConfirmation, qaYes | qaNo | qaCancel, HELP_KEEPUPTODATE_SYNCHRONIZE, &Params)) { case qaNeverAskAgain: SynchronizeSynchronizeCheck->State = cbChecked; // fall thru case qaYes: Synchronize = true; break; case qaNo: Synchronize = false; break; default: case qaCancel: Continue = false; break; }; } else { Synchronize = SynchronizeSynchronizeCheck->Checked; } if (Continue) { assert(!FSynchronizing); LocalDirectoryEdit->SaveToHistory(); CustomWinConfiguration->History[L"LocalDirectory"] = LocalDirectoryEdit->Items; RemoteDirectoryEdit->SaveToHistory(); CustomWinConfiguration->History[L"RemoteDirectory"] = RemoteDirectoryEdit->Items; FSynchronizing = true; try { UpdateControls(); Repaint(); FAbort = false; DoStartStop(true, Synchronize); } catch(...) { FSynchronizing = false; UpdateControls(); throw; } } }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeDialog::LogViewDblClick(TObject * /*Sender*/) { if (LogView->ItemFocused != NULL) { TLogItemData * LogItemData = GetLogItemData(LogView->ItemFocused); if (LogItemData->Entry == slContinuedError) { MoreMessageDialog( LogItemData->Message, LogItemData->MoreMessages.get(), LogItemData->Type, qaOK, LogItemData->HelpKeyword); } } }
//--------------------------------------------------------------------------- unsigned int __fastcall SimpleErrorDialog(const UnicodeString Msg, const UnicodeString MoreMessages) { unsigned int Result; TStrings * More = NULL; try { if (!MoreMessages.IsEmpty()) { More = TextToStringList(MoreMessages); } Result = MoreMessageDialog(Msg, More, qtError, qaOK, HELP_NONE); } __finally { delete More; } return Result; }
//--------------------------------------------------------------------------- unsigned int __fastcall MessageDialog(const UnicodeString Msg, TQueryType Type, unsigned int Answers, UnicodeString HelpKeyword, const TMessageParams * Params) { return MoreMessageDialog(Msg, NULL, Type, Answers, HelpKeyword, Params); }