libtdepim

resourceabc.h
1 /*
2  This file is part of libtdepim.
3 
4  Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #ifndef RESOURCEABC_H
26 #define RESOURCEABC_H
27 
28 #include <tdeabc/resource.h>
29 #include <tqmap.h>
30 #include <tdemacros.h>
31 
32 // This is here because it can't go to tdelibs/tdeabc yet, but ultimately
33 // it should probably go there (maybe redesigned to have a real object
34 // for subresources).
35 
36 namespace KPIM {
37 
44 class TDE_EXPORT ResourceABC : public TDEABC::Resource
45 {
46  TQ_OBJECT
47 
48 
49 public:
50  ResourceABC( const TDEConfig* );
51  virtual ~ResourceABC();
52 
59  virtual TQMap<TQString, TQString> uidToResourceMap() const = 0;
60 
66  virtual TQStringList subresources() const { return TQStringList(); }
67 
71  virtual bool subresourceActive( const TQString& ) const { return true; }
72 
76  virtual bool subresourceWritable( const TQString& ) const = 0;
77 
81  virtual int subresourceCompletionWeight( const TQString& ) const = 0;
82 
86  virtual TQString subresourceLabel( const TQString& ) const = 0;
87 
88 public slots:
92  virtual void setSubresourceActive( const TQString &, bool active ) = 0;
93 
97  virtual void setSubresourceCompletionWeight( const TQString&, int weight ) = 0;
98 
99 signals:
103  void signalSubresourceAdded( KPIM::ResourceABC *, const TQString &type,
104  const TQString &subResource );
105 
109  void signalSubresourceRemoved( KPIM::ResourceABC *, const TQString &type,
110  const TQString &subResource );
111 
112 };
113 
114 }
115 
116 #endif // RESOURCEABC_H
This class is the implementation of subfolder resources for KABC.
Definition: resourceabc.h:45
virtual void setSubresourceActive(const TQString &, bool active)=0
(De-)activate a subresource.
virtual void setSubresourceCompletionWeight(const TQString &, int weight)=0
Set completion weight for a given subresource.
virtual TQStringList subresources() const
If this resource has subresources, return a TQStringList of them.
Definition: resourceabc.h:66
void signalSubresourceAdded(KPIM::ResourceABC *, const TQString &type, const TQString &subResource)
This signal is emitted when a subresource is added.
virtual TQString subresourceLabel(const TQString &) const =0
Label for a given subresource.
void signalSubresourceRemoved(KPIM::ResourceABC *, const TQString &type, const TQString &subResource)
This signal is emitted when a subresource is removed.
virtual int subresourceCompletionWeight(const TQString &) const =0
Completion weight for a given subresource.
virtual TQMap< TQString, TQString > uidToResourceMap() const =0
Get the UID to subresource map.
virtual bool subresourceActive(const TQString &) const
Is this subresource active or not?
Definition: resourceabc.h:71
virtual bool subresourceWritable(const TQString &) const =0
Is the given subresource writable?
TDEPIM classes for drag and drop of mails.