summaryrefslogtreecommitdiffstats
path: root/konversation/src/channeloptionsdialog.h
blob: 2ecf53ee58db5e08dedac1fcf00057490d0f8eac (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
/*
  This program is free software; you can redistribute it and/or modifydvancedModes
  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.
*/

/*
  copyright: (C) 2004 by Peter Simonsson
  email:     psn@linux.se
*/
#ifndef KONVERSATIONCHANNELOPTIONSDIALOG_H
#define KONVERSATIONCHANNELOPTIONSDIALOG_H

#include "channel.h"

#include <tqstringlist.h>

#include <kdialogbase.h>
#include <tdelistview.h>


namespace Konversation
{
    class ChannelOptionsUI;

    class ChannelOptionsDialog : public KDialogBase
    {
        Q_OBJECT
  
            public:
            explicit ChannelOptionsDialog(Channel *channel);
            ~ChannelOptionsDialog();

            TQString topic();
            TQStringList modes();


        public slots:
            void refreshTopicHistory();
            void refreshAllowedChannelModes();
            void refreshModes();
            void refreshEnableModes();
            void toggleAdvancedModes();

            void refreshBanList();
            void addBan(const TQString& newban);
            void addBanClicked();
            void removeBan(const TQString& ban);
            void removeBanClicked();
            void banEdited(TQListViewItem *edited);

            void changeOptions();


        protected slots:
            void topicHistoryItemClicked(TQListViewItem* item);
            void topicBeingEdited(bool state);

            void cancelClicked();
            void okClicked();


        protected:
            bool m_editingTopic;
            TQListViewItem *m_NewBan;


        private:
            ChannelOptionsUI* m_widget;
            Channel *m_channel;
    };


    // This is needed to overcome two deficiencies in TDEListViewItem
    // First there is no signal emitted when a rename is canceled
    // Second there is no way to get the old value of an item after a rename
    class BanListViewItem : public TDEListViewItem
    {
        public:
            explicit BanListViewItem( TQListView *parent );
            BanListViewItem(TQListView *parent, bool isNew);
            BanListViewItem(TQListView *parent, const TQString& label1, const TQString& label2 = TQString(), uint timestamp = 0);
            BanListViewItem (TQListView *parent, bool isNew, const TQString& label1, const TQString& label2 = TQString(), uint timestamp = 0);

            TQString getOldValue() { return m_oldValue; }
            TQDateTime timestamp() { return m_timestamp; }

            virtual TQString text(int column) const;
            virtual int compare(TQListViewItem *i, int col, bool ascending) const;
            virtual void startRename(int col);


        protected:
            virtual void cancelRename(int col);

            TQString m_oldValue;
            bool m_isNewBan;
            TQDateTime m_timestamp;
    };

}
#endif