kaddressbook Library API Documentation

kaddressbookview.h

00001 #ifndef KADDRESSBOOKVIEW_H
00002 #define KADDRESSBOOKVIEW_H
00003 
00004 /*
00005     This file is part of KAddressBook.
00006     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of Qt, and distribute the resulting executable,
00024     without including the source code for Qt in the source distribution.
00025 */
00026 
00027 #include <qstringlist.h>
00028 #include <qwidget.h>
00029 
00030 #include <kabc/field.h>
00031 
00032 #include "filter.h"
00033 
00034 class QDropEvent;
00035 class KConfig;
00036 
00037 namespace KABC { class AddressBook; }
00038 
00047 class KAddressBookView : public QWidget
00048 {
00049     Q_OBJECT
00050 
00051   public:
00052     enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
00053     
00054     KAddressBookView(KABC::AddressBook *doc,
00055                      QWidget *parent, const char *name);
00056     virtual ~KAddressBookView();
00057 
00061     virtual QStringList selectedUids() = 0;
00062 
00075     virtual void readConfig(KConfig *config);
00076 
00088     virtual void writeConfig(KConfig *config);
00089 
00093     virtual QString selectedEmails();
00094 
00099     virtual QString type() const = 0;
00100 
00117     virtual void incrementalSearch(const QString &value, KABC::Field *field);
00118 
00128     KABC::Field::List fields() const { return mFieldList; }
00129     
00135     void setFilter(const Filter &f);
00136     
00141     DefaultFilterType defaultFilterType() const { return mDefaultFilterType; }
00142     
00146     const QString &defaultFilterName() const { return mDefaultFilterName; }
00147     
00150     KABC::AddressBook *addressBook() const { return mDocument; }
00151 
00152   public slots:
00159     virtual void refresh(QString uid = QString::null) = 0;
00160 
00165     virtual void setSelected(QString uid = QString::null,
00166                              bool selected = true) = 0;
00167 
00168   signals:
00172     void modified();
00173 
00184     void selected(const QString &uid);
00185 
00194     void executed(const QString &uid);
00195     
00200     void startDrag();
00201     
00206     void dropped(QDropEvent *e);
00207 
00208   protected:
00214     KABC::Addressee::List addressees();
00215 
00221     QWidget *viewWidget() { return mViewWidget; }
00222 
00223   protected slots:
00224 
00225 
00226   private:
00229     void initGUI();
00230 
00231     KABC::AddressBook *mDocument;
00232     KABC::Field::List mFieldList;
00233     Filter mFilter;
00234     DefaultFilterType mDefaultFilterType;
00235     QString mDefaultFilterName;
00236     
00237     // GUI Components
00238     QWidget *mViewWidget;
00239 };
00240 
00241 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:37 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001