2 This file is part of KAddressBook.
3 Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
27 #include <kabc/resource.h>
30 // This is here because it can't go to kdelibs/kabc yet, but ultimately
31 // it should probably go there (maybe redesigned to have a real object
37 * This class is the implementation of subfolder resources for KABC.
38 * More methods will be added to give KAddressBook the possibility to
39 * handle subresources.
42 class ResourceABC
: public KABC::Resource
47 ResourceABC( const KConfig
* );
48 virtual ~ResourceABC();
51 * Get the UID to subresource map. This is necessary to implement
53 * The returned map has the UID as key and the resource it's in as
56 virtual QMap
<QString
, QString
> uidToResourceMap() const = 0;
59 * If this resource has subresources, return a QStringList of them.
60 * In most cases, resources do not have subresources, so this is
61 * by default just empty.
63 virtual QStringList
subresources() const { return QStringList(); }
66 * Is this subresource active or not?
68 virtual bool subresourceActive( const QString
& ) const { return true; }
71 * Completion weight for a given subresource
73 virtual int subresourceCompletionWeight( const QString
& ) const = 0;
76 * Label for a given subresource
78 virtual QString
subresourceLabel( const QString
& ) const = 0;
82 * (De-)activate a subresource.
84 virtual void setSubresourceActive( const QString
&, bool active
) = 0;
87 * Set completion weight for a given subresource
89 virtual void setSubresourceCompletionWeight( const QString
&, int weight
) = 0;
93 * This signal is emitted when a subresource is added.
95 void signalSubresourceAdded( KPIM::ResourceABC
*, const QString
&type
,
96 const QString
&subResource
);
99 * This signal is emitted when a subresource is removed.
101 void signalSubresourceRemoved( KPIM::ResourceABC
*, const QString
&type
,
102 const QString
&subResource
);
108 #endif // RESOURCEABC_H