void SessionListWidget::doubleClickSession() { const QVariant &itemData = currentItem()->data(0, Qt::UserRole); JobDefinition *job = itemData.value<JobDefinition *>(); qDebug() << *job; if(job->status == JobDefinition::RUNNING) { emit viewSession(job); } }
void EventHandler::customEvent(QEvent *e) { if (e->type() == 10001) { // Forward the event to the next in the chain forwardEvent(e); MClientEvent* me = static_cast<MClientEvent*>(e); if (me->dataTypes().contains("XMLEdit")) { if (_state != NORMAL) qWarning() << "! Remote editing protocol somehow received a key"; _key = me->payload()->toInt(); _state = RECEIVED_KEY; qDebug() << "* Remote editing protocol got edit key" << _key; } else if (me->dataTypes().contains("XMLEditTitle")) { if (_state == RECEIVED_KEY) { _title = me->payload()->toByteArray(); _state = RECEIVED_TITLE; qDebug() << "* Remote editing protocol got edit title" << _title; } else { qWarning() << "! Remote editing protocol never got a key" << "; discarding title"; _state = NORMAL; } } else if (me->dataTypes().contains("XMLEditBody")) { if (_state == RECEIVED_TITLE) { _body = me->payload()->toByteArray(); qDebug() << "* Remote editing protocol got edit body" << _body; editSession(_key, _title, _body); } else if (_state == RECEIVED_KEY) qWarning() << "! Remote editing protocol never got a title" << "; discarding body"; else qWarning() << "! Remote editing protocol never got a key" << "; discarding body"; _state = NORMAL; } else if (me->dataTypes().contains("XMLViewTitle")) { if (_state == NORMAL) { _key = -1; _title = me->payload()->toByteArray(); _state = RECEIVED_TITLE; qDebug() << "* Remote editing protocol got view title" << _title; } } else if (me->dataTypes().contains("XMLViewBody")) { if (_state == RECEIVED_TITLE) { _body = me->payload()->toByteArray(); qDebug() << "* Remote editing protocol got view body" << _body; viewSession(_key, _title, _body); } else if (_state == RECEIVED_KEY) qWarning() << "! Remote editing protocol never got a title" << "; discarding body"; else qWarning() << "! Remote editing protocol never got a key" << "; discarding body"; _state = NORMAL; } else if (me->dataTypes().contains("MUMEIdentifyRequest")) { sendMUMEIdentifyRequest(); } else if (me->dataTypes().contains("SocketConnected")) { if (_pluginSession->isMUME()) sendMUMEIdentifyRequest(); } } else { qDebug() << "! RemoteEdit somehow received the wrong kind of event..."; } }
void SessionListWidget::viewSessionSlot() { QAction *action = qobject_cast<QAction *>(sender()); JobDefinition *job = action->data().value<JobDefinition *>(); emit viewSession(job); }