1 /*
2 This file is part of Choqok, the KDE micro-blogging client
3 
4 Copyright (C) 2008-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
5 
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of
9 the License or (at your option) version 3 or any later version
10 accepted by the membership of KDE e.V. (or its successor approved
11 by the membership of KDE e.V.), which shall act as a proxy
12 defined in Section 14 of version 3 of the license.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, see http://www.gnu.org/licenses/
21 
22 */
23 
24 #ifndef CHOQOKUIGLOBAL_H
25 #define CHOQOKUIGLOBAL_H
26 
27 #include <QObject>
28 
29 #include "choqokmainwindow.h"
30 #include "choqok_export.h"
31 
32 #define choqokMainWindow Choqok::UI::Global::mainWindow()
33 
34 namespace Choqok
35 {
36 
37 class Account;
38 
39 namespace UI
40 {
41 class PostWidget;
42 class QuickPost;
43 
44 /**
45 * This namespace contains the Choqok user interface's global widgets
46 * UI Plugins can use these
47 */
48 namespace Global
49 {
50 /**
51 * Set the main widget to widget
52 */
53 CHOQOK_EXPORT void setMainWindow(Choqok::UI::MainWindow *window);
54 /**
55 * Returns the main widget - this is the widget that message boxes
56 * and KNotify stuff should use as a parent.
57 */
58 CHOQOK_EXPORT Choqok::UI::MainWindow *mainWindow();
59 
60 CHOQOK_EXPORT void setQuickPostWidget(QuickPost *quickPost);
61 
62 CHOQOK_EXPORT QuickPost *quickPostWidget();
63 
64 class CHOQOK_EXPORT SessionManager : public QObject
65 {
66     Q_OBJECT
67 public:
68     ~SessionManager();
69     static SessionManager *self();
70     void emitNewPostWidgetAdded(Choqok::UI::PostWidget *widget, Choqok::Account *theAccount,
71                                 const QString &timelineName = QString());
72 
73 Q_SIGNALS:
74     void newPostWidgetAdded(Choqok::UI::PostWidget *widget, Choqok::Account *theAccount,
75                             const QString &timelineName);
76 
77 public Q_SLOTS:
78     void resetNotifyManager();
79 
80 private:
81     static SessionManager *m_self;
82     SessionManager();
83 };
84 } //Global::UI
85 
86 } //UI
87 
88 }
89 
90 #endif
91