2
kopeteonlinestatusmanager.h
4
Copyright (c) 2004-2005 by Olivier Goffart <ogoffart@kde.org>
6
Kopete (c) 2004-2005 by the Kopete developers <kopete-devel@kde.org>
8
*************************************************************************
10
* This library is free software; you can redistribute it and/or *
11
* modify it under the terms of the GNU Lesser General Public *
12
* License as published by the Free Software Foundation; either *
13
* version 2 of the License, or (at your option) any later version. *
15
*************************************************************************
18
#ifndef kopeteonlinestatusmanager_h__
19
#define kopeteonlinestatusmanager_h__
21
#include "kopete_export.h"
23
#include <QtCore/QObject>
24
#include <QtCore/QFlags>
25
#include <QtCore/QMap>
38
* OnlineStatusManager is a singleton which manage OnlineStatus
40
* @author Olivier Goffart
42
class KOPETE_EXPORT OnlineStatusManager : public QObject
46
static OnlineStatusManager* self();
47
~OnlineStatusManager();
50
* Kopete will uses categories to have a more general system than simply globally away.
52
* Idealy, in each protocol, there should be one status per categories (status may be in several or in none categories
54
* Idle is the status used for auto-away
56
* Status number are organised so that make a tree.
58
//please be carrefull when modifying values of status. read comment in onlineStatus()
61
Idle=1<<8, ExtendedAway=1<<9 , Invisible=1<<10,
63
/*1<<4*/ Busy=1<<5, FreeForChat=1<<6, /* 1<<7*/
70
Q_DECLARE_FLAGS(Categories, Category)
74
* @see registerOnlineStatus
78
/// The user may set status messages for this online status
79
HasStatusMessage = 0x01,
80
/// The action of the status will be disabled if the account is offline.
81
/// use it if your protocol doesn't support connecting with the status as initial status.
82
/// You praticaly shouldn't abuse of that, and automatically set status after connecting if possible
83
DisabledIfOffline = 0x02,
84
/// The status will not appears in the action menu. Used if you want to register the status for e.g. autoaway,
85
/// without letting the user set itself that status
88
Q_DECLARE_FLAGS(Options, Option)
91
* You need to register each status an account can be.
92
* Registered statuses will appear in the account menu.
94
* You should use a special OnlineStatus constructor that call this function automatically
95
* The Protocol constructor is a good place to construct the OnlineStatuses
97
* You can set the status to be in the predefined categories.
98
* Ideally, each category should own one status.
99
* A status may be in several categories, or in none.
100
* There shouldn't be more than one status per protocol per categories.
102
* @param status The status to register
104
void registerOnlineStatus(const OnlineStatus& status);
107
* return the status of the @p protocol which is in the category @p category
109
* If no status has been registered in this category, return the one in the category which is the most similair
111
OnlineStatus onlineStatus(Protocol *protocol, Categories category) const;
114
* return the registered statuses for given @p protocol
116
QList<OnlineStatus> registeredStatusList( Protocol *protocol ) const;
119
* return KIcon for given @p category
121
static KIcon pixmapForCategory( Categories category );
124
* This returns status from config as Kopete::OnlineStatusManager::Category
126
* @return the desired initial status
128
Kopete::OnlineStatusManager::Category initialStatus() const;
131
friend class OnlineStatus;
132
friend class OnlineStatusIconEngine;
133
QPixmap cacheLookupByObject( const OnlineStatus &statusFor, const QString& icon, int size, QColor color, bool idle = false);
134
QPixmap cacheLookupByMimeSource( const QString &mimeSource );
135
QString fingerprint( const OnlineStatus &statusFor, const QString& icon, int size, QColor color, bool idle = false);
136
QPixmap* renderIcon( const OnlineStatus &statusFor, const QString& baseicon, int size, QColor color, bool idle = false) const;
142
void slotIconsChanged();
145
OnlineStatusManager();
150
Q_DECLARE_OPERATORS_FOR_FLAGS(OnlineStatusManager::Categories)
151
Q_DECLARE_OPERATORS_FOR_FLAGS(OnlineStatusManager::Options)
153
} //END namespace Kopete
157
// vim: set noet ts=4 sts=4 sw=4: