Esempio n. 1
0
CMSNDataEvent::CMSNDataEvent(unsigned long _nEvent, unsigned long _nSessionId,
    unsigned long _nBaseId, const Licq::UserId& userId,
			     const string &_strFromId, const string &_strCallId,
                             CMSN *p)
{
  m_pMSN = p;
  m_nSocketDesc = -1;
  m_nEvent = _nEvent;
  m_strId = userId.accountId();
  m_eState = STATE_WAITING_ACK;
  m_nFileDesc = -1;
  {
    Licq::UserReadGuard u(userId);
    m_strFileName = u->pictureFileName();
  }
  m_nFilePos = 0;
  m_nBytesTransferred = 0;
  m_nStartTime = 0;
  m_nSessionId = _nSessionId;
  m_nBaseId = _nBaseId;
  m_nDataSize[0] = 0;
  m_nDataSize[1] = 0;
  m_strFromId = _strFromId;
  m_strCallId = _strCallId;
}
Esempio n. 2
0
AuthDlg::AuthDlg(enum AuthDlgType type, const Licq::UserId& userId, QWidget* parent)
  : QDialog(parent),
    myType(type),
    myUserId(userId)
{
  Support::setWidgetProps(this, "AuthDialog");
  setAttribute(Qt::WA_DeleteOnClose, true);

  QString messageTitle;
  switch (myType)
  {
    default:
    case RequestAuth:
      setWindowTitle(tr("Licq - Request Authorization"));
      messageTitle = tr("Request");
      break;
    case GrantAuth:
      setWindowTitle(tr("Licq - Grant Authorization"));
      messageTitle = tr("Response");
      break;
    case RefuseAuth:
      setWindowTitle(tr("Licq - Refuse Authorization"));
      messageTitle = tr("Response");
      break;
  }

  QVBoxLayout* dialogLayout = new QVBoxLayout(this);
  QHBoxLayout* userIdLayout = new QHBoxLayout();

  QLabel* ownerLabel = new QLabel(this);
  ownerLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  ownerLabel->setText(tr("&Account:"));
  myOwnerCombo = new OwnerComboBox();
  ownerLabel->setBuddy(myOwnerCombo);
  userIdLayout->addWidget(ownerLabel);
  userIdLayout->addWidget(myOwnerCombo);

  QLabel* accountIdLabel = new QLabel(this);
  accountIdLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
  accountIdLabel->setText(tr("&User ID:"));
  myAccountIdEdit = new QLineEdit(this);
  myAccountIdEdit->setMinimumWidth(90);
  accountIdLabel->setBuddy(myAccountIdEdit);
  connect(myAccountIdEdit, SIGNAL(returnPressed()), SLOT(send()) );
  userIdLayout->addWidget(accountIdLabel);
  userIdLayout->addWidget(myAccountIdEdit);

  dialogLayout->addLayout(userIdLayout);
  dialogLayout->addSpacing(6);

  QGroupBox* messageBox = new QGroupBox(messageTitle, this);
  dialogLayout->addWidget(messageBox);
  dialogLayout->setStretchFactor(messageBox, 2);

  QVBoxLayout* messageLayout = new QVBoxLayout(messageBox);
  myMessageEdit = new MLEdit(true);
  myMessageEdit->setSizeHintLines(5);
  messageLayout->addWidget(myMessageEdit);

  QDialogButtonBox* buttons = new QDialogButtonBox();
  QPushButton* okButton = buttons->addButton(QDialogButtonBox::Ok);
  QPushButton* cancelButton = buttons->addButton(QDialogButtonBox::Cancel);

  connect(myMessageEdit, SIGNAL(ctrlEnterPressed()), this, SLOT(send()));
  connect(okButton, SIGNAL(clicked()), SLOT(send()) );
  connect(cancelButton, SIGNAL(clicked()), SLOT(close()) );

  dialogLayout->addWidget(buttons);

  if (userId.isValid())
  {
    myOwnerCombo->setCurrentOwnerId(userId.ownerId());
    myOwnerCombo->setEnabled(false);
    myAccountIdEdit->setText(userId.accountId().c_str());
    myAccountIdEdit->setEnabled(false);
    myMessageEdit->setFocus();
  }
  else
  {
    myOwnerCombo->setFocus();
  }

  show();
}