From af644c020106e7096d4fe9c648f25eede98c972f Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 15 Dec 2024 22:06:44 +0900 Subject: Rename class KProcIO to TDEProcIO Signed-off-by: Michele Calgaro --- TODO | 2 +- kate/part/katedialogs.cpp | 8 +- kate/part/katedialogs.h | 4 +- tdecore/CMakeLists.txt | 4 +- tdecore/MAINTAINERS | 2 +- tdecore/Makefile.am | 4 +- tdecore/README.exec | 4 +- tdecore/kdebug.areas | 2 +- tdecore/kprocio.cpp | 276 -------------------------------------- tdecore/kprocio.h | 217 ------------------------------ tdecore/tdeprocess.h | 2 +- tdecore/tdeprocio.cpp | 276 ++++++++++++++++++++++++++++++++++++++ tdecore/tdeprocio.h | 216 +++++++++++++++++++++++++++++ tdecore/tests/CMakeLists.txt | 2 +- tdecore/tests/Makefile.am | 6 +- tdecore/tests/kprociotest.cpp | 65 --------- tdecore/tests/kprociotest.h | 42 ------ tdecore/tests/tdeprociotest.cpp | 65 +++++++++ tdecore/tests/tdeprociotest.h | 42 ++++++ tdeio/misc/kpac/discovery.cpp | 6 +- tdeio/misc/kpac/discovery.h | 4 +- tdeio/tdefile/tdefilesharedlg.cpp | 2 +- tdeio/tdeio/tdefileshare.cpp | 4 +- tdenewstuff/security.cpp | 20 +-- tdenewstuff/security.h | 4 +- tdeui/kedittoolbar.cpp | 6 +- tdeui/tdespell.cpp | 32 ++--- tdeui/tdespell.h | 16 +-- win/pro_files/tdecore/tdecore.pro | 2 +- 29 files changed, 667 insertions(+), 668 deletions(-) delete mode 100644 tdecore/kprocio.cpp delete mode 100644 tdecore/kprocio.h create mode 100644 tdecore/tdeprocio.cpp create mode 100644 tdecore/tdeprocio.h delete mode 100644 tdecore/tests/kprociotest.cpp delete mode 100644 tdecore/tests/kprociotest.h create mode 100644 tdecore/tests/tdeprociotest.cpp create mode 100644 tdecore/tests/tdeprociotest.h diff --git a/TODO b/TODO index e52b16202..c52d8aaf6 100644 --- a/TODO +++ b/TODO @@ -148,7 +148,7 @@ that we would like to make for the next binary incompatible release. - do something about the NoRead comm mode - add setComm(); remove comm arg from start(). as a side effect, this will allow for using writeStdin() in Block mode. - - merge KProcIO into TDEProcess; add setBuffered() for separate channels. + - merge TDEProcIO into TDEProcess; add setBuffered() for separate channels. - use QByteArray for writeStdin(). better than the buf+len arg, as it is ref-counted. - To discuss: Migrate the about dialog to use qhtml or tdehtml rather then the current diff --git a/kate/part/katedialogs.cpp b/kate/part/katedialogs.cpp index 2627e0ade..f3de71d8b 100644 --- a/kate/part/katedialogs.cpp +++ b/kate/part/katedialogs.cpp @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include #include #include @@ -1636,11 +1636,11 @@ KateModOnHdPrompt::~KateModOnHdPrompt() void KateModOnHdPrompt::slotDiff() { // Start a TDEProcess that creates a diff - KProcIO *p = new KProcIO(); + TDEProcIO *p = new TDEProcIO(); p->setComm( TDEProcess::All ); *p << "diff" << "-u" << "-" << m_doc->url().path(); connect( p, TQ_SIGNAL(processExited(TDEProcess*)), this, TQ_SLOT(slotPDone(TDEProcess*)) ); - connect( p, TQ_SIGNAL(readReady(KProcIO*)), this, TQ_SLOT(slotPRead(KProcIO*)) ); + connect( p, TQ_SIGNAL(readReady(TDEProcIO*)), this, TQ_SLOT(slotPRead(TDEProcIO*)) ); setCursor( WaitCursor ); @@ -1653,7 +1653,7 @@ void KateModOnHdPrompt::slotDiff() p->closeWhenDone(); } -void KateModOnHdPrompt::slotPRead( KProcIO *p) +void KateModOnHdPrompt::slotPRead( TDEProcIO *p) { // create a file for the diff if we haven't one allready if ( ! m_tmpfile ) diff --git a/kate/part/katedialogs.h b/kate/part/katedialogs.h index b4b4eb137..32d7cfccd 100644 --- a/kate/part/katedialogs.h +++ b/kate/part/katedialogs.h @@ -359,7 +359,7 @@ class KateHlDownloadDialog: public KDialogBase void slotUser1(); }; -class KProcIO; +class TDEProcIO; class TDEProcess; /** * This dialog will prompt the user for what do with a file that is @@ -393,7 +393,7 @@ class KateModOnHdPrompt : public KDialogBase void slotUser1(); private slots: - void slotPRead(KProcIO*); ///< Read from the diff process + void slotPRead(TDEProcIO*); ///< Read from the diff process void slotPDone(TDEProcess*); ///< Runs the diff file when done private: diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index f56a92aca..021d650ae 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -64,7 +64,7 @@ install( FILES krandomsequence.h knotifyclient.h kiconeffect.h kaudioplayer.h kdcoppropertyproxy.h netwm.h tdeaccelmanager.h netwm_def.h kpixmapprovider.h kunload.h kstaticdeleter.h kextsock.h - kextendedsocket.h ksockaddr.h kprocio.h kasyncio.h kbufferedio.h + kextendedsocket.h ksockaddr.h tdeprocio.h kasyncio.h kbufferedio.h kurldrag.h kmimesourcefactory.h kmdcodec.h ksocks.h tdesycoca.h tdesycocaentry.h tdesycocatype.h kxmessages.h tdestartupinfo.h klargefile.h tdemultipledrag.h kgenericfactory.h kgenericfactory.tcc @@ -121,7 +121,7 @@ set( ${target}_SRCS krandomsequence.cpp kstringhandler.cpp kcompletion.cpp tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp kaudioplayer.cpp kdcoppropertyproxy.cpp ksockaddr.cpp - kextsock.cpp netsupp.cpp kprocio.cpp kbufferedio.cpp + kextsock.cpp netsupp.cpp tdeprocio.cpp kbufferedio.cpp kpixmapprovider.cpp kurldrag.cpp kmdcodec.cpp ksocks.cpp fakes.c vsnprintf.c tdesycoca.cpp tdesycocadict.cpp tdesycoca.skel tdesycocafactory.cpp kxmessages.cpp tdestartupinfo.cpp diff --git a/tdecore/MAINTAINERS b/tdecore/MAINTAINERS index 1bc8f7a8c..3b4bae7cf 100644 --- a/tdecore/MAINTAINERS +++ b/tdecore/MAINTAINERS @@ -50,7 +50,7 @@ kpalette.cpp Waldo Bastian kpixmapprovider.cpp Carsten Pfeiffer tdeprocctrl.cpp Waldo Bastian tdeprocess.cpp Waldo Bastian -kprocio.cpp Waldo Bastian +tdeprocio.cpp Waldo Bastian krandomsequence.cpp Waldo Bastian kregexp.cpp krfcdate.cpp Waldo Bastian diff --git a/tdecore/Makefile.am b/tdecore/Makefile.am index d30506507..35aa6f6f3 100644 --- a/tdecore/Makefile.am +++ b/tdecore/Makefile.am @@ -51,7 +51,7 @@ include_HEADERS = tdeconfig.h tdeconfigskeleton.h \ krandomsequence.h knotifyclient.h kiconeffect.h \ kaudioplayer.h kdcoppropertyproxy.h netwm.h tdeaccelmanager.h \ netwm_def.h kpixmapprovider.h kunload.h kstaticdeleter.h \ - kextsock.h kextendedsocket.h ksockaddr.h kprocio.h kasyncio.h \ + kextsock.h kextendedsocket.h ksockaddr.h tdeprocio.h kasyncio.h \ kbufferedio.h kurldrag.h kmimesourcefactory.h kmdcodec.h ksocks.h \ tdesycoca.h tdesycocaentry.h tdesycocatype.h kxmessages.h tdestartupinfo.h \ klargefile.h tdemultipledrag.h kgenericfactory.h kgenericfactory.tcc \ @@ -105,7 +105,7 @@ libtdecore_la_SOURCES = libintl.cpp tdeapplication.cpp \ ksavefile.cpp krandomsequence.cpp kstringhandler.cpp kcompletion.cpp \ tdecmdlineargs.cpp tdeaboutdata.cpp kcompletionbase.cpp knotifyclient.cpp \ kaudioplayer.cpp kdcoppropertyproxy.cpp \ - ksockaddr.cpp kextsock.cpp netsupp.cpp kprocio.cpp kbufferedio.cpp \ + ksockaddr.cpp kextsock.cpp netsupp.cpp tdeprocio.cpp kbufferedio.cpp \ kpixmapprovider.cpp kurldrag.cpp \ kmdcodec.cpp ksocks.cpp fakes.c vsnprintf.c \ tdesycoca.cpp tdesycocadict.cpp tdesycocafactory.cpp tdesycoca.skel \ diff --git a/tdecore/README.exec b/tdecore/README.exec index d47c808e9..6ddf1aef4 100644 --- a/tdecore/README.exec +++ b/tdecore/README.exec @@ -16,9 +16,9 @@ child of your process, e.g. because you want to catch stdout/stderr or need to send it data via stdin. You should never use this to start other KDE applications unless your application is called kgdb :-) If you need to send/receive text like data to/from the process, you are probably better -off with KProcIO +off with TDEProcIO -3. KProcIO +3. TDEProcIO Like TDEProcess. Unlike TDEProcess, this class actually makes it easy to send data to and receive data from the process. diff --git a/tdecore/kdebug.areas b/tdecore/kdebug.areas index 24c87f524..e71455362 100644 --- a/tdecore/kdebug.areas +++ b/tdecore/kdebug.areas @@ -18,7 +18,7 @@ 171 tdecore (KSocks) 172 tdecore (TDEStartupInfo) 173 tdecore (TDELocale) -174 tdecore (KProcIO) +174 tdecore (TDEProcIO) 175 tdecore (TDEProcess) 176 tdecore (KWin) 177 tdecore (TDEConfigSkeleton) diff --git a/tdecore/kprocio.cpp b/tdecore/kprocio.cpp deleted file mode 100644 index aac14a09e..000000000 --- a/tdecore/kprocio.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 David Sweet - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// $Id$ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#include "kprocio.h" - -#include -#include - -class KProcIOPrivate { -public: - KProcIOPrivate() : comm(TDEProcess::All) {} - TDEProcess::Communication comm; -}; - -KProcIO::KProcIO ( TQTextCodec *_codec) - : codec(_codec), d(new KProcIOPrivate) -{ - rbi=0; - readsignalon=writeready=true; - outbuffer.setAutoDelete(true); - - if (!codec) - { - codec = TQTextCodec::codecForName("ISO 8859-1"); - if (!codec) - { - kdError(174) << "Can't create ISO 8859-1 codec!" << endl; - } - } -} - -KProcIO::~KProcIO() -{ - delete d; -} - -void -KProcIO::resetAll () -{ - if (isRunning()) - kill(); - - clearArguments(); - rbi=0; - readsignalon=writeready=true; - - disconnect (this, TQ_SIGNAL (receivedStdout (TDEProcess *, char *, int)), - this, TQ_SLOT (received (TDEProcess *, char *, int))); - - disconnect (this, TQ_SIGNAL (receivedStderr (TDEProcess *, char *, int)), - this, TQ_SLOT (received (TDEProcess *, char *, int))); - - disconnect (this, TQ_SIGNAL (wroteStdin(TDEProcess *)), - this, TQ_SLOT (sent (TDEProcess *))); - - outbuffer.clear(); - -} - -void KProcIO::setComm (Communication comm) -{ - d->comm = comm; -} - -bool KProcIO::start (RunMode runmode, bool includeStderr) -{ - connect (this, TQ_SIGNAL (receivedStdout (TDEProcess *, char *, int)), - this, TQ_SLOT (received (TDEProcess *, char *, int))); - - if (includeStderr) - { - connect (this, TQ_SIGNAL (receivedStderr (TDEProcess *, char *, int)), - this, TQ_SLOT (received (TDEProcess *, char *, int))); - } - - connect (this, TQ_SIGNAL (wroteStdin(TDEProcess *)), - this, TQ_SLOT (sent (TDEProcess *))); - - return TDEProcess::start (runmode, d->comm); -} - -bool KProcIO::writeStdin (const TQString &line, bool appendnewline) -{ - return writeStdin(TQCString(codec->fromUnicode(line)), appendnewline); -} - -bool KProcIO::writeStdin (const TQCString &line, bool appendnewline) -{ - TQCString *qs = new TQCString(line); - - if (appendnewline) - { - *qs += '\n'; - } - - int l = qs->length(); - if (!l) - { - delete qs; - return true; - } - - TQByteArray *b = (TQByteArray *) qs; - b->truncate(l); // Strip trailing null - - outbuffer.append(b); - - if (writeready) - { - writeready=false; - return TDEProcess::writeStdin( b->data(), b->size() ); - } - return true; -} - -bool KProcIO::writeStdin(const TQByteArray &data) -{ - if (!data.size()) - return true; - TQByteArray *b = new TQByteArray(data); - outbuffer.append(b); - - if (writeready) - { - writeready=false; - return TDEProcess::writeStdin( b->data(), b->size() ); - } - return true; -} - -void KProcIO::closeWhenDone() -{ - if (writeready) - { - closeStdin(); - return; - } - outbuffer.append(0); - - return; -} - -void KProcIO::sent(TDEProcess *) -{ - outbuffer.removeFirst(); - - if (outbuffer.count()==0) - { - writeready=true; - } - else - { - TQByteArray *b = outbuffer.first(); - if (!b) - { - closeStdin(); - } - else - { - TDEProcess::writeStdin(b->data(), b->size()); - } - } - -} - -void KProcIO::received (TDEProcess *, char *buffer, int buflen) -{ - recvbuffer += TQCString(buffer, buflen+1); - - controlledEmission(); -} - -void KProcIO::ackRead () -{ - readsignalon=true; - if (needreadsignal || recvbuffer.length()!=0) - controlledEmission(); -} - -void KProcIO::controlledEmission () -{ - if (readsignalon) - { - needreadsignal=false; - readsignalon=false; //will stay off until read is acknowledged - emit readReady (this); - } - else - { - needreadsignal=true; - } -} - -void KProcIO::enableReadSignals (bool enable) -{ - readsignalon=enable; - - if (enable && needreadsignal) - emit readReady (this); -} - -int KProcIO::readln (TQString &line, bool autoAck, bool *partial) -{ - int len; - - if (autoAck) - readsignalon=true; - - //need to reduce the size of recvbuffer at some point... - - len=recvbuffer.find ('\n',rbi)-rbi; - - //kdDebug(174) << "KPIO::readln" << endl; - - //in case there's no '\n' at the end of the buffer - if ((len<0) && - ((unsigned int)rbi=0) - { - line = codec->toUnicode(recvbuffer.mid(rbi,len), len); - rbi += len+1; - if (partial) - *partial = false; - return len; - } - - recvbuffer=""; - rbi=0; - - //-1 on return signals "no more data" not error - return -1; - -} - -void KProcIO::virtual_hook( int id, void* data ) -{ TDEProcess::virtual_hook( id, data ); } - -#include "kprocio.moc" - diff --git a/tdecore/kprocio.h b/tdecore/kprocio.h deleted file mode 100644 index 02a3257d5..000000000 --- a/tdecore/kprocio.h +++ /dev/null @@ -1,217 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 David Sweet - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License version 2 as published by the Free Software Foundation. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KPROCIO_H_ -#define KPROCIO_H_ - -#include -#include -#include -#include "tdelibs_export.h" - -class KProcIOPrivate; -class TQTextCodec; - -/** - * KProcIO - * - * This class provides a slightly simpler interface to the communication - * functions provided by TDEProcess. The simplifications are: - * @li The buffer for a write is copied to an internal KProcIO - * buffer and maintained/freed appropriately. There is no need - * to be concerned with wroteStdin() signals _at_all_. - * @li readln() reads a line of data and buffers any leftovers. - * @li Conversion from/to unicode. - * - * Basically, KProcIO gives you buffered I/O similar to fgets()/fputs(). - * - * Aside from these, and the fact that start() takes different - * parameters, use this class just like TDEProcess. - * - * @author David Sweet - * @short A slightly simpler interface to TDEProcess - **/ - - -class TDECORE_EXPORT KProcIO : public TDEProcess -{ - TQ_OBJECT - -public: - /** - * Constructor - */ - KProcIO ( TQTextCodec *codec = 0 ); - - /** - * Destructor - */ - ~KProcIO(); - - /** - * Sets the communication mode to be passed to TDEProcess::start() - * by start(). The default communication mode is TDEProcess::All. - * You probably want to use this function in conjunction with - * TDEProcess::setUsePty(). - * @param comm the communication mode - */ - void setComm (Communication comm); - - /** - * Starts the process. It will fail in the following cases: - * @li The process is already running. - * @li The command line argument list is empty. - * @li The starting of the process failed (could not fork). - * @li The executable was not found. - * - * @param runmode For a detailed description of the - * various run modes, have a look at the - * general description of the TDEProcess class. - * @param includeStderr If true, data from both stdout and stderr is - * listened to. If false, only stdout is listened to. - * @return true on success, false on error. - **/ - bool start (RunMode runmode = NotifyOnExit, bool includeStderr = false); - - /** - * Writes text to stdin of the process. - * @param line Text to write. - * @param appendnewline if true, a newline '\\n' is appended. - * @return true if successful, false otherwise - **/ - bool writeStdin(const TQString &line, bool appendnewline=true); - - /** - * Writes text to stdin of the process. - * @param line Text to write. - * @param appendnewline if true, a newline '\\n' is appended. - * @return true if successful, false otherwise - **/ - bool writeStdin(const TQCString &line, bool appendnewline); - - /** - * Writes data to stdin of the process. - * @param data Data to write. - * @return true if successful, false otherwise - **/ - bool writeStdin(const TQByteArray &data); - - //I like fputs better -- it's the same as writeStdin - //inline - /** - * This function just calls writeStdin(). - * - * @param line Text to write. - * @param AppendNewLine if true, a newline '\\n' is appended. - * @return true if successful, false otherwise - * @deprecated - **/ - TDE_DEPRECATED bool fputs (const TQString &line, bool AppendNewLine=true) - { return writeStdin(line, AppendNewLine); } - - /** - * Closes stdin after all data has been send. - */ - void closeWhenDone(); - - /** - * Reads a line of text (up to and including '\\n'). - * - * Use readln() in response to a readReady() signal. - * You may use it multiple times if more than one line of data is - * available. - * Be sure to use ackRead() when you have finished processing the - * readReady() signal. This informs KProcIO that you are ready for - * another readReady() signal. - * - * readln() never blocks. - * - * autoAck==true makes these functions call ackRead() for you. - * - * @param line is used to store the line that was read. - * @param autoAck when true, ackRead() is called for you. - * @param partial when provided the line is returned - * even if it does not contain a '\\n'. *partial will be set to - * false if the line contains a '\\n' and false otherwise. - * @return the number of characters read, or -1 if no data is available. - **/ - int readln (TQString &line, bool autoAck=true, bool *partial=0); - - /** - * This function calls readln(). - * @param line is used to store the line that was read. - * @param autoAck when true, ackRead() is called for you. - * @return the number of characters read, or -1 if no data is available. - * @deprecated use readln. Note that it has an inverted autoAck default, - * though. - **/ - TDE_DEPRECATED int fgets (TQString &line, bool autoAck=false) - { return readln (line, autoAck); } - - /** - * Reset the class. Doesn't kill the process. - **/ - void resetAll (); - - /** - * Call this after you have finished processing a readReady() - * signal. This call need not be made in the slot that was signalled - * by readReady(). You won't receive any more readReady() signals - * until you acknowledge with ackRead(). This prevents your slot - * from being reentered while you are still processing the current - * data. If this doesn't matter, then call ackRead() right away in - * your readReady()-processing slot. - **/ - void ackRead (); - - /** - * Turns readReady() signals on and off. - * You can turn this off at will and not worry about losing any data. - * (as long as you turn it back on at some point...) - * @param enable true to turn the signals on, false to turn them off - */ - void enableReadSignals (bool enable); - -signals: - /** - * Emitted when the process is ready for reading. - * @param pio the process that emitted the signal - * @see enableReadSignals() - */ - void readReady(KProcIO *pio); - -protected: - TQPtrList outbuffer; - TQCString recvbuffer; - TQTextCodec *codec; - int rbi; - bool needreadsignal, readsignalon, writeready; - - void controlledEmission (); - -protected slots: - void received (TDEProcess *proc, char *buffer, int buflen); - void sent (TDEProcess *); - -protected: - virtual void virtual_hook( int id, void* data ); -private: - KProcIOPrivate *d; -}; - -#endif // KPROCIO_H_ - diff --git a/tdecore/tdeprocess.h b/tdecore/tdeprocess.h index 658571ce7..a6329f147 100644 --- a/tdecore/tdeprocess.h +++ b/tdecore/tdeprocess.h @@ -47,7 +47,7 @@ class KPty; * This class allows a KDE application to start child processes without having * to worry about UN*X signal handling issues and zombie process reaping. * - * @see KProcIO + * @see TDEProcIO * * Basically, this class distinguishes three different ways of running * child processes: diff --git a/tdecore/tdeprocio.cpp b/tdecore/tdeprocio.cpp new file mode 100644 index 000000000..e614148c5 --- /dev/null +++ b/tdecore/tdeprocio.cpp @@ -0,0 +1,276 @@ +/* This file is part of the KDE libraries + Copyright (C) 1997 David Sweet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +// $Id$ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "tdeprocio.h" + +#include +#include + +class TDEProcIOPrivate { +public: + TDEProcIOPrivate() : comm(TDEProcess::All) {} + TDEProcess::Communication comm; +}; + +TDEProcIO::TDEProcIO ( TQTextCodec *_codec) + : codec(_codec), d(new TDEProcIOPrivate) +{ + rbi=0; + readsignalon=writeready=true; + outbuffer.setAutoDelete(true); + + if (!codec) + { + codec = TQTextCodec::codecForName("ISO 8859-1"); + if (!codec) + { + kdError(174) << "Can't create ISO 8859-1 codec!" << endl; + } + } +} + +TDEProcIO::~TDEProcIO() +{ + delete d; +} + +void +TDEProcIO::resetAll () +{ + if (isRunning()) + kill(); + + clearArguments(); + rbi=0; + readsignalon=writeready=true; + + disconnect (this, TQ_SIGNAL (receivedStdout (TDEProcess *, char *, int)), + this, TQ_SLOT (received (TDEProcess *, char *, int))); + + disconnect (this, TQ_SIGNAL (receivedStderr (TDEProcess *, char *, int)), + this, TQ_SLOT (received (TDEProcess *, char *, int))); + + disconnect (this, TQ_SIGNAL (wroteStdin(TDEProcess *)), + this, TQ_SLOT (sent (TDEProcess *))); + + outbuffer.clear(); + +} + +void TDEProcIO::setComm (Communication comm) +{ + d->comm = comm; +} + +bool TDEProcIO::start (RunMode runmode, bool includeStderr) +{ + connect (this, TQ_SIGNAL (receivedStdout (TDEProcess *, char *, int)), + this, TQ_SLOT (received (TDEProcess *, char *, int))); + + if (includeStderr) + { + connect (this, TQ_SIGNAL (receivedStderr (TDEProcess *, char *, int)), + this, TQ_SLOT (received (TDEProcess *, char *, int))); + } + + connect (this, TQ_SIGNAL (wroteStdin(TDEProcess *)), + this, TQ_SLOT (sent (TDEProcess *))); + + return TDEProcess::start (runmode, d->comm); +} + +bool TDEProcIO::writeStdin (const TQString &line, bool appendnewline) +{ + return writeStdin(TQCString(codec->fromUnicode(line)), appendnewline); +} + +bool TDEProcIO::writeStdin (const TQCString &line, bool appendnewline) +{ + TQCString *qs = new TQCString(line); + + if (appendnewline) + { + *qs += '\n'; + } + + int l = qs->length(); + if (!l) + { + delete qs; + return true; + } + + TQByteArray *b = (TQByteArray *) qs; + b->truncate(l); // Strip trailing null + + outbuffer.append(b); + + if (writeready) + { + writeready=false; + return TDEProcess::writeStdin( b->data(), b->size() ); + } + return true; +} + +bool TDEProcIO::writeStdin(const TQByteArray &data) +{ + if (!data.size()) + return true; + TQByteArray *b = new TQByteArray(data); + outbuffer.append(b); + + if (writeready) + { + writeready=false; + return TDEProcess::writeStdin( b->data(), b->size() ); + } + return true; +} + +void TDEProcIO::closeWhenDone() +{ + if (writeready) + { + closeStdin(); + return; + } + outbuffer.append(0); + + return; +} + +void TDEProcIO::sent(TDEProcess *) +{ + outbuffer.removeFirst(); + + if (outbuffer.count()==0) + { + writeready=true; + } + else + { + TQByteArray *b = outbuffer.first(); + if (!b) + { + closeStdin(); + } + else + { + TDEProcess::writeStdin(b->data(), b->size()); + } + } + +} + +void TDEProcIO::received (TDEProcess *, char *buffer, int buflen) +{ + recvbuffer += TQCString(buffer, buflen+1); + + controlledEmission(); +} + +void TDEProcIO::ackRead () +{ + readsignalon=true; + if (needreadsignal || recvbuffer.length()!=0) + controlledEmission(); +} + +void TDEProcIO::controlledEmission () +{ + if (readsignalon) + { + needreadsignal=false; + readsignalon=false; //will stay off until read is acknowledged + emit readReady (this); + } + else + { + needreadsignal=true; + } +} + +void TDEProcIO::enableReadSignals (bool enable) +{ + readsignalon=enable; + + if (enable && needreadsignal) + emit readReady (this); +} + +int TDEProcIO::readln (TQString &line, bool autoAck, bool *partial) +{ + int len; + + if (autoAck) + readsignalon=true; + + //need to reduce the size of recvbuffer at some point... + + len=recvbuffer.find ('\n',rbi)-rbi; + + //kdDebug(174) << "KPIO::readln" << endl; + + //in case there's no '\n' at the end of the buffer + if ((len<0) && + ((unsigned int)rbi=0) + { + line = codec->toUnicode(recvbuffer.mid(rbi,len), len); + rbi += len+1; + if (partial) + *partial = false; + return len; + } + + recvbuffer=""; + rbi=0; + + //-1 on return signals "no more data" not error + return -1; + +} + +void TDEProcIO::virtual_hook( int id, void* data ) +{ TDEProcess::virtual_hook( id, data ); } + +#include "tdeprocio.moc" + diff --git a/tdecore/tdeprocio.h b/tdecore/tdeprocio.h new file mode 100644 index 000000000..d7394b8b1 --- /dev/null +++ b/tdecore/tdeprocio.h @@ -0,0 +1,216 @@ +/* This file is part of the TDE libraries + Copyright (C) 1997 David Sweet + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef TDEPROCIO_H_ +#define TDEPROCIO_H_ + +#include +#include +#include +#include "tdelibs_export.h" + +class TDEProcIOPrivate; +class TQTextCodec; + +/** + * TDEProcIO + * + * This class provides a slightly simpler interface to the communication + * functions provided by TDEProcess. The simplifications are: + * @li The buffer for a write is copied to an internal TDEProcIO + * buffer and maintained/freed appropriately. There is no need + * to be concerned with wroteStdin() signals _at_all_. + * @li readln() reads a line of data and buffers any leftovers. + * @li Conversion from/to unicode. + * + * Basically, TDEProcIO gives you buffered I/O similar to fgets()/fputs(). + * + * Aside from these, and the fact that start() takes different + * parameters, use this class just like TDEProcess. + * + * @author David Sweet + * @short A slightly simpler interface to TDEProcess + **/ + + +class TDECORE_EXPORT TDEProcIO : public TDEProcess +{ + TQ_OBJECT + +public: + /** + * Constructor + */ + TDEProcIO ( TQTextCodec *codec = 0 ); + + /** + * Destructor + */ + ~TDEProcIO(); + + /** + * Sets the communication mode to be passed to TDEProcess::start() + * by start(). The default communication mode is TDEProcess::All. + * You probably want to use this function in conjunction with + * TDEProcess::setUsePty(). + * @param comm the communication mode + */ + void setComm (Communication comm); + + /** + * Starts the process. It will fail in the following cases: + * @li The process is already running. + * @li The command line argument list is empty. + * @li The starting of the process failed (could not fork). + * @li The executable was not found. + * + * @param runmode For a detailed description of the + * various run modes, have a look at the + * general description of the TDEProcess class. + * @param includeStderr If true, data from both stdout and stderr is + * listened to. If false, only stdout is listened to. + * @return true on success, false on error. + **/ + bool start (RunMode runmode = NotifyOnExit, bool includeStderr = false); + + /** + * Writes text to stdin of the process. + * @param line Text to write. + * @param appendnewline if true, a newline '\\n' is appended. + * @return true if successful, false otherwise + **/ + bool writeStdin(const TQString &line, bool appendnewline=true); + + /** + * Writes text to stdin of the process. + * @param line Text to write. + * @param appendnewline if true, a newline '\\n' is appended. + * @return true if successful, false otherwise + **/ + bool writeStdin(const TQCString &line, bool appendnewline); + + /** + * Writes data to stdin of the process. + * @param data Data to write. + * @return true if successful, false otherwise + **/ + bool writeStdin(const TQByteArray &data); + + //I like fputs better -- it's the same as writeStdin + //inline + /** + * This function just calls writeStdin(). + * + * @param line Text to write. + * @param AppendNewLine if true, a newline '\\n' is appended. + * @return true if successful, false otherwise + * @deprecated + **/ + TDE_DEPRECATED bool fputs (const TQString &line, bool AppendNewLine=true) + { return writeStdin(line, AppendNewLine); } + + /** + * Closes stdin after all data has been send. + */ + void closeWhenDone(); + + /** + * Reads a line of text (up to and including '\\n'). + * + * Use readln() in response to a readReady() signal. + * You may use it multiple times if more than one line of data is + * available. + * Be sure to use ackRead() when you have finished processing the + * readReady() signal. This informs TDEProcIO that you are ready for + * another readReady() signal. + * + * readln() never blocks. + * + * autoAck==true makes these functions call ackRead() for you. + * + * @param line is used to store the line that was read. + * @param autoAck when true, ackRead() is called for you. + * @param partial when provided the line is returned + * even if it does not contain a '\\n'. *partial will be set to + * false if the line contains a '\\n' and false otherwise. + * @return the number of characters read, or -1 if no data is available. + **/ + int readln (TQString &line, bool autoAck=true, bool *partial=0); + + /** + * This function calls readln(). + * @param line is used to store the line that was read. + * @param autoAck when true, ackRead() is called for you. + * @return the number of characters read, or -1 if no data is available. + * @deprecated use readln. Note that it has an inverted autoAck default, + * though. + **/ + TDE_DEPRECATED int fgets (TQString &line, bool autoAck=false) + { return readln (line, autoAck); } + + /** + * Reset the class. Doesn't kill the process. + **/ + void resetAll (); + + /** + * Call this after you have finished processing a readReady() + * signal. This call need not be made in the slot that was signalled + * by readReady(). You won't receive any more readReady() signals + * until you acknowledge with ackRead(). This prevents your slot + * from being reentered while you are still processing the current + * data. If this doesn't matter, then call ackRead() right away in + * your readReady()-processing slot. + **/ + void ackRead (); + + /** + * Turns readReady() signals on and off. + * You can turn this off at will and not worry about losing any data. + * (as long as you turn it back on at some point...) + * @param enable true to turn the signals on, false to turn them off + */ + void enableReadSignals (bool enable); + +signals: + /** + * Emitted when the process is ready for reading. + * @param pio the process that emitted the signal + * @see enableReadSignals() + */ + void readReady(TDEProcIO *pio); + +protected: + TQPtrList outbuffer; + TQCString recvbuffer; + TQTextCodec *codec; + int rbi; + bool needreadsignal, readsignalon, writeready; + + void controlledEmission (); + +protected slots: + void received (TDEProcess *proc, char *buffer, int buflen); + void sent (TDEProcess *); + +protected: + virtual void virtual_hook( int id, void* data ); +private: + TDEProcIOPrivate *d; +}; + +#endif diff --git a/tdecore/tests/CMakeLists.txt b/tdecore/tests/CMakeLists.txt index b0c1fb36b..e79dbfdeb 100644 --- a/tdecore/tests/CMakeLists.txt +++ b/tdecore/tests/CMakeLists.txt @@ -36,7 +36,7 @@ set( CHECKS ksocktest kstringhandlertest kcmdlineargstest tdeapptest kmemtest dcopkonqtest kipctest cplusplustest kiconloadertest kresolvertest kmdcodectest knotifytest ksortablevaluelisttest krfcdatetest testqtargs - kprociotest kcharsetstest kcalendartest kmacroexpandertest kshelltest + tdeprociotest kcharsetstest kcalendartest kmacroexpandertest kshelltest kxerrorhandlertest startserviceby kglobaltest ktimezonestest ) diff --git a/tdecore/tests/Makefile.am b/tdecore/tests/Makefile.am index c7b1f7d0e..cbf12cb2c 100644 --- a/tdecore/tests/Makefile.am +++ b/tdecore/tests/Makefile.am @@ -26,14 +26,14 @@ check_PROGRAMS = tdeconfigtestgui klocaletest tdeprocesstest ksimpleconfigtest \ kdebugtest ksocktest kstringhandlertest kcmdlineargstest tdeapptest \ kmemtest kidlservertest kidlclienttest dcopkonqtest kipctest \ cplusplustest kiconloadertest kresolvertest kmdcodectest knotifytest \ - ksortablevaluelisttest krfcdatetest testqtargs kprociotest \ + ksortablevaluelisttest krfcdatetest testqtargs tdeprociotest \ kcharsetstest kcalendartest kmacroexpandertest kshelltest \ kxerrorhandlertest startserviceby tdestdacceltest kglobaltest ktimezonestest TESTS = kurltest tdestdacceltest noinst_HEADERS = klocaletest.h tdeprocesstest.h KIDLTest.h \ - kipctest.h kprociotest.h + kipctest.h tdeprociotest.h METASOURCES = AUTO @@ -68,7 +68,7 @@ knotifytest_SOURCES = knotifytest.cpp ksortablevaluelisttest_SOURCES = ksortablevaluelisttest.cpp krfcdatetest_SOURCES = krfcdatetest.cpp testqtargs_SOURCES = testqtargs.cpp -kprociotest_SOURCES = kprociotest.cpp +tdeprociotest_SOURCES = tdeprociotest.cpp kcharsetstest_SOURCES = kcharsetstest.cpp kcalendartest_SOURCES = kcalendartest.cpp kmacroexpandertest_SOURCES = kmacroexpandertest.cpp diff --git a/tdecore/tests/kprociotest.cpp b/tdecore/tests/kprociotest.cpp deleted file mode 100644 index 81522f394..000000000 --- a/tdecore/tests/kprociotest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -// MAIN -- a little demo of the capabilities of the "TDEProcess" class -// -// version 0.2, Aug 2nd 1997 -// $Id$ -// -// (C) Christian Czezatke -// e9025461@student.tuwien.ac.at -// - - -#include "tdeprocess.h" - -#include -#include -#include - -#include - -#include "kprociotest.h" - - - -// -// A nice input for "sort"... ;- ) -// -static const char txt[] = "hat\nder\nalte\nhexenmeister\nsich\ndoch\neinmal\nwegbegeben\n\ -und\nnun\nsollen\nseine\ngeister\nsich\nnach\nmeinem\nwillen\nregen\nseine\nwort\nund\n\ -werke\nmerkt\nich\nund\nden\nbrauch\nund\nmit\ngeistesstaerke\ntu\nich\nwunder\nauch\n"; - - -int main(int argc, char *argv[]) -{ - Dummy dummy; - TDEApplication app(argc, argv, TQCString("kprociotest")); - - printf("Welcome to the KProcIO Demo Application!\n"); - - - KProcIO p; - - p << "rev"; - - p.connect(&p, TQ_SIGNAL(processExited(TDEProcess*)), &dummy, TQ_SLOT(printMessage(TDEProcess*))); - p.connect(&p, TQ_SIGNAL(readReady(KProcIO*)), &dummy, TQ_SLOT(gotOutput(KProcIO*))); - - bool b; - - b = p.start(); - printf("Start returns %s\n", b ? "true" : "false"); - - b = p.fputs("Hello World!"); - printf("fputs returns %s\n", b ? "true" : "false"); - - b = p.fputs("This is a test. It should come out in reverse (esrever)"); - printf("fputs returns %s\n", b ? "true" : "false"); - - p.closeWhenDone(); - - printf("Entering man Qt event loop -- press to abort\n"); - app.exec(); - - return 0; -} -#include "kprociotest.moc" diff --git a/tdecore/tests/kprociotest.h b/tdecore/tests/kprociotest.h deleted file mode 100644 index 78b5ad926..000000000 --- a/tdecore/tests/kprociotest.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// DUMMY -- A dummy class with a slot to demonstrate TDEProcess signals -// -// version 0.2, Aug 2nd 1997 -// -// (C) Christian Czezatke -// e9025461@student.tuwien.ac.at -// - - -#ifndef __DUMMY_H__ -#define __DUMMY_H__ - -#include -#include -#include "kprocio.h" - -class Dummy : public TQObject -{ - TQ_OBJECT - - public slots: - void printMessage(TDEProcess *proc) - { - printf("Process %d exited!\n", (int)proc->getPid()); - } - - void gotOutput(KProcIO*proc) - { - TQString line; - while(true) { - int result = proc->readln(line); - if (result == -1) return; - printf("OUTPUT>> [%d] '%s'\n", result, line.latin1()); - } - } - -}; - -#endif - - diff --git a/tdecore/tests/tdeprociotest.cpp b/tdecore/tests/tdeprociotest.cpp new file mode 100644 index 000000000..16c9b14b6 --- /dev/null +++ b/tdecore/tests/tdeprociotest.cpp @@ -0,0 +1,65 @@ +// +// MAIN -- a little demo of the capabilities of the "TDEProcess" class +// +// version 0.2, Aug 2nd 1997 +// $Id$ +// +// (C) Christian Czezatke +// e9025461@student.tuwien.ac.at +// + + +#include "tdeprocess.h" + +#include +#include +#include + +#include + +#include "tdeprociotest.h" + + + +// +// A nice input for "sort"... ;- ) +// +static const char txt[] = "hat\nder\nalte\nhexenmeister\nsich\ndoch\neinmal\nwegbegeben\n\ +und\nnun\nsollen\nseine\ngeister\nsich\nnach\nmeinem\nwillen\nregen\nseine\nwort\nund\n\ +werke\nmerkt\nich\nund\nden\nbrauch\nund\nmit\ngeistesstaerke\ntu\nich\nwunder\nauch\n"; + + +int main(int argc, char *argv[]) +{ + Dummy dummy; + TDEApplication app(argc, argv, TQCString("tdeprociotest")); + + printf("Welcome to the TDEProcIO Demo Application!\n"); + + + TDEProcIO p; + + p << "rev"; + + p.connect(&p, TQ_SIGNAL(processExited(TDEProcess*)), &dummy, TQ_SLOT(printMessage(TDEProcess*))); + p.connect(&p, TQ_SIGNAL(readReady(TDEProcIO*)), &dummy, TQ_SLOT(gotOutput(TDEProcIO*))); + + bool b; + + b = p.start(); + printf("Start returns %s\n", b ? "true" : "false"); + + b = p.fputs("Hello World!"); + printf("fputs returns %s\n", b ? "true" : "false"); + + b = p.fputs("This is a test. It should come out in reverse (esrever)"); + printf("fputs returns %s\n", b ? "true" : "false"); + + p.closeWhenDone(); + + printf("Entering man Qt event loop -- press to abort\n"); + app.exec(); + + return 0; +} +#include "tdeprociotest.moc" diff --git a/tdecore/tests/tdeprociotest.h b/tdecore/tests/tdeprociotest.h new file mode 100644 index 000000000..194a26504 --- /dev/null +++ b/tdecore/tests/tdeprociotest.h @@ -0,0 +1,42 @@ +// +// DUMMY -- A dummy class with a slot to demonstrate TDEProcess signals +// +// version 0.2, Aug 2nd 1997 +// +// (C) Christian Czezatke +// e9025461@student.tuwien.ac.at +// + + +#ifndef __DUMMY_H__ +#define __DUMMY_H__ + +#include +#include +#include "tdeprocio.h" + +class Dummy : public TQObject +{ + TQ_OBJECT + + public slots: + void printMessage(TDEProcess *proc) + { + printf("Process %d exited!\n", (int)proc->getPid()); + } + + void gotOutput(TDEProcIO*proc) + { + TQString line; + while(true) { + int result = proc->readln(line); + if (result == -1) return; + printf("OUTPUT>> [%d] '%s'\n", result, line.latin1()); + } + } + +}; + +#endif + + diff --git a/tdeio/misc/kpac/discovery.cpp b/tdeio/misc/kpac/discovery.cpp index 9e3cafd19..4e1bab960 100644 --- a/tdeio/misc/kpac/discovery.cpp +++ b/tdeio/misc/kpac/discovery.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include "discovery.moc" @@ -51,9 +51,9 @@ namespace KPAC { Discovery::Discovery( TQObject* parent ) : Downloader( parent ), - m_helper( new KProcIO ) + m_helper( new TDEProcIO ) { - connect( m_helper, TQ_SIGNAL( readReady( KProcIO* ) ), TQ_SLOT( helperOutput() ) ); + connect( m_helper, TQ_SIGNAL( readReady( TDEProcIO* ) ), TQ_SLOT( helperOutput() ) ); connect( m_helper, TQ_SIGNAL( processExited( TDEProcess* ) ), TQ_SLOT( failed() ) ); *m_helper << "kpac_dhcp_helper"; diff --git a/tdeio/misc/kpac/discovery.h b/tdeio/misc/kpac/discovery.h index b725fb469..b701d8b74 100644 --- a/tdeio/misc/kpac/discovery.h +++ b/tdeio/misc/kpac/discovery.h @@ -25,7 +25,7 @@ #include "downloader.h" -class KProcIO; +class TDEProcIO; namespace KPAC { @@ -45,7 +45,7 @@ namespace KPAC bool initHostName(); bool checkDomain() const; - KProcIO* m_helper; + TDEProcIO* m_helper; TQString m_hostname; }; } diff --git a/tdeio/tdefile/tdefilesharedlg.cpp b/tdeio/tdefile/tdefilesharedlg.cpp index ca5b97e45..9e3770b6c 100644 --- a/tdeio/tdefile/tdefilesharedlg.cpp +++ b/tdeio/tdefile/tdefilesharedlg.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeio/tdeio/tdefileshare.cpp b/tdeio/tdeio/tdefileshare.cpp index 00e64d857..584d4e5e2 100644 --- a/tdeio/tdeio/tdefileshare.cpp +++ b/tdeio/tdeio/tdefileshare.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -179,7 +179,7 @@ void KFileShare::readShareList() s_authorization = ErrorNotFound; return; } - KProcIO proc; + TDEProcIO proc; proc << exe; if ( !proc.start( TDEProcess::Block ) ) { kdError() << "Can't run " << exe << endl; diff --git a/tdenewstuff/security.cpp b/tdenewstuff/security.cpp index 6952f1ec6..07cb798c0 100644 --- a/tdenewstuff/security.cpp +++ b/tdenewstuff/security.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include //app includes #include "security.h" @@ -55,10 +55,10 @@ void Security::readKeys() } m_runMode = List; m_keys.clear(); - KProcIO *readProcess=new KProcIO(); + TDEProcIO *readProcess=new TDEProcIO(); *readProcess << "gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--with-colon"<<"--list-keys"; connect(readProcess, TQ_SIGNAL(processExited(TDEProcess *)), this, TQ_SLOT(slotProcessExited(TDEProcess *))); - connect(readProcess, TQ_SIGNAL(readReady(KProcIO *)) ,this, TQ_SLOT(slotDataArrived(KProcIO *))); + connect(readProcess, TQ_SIGNAL(readReady(TDEProcIO *)) ,this, TQ_SLOT(slotDataArrived(TDEProcIO *))); if (!readProcess->start(TDEProcess::NotifyOnExit, true)) KMessageBox::error(0L, i18n("Cannot start gpg and retrieve the available keys. Make sure that gpg is installed, otherwise verification of downloaded resources will not be possible.")); else @@ -73,10 +73,10 @@ void Security::readSecretKeys() return; } m_runMode = ListSecret; - KProcIO *readProcess=new KProcIO(); + TDEProcIO *readProcess=new TDEProcIO(); *readProcess << "gpg"<<"--no-secmem-warning"<<"--no-tty"<<"--with-colon"<<"--list-secret-keys"; connect(readProcess, TQ_SIGNAL(processExited(TDEProcess *)), this, TQ_SLOT(slotProcessExited(TDEProcess *))); - connect(readProcess, TQ_SIGNAL(readReady(KProcIO *)) ,this, TQ_SLOT(slotDataArrived(KProcIO *))); + connect(readProcess, TQ_SIGNAL(readReady(TDEProcIO *)) ,this, TQ_SLOT(slotDataArrived(TDEProcIO *))); if (readProcess->start(TDEProcess::NotifyOnExit, true)) m_gpgRunning = true; } @@ -98,7 +98,7 @@ void Security::slotProcessExited(TDEProcess *process) delete process; } -void Security::slotDataArrived(KProcIO *procIO) +void Security::slotDataArrived(TDEProcIO *procIO) { TQString data; while (procIO->readln(data, true) != -1) @@ -246,10 +246,10 @@ void Security::slotCheckValidity() m_signatureKey.trusted = false; //verify the signature - KProcIO *verifyProcess=new KProcIO(); + TDEProcIO *verifyProcess=new TDEProcIO(); *verifyProcess<<"gpg"<<"--no-secmem-warning"<<"--status-fd=2"<<"--command-fd=0"<<"--verify" << f.dirPath() + "/signature"<< m_fileName; connect(verifyProcess, TQ_SIGNAL(processExited(TDEProcess *)),this, TQ_SLOT(slotProcessExited(TDEProcess *))); - connect(verifyProcess, TQ_SIGNAL(readReady(KProcIO *)),this, TQ_SLOT(slotDataArrived(KProcIO *))); + connect(verifyProcess, TQ_SIGNAL(readReady(TDEProcIO *)),this, TQ_SLOT(slotDataArrived(TDEProcIO *))); if (verifyProcess->start(TDEProcess::NotifyOnExit,true)) m_gpgRunning = true; else @@ -326,10 +326,10 @@ void Security::slotSignFile() m_secretKey = secretKeys[0]; //verify the signature - KProcIO *signProcess=new KProcIO(); + TDEProcIO *signProcess=new TDEProcIO(); *signProcess<<"gpg"<<"--no-secmem-warning"<<"--status-fd=2"<<"--command-fd=0"<<"--no-tty"<<"--detach-sign" << "-u" << m_secretKey << "-o" << f.dirPath() + "/signature" << m_fileName; connect(signProcess, TQ_SIGNAL(processExited(TDEProcess *)),this, TQ_SLOT(slotProcessExited(TDEProcess *))); - connect(signProcess, TQ_SIGNAL(readReady(KProcIO *)),this, TQ_SLOT(slotDataArrived(KProcIO *))); + connect(signProcess, TQ_SIGNAL(readReady(TDEProcIO *)),this, TQ_SLOT(slotDataArrived(TDEProcIO *))); m_runMode = Sign; if (signProcess->start(TDEProcess::NotifyOnExit,true)) m_gpgRunning = true; diff --git a/tdenewstuff/security.h b/tdenewstuff/security.h index ac3f4f1a0..fc3e298c6 100644 --- a/tdenewstuff/security.h +++ b/tdenewstuff/security.h @@ -21,7 +21,7 @@ #include #include -class KProcIO; +class TDEProcIO; class TDEProcess; struct KeyStruct { @@ -121,7 +121,7 @@ private: private slots: void slotProcessExited(TDEProcess *process); - void slotDataArrived(KProcIO *process); + void slotDataArrived(TDEProcIO *process); signals: /** Sent when the validity check is done. diff --git a/tdeui/kedittoolbar.cpp b/tdeui/kedittoolbar.cpp index 193a2e4ac..0d594c8f4 100644 --- a/tdeui/kedittoolbar.cpp +++ b/tdeui/kedittoolbar.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include static const char * const lineseparatorstring = I18N_NOOP("--- line separator ---"); static const char * const separatorstring = I18N_NOOP("--- separator ---"); @@ -357,7 +357,7 @@ public: KSeparator *m_comboSeparator; TQLabel * m_helpArea; KPushButton* m_changeIcon; - KProcIO* m_kdialogProcess; + TDEProcIO* m_kdialogProcess; bool m_hasKDialog; }; @@ -1387,7 +1387,7 @@ void KEditToolbarWidget::slotChangeIcon() if ( d->m_kdialogProcess && d->m_kdialogProcess->isRunning() ) return; - d->m_kdialogProcess = new KProcIO; + d->m_kdialogProcess = new TDEProcIO; TQString kdialogExe = TDEStandardDirs::findExe(TQString::fromLatin1("kdialog")); (*d->m_kdialogProcess) << kdialogExe; (*d->m_kdialogProcess) << "--embed"; diff --git a/tdeui/tdespell.cpp b/tdeui/tdespell.cpp index d2326412b..0e47a172c 100644 --- a/tdeui/tdespell.cpp +++ b/tdeui/tdespell.cpp @@ -44,7 +44,7 @@ #include "tdespell.h" #include "tdespelldlg.h" #include -#include +#include #define MAXLINELENGTH 10000 #undef IGNORE //fix possible conflict @@ -96,11 +96,11 @@ public: */ -// Connects a slot to KProcIO's output signal -#define OUTPUT(x) (connect (proc, TQ_SIGNAL (readReady(KProcIO *)), this, TQ_SLOT (x(KProcIO *)))) +// Connects a slot to TDEProcIO's output signal +#define OUTPUT(x) (connect (proc, TQ_SIGNAL (readReady(TDEProcIO *)), this, TQ_SLOT (x(TDEProcIO *)))) // Disconnect a slot from... -#define NOOUTPUT(x) (disconnect (proc, TQ_SIGNAL (readReady(KProcIO *)), this, TQ_SLOT (x(KProcIO *)))) +#define NOOUTPUT(x) (disconnect (proc, TQ_SIGNAL (readReady(TDEProcIO *)), this, TQ_SLOT (x(TDEProcIO *)))) @@ -319,7 +319,7 @@ KSpell::ispellErrors( TDEProcess *, char *buffer, int buflen ) // kdDebug(750) << "ispellErrors [" << buffer << "]\n" << endl; } -void KSpell::KSpell2( KProcIO * ) +void KSpell::KSpell2( TDEProcIO * ) { TQString line; @@ -555,7 +555,7 @@ bool KSpell::checkWord( const TQString & buffer, bool _usedialog, bool suggest ) return true; } -void KSpell::checkWord2( KProcIO* ) +void KSpell::checkWord2( TDEProcIO* ) { TQString word; TQString line; @@ -608,7 +608,7 @@ void KSpell::checkNext() } } -void KSpell::suggestWord( KProcIO * ) +void KSpell::suggestWord( TDEProcIO * ) { TQString word; TQString line; @@ -800,14 +800,14 @@ bool KSpell::checkList (TQStringList *_wordlist, bool _usedialog) lastpos = -1; checkList2(); - // when checked, KProcIO calls checkList3a + // when checked, TDEProcIO calls checkList3a OUTPUT(checkList3a); return true; } void KSpell::checkList2 () - // send one word from the list to KProcIO + // send one word from the list to TDEProcIO // invoked first time by checkList, later by checkListReplaceCurrent and checkList4 { // send next word @@ -837,8 +837,8 @@ void KSpell::checkList2 () } } -void KSpell::checkList3a (KProcIO *) - // invoked by KProcIO, when data from ispell are read +void KSpell::checkList3a (TDEProcIO *) + // invoked by TDEProcIO, when data from ispell are read { //kdDebug(750) << "start of checkList3a" << endl; @@ -961,7 +961,7 @@ void KSpell::checkList4 () //proc->disconnect(); //proc->kill(); //delete proc; - //proc = new KProcIO( codec ); + //proc = new TDEProcIO( codec ); //startIspell(); return; }; @@ -1006,7 +1006,7 @@ bool KSpell::check( const TQString &_buffer, bool _usedialog ) newbuffer = origbuffer; - // KProcIO calls check2 when read from ispell + // TDEProcIO calls check2 when read from ispell OUTPUT( check2 ); proc->writeStdin(TQString("!")); @@ -1033,8 +1033,8 @@ bool KSpell::check( const TQString &_buffer, bool _usedialog ) } -void KSpell::check2( KProcIO * ) - // invoked by KProcIO when read from ispell +void KSpell::check2( TDEProcIO * ) + // invoked by TDEProcIO when read from ispell { int e, tempe; TQString word; @@ -1564,7 +1564,7 @@ void KSpell::initialize( TQWidget *_parent, const TQString &_caption, // Hack for modal spell checking connect( this, TQ_SIGNAL(ready(KSpell *)), this, TQ_SLOT(slotModalReady()) ); - proc = new KProcIO( codec ); + proc = new TDEProcIO( codec ); startIspell(); } diff --git a/tdeui/tdespell.h b/tdeui/tdespell.h index 1ff854cfc..fd56928b5 100644 --- a/tdeui/tdespell.h +++ b/tdeui/tdespell.h @@ -27,7 +27,7 @@ #include class TQTextCodec; -class KProcIO; +class TDEProcIO; class TDEProcess; class KSpellDlg; @@ -447,18 +447,18 @@ signals: protected slots: - /* All of those signals from KProcIO get sent here. */ - void KSpell2 (KProcIO *); - void checkWord2 (KProcIO *); + /* All of those signals from TDEProcIO get sent here. */ + void KSpell2 (TDEProcIO *); + void checkWord2 (TDEProcIO *); void checkWord3 (); - void check2 (KProcIO *); + void check2 (TDEProcIO *); void checkList2 (); - void checkList3a (KProcIO *); + void checkList3a (TDEProcIO *); void checkListReplaceCurrent (); void checkList4 (); void dialog2 (int dlgresult); void check3 (); - void suggestWord( KProcIO * ); + void suggestWord( TDEProcIO * ); void slotStopCancel (int); void ispellExit (TDEProcess *); @@ -492,7 +492,7 @@ signals: protected: - KProcIO *proc; + TDEProcIO *proc; TQWidget *parent; KSpellConfig *ksconfig; KSpellDlg *ksdlg; diff --git a/win/pro_files/tdecore/tdecore.pro b/win/pro_files/tdecore/tdecore.pro index ddf1003ee..c249670a6 100644 --- a/win/pro_files/tdecore/tdecore.pro +++ b/win/pro_files/tdecore/tdecore.pro @@ -22,7 +22,7 @@ fakes.c \ kpixmapprovider.cpp \ kpalette.cpp \ tdeprocess.cpp \ -kprocio.cpp \ +tdeprocio.cpp \ kcrash.cpp \ kallocator.cpp \ knotifyclient.cpp \ -- cgit v1.2.1