kaddressbook

kaddressbookcardview.h

00001 #ifndef KADDRESSBOOKCARDVIEW_H
00002 #define KADDRESSBOOKCARDVIEW_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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00021 
00022     As a special exception, permission is given to link this program
00023     with any edition of TQt, and distribute the resulting executable,
00024     without including the source code for TQt in the source distribution.
00025 */
00026 
00027 #include <tqstring.h>
00028 #include <kiconview.h>
00029 
00030 #include "cardview.h"
00031 #include "kaddressbookview.h"
00032 
00033 class TQDragEntryEvent;
00034 class TQDropEvent;
00035 class KConfig;
00036 class AddresseeCardView;
00037 
00043 class KAddressBookCardView : public KAddressBookView
00044 {
00045   Q_OBJECT
00046   TQ_OBJECT
00047 
00048   public:
00049     KAddressBookCardView( KAB::Core *core, TQWidget *parent,
00050                           const char *name = 0 );
00051     virtual ~KAddressBookCardView();
00052 
00053     virtual TQStringList selectedUids();
00054     virtual TQString type() const { return "Card"; }
00055     virtual KABC::Field *sortField() const;
00056 
00057     virtual void readConfig( KConfig *config );
00058     virtual void writeConfig( KConfig *config );
00059 
00060     void scrollUp();
00061     void scrollDown();
00062 
00063   public slots:
00064     void refresh( const TQString &uid = TQString() );
00065     void setSelected( const TQString &uid = TQString(), bool selected = true );
00066     virtual void setFirstSelected( bool selected = true );
00067 
00068   protected slots:
00069     void addresseeExecuted( CardViewItem* );
00070     void addresseeSelected();
00071     void rmbClicked( CardViewItem*, const TQPoint& );
00072 
00073   private:
00074     AddresseeCardView *mCardView;
00075     bool mShowEmptyFields;
00076 };
00077 
00078 class AddresseeCardView : public CardView
00079 {
00080   Q_OBJECT
00081   TQ_OBJECT
00082   public:
00083     AddresseeCardView( TQWidget *parent, const char *name = 0 );
00084     ~AddresseeCardView();
00085 
00086   signals:
00087     void startAddresseeDrag();
00088     void addresseeDropped( TQDropEvent* );
00089 
00090   protected:
00091     virtual void dragEnterEvent( TQDragEnterEvent* );
00092     virtual void dropEvent( TQDropEvent* );
00093     virtual void startDrag();
00094 };
00095 
00096 #endif