home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kaddressbook / extensionwidget.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.1 KB  |  121 lines

  1. /*
  2.     This file is part of KAddressBook.
  3.     Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
  4.  
  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.
  9.  
  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.
  14.  
  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18.  
  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.
  22. */
  23.  
  24. #ifndef KAB_EXTENSIONWIDGET_H
  25. #define KAB_EXTENSIONWIDGET_H
  26.  
  27. #include <qwidget.h>
  28.  
  29. #include <kabc/addressbook.h>
  30. #include <klibloader.h>
  31. #include <kdepimmacros.h>
  32.  
  33. #define KAB_EXTENSIONWIDGET_PLUGIN_VERSION 1
  34.  
  35. namespace KAB {
  36. class Core;
  37. class ConfigureWidget;
  38.  
  39. class KDE_EXPORT ExtensionWidget : public QWidget
  40. {
  41.   Q_OBJECT
  42.  
  43.   public:
  44.     ExtensionWidget( Core *core, QWidget *parent, const char *name = 0 );
  45.     ~ExtensionWidget();
  46.  
  47.     /**
  48.       @return A pointer to the core object
  49.     */
  50.     KAB::Core *core() const;
  51.  
  52.     /**
  53.       Returns whether there are selected contacts in the view.
  54.      */
  55.     bool contactsSelected() const;
  56.  
  57.     /**
  58.       Returns a list of contacts that are selected in the view.
  59.       Use @ref addresseesSelected() to test if there exists selected
  60.       contacts.
  61.      */
  62.     KABC::Addressee::List selectedContacts();
  63.  
  64.     /**
  65.       This method is called whenever the selection in the view changed.
  66.      */
  67.     virtual void contactsSelectionChanged();
  68.  
  69.     /**
  70.       This method should be reimplemented and return the i18ned title of this
  71.       widget.
  72.      */
  73.     virtual QString title() const = 0;
  74.  
  75.     /**
  76.       This method should be reimplemented and return a unique identifier.
  77.      */
  78.     virtual QString identifier() const = 0;
  79.  
  80.   signals:
  81.     void modified( const KABC::Addressee::List &list );
  82.     void deleted( const QStringList& uidList );
  83.  
  84.   private:
  85.     KAB::Core *mCore;
  86.  
  87.     class ExtensionWidgetPrivate;
  88.     ExtensionWidgetPrivate *d;
  89. };
  90.  
  91. class ExtensionFactory : public KLibFactory
  92. {
  93.   public:
  94.     virtual ExtensionWidget *extension( KAB::Core *core, QWidget *parent,
  95.                                         const char *name = 0 ) = 0;
  96.  
  97.     virtual ConfigureWidget *configureWidget( QWidget*, const char* = 0 )
  98.     {
  99.       return 0;
  100.     }
  101.  
  102.     virtual bool configureWidgetAvailable() { return false; }
  103.  
  104.     /**
  105.       This method should return the same identifier like the config
  106.       widget.
  107.      */
  108.     virtual QString identifier() const = 0;
  109.  
  110.   protected:
  111.     virtual QObject* createObject( QObject*, const char*, const char*,
  112.                                    const QStringList & )
  113.     {
  114.       return 0;
  115.     }
  116. };
  117.  
  118. }
  119.  
  120. #endif
  121.