summaryrefslogtreecommitdiffstats
path: root/src/freshklam.h
blob: 1ee716dd2147f674b7eef9ce9672355b560bc562 (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
200
201
202
203
204
/*
 * 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 <kapplication.h>
#include <kmainwindow.h>
#include <kdirlister.h> //stack allocated
#include <kurl.h>       //stack allocated
#include <kresolver.h> // namespace
#include <khtml_part.h>
#include "update.h"

namespace DOM {
  class Node;
}


using namespace KNetwork;

class KPrinter;
class KToggleAction;
class KURL;
class QLineEdit;
class QComboBox;
class QCheckBox;
class QListBox;
class QPushButton;
class QLabel;
class KProcess;
class KConfig;
class KURLRequester;
class KLineEdit;
class KProgressDialog;
class KProcIO;
class KHTMLPart;
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 QWidget
{
    Q_OBJECT
public:
    /**
     * Default Constructor
     */
    Freshklam(QWidget *parent, const char *name=0);

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

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

protected:
    /**
     * Overridden virtuals for Qt drag 'n drop (XDND)
     */
    /*virtual void dragEnterEvent(QDragEnterEvent *event);
    virtual void dropEvent(QDropEvent *event);*/

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

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



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

private:
    //FreshklamView *m_view;



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


public slots:
    void slotSearch();
    void slotCancel();
    void checkForNewClamAVNow();
    void getCurrentVersionOfClamAV( );
    void toggleUpgradeButtons(bool);
private slots:
/*    void slotProg();*/
    void childExited();
    void processDied();
    void receivedOutput(KProcess *proc, char *buffer, int buflen);
    void slotClear();
    void writeConf();
    void handleChecks();
    //void arkollonExited(KProcess *arkollonproc);
/*    void klamavInstallationExited(KProcess *arkollonproc);
    void clamavInstallationExited(KProcess *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(QString component, QString version, QString extension);*/
    void startProgressDialog( const QString & text );
    void checkInternet();
    void connectToHost();
/*    void checkForNewKlamAV();*/
    void initCheckBoxes();
/*    void getVersionFromLink( const DOM::Node &n );
    void completedSearchForUpdates(const QString &component, const QString &extension);*/
    void updateMetaDB();
/*    QString getMirror();*/
    QLineEdit *template_edit;
    QComboBox *check_combo;
    KURLRequester *dir_combo;
    KURLRequester *proxy_dir_combo;
    QCheckBox *daemon_box;
    QCheckBox* clamav_box;
    QCheckBox* klamav_box;
    QCheckBox *recursive_box;
    QListBox *resultbox;
    QLabel *status_label, *matches_label;
    KProcess *childproc;
    KProcIO *versionproc;
    QString buf;
    KConfig* config;
    QStringList lastSearchItems;
    QStringList lastDownloadPaths;
    KLineEdit    *proxyIP;
    KLineEdit    *proxyPort;
    KLineEdit    *proxyUser;
    KLineEdit    *proxyPass;
    QString tempFileName;
    QString errorMessage;
    QString pidFileName;
    bool freshklamAlive;
    KProgressDialog *progressDialog;
    QTimer *timer;
/*    bool upgradeinprogress;*/
    bool checkingDirectly;
/*    double highestsofarnumeric;
    QString highestsofarraw;
    QString highestsofarfilename;*/
    KResolver m_resolver;
/*    QString currentClamAVVersion;
    KHTMLPart *filelist;*/
    QPushButton *clamav_options;
    QPushButton *klamav_options;

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

#endif // _Freshklam_H_