kaddressbook

kaddressbookiconview.h
1 /*
2  This file is part of KAddressBook.
3  Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
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 TQt, and distribute the resulting executable,
21  without including the source code for TQt in the source distribution.
22 */
23 
24 #ifndef KADDRESSBOOKICONVIEW_H
25 #define KADDRESSBOOKICONVIEW_H
26 
27 #include <tqstring.h>
28 #include <kiconview.h>
29 #include "kaddressbookview.h"
30 
31 class TQIconViewItem;
32 class TDEConfig;
33 class AddresseeIconView;
34 class AddresseeIconViewItem;
35 
36 namespace TDEABC { class AddressBook; }
37 
43 {
44  TQ_OBJECT
45 
46 
47  public:
48  KAddressBookIconView( KAB::Core *core, TQWidget *parent,
49  const char *name = 0 );
50  virtual ~KAddressBookIconView();
51 
52  virtual TQStringList selectedUids();
53  virtual TQString type() const { return "Icon"; }
54  virtual TDEABC::Field *sortField() const;
55  virtual void readConfig( TDEConfig *config );
56 
57  void scrollUp();
58  void scrollDown();
59 
60  public slots:
61  void refresh( const TQString &uid = TQString() );
62  void setSelected( const TQString &uid = TQString(), bool selected = true );
63  virtual void setFirstSelected( bool selected = true );
64 
65  protected slots:
66  void addresseeExecuted( TQIconViewItem *item );
67  void addresseeSelected();
68  void rmbClicked( TQIconViewItem*, const TQPoint& );
69 
70  private:
71  AddresseeIconView *mIconView;
72  TQPtrList<AddresseeIconViewItem> mIconList;
73 };
74 
75 
76 class AddresseeIconView : public TDEIconView
77 {
78  TQ_OBJECT
79 
80 
81  public:
82  AddresseeIconView( TQWidget *parent, const char *name = 0 );
83  ~AddresseeIconView();
84 
85  signals:
86  void addresseeDropped( TQDropEvent* );
87  void startAddresseeDrag();
88 
89  protected:
90  virtual TQDragObject *dragObject();
91 
92  protected slots:
93  void itemDropped( TQDropEvent*, const TQValueList<TQIconDragItem>& );
94 };
95 #endif
This is an example kaddressbook view that is implemented using TDEIconView.
virtual void readConfig(TDEConfig *config)
Called whenever this view should read the config.
virtual TQStringList selectedUids()
Must be overloaded in subclasses.
virtual TQString type() const
Return the type of the view: Icon, Table, etc.
virtual TDEABC::Field * sortField() const
Base class for all views in kaddressbook.
KAB::Core * core() const
void selected(const TQString &uid)
This signal should be emitted by a subclass whenever an addressee is selected.