Exemplo n.º 1
0
void CForwardDlg::dropEvent(QDropEvent * de)
{
  QString text;

  // extract the text from the event
  if (!QTextDrag::decode(de, text))
    return;

  if (text.length() == 0) return;
  m_szId = strdup(text.latin1());
  m_nPPID = LICQ_PPID; //TODO dropevent needs the ppid

  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R);

  edtUser->setText(QString::fromUtf8(u->GetAlias()) + " (" + text + ")");
  gUserManager.DropUser(u);
}
Exemplo n.º 2
0
ShowAwayMsgDlg::ShowAwayMsgDlg(CICQDaemon *_server, CSignalManager* _sigman,
  const char *szId, unsigned long nPPID, QWidget *parent)
  : LicqDialog(parent, "ShowAwayMessageDialog")
{
  m_szId = szId ? strdup(szId) : 0;
  m_nPPID = nPPID;
  sigman = _sigman;
  server = _server;

  QBoxLayout* top_lay = new QVBoxLayout(this, 10);
  mleAwayMsg = new MLEditWrap(true, this);
  // ICQ99b allows 37 chars per line, so we do the same
  //mleAwayMsg->setWordWrap(QMultiLineEditNew::FixedColumnWidth);
  //mleAwayMsg->setWrapColumnOrWidth(37);
  mleAwayMsg->setReadOnly(true);
  mleAwayMsg->setMinimumSize(230, 110);
  connect(mleAwayMsg, SIGNAL(signal_CtrlEnterPressed()), SLOT(accept()));
  top_lay->addWidget(mleAwayMsg);

  QBoxLayout* lay = new QHBoxLayout(top_lay, 10);

  chkShowAgain = new QCheckBox(tr("&Show Again"), this);
  lay->addWidget(chkShowAgain);

  lay->addStretch(1);
  lay->addSpacing(30);

  ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R);
  QTextCodec * codec = UserCodec::codecForICQUser(u);
//  chkShowAgain->setChecked(u->ShowAwayMsg());

  setCaption(QString(tr("%1 Response for %2")).arg(u->StatusStr()).arg(QString::fromUtf8(u->GetAlias())));

  btnOk = new QPushButton(tr("&Ok"), this);
  btnOk->setMinimumWidth(75);
  btnOk->setDefault(true);
  btnOk->setFocus();
  connect(btnOk, SIGNAL(clicked()), SLOT(accept()));
  lay->addWidget(btnOk);

  // Check if this is an active request or not
  if (sigman == NULL || server == NULL)
  {
    mleAwayMsg->setText(codec->toUnicode(u->AutoResponse()));
    gUserManager.DropUser(u);
    icqEventTag = 0;
  }
  else
  {
    bool bSendServer = (u->SocketDesc(ICQ_CHNxNONE) <= 0 && u->Version() > 6);
    gUserManager.DropUser(u);
    mleAwayMsg->setEnabled(false);
    mleAwayMsg->setBackgroundMode(PaletteBackground);
    connect (sigman, SIGNAL(signal_doneUserFcn(ICQEvent *)), this, SLOT(doneEvent(ICQEvent *)));
    icqEventTag = server->icqFetchAutoResponse(szId, nPPID, bSendServer);
  }

  show();
}
Exemplo n.º 3
0
CRefuseDlg::CRefuseDlg(unsigned long _nUin, QString t, QWidget* parent)
   : LicqDialog(parent, "RefuseDialog", true)
{
  ICQUser *u = gUserManager.FetchUser(_nUin, LOCK_R);
  QLabel *lbl = new QLabel(tr("Refusal message for %1 with ").arg(t) + QString::fromUtf8(u->GetAlias()) + ":", this);
  gUserManager.DropUser(u);

  mleRefuseMsg = new MLEditWrap(true, this);

  QPushButton *btnRefuse = new QPushButton(tr("Refuse"), this );
  connect( btnRefuse, SIGNAL(clicked()), SLOT(accept()) );
  QPushButton *btnCancel = new QPushButton(tr("Cancel"), this );
  connect( btnCancel, SIGNAL(clicked()), SLOT(reject()) );
  int bw = 75;
  bw = QMAX(bw, btnRefuse->sizeHint().width());
  bw = QMAX(bw, btnCancel->sizeHint().width());
  btnRefuse->setFixedWidth(bw);
  btnCancel->setFixedWidth(bw);

  QGridLayout *lay = new QGridLayout(this, 3, 5, 15, 10);
  lay->addMultiCellWidget(lbl, 0, 0, 0, 4);
  lay->addMultiCellWidget(mleRefuseMsg, 1, 1, 0, 4);
  lay->addWidget(btnRefuse, 2, 1);
  lay->addWidget(btnCancel, 2, 3);
  lay->setColStretch(0, 2);
  lay->setColStretch(4, 2);
  lay->addColSpacing(2, 10);

  setCaption(tr("Licq %1 Refusal").arg(t));
}