kaddressbook Library API Documentation

kaddressbookview.h

00001 /*
00002     This file is part of KAddressBook.
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019     As a special exception, permission is given to link this program
00020     with any edition of Qt, and distribute the resulting executable,
00021     without including the source code for Qt in the source distribution.
00022 */
00023 
00024 #ifndef KADDRESSBOOKVIEW_H
00025 #define KADDRESSBOOKVIEW_H
00026 
00027 #include <qstringlist.h>
00028 #include <qwidget.h>
00029 
00030 #include <kabc/field.h>
00031 #include <klibloader.h>
00032 
00033 #include "filter.h"
00034 #include "viewconfigurewidget.h"
00035 
00036 class KConfig;
00037 class KXMLGUIClient;
00038 
00039 class QDropEvent;
00040 
00041 namespace KAB { class Core; }
00042 namespace KABC { class AddressBook; }
00043 
00053 class KAddressBookView : public QWidget
00054 {
00055   Q_OBJECT
00056 
00057   public:
00058     enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
00059     
00060     KAddressBookView( KAB::Core *core, QWidget *parent, const char *name );
00061     virtual ~KAddressBookView();
00062 
00067     virtual QStringList selectedUids() = 0;
00068 
00082     virtual void readConfig( KConfig *config );
00083 
00096     virtual void writeConfig( KConfig *config );
00097 
00102     virtual QString selectedEmails();
00103 
00109     virtual QString type() const = 0;
00110 
00121     KABC::Field::List fields() const;
00122     
00129     void setFilter( const Filter& );
00130     
00136     DefaultFilterType defaultFilterType() const;
00137     
00142     const QString &defaultFilterName() const;
00143     
00147     KAB::Core *core() const;
00148 
00152     virtual KABC::Field *sortField() const = 0;
00153 
00154   public slots:
00162     virtual void refresh( QString uid = QString::null ) = 0;
00163 
00169     virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0;
00170 
00176     void popup( const QPoint &point );
00177 
00178   signals:
00183     void modified();
00184 
00196     void selected( const QString &uid );
00197 
00207     void executed( const QString &uid );
00208     
00214     void startDrag();
00215     
00221     void dropped( QDropEvent* );
00222 
00226     void sortFieldChanged();
00227 
00228   protected:
00235     KABC::Addressee::List addressees();
00236 
00243     QWidget *viewWidget();
00244 
00245   private slots:
00246     void updateView();
00247 
00248   private:
00249     void initGUI();
00250 
00251     DefaultFilterType mDefaultFilterType;
00252     Filter mFilter;
00253     QString mDefaultFilterName;
00254     KAB::Core *mCore;
00255     KABC::Field::List mFieldList;
00256     
00257     QWidget *mViewWidget;
00258 };
00259 
00260 class ViewFactory : public KLibFactory
00261 {
00262   public:
00263     virtual KAddressBookView *view( KAB::Core *core, QWidget *parent,
00264                                     const char *name = 0 ) = 0;
00269     virtual QString type() const = 0;
00270     
00276     virtual QString description() const = 0;
00277     
00287     virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab,
00288                                                   QWidget *parent,
00289                                                   const char *name = 0 ); 
00290 
00291   protected:
00292     virtual QObject* createObject( QObject*, const char*, const char*,
00293                                    const QStringList & )
00294     {
00295       return 0;
00296     }
00297 };
00298 
00299 #endif
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Dec 21 14:24:11 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003