1/*
2 This file is part of the KDE Kontact Plugin Interface Library.
3
4 Copyright (c) 2001 Matthias Hoelzer-Kluepfel <mhk@kde.org>
5 Copyright (c) 2002-2003 Daniel Molkentin <molkentin@kde.org>
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21
22*/
23#ifndef KONTACTINTERFACE_CORE_H
24#define KONTACTINTERFACE_CORE_H
25
26#include "kontactinterface_export.h"
27#include <kparts/mainwindow.h>
28#include <kparts/part.h>
29
30namespace KontactInterface {
31
32class Plugin;
33
34/**
35 * @short The abstract interface that represents the Kontact core.
36 *
37 * This class provides the interface to the Kontact core for the plugins.
38 */
39class KONTACTINTERFACE_EXPORT Core : public KParts::MainWindow
40{
41 Q_OBJECT
42
43 public:
44 /**
45 * Destroys the core object.
46 */
47 virtual ~Core();
48
49 /**
50 * Selects the given plugin and raises the associated part.
51 * @see selectPlugin(const QString &)
52 *
53 * @param plugin is a pointer to the Kontact Plugin to select.
54 */
55 virtual void selectPlugin( KontactInterface::Plugin *plugin ) = 0;
56
57 /**
58 * This is an overloaded member function
59 * @see selectPlugin(KontactInterface::Plugin *)
60 *
61 * @param plugin is the name of the Kontact Plugin select.
62 */
63 virtual void selectPlugin( const QString &plugin ) = 0;
64
65 /**
66 * Returns the pointer list of available plugins.
67 */
68 virtual QList<KontactInterface::Plugin*> pluginList() const = 0;
69
70 /**
71 * @internal (for Plugin)
72 *
73 * @param library the library to create part from
74 * Creates a part from the given @p library.
75 */
76 KParts::ReadOnlyPart *createPart( const char *library );
77
78 /**
79 * @internal (for Plugin)
80 *
81 * Tells the kontact core that a part has been loaded.
82 */
83 virtual void partLoaded( Plugin *plugin, KParts::ReadOnlyPart *part ) = 0;
84
85 Q_SIGNALS:
86 /**
87 * This signal is emitted whenever a new day starts.
88 *
89 * @param date The date of the new day
90 */
91 void dayChanged( const QDate &date );
92
93 protected:
94 /**
95 * Creates a new core object.
96 *
97 * @param parent The parent widget.
98 * @param flags The window flags.
99 */
100 explicit Core( QWidget *parent = 0, Qt::WindowFlags flags = KDE_DEFAULT_WINDOWFLAGS );
101
102 /**
103 * Returns the last error message for problems during
104 * KParts loading.
105 */
106 QString lastErrorMessage() const;
107
108 private:
109 //@cond PRIVATE
110 class Private;
111 Private *const d;
112
113 Q_PRIVATE_SLOT( d, void slotPartDestroyed( QObject * ) )
114 Q_PRIVATE_SLOT( d, void checkNewDay() )
115 //@endcond
116};
117
118}
119
120#endif
121
122// vim: sw=2 sts=2 et tw=80
123