kaddressbook

distributionlistngwidget.h
1 /*
2  This file is part of KAddressBook.
3  Copyright (c) 2007 Klaralvdalens Datakonsult AB <frank@kdab.net>
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  As a special exception, permission is given to link this program
19  with any edition of TQt, and distribute the resulting executable,
20  without including the source code for TQt in the source distribution.
21 */
22 
23 #ifndef KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
24 #define KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H
25 
26 #include "extensionwidget.h"
27 
28 #include <kabc/addressee.h>
29 
30 #include <klistbox.h>
31 
32 #include <tqstringlist.h>
33 
34 class TQDragEnterEvent;
35 class TQDragMoveEvent;
36 class TQDropEvent;
37 class TQPoint;
38 class TQPushButton;
39 
40 namespace KABC {
41  class DistributionListManager;
42 }
43 
44 namespace KAB {
45 namespace DistributionListNg {
46 
47 class ListBox : public KListBox
48 {
49  Q_OBJECT
50  TQ_OBJECT
51 public:
52  ListBox( TQWidget* parent = 0 );
53 
54 signals:
55 
56  void dropped( const TQString &listName, const KABC::Addressee::List &addressees );
57 
58 protected:
59  //override
60  void dragEnterEvent( TQDragEnterEvent *event );
61  //override
62  void dragMoveEvent( TQDragMoveEvent *event );
63  //override
64  void dropEvent( TQDropEvent *event );
65 };
66 
67 class MainWidget : public KAB::ExtensionWidget
68 {
69  Q_OBJECT
70  TQ_OBJECT
71 
72 public:
73  explicit MainWidget( KAB::Core *core, TQWidget *parent = 0, const char *name = 0 );
74 
75  //impl
76  TQString title() const;
77 
78  //impl
79  TQString identifier() const;
80 
81 
82 private:
83  void changed( const KABC::Addressee& );
84 
85 private slots:
86 
87  void deleteSelectedDistributionList();
88  void editSelectedDistributionList();
89 
90  void contextMenuRequested( TQListBoxItem *item, const TQPoint &point );
91  void updateEntries();
92  void itemSelected( int index );
93  void contactsDropped( const TQString &listName, const KABC::Addressee::List &addressees );
94 
95 private:
96  ListBox *mListBox;
97  TQStringList mCurrentEntries;
98  TQPushButton *mAddButton;
99  TQPushButton *mEditButton;
100  TQPushButton *mRemoveButton;
101 };
102 
103 } // namespace DistributionListNg
104 } // namespace KAB
105 
106 #endif // KAB_DISTRIBUTIONLISTNG_MAINWIDGET_H