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:
00246     void initGUI();
00247 
00248     DefaultFilterType mDefaultFilterType;
00249     Filter mFilter;
00250     QString mDefaultFilterName;
00251     KAB::Core *mCore;
00252     KABC::Field::List mFieldList;
00253     
00254     QWidget *mViewWidget;
00255 };
00256 
00257 class ViewFactory : public KLibFactory
00258 {
00259   public:
00260     virtual KAddressBookView *view( KAB::Core *core, QWidget *parent,
00261                                     const char *name = 0 ) = 0;
00266     virtual QString type() const = 0;
00267     
00273     virtual QString description() const = 0;
00274     
00284     virtual ViewConfigureWidget *configureWidget( KABC::AddressBook *ab,
00285                                                   QWidget *parent,
00286                                                   const char *name = 0 ); 
00287 
00288   protected:
00289     virtual QObject* createObject( QObject*, const char*, const char*,
00290                                    const QStringList & )
00291     {
00292       return 0;
00293     }
00294 };
00295 
00296 #endif
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:52 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003