4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-08 16:59:33 +00:00

proper object parenting

svn path=/trunk/kdesupport/qca/; revision=430634
This commit is contained in:
Justin Karneges 2005-07-02 02:01:09 +00:00
parent 10a3871258
commit 34894dd80f
6 changed files with 24 additions and 20 deletions

@ -59,7 +59,7 @@ public:
QByteArray leftover_stdout;
QByteArray leftover_stderr;
Private(GPGProc *_q) : q(_q)
Private(GPGProc *_q) : QObject(_q), q(_q), pipeAux(this), pipeCommand(this), pipeStatus(this), doneTimer(this)
{
proc = 0;
doneTimer.setSingleShot(true);
@ -411,7 +411,8 @@ private:
}
};
GPGProc::GPGProc()
GPGProc::GPGProc(QObject *parent)
:QObject(parent)
{
d = new Private(this);
}
@ -480,7 +481,7 @@ void GPGProc::start(const QString &bin, const QStringList &args, Mode mode)
QString fullcmd = fullargs.join(" ");
emit debug(QString("Running: [") + bin + ' ' + fullcmd + ']');
d->proc = new SProcess;
d->proc = new SProcess(d);
#ifdef Q_OS_UNIX
QList<int> plist;

@ -38,7 +38,7 @@ class GPGProc : public QObject
public:
enum Error { FailedToStart, UnexpectedExit, ErrorWrite };
enum Mode { NormalMode, ExtendedMode };
GPGProc();
GPGProc(QObject *parent = 0);
~GPGProc();
void reset();

@ -185,7 +185,7 @@ public:
const char *data;
int size;
QPipeWriter(Q_PIPE_ID id)
QPipeWriter(Q_PIPE_ID id, QObject *parent = 0) : QThread(parent)
{
do_quit = false;
data = 0;
@ -316,7 +316,7 @@ public:
QSocketNotifier *sn_read, *sn_write;
#endif
Private(QPipeDevice *_q) : q(_q), pipe(INVALID_Q_PIPE_ID)
Private(QPipeDevice *_q) : QObject(_q), q(_q), pipe(INVALID_Q_PIPE_ID)
{
#ifdef Q_OS_WIN
readTimer = 0;
@ -385,13 +385,13 @@ public:
setBlocking(pipe, false);
#ifdef Q_OS_WIN
// polling timer
readTimer = new QTimer;
readTimer = new QTimer(this);
connect(readTimer, SIGNAL(timeout()), SLOT(t_timeout()));
readTimer->start(100);
#endif
#ifdef Q_OS_UNIX
// socket notifier
sn_read = new QSocketNotifier(pipe, QSocketNotifier::Read);
sn_read = new QSocketNotifier(pipe, QSocketNotifier::Read, this);
connect(sn_read, SIGNAL(activated(int)), SLOT(sn_read_activated(int)));
#endif
}
@ -401,7 +401,7 @@ public:
setBlocking(pipe, false);
// socket notifier
sn_write = new QSocketNotifier(pipe, QSocketNotifier::Write);
sn_write = new QSocketNotifier(pipe, QSocketNotifier::Write, this);
connect(sn_write, SIGNAL(activated(int)), SLOT(sn_write_activated(int)));
sn_write->setEnabled(false);
#endif
@ -485,7 +485,8 @@ public slots:
}
};
QPipeDevice::QPipeDevice()
QPipeDevice::QPipeDevice(QObject *parent)
:QObject(parent)
{
d = new Private(this);
}
@ -681,7 +682,7 @@ int QPipeDevice::write(const char *data, int size)
#ifdef Q_OS_WIN
if(!d->pipeWriter)
{
d->pipeWriter = new QPipeWriter(d->pipe);
d->pipeWriter = new QPipeWriter(d->pipe, d);
connect(d->pipeWriter, SIGNAL(canWrite()), d, SLOT(pw_canWrite()));
d->pipeWriter->start();
}
@ -737,7 +738,7 @@ public:
bool closeLater;
bool closing;
Private(QPipeEnd *_q) : q(_q)
Private(QPipeEnd *_q) : QObject(_q), q(_q), pipe(this), readTrigger(this), writeTrigger(this), closeTrigger(this)
{
readTrigger.setSingleShot(true);
writeTrigger.setSingleShot(true);
@ -1019,7 +1020,8 @@ public slots:
}
};
QPipeEnd::QPipeEnd()
QPipeEnd::QPipeEnd(QObject *parent)
:QObject(parent)
{
d = new Private(this);
}
@ -1154,7 +1156,8 @@ void QPipeEnd::writeSecure(const QSecureArray &buf)
//----------------------------------------------------------------------------
// QPipe
//----------------------------------------------------------------------------
QPipe::QPipe()
QPipe::QPipe(QObject *parent)
:i(parent), o(parent)
{
}

@ -44,7 +44,7 @@ class QPipeDevice : public QObject
Q_OBJECT
public:
enum Type { Read, Write };
QPipeDevice();
QPipeDevice(QObject *parent = 0);
~QPipeDevice();
Type type() const; // Read or Write
@ -79,7 +79,7 @@ class QPipeEnd : public QObject
Q_OBJECT
public:
enum Error { ErrorEOF, ErrorBroken };
QPipeEnd();
QPipeEnd(QObject *parent = 0);
~QPipeEnd();
void reset();
@ -131,7 +131,7 @@ private:
class QPipe
{
public:
QPipe();
QPipe(QObject *parent = 0);
~QPipe();
void reset();

@ -28,8 +28,8 @@ namespace gpgQCAPlugin {
//----------------------------------------------------------------------------
// SProcess
//----------------------------------------------------------------------------
SProcess::SProcess()
:QProcess()
SProcess::SProcess(QObject *parent)
:QProcess(parent)
{
}

@ -28,7 +28,7 @@ class SProcess : public QProcess
{
Q_OBJECT
public:
SProcess();
SProcess(QObject *parent = 0);
~SProcess();
#ifdef Q_OS_UNIX