2 kopetestatusmanager.h - Kopete Status Manager
4 Copyright (c) 2008 by Roman Jarosz <kedgedev@centrum.cz>
5 Kopete (c) 2008 by the Kopete developers <kopete-devel@kde.org>
7 *************************************************************************
9 * This library is free software; you can redistribute it and/or *
10 * modify it under the terms of the GNU Lesser General Public *
11 * License as published by the Free Software Foundation; either *
12 * version 2 of the License, or (at your option) any later version. *
14 *************************************************************************
16 #ifndef KOPETESTATUSMANAGER_H
17 #define KOPETESTATUSMANAGER_H
19 #include <QtCore/QObject>
21 #include "kopete_export.h"
22 #include "kopetestatusmessage.h"
36 * StatusManager manages status items that are used to build status menu.
37 * It also stores current status message and sets auto away status.
39 * StatusManager is a singleton, you may uses it with @ref StatusManager::self()
41 * @author Roman Jarosz <kedgedev@centrum.cz>
43 class KOPETE_EXPORT StatusManager
: public QObject
48 * Get the only instance of StatusManager
49 * @return StatusManager single instance
51 static StatusManager
*self();
56 * Save status data tree into XML file
61 * Load status data tree into XML file
66 * Set new status data tree
68 void setRootGroup( Status::StatusGroup
* rootGroup
);
71 * Get current status data tree
73 Status::StatusGroup
*getRootGroup() const;
76 * Copy current status data tree
78 Status::StatusGroup
*copyRootGroup() const;
81 * Find status item for given uid
83 const Status::StatusItem
*itemForUid( const QString
&uid
) const;
86 * Convert status item to XML structure
88 * @note it's public because it's also used for drag&drop
90 static QDomElement
storeStatusItem( const Status::StatusItem
*item
);
93 * Restore status item from XML structure
95 * @note it's public because it's also used for drag&drop
97 static Status::StatusItem
*parseStatusItem( QDomElement element
);
100 * Remember current global status
102 void setGlobalStatus( uint category
, const Kopete::StatusMessage
&statusMessage
= Kopete::StatusMessage() );
105 * Remember current global status message
107 void setGlobalStatusMessage( const Kopete::StatusMessage
&statusMessage
= Kopete::StatusMessage() );
110 * Get current global status message
112 Kopete::StatusMessage
globalStatusMessage() const;
115 * Returns true if auto away status was set
120 * Returns true if global away status was set
131 * Set all online account to auto away status
137 * This signal is emitted when root item of status data tree has changed.
142 * This signal is emitted when global status has changed.
144 void globalStatusChanged();
147 void accountUnregistered( const Kopete::Account
*account
);
149 void loadBehaviorSettings();
153 void updateUidHash( Status::StatusItem
*item
);
155 Status::StatusGroup
*defaultStatuses() const;
157 static StatusManager
*instance
;