Beispiel #1
0
//------------------------------------------------------------------------------
// Warn about items that will be orphaned.
//------------------------------------------------------------------------------
void CaptureForm::acceptForm(bool) {
    if (!validateForm()) {
        return;
    }
    CryptoMediator cm;
    if (cm.gpgEnabled() &&
        m_encryptCheckBox->isChecked() &&
        !cm.encrypt(*m_item)) {

        QMessageBox::StandardButton reply =  QMessageBox::critical(
            this,
            "Recap",
            tr("The encryption operation failed (%1).\n\n"
               "You can opt to save the item unencrypted anyway, discard the "
               "item or cancel to go back and re-edit it.").arg(cm.lastError()),
            QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel
        );
        switch (reply) {
            case QMessageBox::Save:
                break;
            case QMessageBox::Discard:
                reject();
                return;
            case QMessageBox::Cancel:
            default:
                return;
        }
    }
    emit requestWrite(*m_item);
    accept();
}
Beispiel #2
0
//------------------------------------------------------------------------------
// Connect all signals/slots
//------------------------------------------------------------------------------
void CaptureForm::setConnections(const QtSerializerWrapper& writer) {
    connect(m_titleEdit, SIGNAL(textEdited(QString)),
            this, SLOT(setItemTitle(QString)));

    connect(m_tagsEdit, SIGNAL(editingFinished()),
            this, SLOT(setTags()));

    connect(m_tagsBox, SIGNAL(activated(QString)),
            this, SLOT(addTag(QString)));

    connect(m_contentEdit, SIGNAL(textChanged()),
            this, SLOT(updateContentNotes()));

    connect(this, SIGNAL(requestWrite(QtItemWrapper)),
            &writer, SLOT(write(QtItemWrapper)));

    connect(m_okButton, SIGNAL(clicked(bool)),
            this, SLOT(acceptForm(bool)));

    connect(m_cancelButton, SIGNAL(clicked(bool)),
            this, SLOT(rejectForm(bool)));
}
void THttpSocket::writeRawDataFromWebSocket(const QByteArray &data)
{
    emit requestWrite(data);
}