libtdepim

completionordereditor.h
1 /*
2  * completionordereditor.h
3  *
4  * Copyright (c) 2004 David Faure <faure@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License
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  * In addition, as a special exception, the copyright holders give
20  * permission to link the code of this program with any edition of
21  * the TQt library by Trolltech AS, Norway (or with modified versions
22  * of TQt that use the same license as TQt), and distribute linked
23  * combinations including the two. You must obey the GNU General
24  * Public License in all respects for all of the code used other than
25  * TQt. If you modify this file, you may extend this exception to
26  * your version of the file, but you are not obligated to do so. If
27  * you do not wish to do so, delete this exception statement from
28  * your version.
29  */
30 
31 #ifndef COMPLETIONORDEREDITOR_H
32 #define COMPLETIONORDEREDITOR_H
33 
34 #include <kdialogbase.h>
35 #include <tdeconfig.h>
36 
37 class KPushButton;
38 class TDEListView;
39 namespace KPIM {
40 
41 class LdapSearch;
42 class CompletionOrderEditor;
43 
44 // Base class for items in the list
45 class CompletionItem
46 {
47 public:
48  virtual ~CompletionItem() {}
49  virtual TQString label() const = 0;
50  virtual int completionWeight() const = 0;
51  virtual void setCompletionWeight( int weight ) = 0;
52  virtual void save( CompletionOrderEditor* ) = 0;
53 };
54 
55 
56 // I don't like TQPtrList much, but it has compareItems, which TQValueList doesn't
57 class CompletionItemList : public TQPtrList<CompletionItem>
58 {
59 public:
60  CompletionItemList() {}
61  virtual int compareItems( TQPtrCollection::Item s1, TQPtrCollection::Item s2 );
62 };
63 
64 class CompletionOrderEditor : public KDialogBase {
65  TQ_OBJECT
66 
67 
68 public:
69  CompletionOrderEditor( KPIM::LdapSearch* ldapSearch, TQWidget* parent, const char* name = 0 );
70  ~CompletionOrderEditor();
71 
72  TDEConfig* configFile() { return &mConfig; }
73 
74 private slots:
75  void slotSelectionChanged( TQListViewItem* );
76  void slotMoveUp();
77  void slotMoveDown();
78  virtual void slotOk();
79 
80 private:
81  TDEConfig mConfig;
82  CompletionItemList mItems;
83  TDEListView* mListView;
84  KPushButton* mUpButton;
85  KPushButton* mDownButton;
86 
87  bool mDirty;
88 };
89 
90 } // namespace
91 
92 #endif /* COMPLETIONORDEREDITOR_H */
93 
This class is internal.
Definition: ldapclient.h:247
TDEPIM classes for drag and drop of mails.