1 /***************************************************************************
2 Copyright 2006 David Nolden <david.nolden.kdevelop@art-master.de>
3 ***************************************************************************/
5 /***************************************************************************
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 ***************************************************************************/
14 #ifndef MESSAGEMANAGER_H
15 #define MESSAGEMANAGER_H
17 #include "kdevteamwork_messages.h"
19 #include "indocumentmessage.h"
20 #include "autoconstructpointer.h"
24 class LocalPatchSource
;
25 class KDevTeamworkTextMessage
;
27 class MessageHistoryManager
;
29 //class LocalPatchSource::Identity;
31 class KDevTeamworkUser
;
33 typedef SafeSharedPtr
<KDevTeamworkUser
, BoostSerialization
> KDevTeamworkUserPointer
;
35 class ConversationManager
;
38 BIND_LIST_2( MessageManagerMessages
, KDevTeamworkTextMessage
, InDocumentMessage
)
40 /** This class manages the KDevTeamworkTextMessage-based messages
43 class MessageManager
: public QObject
{
46 MessageManager( KDevTeamwork
* tw
);
49 void restorePartialProjectSession( const QDomElement
* el
);
51 void savePartialProjectSession( QDomElement
* el
);
53 int receiveMessage( MessageInterface
* msg
);
54 int receiveMessage( KDevTeamworkTextMessage
* msg
);
55 int receiveMessage( InDocumentMessage
* msg
);
57 int processMessage( KDevTeamworkTextMessage
* msg
);
59 KDevTeamwork
* teamwork();
61 void log( const QString
& str
, LogLevel level
= Info
);
63 MessageHistoryManager
& historyManager();
64 ConversationManager
& conversationManager();
66 void showMessageHistory( const QList
<KDevTeamworkUserPointer
>& users
= QList
<KDevTeamworkUserPointer
>(), const QString
& context
= "" );
68 void fillMessageMenu( QMenu
* menu
, MessagePointer msg
);
70 void showMessage( const MessagePointer
& msg
);
73 ///This can be used to indicate that information about the message(like icon, text, etc.) has been changed.
74 void updateMessage( const MessagePointer
& msg
);
75 void slotShowMessage();
79 ///Is emitted whenver a message is reported to have changed.(through updateMessage(..))
80 void messageUpdated( const MessagePointer
& msg
);
83 MessageDispatcher
<MessageManager
, MessageManagerMessages
> dispatcher_
;
84 KDevTeamwork
* m_teamwork
;
86 AutoConstructPointer
<ConversationManager
> m_conversationManager
;
87 AutoConstructPointer
<MessageHistoryManager
> m_historyManager
;
89 QAction
* m_showMessageAction
;
95 // kate: space-indent on; indent-width 2; tab-width 2; replace-tabs on