libtdepim

resourceabc.h
00001 /*
00002     This file is part of libtdepim.
00003 
00004     Copyright (c) 2004 Bo Thorsen <bo@sonofthor.dk>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of TQt, and distribute the resulting executable,
00022     without including the source code for TQt in the source distribution.
00023 */
00024 
00025 #ifndef RESOURCEABC_H
00026 #define RESOURCEABC_H
00027 
00028 #include <tdeabc/resource.h>
00029 #include <tqmap.h>
00030 #include <tdepimmacros.h>
00031 
00032 // This is here because it can't go to tdelibs/tdeabc yet, but ultimately
00033 // it should probably go there (maybe redesigned to have a real object
00034 // for subresources).
00035 
00036 namespace KPIM {
00037 
00044 class KDE_EXPORT ResourceABC : public TDEABC::Resource
00045 {
00046   Q_OBJECT
00047   
00048 
00049 public:
00050   ResourceABC( const TDEConfig* );
00051   virtual ~ResourceABC();
00052 
00059   virtual TQMap<TQString, TQString> uidToResourceMap() const = 0;
00060 
00066   virtual TQStringList subresources() const { return TQStringList(); }
00067 
00071   virtual bool subresourceActive( const TQString& ) const { return true; }
00072 
00076   virtual bool subresourceWritable( const TQString& ) const = 0;
00077 
00081   virtual int subresourceCompletionWeight( const TQString& ) const = 0;
00082 
00086   virtual TQString subresourceLabel( const TQString& ) const = 0;
00087 
00088 public slots:
00092   virtual void setSubresourceActive( const TQString &, bool active ) = 0;
00093 
00097   virtual void setSubresourceCompletionWeight( const TQString&, int weight ) = 0;
00098 
00099 signals:
00103   void signalSubresourceAdded( KPIM::ResourceABC *, const TQString &type,
00104                                const TQString &subResource );
00105 
00109   void signalSubresourceRemoved( KPIM::ResourceABC *, const TQString &type,
00110                                  const TQString &subResource );
00111 
00112 };
00113 
00114 }
00115 
00116 #endif // RESOURCEABC_H