summaryrefslogtreecommitdiffstats
path: root/wizards/servertype.h
blob: 8e6954b4c37c5f7f26f3b5c99363aaa189506262 (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
/*
    This file is part of kdepim.

    Copyright (c) 2004 Tobias Koenig <[email protected]>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef SERVERTYPE
#define SERVERTYPE

#include <kconfigpropagator.h>
#include <klibloader.h>

#include <tqobject.h>

class ServerType : public QObject
{
  public:
    class ConnectionInfo
    {
      public:
        /**
          The unique identifier
         */
        TQString uid;

        /**
          The user visible name
         */
        TQString name;

        /**
          Whether the connection is active or passive
         */
        bool active;
    };

    /**
      This map tqcontains the uids and the user visible names
      of a server type.
     */
    typedef TQValueList<ConnectionInfo> ConnectionInfoList;

    ServerType( TQObject *parent, const char *name ):TQObject(parent, name) {}
    virtual ~ServerType() {}

    /**
      Returns the connection information of the server type.
     */
    virtual ConnectionInfoList connectionInfo() const = 0;

    /**
      This method is called whenever the user wants to add a new
      connection.
     */
    virtual void addConnection() = 0;

    /**
      This method is called whenever the user wants to edit an existing
      connection.

      @param uid The uid of the resource.
     */
    virtual void editConnection( const TQString& uid ) = 0;

    /**
      This method is called whenever the user wants to remove an existing
      connection.

      @param uid The uid of the resource.
     */
    virtual void deleteConnection( const TQString& uid ) = 0;

    /**
      This method is called whenever the user marks an existing
      connection as active or inactive.

      @param uid The uid of the resource.
      @param active Whether the connection shall be set active or not.
     */
    virtual void activateConnection( const TQString& uid, bool active ) = 0;

    virtual KConfigPropagator::Change::List changes() = 0;
};


/**
  A factory class which loads/creates ServerType objects for us.
 */
class ServerTypeFactory : public KLibFactory
{
  public:
    virtual ServerType *serverType( TQObject *parent, const char *name = 0 ) = 0;

    /**
      Returns the identifier.
     */
    virtual TQString identifier() const = 0;

    /**
      Returns the i18n'ed name.
     */
    virtual TQString title() const = 0;

  protected:
    virtual TQObject* createObject( TQObject*, const char*,
                                   const char*, const TQStringList & )
    { return 0; }
};

#endif