本文整理汇总了C++中EventContact类的典型用法代码示例。如果您正苦于以下问题:C++ EventContact类的具体用法?C++ EventContact怎么用?C++ EventContact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventContact类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processEvent
bool AIMInfo::processEvent(Event *e)
{
if (e->type() == eEventContact){
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eChanged)
return false;
Contact *contact = ec->contact();
if (contact->have(m_data))
fill();
} else
if ((e->type() == eEventMessageReceived) && m_data){
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (msg->type() == MessageStatus){
if (m_client->dataName(m_data) == msg->client())
fill();
}
} else
if ((e->type() == eEventClientChanged) && (m_data == 0)){
EventClientChanged *ecc = static_cast<EventClientChanged*>(e);
if (ecc->client() == m_client)
fill();
}
return false;
}
示例2: fill
bool ICQSecure::processEvent(Event *e)
{
if (e->type() == eEventClientChanged){
EventClientChanged *ecc = static_cast<EventClientChanged*>(e);
if (ecc->client() == m_client)
fill();
} else
if (e->type() == eEventContact){
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eChanged)
return false;
fillListView(lstVisible, &ICQUserData::VisibleId);
fillListView(lstInvisible, &ICQUserData::InvisibleId);
}
return false;
}
示例3: processEvent
bool PastInfo::processEvent(Event *e)
{
if (e->type() == eEventContact){
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eChanged)
return false;
Contact *contact = ec->contact();
if (contact->clientData.have(m_data))
fill();
} else
if ((e->type() == eEventClientChanged) && (m_data == 0)){
EventClientChanged *ecc = static_cast<EventClientChanged*>(e);
if (ecc->client() == m_client)
fill();
}
return false;
}
示例4: switch
bool SoundPlugin::processEvent(SIM::Event *e)
{
switch (e->type())
{
case eEventLoginStart:
{
playSound(value("StartUp").toString());
break;
}
case eEventPluginLoadConfig:
{
PropertyHubPtr hub = ProfileManager::instance()->getPropertyHub("sound");
if(!hub.isNull())
setPropertyHub(hub);
if(!value("StartUp").isValid())
setValue("StartUp", "sounds/startup.ogg");
if(!value("MessageSent").isValid())
setValue("MessageSent", "sounds/msgsent.ogg");
if(!value("FileDone").isValid())
setValue("FileDone", "sounds/filedone.ogg");
break;
}
case eEventContact:
{
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eOnline)
break;
Contact *contact = ec->contact();
bool disable = contact->getUserData()->root()->value("sound/Disable").toBool();
QString alert = contact->getUserData()->root()->value("sound/Alert").toString();
if(alert.isEmpty())
alert = getContacts()->userdata()->value("sound/Alert").toString();
if (!alert.isEmpty() && !disable)
EventPlaySound(alert).process();
break;
}
case eEventMessageSent:
{
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
QString err = msg->getError();
if (!err.isEmpty())
return false;
QString sound;
if (msg->type() == MessageFile)
sound = value("FileDone").toString();
else if ((msg->getFlags() & MESSAGE_NOHISTORY) == 0)
{
if ((msg->getFlags() & MESSAGE_MULTIPLY) && ((msg->getFlags() & MESSAGE_LAST) == 0))
return false;
sound = value("MessageSent").toString();
}
if (!sound.isEmpty())
EventPlaySound(sound).process();
break;
}
case eEventMessageReceived:
{
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if(msg->type() == MessageStatus)
return false;
Contact *contact = getContacts()->contact(msg->contact());
bool nosound, disable;
if(contact)
{
nosound = contact->getUserData()->root()->value("sound/NoSoundIfActive").toBool();
disable = contact->getUserData()->root()->value("sound/Disable").toBool();
}
else
{
nosound = getContacts()->userdata()->value("sound/NoSoundIfActive").toBool();
disable = getContacts()->userdata()->value("sound/Disable").toBool();
}
if(!disable && nosound)
{
EventActiveContact e;
e.process();
if (e.contactID() == contact->id())
disable = true;
}
if(!disable)
{
QString sound = messageSound(msg->baseType(), contact->id());
playSound(sound);
}
break;
}
case eEventPlaySound:
{
EventPlaySound *s = static_cast<EventPlaySound*>(e);
playSound(s->sound());
return true;
}
default:
break;
}
return false;
}
示例5: switch
bool UserConfig::processEvent(Event *e)
{
switch (e->type()){
case eEventGroup:{
EventGroup *ev = static_cast<EventGroup*>(e);
Group *group = ev->group();
switch(ev->action()) {
case EventGroup::eDeleted:
if (group == m_group)
close();
return false;
case EventGroup::eChanged:
if (group == m_group)
setTitle();
return false;
case EventGroup::eAdded:
return false;
}
break;
}
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
if (contact != m_contact)
break;
switch(ec->action()) {
case EventContact::eCreated:
if (m_nUpdates)
m_nUpdates--;
btnUpdate->setEnabled(m_nUpdates == 0);
setTitle();
case EventContact::eDeleted:
close();
break;
case EventContact::eChanged:
if (m_nUpdates)
m_nUpdates--;
btnUpdate->setEnabled(m_nUpdates == 0);
setTitle();
break;
case EventContact::eFetchInfoFailed:
if (m_nUpdates){
if (--m_nUpdates == 0){
btnUpdate->setEnabled(true);
setTitle();
}
}
break;
default:
break;
}
break;
}
case eEventCommandRemove: {
EventCommandRemove *ecr = static_cast<EventCommandRemove*>(e);
removeCommand(ecr->id());
return false;
}
case eEventLanguageChanged:
case eEventPluginChanged:
case eEventClientsChanged:
fill();
return false;
default:
break;
}
return false;
}
示例6: switch
bool FilterPlugin::processEvent(Event *e)
{
switch (e->type()) {
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eChanged)
break;
Contact *contact = ec->contact();
if (contact->getGroup()){
Command cmd;
cmd->id = CmdIgnore;
cmd->flags = BTN_HIDE;
cmd->param = (void*)(contact->id());
EventCommandShow(cmd).process();
}
break;
}
case eEventPluginLoadConfig:
{
setPropertyHub( ProfileManager::instance()->getPropertyHub("filter") );
break;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (!msg || (msg->type() == MessageStatus))
return false;
Contact *contact = getContacts()->contact(msg->contact());
PropertyHubPtr data = contact->getUserData("filter");
// check if we accept only from users on the list
if (((contact == NULL) || contact->getFlags() & CONTACT_TEMPORARY) &&
((value("FromList").toBool() &&
msg->type() != MessageAuthRequest &&
msg->type() != MessageAuthGranted &&
msg->type() != MessageAuthRefused) ||
(value("AuthFromList").toBool() && msg->type() <= MessageContacts))) {
delete msg;
delete contact;
return msg;
}
if (!contact)
return false;
// check if the user is a ignored user
if (contact->getIgnore()){
delete msg;
return true;
}
// get filter-data
if (data && !data->value("SpamList").toString().isEmpty() && (!contact || (contact->getFlags() & CONTACT_TEMPORARY) )) {
if (checkSpam(msg->getPlainText(), data->value("SpamList").toString())){
delete msg;
return true;
}
}
break;
}
case eEventCheckCommandState: {
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if (cmd->id == CmdIgnore){
cmd->flags &= ~BTN_HIDE;
Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
if (contact && contact->getGroup())
cmd->flags |= BTN_HIDE;
return true;
}
if (cmd->id == CmdIgnoreText){
cmd->flags &= ~COMMAND_CHECKED;
if (cmd->menu_id == MenuMsgView){
MsgViewBase *edit = (MsgViewBase*)(cmd->param);
if (edit->textCursor().hasSelection())
return true;
} else
/*if (cmd->menu_id == MenuTextEdit){
TextEdit *edit = ((MsgEdit*)(cmd->param))->m_edit;
if (edit->textCursor().hasSelection())
return true;
}*/ //Fixme Block (crashing on rightclick in msgedit from container)
return false;
}
if (cmd->menu_id == MenuContactGroup){
if (cmd->id == CmdIgnoreList){
Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
if (contact == NULL)
return false;
cmd->flags &= COMMAND_CHECKED;
if (contact->getIgnore())
cmd->flags |= COMMAND_CHECKED;
return true;
}
}
break;
}
case eEventCommandExec: {
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
CommandDef *cmd = ece->cmd();
if (cmd->id == CmdIgnore){
Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
if (contact){
//.........这里部分代码省略.........
示例7: switch
bool MsgEdit::processEvent(Event *e)
{
switch (e->type()) {
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
if (ec->contact()->id() != m_userWnd->m_id)
break;
adjustType();
break;
}
case eEventClientChanged: {
adjustType();
break;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (msg->getFlags() & MESSAGE_NOVIEW)
return false;
if ((msg->contact() == m_userWnd->id()) && (msg->type() != MessageStatus)){
if (CorePlugin::instance()->getContainerMode()){
bool bSetFocus = false;
if (topLevelWidget() && topLevelWidget()->inherits("Container")){
Container *container = static_cast<Container*>(topLevelWidget());
if (container->wnd() == m_userWnd)
bSetFocus = true;
}
setMessage(msg, bSetFocus);
}else{
if (m_edit->isReadOnly())
QTimer::singleShot(0, this, SLOT(setupNext()));
}
}
break;
}
case eEventRealSendMessage: {
EventRealSendMessage *ersm = static_cast<EventRealSendMessage*>(e);
if (ersm->edit() == this){
sendMessage(ersm->msg());
return true;
}
break;
}
case eEventCheckCommandState: {
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if ((cmd->param == (TextEdit*)m_edit) && (cmd->id == CmdTranslit)){
Contact *contact = getContacts()->contact(m_userWnd->id());
if (contact){
SIM::PropertyHubPtr data = contact->getUserData("translit");
if(!data.isNull()) {
cmd->flags &= ~COMMAND_CHECKED;
if (data->value("Translit").toBool())
cmd->flags |= COMMAND_CHECKED;
// FIXME: return true; missing here?
}
}
return false;
}
if ((cmd->menu_id != MenuTextEdit) || (cmd->param != (TextEdit*)m_edit))
return false;
cmd->flags &= ~(COMMAND_CHECKED | COMMAND_DISABLED);
switch (cmd->id){
case CmdUndo:
if (m_edit->isReadOnly())
return false;
if (!m_edit->document()->isUndoAvailable())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdRedo:
if (m_edit->isReadOnly())
return false;
if (!m_edit->document()->isRedoAvailable())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdCut:
if (m_edit->isReadOnly())
return false;
case CmdCopy:
if (m_edit->textCursor().selectedText().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdPaste:
if (m_edit->isReadOnly())
return false;
if (QApplication::clipboard()->text().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
case CmdClear:
if (m_edit->isReadOnly())
return false;
case CmdSelectAll:
if (m_edit->toPlainText().isEmpty())
cmd->flags |= COMMAND_DISABLED;
return true;
}
break;
}
case eEventCommandExec: {
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
//.........这里部分代码省略.........
示例8: switch
bool ActionPlugin::processEvent(Event *e)
{
switch (e->type() ) {
case eEventCheckCommandState: {
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if ((cmd->id == CmdAction) && (cmd->menu_id == MenuContact)){
Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
if (contact == NULL)
return false;
PropertyHubPtr data = contact->getUserData("action");
if (!data || data->value("NMenu").toInt() == 0)
return false;
CommandDef *cmds = new CommandDef[data->value("NMenu").toInt() + 1];
unsigned n = 0;
for (int i = 0; i < data->value("NMenu").toInt(); i++){
QString str = data->stringMapValue("Menu", i +1);
QString item = getToken(str, ';');
int pos = item.indexOf("&IP;");
if (pos >= 0)
{
EventGetContactIP e(contact);
if (!e.process())
continue;
}
pos = item.indexOf("&Mail;");
if (pos >= 0)
{
if (contact->getEMails().isEmpty())
continue;
}
pos = item.indexOf("&Phone;");
if (pos >= 0)
{
if (contact->getPhones().isEmpty())
continue;
}
cmds[n].id = CmdAction + i;
cmds[n].text = "_";
cmds[n].text_wrk = item;
n++;
}
if (n == 0)
{
delete[] cmds;
return false;
}
cmd->param = cmds;
cmd->flags |= COMMAND_RECURSIVE;
return true;
}
break;
}
case eEventCommandExec: {
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
CommandDef *cmd = ece->cmd();
if ((cmd->menu_id == MenuContact) && (cmd->id >= CmdAction)){
unsigned n = cmd->id - CmdAction;
Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
PropertyHubPtr data = contact->getUserData("action");
if (!contact || !data || n >= data->value("NMenu").toLongLong())
return false;
QString str = data->stringMapValue("Menu", n +1);
getToken(str, ';');
EventTemplate::TemplateExpand t;
t.tmpl = str;
t.contact = contact;
t.receiver = this;
t.param = NULL;
EventTemplateExpand(&t).process();
return true;
}
break;
}
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
if(ec->action() != EventContact::eOnline)
break;
Contact *contact = ec->contact();
if (contact == NULL)
return false;
PropertyHubPtr data = contact->getUserData("action");
if (!data || data->value("OnLine").toString().isEmpty())
return false;
EventTemplate::TemplateExpand t;
t.tmpl = data->value("OnLine").toString();
t.contact = contact;
t.receiver = this;
t.param = NULL;
EventTemplateExpand(&t).process();
return true;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
Contact *contact = getContacts()->contact(msg->contact());
if (contact == NULL)
return false;
PropertyHubPtr data = contact->getUserData("action");
//.........这里部分代码省略.........
示例9: switch
bool HistoryWindow::processEvent(Event *e)
{
switch(e->type()) {
case eEventContact:
{
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
if (contact->id() != m_id)
break;
switch(ec->action())
{
case EventContact::eDeleted:
QTimer::singleShot(0, this, SLOT(close()));
break;
case EventContact::eChanged:
setName();
break;
default:
break;
}
break;
}
case eEventCheckCommandState:
{
EventCheckCommandState *ecs = static_cast<EventCheckCommandState*>(e);
CommandDef *cmd = ecs->cmd();
if (cmd->id == CmdHistoryDirection && (unsigned long)(cmd->param) == m_id)
{
cmd->flags &= ~COMMAND_CHECKED;
if (m_bDirection)
cmd->flags |= COMMAND_CHECKED;
return true;
}
if (cmd->id != CmdDeleteMessage && cmd->id != CmdCutHistory || cmd->param != m_view || !m_view->currentMessage())
return false;
cmd->flags &= ~COMMAND_CHECKED;
return true;
}
case eEventCommandExec:
{
EventCommandExec *ece = static_cast<EventCommandExec*>(e);
CommandDef *cmd = ece->cmd();
if ((unsigned long)(cmd->param) != m_id)
return false;
if (cmd->id == CmdHistoryDirection)
{
bool bDirection = ((cmd->flags & COMMAND_CHECKED) != 0);
CorePlugin::instance()->setValue("HistoryDirection", bDirection);
if (bDirection != m_bDirection)
{
m_bDirection = bDirection;
m_page = 0;
m_states.clear();
fill();
}
return true;
}
if (cmd->id == CmdHistoryNext)
{
if (m_page + 1 < m_states.size())
{
m_page++;
fill();
}
return true;
}
if (cmd->id == CmdHistoryPrev)
{
if (m_page > 0)
{
m_page--;
fill();
}
return true;
}
if (cmd->id == CmdHistorySave)
{
QString str = QFileDialog::getSaveFileName(this, QString::null, QString::null, i18n("Textfile (*.txt)"));
if(!str.isEmpty())
{
bool res = true;
if (QFile::exists(str))
{
QMessageBox mb(i18n("Error"), i18n("File already exists. Overwrite?"),
QMessageBox::Warning,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No,
QMessageBox::Cancel | QMessageBox::Escape);
mb.setButtonText(QMessageBox::Yes, i18n("&Overwrite"));
mb.setButtonText(QMessageBox::No, i18n("&Append"));
switch (mb.exec())
{
case QMessageBox::Yes:
res = History::save(m_id, str, false);
break;
case QMessageBox::No:
res = History::save(m_id, str, true);
break;
case QMessageBox::Cancel:
//.........这里部分代码省略.........
示例10: switch
bool OSDPlugin::processEvent(Event *e)
{
OSDRequest osd;
switch (e->type()){
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
if (contact->getIgnore())
break;
switch(ec->action()) {
case EventContact::eOnline: {
osd.contact = contact->id();
osd.type = OSD_ALERTONLINE;
queue.push_back(osd);
processQueue();
break;
}
case EventContact::eStatus: {
OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data){
unsigned style = 0;
QString wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.isEmpty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (bTyping){
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it == typing.end()){
typing.push_back(contact->id());
osd.contact = contact->id();
osd.type = OSD_TYPING;
queue.push_back(osd);
processQueue();
}
}else{
list<unsigned>::iterator it;
for (it = typing.begin(); it != typing.end(); ++it)
if ((*it) == contact->id())
break;
if (it != typing.end())
typing.erase(it);
if ((m_request.type == OSD_TYPING) && (m_request.contact == contact->id())){
m_timer->stop();
m_timer->start(100);
}
}
}
break;
}
default:
break;
}
break;
}
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
Contact *contact = getContacts()->contact(msg->contact());
if (contact == NULL)
break;
OSDUserData *data = (OSDUserData*)(contact->getUserData(user_data_id));
if (data == NULL)
break;
osd.contact = msg->contact();
if (! core->unread.empty())
bHaveUnreadMessages=true;
if (msg->type() == MessageStatus) {
StatusMessage *smsg = (StatusMessage*)msg;
switch (smsg->getStatus()) {
case STATUS_AWAY:
osd.type = OSD_ALERTAWAY;
break;
case STATUS_NA:
osd.type = OSD_ALERTNA;
break;
case STATUS_DND:
osd.type = OSD_ALERTDND;
break;
case STATUS_OCCUPIED: /* STATUS_OCCUPIED, took over from contacts.h! */
osd.type = OSD_ALERTOCCUPIED;
break;
case STATUS_FFC:
osd.type = OSD_ALERTFFC;
break;
case STATUS_OFFLINE:
osd.type = OSD_ALERTOFFLINE;
break;
case STATUS_ONLINE:
osd.type = OSD_NONE;
return false;
default:
//.........这里部分代码省略.........
示例11: switch
bool Container::processEvent(Event *e)
{
if (m_tabBar == NULL)
return false;
switch (e->type()){
case eEventMessageReceived: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
if (msg->type() == MessageStatus){
Contact *contact = getContacts()->contact(msg->contact());
if (contact)
contactChanged(contact);
return false;
}
if (msg->getFlags() & MESSAGE_NOVIEW)
return false;
if (CorePlugin::m_plugin->getContainerMode()){
if (isActiveWindow() && !isMinimized()){
UserWnd *userWnd = m_tabBar->currentWnd();
if (userWnd && (userWnd->id() == msg->contact()))
userWnd->markAsRead();
}else{
UserWnd *userWnd = wnd(msg->contact());
if (userWnd)
QTimer::singleShot(0, this, SLOT(flash()));
}
}
// no break here - otherwise we have to duplicate the code below...
}
case eEventMessageRead: {
EventMessage *em = static_cast<EventMessage*>(e);
Message *msg = em->msg();
UserWnd *userWnd = wnd(msg->contact());
if (userWnd){
bool bBold = false;
for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){
if ((*it).contact != msg->contact())
continue;
bBold = true;
break;
}
m_tabBar->setBold(msg->contact(), bBold);
}
break;
}
case eEventActiveContact: {
EventActiveContact *eac = static_cast<EventActiveContact*>(e);
if (!isActiveWindow())
return false;
UserWnd *userWnd = m_tabBar->currentWnd();
if (userWnd) {
eac->setContactID(userWnd->id());
return true;
}
break;
}
case eEventContact: {
EventContact *ec = static_cast<EventContact*>(e);
Contact *contact = ec->contact();
UserWnd *userWnd = wnd(contact->id());
if(!userWnd)
break;
switch(ec->action()) {
case EventContact::eDeleted: {
removeUserWnd(userWnd);
break;
}
case EventContact::eChanged: {
if (contact->getIgnore()){
removeUserWnd(userWnd);
break;
}
m_tabBar->changeTab(contact->id());
contactChanged(contact);
break;
}
case EventContact::eStatus: {
unsigned style = 0;
QString wrkIcons;
QString statusIcon;
contact->contactInfo(style, statusIcon, &wrkIcons);
bool bTyping = false;
while (!wrkIcons.isEmpty()){
if (getToken(wrkIcons, ',') == "typing"){
bTyping = true;
break;
}
}
if (userWnd->m_bTyping != bTyping){
userWnd->m_bTyping = bTyping;
if (bTyping){
userWnd->setStatus(g_i18n("%1 is typing", contact) .arg(contact->getName()));
}else{
userWnd->setStatus("");
}
userWnd = m_tabBar->currentWnd();
if (userWnd && (contact->id() == userWnd->id()))
m_status->message(userWnd->status());
}
}
//.........这里部分代码省略.........