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

/*
  Copyright (C) 2002 Dario Abatianni <eisfuchs@tigress.com>
  Copyright (C) 2005 Ismail Donmez <ismail@kde.org>
  Copyright (C) 2005 Peter Simonsson <psn@linux.se>
  Copyright (C) 2005 John Tapsell <johnflux@gmail.com>
  Copyright (C) 2005-2008 Eike Hein <hein@kde.org>
*/

#ifndef PREFERENCES_H
#define PREFERENCES_H

#include "servergroupsettings.h"
#include "identity.h"
#include "preferences_base.h"

#include <tqobject.h>
#include <tqptrlist.h>
#include <tqsize.h>
#include <tqvaluelist.h>
#include <tqstringlist.h>
#include <tqfont.h>
#include <tqcolor.h>
#include <tqmap.h>

#include <tdeversion.h>


/*
Options still to be GUIfied:

Operator LEDs (int)
OperatorColor (int)
VoiceColor (int)
NoRightsColor (int)
*/

class Ignore;
class Highlight;

class Preferences : public TQObject, public PreferencesBase
{
    TQ_OBJECT
  

    protected:
        Preferences();
        static Preferences *mSelf;

    public:

        static Preferences *self();
        ~Preferences();
        enum Pages
        {
            NotifyPage,
            ChatWinAppearancePage
        };
        static const Konversation::ServerGroupList serverGroupList();
        static void setServerGroupList(const Konversation::ServerGroupList& list);
        static void addServerGroup(Konversation::ServerGroupSettingsPtr serverGroup);
        static const Konversation::ServerGroupSettingsPtr serverGroupById(int id);
        static const Konversation::ServerGroupSettingsPtr serverGroupByServer(const TQString& server);
        static int serverGroupIdByName(const TQString& serverGroup);
        static bool isServerGroup(const TQString& server);
        static void removeServerGroup(int id);

        /** Returns a list of alias set up by default.  This is a set of aliases for the scripts found. */
        static TQStringList defaultAliasList();

        //notifylist is in tdeconfigxt - FIXME
        static const TQMap<int, TQStringList> notifyList();
        static const TQStringList notifyListByGroupName(const TQString& groupName);
        static const TQString notifyStringByGroupName(const TQString& groupName);
        static void setNotifyList(const TQMap<int, TQStringList>& newList);
        static bool addNotify(int serverGroupId, const TQString& newPattern);
        static bool removeNotify(const TQString& groupName, const TQString& pattern);
        static bool isNotify(int serverGroupId, const TQString& pattern);
        static bool hasNotifyList(int serverGroupId);

        static const TQPtrList<Highlight> highlightList();
        static void setHighlightList(TQPtrList<Highlight> newList);
        static void addHighlight(const TQString& newHighlight,bool regExp, const TQColor &color,const TQString& sound,const TQString& autoText);

        /* All of the below work on the first (default) identity in your identity list*/
        static void addIgnore(const TQString &newIgnore);
        static bool removeIgnore(const TQString &oldIgnore);
        static bool isIgnored(const TQString &nickname);
        static void clearIgnoreList();
        static const TQPtrList<Ignore> ignoreList();
        static void setIgnoreList(TQPtrList<Ignore> newList);

        static const TQStringList quickButtonList();
        static const TQStringList defaultQuickButtonList();
        static void setQuickButtonList(const TQStringList newList);
        static void clearQuickButtonList();

        static const TQStringList autoreplaceList();
        static const TQStringList defaultAutoreplaceList();
        static void setAutoreplaceList(const TQStringList newList);
        static void clearAutoreplaceList();

        static void addIdentity(IdentityPtr identity);
        static void removeIdentity(IdentityPtr identity);
        static void clearIdentityList();
        static const IdentityList identityList();
        static void setIdentityList(const IdentityList& list);
        static const IdentityPtr identityByName(const TQString& name);
        static const IdentityPtr identityById(int id);
        static const TQString ident();
        static void setIdent(const TQString &ident);
        static const TQString realName();
        static void setRealName(const TQString &name);
        static const TQString partReason();
        static void setPartReason(const TQString &newReason);
        static const TQString kickReason();
        static void setKickReason(const TQString &newReason);
        static void setShowAwayMessage(bool state);
        static bool showAwayMessage();
        static const TQString awayMessage();
        static void setAwayMessage(const TQString &newMessage);
        static const TQString unAwayMessage();
        static void setUnAwayMessage(const TQString &newMessage);
        static const TQString defaultNicknameSortingOrder();
        static const TQString nickname(int index);
        static const TQStringList nicknameList();
        static void setNickname(int index,const TQString &newName);
        static void setNicknameList(const TQStringList &newList);

        static bool dialogFlag(const TQString& flagName);
        static void setDialogFlag(const TQString& flagName,bool state);

        static const TQString channelEncoding(const TQString& server,const TQString& channel);
        static const TQString channelEncoding(int serverGroupId,const TQString& channel);
        static void setChannelEncoding(const TQString& server,const TQString& channel,const TQString& encoding);
        static void setChannelEncoding(int serverGroupId,const TQString& channel,const TQString& encoding);
        static const TQValueList<int> channelEncodingsServerGroupIdList();
        static const TQStringList channelEncodingsChannelList(int serverGroupId);

        static void setShowTrayIcon(bool state);
        static void setTrayNotify(bool state);
        static void setAutoUserhost(bool state);

        static TQString webBrowserCmd();

    signals:
        void requestServerConnection(int number);
        void requestSaveOptions();
        void autoContinuousWhoChanged();
        void updateTrayIcon();

    protected:
        IdentityPtr mIdentity;
        Konversation::ServerGroupList mServerGroupList;
        TQPtrList<Ignore> mIgnoreList;
        TQValueList<IdentityPtr> mIdentityList;
        TQPtrList<Highlight> mHighlightList;
        TQMap<int, TQStringList> mNotifyList;  // network id, list of nicks
        TQMap< int,TQMap<TQString,TQString> > mChannelEncodingsMap;  // mChannelEncodingsMap[serverGroupdId][channelName]
        TQStringList mQuickButtonList;
        TQStringList mAutoreplaceList;
        TQString mSortingOrder;
};
#endif