summaryrefslogtreecommitdiffstats
path: root/konversation/src/channellistpanel.h
blob: f03dc3f528fd300b8a1ec1eb92cc5c706c2d5e6b (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
/*
  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.
*/

/*
  Shows the list of channels
  begin:     Die Apr 29 2003
  copyright: (C) 2003 by Dario Abatianni
  email:     eisfuchs@tigress.com
*/

#ifndef CHANNELLISTPANEL_H
#define CHANNELLISTPANEL_H

#include "chatwindow.h"

#include <tqtimer.h>


class TQCheckBox;
class TQStringList;
class TQTimer;
class TQListView;
class TQListViewItem;
class TQPushButton;

class TDEListView;
class KLineEdit;
class ChannelListViewItem;

class ChannelListPanel : public ChatWindow
{
    TQ_OBJECT
  

    public:
        explicit ChannelListPanel(TQWidget* parent);
        ~ChannelListPanel();

        virtual bool closeYourself();
        virtual void emitUpdateInfo();

    signals:
        void refreshChannelList();
        void joinChannel(const TQString& channelName);
        void adjustMinValue(int num);
        void adjustMaxValue(int num);
        void updateNumUsers(const TQString& num);
        void updateNumChannels(const TQString& num);

    public slots:
        void addToChannelList(const TQString& channel,int users,const TQString& topic);

        virtual void appendInputText(const TQString&, bool fromCursor);
        void setFilter(const TQString& filter);

        void applyFilterClicked();

    protected slots:
        void refreshList();
        void updateDisplay();                     // will be called by a timer to update regularly
        void saveList();
        void joinChannelClicked();

        void setMinUsers(int num);
        void setMaxUsers(int num);

        void filterTextChanged(const TQString& newText);
        void channelTargetClicked();
        void topicTargetClicked();
        void regExpClicked();

        void contextMenu (TDEListView* l, TQListViewItem* i, const TQPoint& p);

        //Used to disable functions when not connected
        virtual void serverOnline(bool online);

    protected:

        /** Called from ChatWindow adjustFocus */
        virtual void childAdjustFocus();

        virtual bool isInsertCharacterSupported() { return true; }

        int getNumChannels();
        int getNumUsers();
        int getVisibleChannels();
        int getVisibleUsers();

        void setNumChannels(int num);
        void setNumUsers(int num);
        void setVisibleChannels(int num);
        void setVisibleUsers(int num);

        void setChannelTarget(bool state);
        bool getChannelTarget();

        void setTopicTarget(bool state);
        bool getTopicTarget();

        void setRegExp(bool state);
        bool getRegExp();

        int getMinUsers();
        int getMaxUsers();

        const TQString& getFilterText();
        void  applyFilterToItem(TQListViewItem* item);

        void updateUsersChannels();

        int numChannels;
        int numUsers;
        int visibleChannels;
        int visibleUsers;

        int minUsers;
        int maxUsers;

        bool channelTarget;
        bool topicTarget;

        bool regExp;

        // store channels to be inserted in ListView here first
        TQStringList pendingChannels;
        TQTimer updateTimer;

        TQCheckBox* channelFilter;
        TQCheckBox* topicFilter;
        TQCheckBox* regexpCheck;

        TQPushButton* applyFilter;
        TQPushButton* refreshListButton;
        TQPushButton* joinChannelButton;

        TDEListView* channelListView;

        KLineEdit* filterInput;

        TQString filterText;

        int m_oldSortColumn;
};
#endif