Source Code (Use browser search to find items of interest.)

Class Index

empath'EmpathSecurityProcess (./kdepim/empath/lib/EmpathSecurityProcess.h:44)

class EmpathSecurityProcess : public QObject
{
    Q_OBJECT
    
    public:
        
        ~EmpathSecurityProcess();

        /**
         * Encrypt s to r. This will not ask for passphrase.
         * A connection will be made to parent's slot 's_encryptDone()'
         */
        static void encrypt
            (const QCString & s, const QCString & r, QObject * parent);

        /**
         * Encrypt and sign s to r. This will ask for passphrase.
         * A connection will be made to parent's slot 's_encryptAndSignDone()'
         */
        static void encryptAndSign
            (const QCString & s, const QCString & r, QObject * parent);
        
        /**
         * Decrypt s.
         * A connection will be made to parent's slot 's_decryptDone()'
         */
        static void decrypt
            (const QCString & s, QObject * parent);
        
    protected slots:

        void s_pgpFinished(KProcess *);
        void s_pgpSentOutput(KProcess *, char *, int);
        void s_pgpSentError(KProcess *, char *, int);
        
    signals:
        
        void done(bool, QCString);
        
    private:
        
        EmpathSecurityProcess();

        void _encrypt            (const QCString &, const QCString &, QObject *);
        void _encryptAndSign    (const QCString &, const QCString &, QObject *);
        void _decrypt            (const QCString &, QObject *);

        KShellProcess p;
        
        QCString outputStr_;
        QCString errorStr_;
};

// vim:ts=4:sw=4:tw=78

empath'EmpathSecurityProcess::EmpathSecurityProcess() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:39)

EmpathSecurityProcess::EmpathSecurityProcess()
{
    empathDebug("ctor");

    QObject::connect(&p, SIGNAL(receivedStdout(KProcess *, char *, int)),
            this, SLOT(s_pgpSentOutput(KProcess *, char *, int)));

    QObject::connect(&p, SIGNAL(receivedStderr(KProcess *, char *, int)),
            this, SLOT(s_pgpSentError(KProcess *, char *, int)));

    QObject::connect(&p, SIGNAL(processExited(KProcess *)),
        this, SLOT(s_pgpFinished(KProcess *)));
}


empath'EmpathSecurityProcess::~EmpathSecurityProcess() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:53)

EmpathSecurityProcess::~EmpathSecurityProcess()
{
    empathDebug("dtor");
    p.kill();
}

    void

empath'EmpathSecurityProcess::encrypt() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:60)

EmpathSecurityProcess::encrypt(
    const QCString & s, const QCString & r, QObject * parent)
{
    EmpathSecurityProcess * p = new EmpathSecurityProcess;
    CHECK_PTR(p);

    p->_encrypt(s, r, parent);
}

    void

empath'EmpathSecurityProcess::encryptAndSign() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:70)

EmpathSecurityProcess::encryptAndSign(
    const QCString & s, const QCString & r, QObject * parent)
{
    EmpathSecurityProcess * p = new EmpathSecurityProcess;
    CHECK_PTR(p);

    p->_encryptAndSign(s, r, parent);
}

    void

empath'EmpathSecurityProcess::decrypt() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:80)

EmpathSecurityProcess::decrypt(const QCString & s, QObject * parent)
{
    EmpathSecurityProcess * p = new EmpathSecurityProcess;
    CHECK_PTR(p);
    
    p->_decrypt(s, parent);
}

    void

empath'EmpathSecurityProcess::s_pgpFinished() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:89)

EmpathSecurityProcess::s_pgpFinished(KProcess * p)
{
    emit(done(p->normalExit(), outputStr_));
    delete this;
}

    void

empath'EmpathSecurityProcess::s_pgpSentOutput() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:96)

EmpathSecurityProcess::s_pgpSentOutput(KProcess *, char * s, int)
{
    outputStr_ += s;
}

    void

empath'EmpathSecurityProcess::s_pgpSentError() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:102)

EmpathSecurityProcess::s_pgpSentError(KProcess *, char * s, int)
{
    errorStr_ = s;
}

    void

empath'EmpathSecurityProcess::_encrypt() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:108)

EmpathSecurityProcess::_encrypt(
    const QCString &, const QCString & recipient, QObject * parent)
{
    p    << "pgpe -atf +batchmode=1 -r " << recipient;

    QObject::connect(
        this,    SIGNAL(done(bool, QCString)),
        parent,    SLOT(s_encryptDone(bool, QCString)));
    
    if (!p.start(KProcess::NotifyOnExit, KProcess::All)) {
        empathDebug("Couldn't start pgp process");
        emit(done(false, ""));
        delete this;
    }
}
    
    void

empath'EmpathSecurityProcess::_encryptAndSign() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:125)

EmpathSecurityProcess::_encryptAndSign(
    const QCString &, const QCString & recipient, QObject * parent)
{
    p    << "pgpe -atf +batchmode=1 -s -r " << recipient;

    QObject::connect(
    this,    SIGNAL(done(bool, QCString)),
    parent,    SLOT(s_encryptAndSignDone(bool, QCString)));

    bool ok(false);

    // This makes us rely on kdeui !
    // Need to use EmpathUI to get this.
    QString passphrase; // =
#if 0
        KLineEditDlg::getText(
            i18n("PGP passphrase"),
            QString::null,
            &ok,
            static_cast<QWidget *>(0L)
        );
#endif
    
    if (!ok || passphrase.isEmpty()) {
        emit(done(false, ""));
        delete this;
    }
    
    if (!p.start(KProcess::NotifyOnExit, KProcess::All)) {
        empathDebug("Couldn't start pgp process");
        emit(done(false, ""));
        delete this;
    }

    setenv("PGPPASSFD", "0", 1);
}

    void

empath'EmpathSecurityProcess::_decrypt() (./kdepim/empath/lib/EmpathSecurityProcess.cpp:163)

EmpathSecurityProcess::_decrypt(
    const QCString &, QObject * parent)
{
    p    << "pgpv -f -z";
    
    QObject::connect(
        this,    SIGNAL(done(bool, QCString)),
        parent,    SLOT(s_decryptDone(bool, QCString)));
    
    if (!p.start(KProcess::NotifyOnExit, KProcess::All)) {
        empathDebug("Couldn't start pgp process");
        emit(done(false, ""));
        delete this;
    }
}

// vim:ts=4:sw=4:tw=78