kaddressbook_plugin.h
1 /*
2  This file is part of Kontact.
3 
4  Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@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; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #ifndef KADDRESSBOOK_PLUGIN_H
26 #define KADDRESSBOOK_PLUGIN_H
27 
28 #include <klocale.h>
29 #include <kparts/part.h>
30 
31 #include "kaddressbookiface_stub.h"
32 #include "plugin.h"
33 #include <uniqueapphandler.h>
34 
35 class KAboutData;
36 
37 class KABUniqueAppHandler : public Kontact::UniqueAppHandler
38 {
39 public:
40  KABUniqueAppHandler( Kontact::Plugin* plugin ) : Kontact::UniqueAppHandler( plugin ) {}
41  virtual void loadCommandLineOptions();
42  virtual int newInstance();
43 };
44 
45 class KAddressbookPlugin : public Kontact::Plugin
46 {
47  Q_OBJECT
48  TQ_OBJECT
49 
50  public:
51  KAddressbookPlugin( Kontact::Core *core, const char *name, const TQStringList& );
52  ~KAddressbookPlugin();
53 
54  virtual bool createDCOPInterface( const TQString &serviceType );
55  virtual bool isRunningStandalone();
56  int weight() const { return 300; }
57 
58  bool canDecodeDrag( TQMimeSource * );
59  void processDropEvent( TQDropEvent * );
60 
61  virtual TQStringList configModules() const;
62 
63  virtual TQStringList invisibleToolbarActions() const;
64 
65  virtual void configUpdated();
66 
67  KAddressBookIface_stub *interface();
68 
69  //override
70  void loadProfile( const TQString& directory );
71 
72  //override
73  void saveToProfile( const TQString& directory ) const;
74 
75  protected:
76  KParts::ReadOnlyPart *createPart();
77  private slots:
78  void slotNewContact();
79  void slotNewDistributionList();
80  void slotSyncContacts();
81 
82  private:
83  KAddressBookIface_stub *mStub;
84  Kontact::UniqueAppWatcher *mUniqueAppWatcher;
85 };
86 
87 #endif