summaryrefslogtreecommitdiffstats
path: root/src/freshklam.h
blob: ee01247fdb108a50b5ef7a7be4f8a6d1f03c7c11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
 * Copyright (C) 2004 Robert Hogan <robert at roberthogan dot net>
 */

#ifndef _FRESHKLAM_H_
#define _FRESHKLAM_H_

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <tdeapplication.h>
#include <tdemainwindow.h>
#include <kdirlister.h> //stack allocated
#include <kurl.h>       //stack allocated
#include <kresolver.h> // namespace
#include <tdehtml_part.h>
#include "update.h"

namespace DOM {
  class Node;
}


using namespace KNetwork;

class KPrinter;
class TDEToggleAction;
class KURL;
class TQLineEdit;
class TQComboBox;
class TQCheckBox;
class TQListBox;
class TQPushButton;
class TQLabel;
class TDEProcess;
class TDEConfig;
class KURLRequester;
class KLineEdit;
class KProgressDialog;
class KProcIO;
class TDEHTMLPart;
class KlamavUpdate;

/**
 * This class serves as the main window for Freshklam.  It handles the
 * menus, toolbars, and status bars.
 *
 * @short Main window class
 * @author $AUTHOR <$EMAIL>
 * @version $APP_VERSION
 */
class Freshklam : public TQWidget
{
    Q_OBJECT
public:
    /**
     * Default Constructor
     */
    Freshklam(TQWidget *parent, const char *name=0);

    /**
     * Default Destructor
     */
    virtual ~Freshklam();

    /**
     * Use this method to load whatever file/URL you have
     */
    void  setDirName(TQString);
    TQString  getCurrentDBDir();
    bool isFreshklamAlive();
    TQPushButton *search_button, *cancel_button;
    void enableAutoUpdates();

protected:
    /**
     * Overridden virtuals for TQt drag 'n drop (XDND)
     */
    /*virtual void dragEnterEvent(TQDragEnterEvent *event);
    virtual void dropEvent(TQDropEvent *event);*/

protected:
    /**
     * This function is called when it is time for the app to save its
     * properties for session management purposes.
     */
    //void saveProperties(TDEConfig *);

    /**
     * This function is called when this app is restored.  The TDEConfig
     * object points to the session management config file that was saved
     * with @ref saveProperties
     */
    //void readProperties(TDEConfig *);



private:
    void setupAccel();
    void setupActions();

private:
    //FreshklamView *m_view;



signals:
    void itemSelected(TQString abs_filename, int line);


public slots:
    void slotSearch();
    void slotCancel();
    void checkForNewClamAVNow();
    void getCurrentVersionOfClamAV( );
private slots:
/*    void slotProg();*/
    void childExited();
    void processDied();
    void receivedOutput(TDEProcess *proc, char *buffer, int buflen);
    void slotClear();
    void writeConf();
    void handleChecks();
    //void arkollonExited(TDEProcess *arkollonproc);
/*    void klamavInstallationExited(TDEProcess *arkollonproc);
    void clamavInstallationExited(TDEProcess *arkollonproc);*/
    //void newItems( const KFileItemList& );
    void resolved(KResolverResults result);
    void checkForNewKlamAVNow();
    void readVersionLine(KProcIO *);
/*    void parseSFPage();
    void parseSFPageHack();*/
/*    void updateCanceled();*/
    void versionExited();
private:
/*    void getLatestVersionFromSF(KURL url);
    void getLatestVersionFromSFHack(KURL url);*/
    void processOutput();
    void finish();
    void getout();
    void updateMailClient();
    void enableInputs();
    void disableInputs();
    bool killPID();
    void  createDBDir();
/*    void  downloadComponent(TQString component, TQString version, TQString extension);*/
    void startProgressDialog( const TQString & text );
    void checkInternet();
    void connectToHost();
/*    void checkForNewKlamAV();*/
    void initCheckBoxes();
/*    void getVersionFromLink( const DOM::Node &n );
    void completedSearchForUpdates(const TQString &component, const TQString &extension);*/
    void updateMetaDB();
/*    TQString getMirror();*/
    TQLineEdit *template_edit;
    TQComboBox *check_combo;
    KURLRequester *dir_combo;
    KURLRequester *proxy_dir_combo;
    TQCheckBox *daemon_box;
    TQCheckBox *recursive_box;
    TQListBox *resultbox;
    TQLabel *status_label, *matches_label;
    TDEProcess *childproc;
    KProcIO *versionproc;
    TQString buf;
    TDEConfig* config;
    TQStringList lastSearchItems;
    TQStringList lastDownloadPaths;
    KLineEdit    *proxyIP;
    KLineEdit    *proxyPort;
    KLineEdit    *proxyUser;
    KLineEdit    *proxyPass;
    TQString tempFileName;
    TQString errorMessage;
    TQString pidFileName;
    bool freshklamAlive;
    KProgressDialog *progressDialog;
    TQTimer *timer;
/*    bool upgradeinprogress;*/
    bool checkingDirectly;
/*    double highestsofarnumeric;
    TQString highestsofarraw;
    TQString highestsofarfilename;*/
    KResolver m_resolver;
/*    TQString currentClamAVVersion;
    TDEHTMLPart *filelist;*/

// private:
//     KDirLister clamav_lister;
//     KURL       clamav_url;
//     KDirLister klamav_lister;
//     KURL       klamav_url;
     KURL       m_url;
    KlamavUpdate* updater;
};

#endif // _Freshklam_H_