~ubuntu-branches/ubuntu/wily/psi/wily-proposed

« back to all changes in this revision

Viewing changes to third-party/qca/qca-gnupg/gpgproc/gpgproc.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
namespace gpgQCAPlugin {
33
33
 
 
34
void releaseAndDeleteLater(QObject *owner, QObject *obj)
 
35
{
 
36
        obj->disconnect(owner);
 
37
        obj->setParent(0);
 
38
        obj->deleteLater();
 
39
}
 
40
 
 
41
//----------------------------------------------------------------------------
 
42
// SafeTimer
 
43
//----------------------------------------------------------------------------
 
44
SafeTimer::SafeTimer(QObject *parent) :
 
45
        QObject(parent)
 
46
{
 
47
        timer = new QTimer(this);
 
48
        connect(timer, SIGNAL(timeout()), SIGNAL(timeout()));
 
49
}
 
50
 
 
51
SafeTimer::~SafeTimer()
 
52
{
 
53
        releaseAndDeleteLater(this, timer);
 
54
}
 
55
 
 
56
int SafeTimer::interval() const
 
57
{
 
58
        return timer->interval();
 
59
}
 
60
 
 
61
bool SafeTimer::isActive() const
 
62
{
 
63
        return timer->isActive();
 
64
}
 
65
 
 
66
bool SafeTimer::isSingleShot() const
 
67
{
 
68
        return timer->isSingleShot();
 
69
}
 
70
 
 
71
void SafeTimer::setInterval(int msec)
 
72
{
 
73
        timer->setInterval(msec);
 
74
}
 
75
 
 
76
void SafeTimer::setSingleShot(bool singleShot)
 
77
{
 
78
        timer->setSingleShot(singleShot);
 
79
}
 
80
 
 
81
int SafeTimer::timerId() const
 
82
{
 
83
        return timer->timerId();
 
84
}
 
85
 
 
86
void SafeTimer::start(int msec)
 
87
{
 
88
        timer->start(msec);
 
89
}
 
90
 
 
91
void SafeTimer::start()
 
92
{
 
93
        timer->start();
 
94
}
 
95
 
 
96
void SafeTimer::stop()
 
97
{
 
98
        timer->stop();
 
99
}
 
100
 
 
101
//----------------------------------------------------------------------------
 
102
// QProcessSignalRelay
 
103
//----------------------------------------------------------------------------
34
104
class QProcessSignalRelay : public QObject
35
105
{
36
106
        Q_OBJECT
114
184
        QStringList statusLines;
115
185
        GPGProc::Error error;
116
186
        int exitCode;
117
 
        QTimer startTrigger, doneTrigger;
 
187
        SafeTimer startTrigger, doneTrigger;
118
188
 
119
189
        QByteArray pre_stdin, pre_aux;
120
190
#ifdef QPIPE_SECURE
182
252
                                proc->terminate();
183
253
                        proc->setParent(0);
184
254
#ifdef QPROC_SIGNAL_RELAY
185
 
                        delete proc_relay;
 
255
                        releaseAndDeleteLater(this, proc_relay);
186
256
                        proc_relay = 0;
187
257
                        delete proc; // should be safe to do thanks to relay
188
258
#else