kmail_plugin.h
1 /*
2  This file is part of Kontact.
3  Copyright (c) 2003 Kontact Developer
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 KMAIL_PLUGIN_H
25 #define KMAIL_PLUGIN_H
26 
27 #include <tdelocale.h>
28 #include <tdeparts/part.h>
29 
30 #include "kmailIface_stub.h"
31 #include <plugin.h>
32 #include <summary.h>
33 #include <uniqueapphandler.h>
34 
35 class TQMimeSource;
36 class TQDropEvent;
37 
38 class KMailUniqueAppHandler : public Kontact::UniqueAppHandler
39 {
40 public:
41  KMailUniqueAppHandler( Kontact::Plugin* plugin ) : Kontact::UniqueAppHandler( plugin ) {}
42  virtual void loadCommandLineOptions();
43  virtual int newInstance();
44 };
45 
46 class KMailPlugin : public Kontact::Plugin
47 {
48  Q_OBJECT
49 
50  public:
51  KMailPlugin( Kontact::Core *core, const char *name, const TQStringList& );
52  virtual ~KMailPlugin();
53 
54  virtual bool isRunningStandalone();
55  virtual bool createDCOPInterface( const TQString& serviceType );
56  virtual Kontact::Summary *createSummaryWidget( TQWidget *parent );
57  virtual TQString tipFile() const;
58  int weight() const { return 200; }
59 
60  virtual TQStringList invisibleToolbarActions() const;
61  virtual bool queryClose() const;
62 
63  //override
64  void loadProfile( const TQString& profileDirectory );
65 
66  //override
67  void saveToProfile( const TQString& profileDirectory );
68 
69  protected:
70  virtual KParts::ReadOnlyPart* createPart();
71  void openComposer( const KURL& = KURL() );
72  void openComposer( const TQString& to );
73  bool canDecodeDrag( TQMimeSource * );
74  void processDropEvent( TQDropEvent * );
75 
76 
77  protected slots:
78  void slotNewMail();
79  void slotSyncFolders();
80 
81  private:
82  KMailIface_stub *mStub;
83  Kontact::UniqueAppWatcher *mUniqueAppWatcher;
84 };
85 
86 #endif