kcmpureftpdstat.h
00001 /***************************************************************************
00002 kcmpureftpdstat.h - PureFTPd Statistics
00003 -------------------
00004 begin : Thu Jan 2 2002
00005 copyright : (C) 2002,2003 by Claudiu Costin
00006 email : claudiuc@kde.org
00007 ***************************************************************************/
00008
00009 /***************************************************************************
00010 * *
00011 * This program is free software; you can redistribute it and/or modify *
00012 * it under the terms of the GNU General Public License as published by *
00013 * the Free Software Foundation; either version 2 of the License, or *
00014 * (at your option) any later version. *
00015 * *
00016 ***************************************************************************/
00017
00018 #ifndef __KCMPUREFTPDSTAT_H__
00019 #define __KCMPUREFTPDSTAT_H__
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025 #include <signal.h>
00026 #include <unistd.h>
00027 #include <sys/types.h>
00028 #include <sys/stat.h>
00029
00030 #include <qglobal.h>
00031 #include <qmap.h>
00032 #include <qstring.h>
00033 #include <qtimer.h>
00034 #include <qlabel.h>
00035 #include <qgroupbox.h>
00036 #include <qcheckbox.h>
00037 #include <qradiobutton.h>
00038 #include <qcombobox.h>
00039 #include <qtextview.h>
00040 #include <qtabwidget.h>
00041 #include <qmultilineedit.h>
00042
00043 #include <kdeversion.h>
00044 #include <kdebug.h>
00045 #include <kglobal.h>
00046 #include <kconfig.h>
00047 #include <kapp.h>
00048 #include <kcmodule.h>
00049 #include <kaboutdata.h>
00050 #include <kurlrequester.h>
00051 #include <knuminput.h>
00052 #include <klineedit.h>
00053 #include <kpushbutton.h>
00054 #include <klistview.h>
00055 #include <kprocess.h>
00056
00057 #include "ftpsession.h"
00058
00059
00060 typedef QMap<pid_t,KListViewItem*> FtpGuiMap;
00061 typedef QMap<pid_t,FTPSessionItem> FtpSessionMap;
00062
00063 class KPureftpdStat : public KCModule {
00064 Q_OBJECT
00065
00066 public:
00067 enum InfoMessage {
00068 InfoClear, InfoInit, InfoWarning, InfoExecRunning,
00069 InfoExecCommandError, InfoExecCommandKill
00070 };
00071 enum LogMessage {
00072 LogClear, LogInit, LogWriteError, LogExecTailError,
00073 LogExecCommandError, LogExecTerminated, LogFull
00074 };
00075
00076 KPureftpdStat(QWidget *parent = 0L, const char *name = 0L);
00077 virtual ~KPureftpdStat();
00078 void load();
00079 void save();
00080 void defaults();
00081 int buttons();
00082 QString quickHelp() const;
00083 virtual const KAboutData *aboutData() const;
00084
00085 protected slots:
00086 void configChanged();
00087 void configChanged(int number);
00088 void configChanged(const QString &text);
00089 void slotShowExtendedInfo(QListViewItem *item);
00090 void slotChangedInterval(int interval);
00091
00092 void slotLogSearch();
00093 void slotLogResetSearch();
00094 void slotLogSave();
00095 void slotLogCopy();
00096 void slotLogClear();
00097
00098 void slotLogProcessToggleUpdate(bool toggled);
00099 void slotLogProcessRecvStdout(KProcess *p, char *buf, int len);
00100 void slotLogProcessRecvStderr(KProcess *p, char *buf, int len);
00101 void slotLogProcessExited(KProcess *p);
00102 void startLogProcess();
00103 void stopLogProcess();
00104
00105 void slotInfoProcessToggleUpdate();
00106 void slotInfoProcessRecvStdout(KProcess *p, char *buf, int len);
00107 void slotInfoProcessRecvStderr(KProcess *p, char *buf, int len);
00108 void slotInfoProcessExited(KProcess *p);
00109 void startInfoProcess();
00110 void stopInfoProcess();
00111
00112 void slotInfoConfDefault(bool b);
00113 void slotInfoConfUseDefault(bool b);
00114 void slotLogConfDefault(bool b);
00115
00116 private:
00117 void initView();
00118 void processInfoOutput();
00119 void displayInfoMessage(InfoMessage t);
00120 void displayLogMessage(LogMessage t);
00121 QString prettyByte(unsigned long long m_byte);
00122
00123 bool mFound, reachedMaxNumLines, deliberatedKill, isProcessingInfo;
00124 int logMaxNumLines;
00125 FtpGuiMap ftpGuiMap;
00126 FtpSessionMap ftpSessionMap;
00127 QTimer *infoTimer;
00128 QString infoOutput, lastLine, pureftpwhoDefaultPath,
00129 pureftpwhoExe, startDir, fileName,
00130 tmpStdout, tmpStderr;
00131 QGroupBox *grpInfoMessage, *grpLogMessage;
00132 QTabWidget *tab;
00133 QWidget *tabInfo, *tabLog, *tabConfig;
00134 QLabel *txtPureftpwhoPath, *txtInfoCommand,
00135 *txtLogFileName, *txtLogCommand,
00136 *mesgInfoIcon, *mesgInfoText, *mesgLogIcon, *mesgLogText;
00137 QRadioButton *rbLogFile, *rbLogCustom, *rbInfoDefault, *rbInfoCustom;
00138 QCheckBox *caseSensitive, *wholeWords, *findBackwards,
00139 *pureftpwhoDefault;
00140 QTextView *txtExtInfo;
00141 QMultiLineEdit *logOutput;
00142 KLineEdit *editSearch, *infoCommand, *logCommand;
00143 KURLRequester *logFileName, *pureftpwhoPath;
00144 KPushButton *infoUpdate, *logUpdate, *logSearch, *logResetSearch,
00145 *logSave, *logCopy, *logClear;
00146 KListView *connList;
00147 KIntNumInput *updateInterval, *historyLines;
00148 KConfig *config;
00149 KAboutData *myAboutData;
00150 KShellProcess *infoProcess, *logProcess;
00151 };
00152
00153 #endif
00154
Generated on Thu Jul 24 01:57:14 2003 by doxygen 1.2.15.
