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 <tdeabc/addressee.h>
29
30#include <tdelistbox.h>
31
32#include <tqstringlist.h>
33
34class TQDragEnterEvent;
35class TQDragMoveEvent;
36class TQDropEvent;
37class TQPoint;
38class TQPushButton;
39
40namespace TDEABC {
41 class DistributionListManager;
42}
43
44namespace KAB {
45namespace DistributionListNg {
46
47class ListBox : public TDEListBox
48{
49 TQ_OBJECT
50
51public:
52 ListBox( TQWidget* parent = 0 );
53
54signals:
55
56 void dropped( const TQString &listName, const TDEABC::Addressee::List &addressees );
57
58protected:
59 //override
60 void dragEnterEvent( TQDragEnterEvent *event );
61 //override
62 void dragMoveEvent( TQDragMoveEvent *event );
63 //override
64 void dropEvent( TQDropEvent *event );
65};
66
67class MainWidget : public KAB::ExtensionWidget
68{
69 TQ_OBJECT
70
71
72public:
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
82private:
83 void changed( const TDEABC::Addressee& );
84
85private 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 TDEABC::Addressee::List &addressees );
94
95private:
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