• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

knode

knprotocolclient.h

Go to the documentation of this file.
00001 /*
00002     knprotocolclient.h
00003 
00004     KNode, the KDE newsreader
00005     Copyright (c) 1999-2001 the KNode authors.
00006     See file AUTHORS for details
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012     You should have received a copy of the GNU General Public License
00013     along with this program; if not, write to the Free Software Foundation,
00014     Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
00015 */
00016 
00017 #ifndef KNPROTOCOLCLIENT_H
00018 #define KNPROTOCOLCLIENT_H
00019 
00020 #include <QDateTime>
00021 #include <QThread>
00022 #include <q3cstring.h>
00023 //Added by qt3to4:
00024 #include <Q3StrList>
00025 
00026 #include <knserverinfo.h>
00027 
00028 class Q3StrList;
00029 class KNJobData;
00030 struct in_addr;
00031 
00032 
00033 class KNProtocolClient : public QThread  {
00034 
00035   public:
00036     enum threadSignal { TSworkDone=0, TSjobStarted=1, TSconnect=2, TSloadGrouplist=3,
00037                         TSwriteGrouplist=4, TSdownloadGrouplist=5, TSdownloadNew=6,
00038                         TSsortNew=7, TSdownloadArticle=8, TSsendArticle=9, TSsendMail=10,
00039                         TSprogressUpdate=11, TSdownloadDesc=12, TSdownloadNewGroups=13 };
00040 
00041     KNProtocolClient(int NfdPipeIn, int NfdPipeOut);
00042     ~KNProtocolClient();
00043   
00044     virtual void run();
00045 
00046     void insertJob(KNJobData *newJob);
00047     void removeJob();
00048 
00049     void updatePercentage(int percent);
00050 
00051     int getProgressValue() const { return progressValue; }
00053     int getByteCount() const { return byteCount; }
00054     bool isInByteCountMode() const { return byteCountMode; }
00055 
00056     void terminateClient() { mTerminate = true; }
00057   protected:
00058 
00060     void waitForWork();
00062     virtual void processJob();
00063 
00065     virtual bool openConnection();
00066     bool isConnected()   { return (tcpSocket!=-1); }
00068     virtual void closeConnection();
00069 
00071     virtual bool sendCommand(const QByteArray &cmd, int &rep);
00073     bool sendCommandWCheck(const QByteArray &cmd, int rep);
00075     bool sendMsg(const QByteArray &msg);
00076 
00078     bool getNextLine();
00080     char* getCurrentLine()  { return thisLine; }
00082     bool getMsg(Q3StrList &msg);
00084     bool getNextResponse(int &rep);
00086     bool checkNextResponse(int rep);
00087 
00089     virtual void handleErrors();
00090 
00091     void sendSignal(threadSignal s);
00092 
00093     KNJobData *job;
00094     KNServerInfo account;
00096     QString errorPrefix;
00097     int progressValue, predictedLines, doneLines;
00098     bool byteCountMode;
00099 
00100   private:
00102     bool waitForRead();
00104     bool waitForWrite();
00105     void closeSocket();
00107     bool sendStr(const QByteArray &str);
00109     void clearPipe();
00110 
00111     char *input;
00112     char *thisLine, *nextLine, *inputEnd;
00113     unsigned int inputSize;
00115     int fdPipeIn,fdPipeOut;
00116     int tcpSocket;
00118     int byteCount;
00119     QTime timer;
00120     bool mTerminate;
00121 
00122 };
00123 
00124 #endif

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal