Ejemplo n.º 1
0
int qSslChat::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: peerRejectedFileSend(); break;
        case 1: fsCompleted(); break;
        case 2: hostConnection(); break;
        case 3: connectToHost(); break;
        case 4: activateMsgSending(); break;
        case 5: sendMsg((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 6: receiveMessage((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 7: displayMsg(); break;
        case 8: endConnection(); break;
        case 9: sendAnticipation(); break;
        case 10: sendFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 11: notifyServer(); break;
        case 12: completeFileSend(); break;
        case 13: selectSmiley(); break;
        case 14: insertSmiley((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 15: displayCertificateInfo(); break;
        }
        _id -= 16;
    }
    return _id;
}
Ejemplo n.º 2
0
qSslChat :: qSslChat()
{
  setupUi(this);
  messageList -> setDisabled(true);
  messageList -> setAcceptDrops(true);
  msgEdit -> setDisabled(true);
  sendButton -> setDisabled(true);
  smileyButton -> setDisabled(true);
  cinfoButton -> setDisabled(true);
  portBox -> setRange(1024,65535);
  portBox -> setValue(7752);
  setWindowTitle("Buddies SSL Chat");
  setWindowIcon(QIcon(":/icons/Logo.png"));
  mode=0;
  server=0;

  cinfoButton -> setIcon(QIcon(":/icons/encrypted.png"));
  cinfoButton -> setIconSize(QSize(20,20));
  cinfoButton -> setToolTip(tr("Display certificate info"));

  connect(cinfoButton,SIGNAL(clicked()),this,SLOT(displayCertificateInfo()));

  smileyButton -> setIcon(QIcon(":/emoticons/01.gif"));
  smileyButton -> setIconSize(QSize(20,20));
  connect(smileyButton,SIGNAL(clicked()),this,SLOT(selectSmiley()));
  emoSelector = new EmoticonSelector(this);
  emoSelector -> hide();
  emoSelector -> alignTo(smileyButton);
  connect(emoSelector,SIGNAL(smileySelected(QString,QString)),this,SLOT(insertSmiley(QString,QString)));

  tableFormat.setBorder(0);
  //systray = new systemTray(this);
  addAnimations();

  QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF8"));
  QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF8"));

  connect(hostButton,SIGNAL(clicked()),this,SLOT(hostConnection()));
  connect(connectButton,SIGNAL(clicked()),this,SLOT(connectToHost()));
  connect(disconnectButton,SIGNAL(clicked()),this,SLOT(endConnection()));
  connect(messageList,SIGNAL(fileSendInitiated(QString,int,int)),this,SLOT(sendFile(QString,int,int)));

}
Ejemplo n.º 3
0
void SslClient::socketEncrypted()
{
    if (!socket)
        return;                 // might have disconnected already

    form->sessionOutput->clear();
    form->sessionInput->setFocus();

    QPalette palette;
    palette.setColor(QPalette::Base, QColor(255, 255, 192));
    form->hostNameEdit->setPalette(palette);

    QSslCipher ciph = socket->sessionCipher();
    QString cipher = QString("%1, %2 (%3/%4)").arg(ciph.authenticationMethod())
                     .arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits());;
    form->cipherLabel->setText(cipher);

    if (!padLock) {
        padLock = new QToolButton;
        padLock->setIcon(QIcon(":/encrypted.png"));
#ifndef QT_NO_CURSOR
        padLock->setCursor(Qt::ArrowCursor);
#endif
        padLock->setToolTip(tr("Display encryption details."));

        int extent = form->hostNameEdit->height() - 2;
        padLock->resize(extent, extent);
        padLock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);

        QHBoxLayout *layout = new QHBoxLayout(form->hostNameEdit);
        layout->setMargin(form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth));
        layout->setSpacing(0);
        layout->addStretch();
        layout->addWidget(padLock);

        form->hostNameEdit->setLayout(layout);

        connect(padLock, SIGNAL(clicked()),
                this, SLOT(displayCertificateInfo()));
    } else {
        padLock->show();
    }
}
Ejemplo n.º 4
0
void SslClient::setupUi()
{
    if (form)
        return;

    form = new Ui_Form;
    form->setupUi(this);
    form->hostNameEdit->setSelection(0, form->hostNameEdit->text().size());
    form->sessionOutput->setHtml(tr("&lt;not connected&gt;"));

    connect(form->hostNameEdit, SIGNAL(textChanged(QString)),
            this, SLOT(updateEnabledState()));
    connect(form->connectButton, SIGNAL(clicked()),
            this, SLOT(secureConnect()));
    connect(form->sendButton, SIGNAL(clicked()),
            this, SLOT(sendData()));

    padLock = new QToolButton;
    padLock->setIcon(QIcon(":/encrypted.png"));
    connect(padLock, SIGNAL(clicked()), this, SLOT(displayCertificateInfo()));

#if QT_CONFIG(cursor)
    padLock->setCursor(Qt::ArrowCursor);
#endif
    padLock->setToolTip(tr("Display encryption details."));

    const int extent = form->hostNameEdit->height() - 2;
    padLock->resize(extent, extent);
    padLock->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);

    QHBoxLayout *layout = new QHBoxLayout(form->hostNameEdit);
    layout->setMargin(form->hostNameEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth));
    layout->setSpacing(0);
    layout->addStretch();
    layout->addWidget(padLock);

    form->hostNameEdit->setLayout(layout);
    padLock->hide();
}
Ejemplo n.º 5
0
void SslClient::sslErrors(const QList<QSslError> &errors)
{
    QDialog errorDialog(this);
    Ui_SslErrors ui;
    ui.setupUi(&errorDialog);
    connect(ui.certificateChainButton, SIGNAL(clicked()),
            this, SLOT(displayCertificateInfo()));

    foreach (const QSslError &error, errors)
        ui.sslErrorList->addItem(error.errorString());

    executingDialog = true;
#ifdef Q_OS_SYMBIAN
    errorDialog.showMaximized();
#endif
    if (errorDialog.exec() == QDialog::Accepted)
        socket->ignoreSslErrors();
    executingDialog = false;

    // did the socket state change?
    if (socket->state() != QAbstractSocket::ConnectedState)
        socketStateChanged(socket->state());
}