summaryrefslogtreecommitdiffstats
path: root/klinkstatus/src/ui/sessionwidget.h
blob: 49b5b2a355d5c3480d16fc09e3994e31c24d053a (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
/***************************************************************************
 *   Copyright (C) 2004 by Paulo Moura Guedes                              *
 *   moura@tdewebdev.org                                                        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/

#ifndef SESSION_WIDGET_H
#define SESSION_WIDGET_H

#include "sessionwidgetbase.h"
#include "../engine/linkchecker.h"
#include "../engine/linkstatus.h"
class SearchManager;
class TableItem;
class ActionManager;
class LinkMatcher;

#include <tqtimer.h>
#include <tqstring.h>
class TQStringList;
class TQListViewItem;

class KURL;
class TDEConfig;
class TDEToggleAction;

#include <vector>

using namespace std;

class SessionWidget: public SessionWidgetBase
{
    Q_OBJECT
  

public:

    SessionWidget(int max_simultaneous_connections = 3, int time_out = 50,
                  TQWidget* parent = 0, const char* name = 0, WFlags f = 0);

    ~SessionWidget();

    void setColumns(TQStringList const& colunas);
    void setUrl(KURL const& url);
    
    bool treeDisplay() const { return tree_display_; }

    bool followLastLinkChecked() const { return follow_last_link_checked_; }
    void setFollowLastLinkChecked(bool follow);

    bool isEmpty() const;
    SearchManager const* getSearchManager() const;

    bool inProgress() const { return in_progress_; }
    bool paused() const { return paused_; }
    bool stopped() const { return stopped_; }

signals:
    void signalUpdateTabLabel(const LinkStatus *, SessionWidget*);
    void signalSearchStarted();
    void signalSearchPaused();
    void signalSearchFinnished();

public slots:

    virtual void slotClearComboUrl();
    void slotLoadSettings(bool modify_current_widget_settings = true);

    void slotStartSearch();
    void slotPauseSearch();
    void slotStopSearch();

    void slotHideSearchPanel();
    void slotResetSearchOptions();
    void slotFollowLastLinkChecked();
    
    void slotExportAsHTML();

private slots:

    virtual void slotCheck();
    virtual void slotCancel() {} // FIXME hack
    //virtual void slotSuggestDomain(bool toogle);

    void slotEnableCheckButton(const TQString &);
    void slotRootChecked(LinkStatus const* linkstatus, LinkChecker * anal);
    void slotLinkChecked(LinkStatus const* linkstatus, LinkChecker * anal);
    void slotSearchFinished();
    void slotSearchPaused();
    /** Shows the status of the clicked URL (row) for 5 seconds */
    void showBottomStatusLabel(TQListViewItem* item);
    void clearBottomStatusLabel();
    void slotSetTimeElapsed();
    void newSearchManager();

    void slotAddingLevelTotalSteps(uint steps);
    void slotAddingLevelProgress();
    void slotLinksToCheckTotalSteps(uint steps);

    void slotChooseUrlDialog();

    void slotApplyFilter(LinkMatcher);
    
private:

    virtual void keyPressEvent ( TQKeyEvent* e );
    bool validFields();
    void insertUrlAtCombobox(TQString const& url);
    void init();
    void saveCurrentCheckSettings();
    bool pendingActions() const;
    void resetPendingActions();

private:
    SearchManager* search_manager_;
    ActionManager* action_manager_;

    bool ready_;
    bool to_start_;
    bool to_pause_;
    bool to_stop_;
    bool in_progress_;
    bool paused_;
    bool stopped_;

    TQTimer bottom_status_timer_;
    int max_simultaneous_connections_;
    int time_out_;
    bool tree_display_; // tree/flat result display
    bool follow_last_link_checked_;
    TDEToggleAction* start_search_action_;
};



#endif