コード例 #1
0
AccountNotificationService::AccountNotificationService(QObject *parent) :
		QObject{parent},
		m_ignoreErrorsCallback{QStringLiteral("connection-ignore-errors"), tr("Ignore"),
			[this](const Notification &notification){ return ignoreErrors(notification); }},
		m_connectionErrorEvent{QStringLiteral("ConnectionError"), QStringLiteral(QT_TRANSLATE_NOOP("@default", "Connection error"))}
{
}
コード例 #2
0
void ConnectionErrorNotification::registerEvent()
{
	Core::instance()->notificationEventRepository()->addNotificationEvent(NotificationEvent("ConnectionError", QT_TRANSLATE_NOOP("@default", "Connection error")));

	Parser::registerObjectTag("error", getErrorMessage);
	Parser::registerObjectTag("errorServer", getErrorServer);

	auto connectionIgnoreErrorsDisconnect = NotificationCallback{
		"connection-ignore-errors",
		tr("Ignore"),
		[](Notification *notification){
			auto connectionErrorNotification = qobject_cast<ConnectionErrorNotification *>(notification);
			if (connectionErrorNotification)
				connectionErrorNotification->ignoreErrors();
		}
	};
	Core::instance()->notificationCallbackRepository()->addCallback(connectionIgnoreErrorsDisconnect);
}