<commit_before>/*
    kopeteonlinestatusmanager.h

    Copyright (c) 2004 by <NAME>  <ogoffart @ tiscalinet.be>

    Kopete    (c) 2004 by the Kopete developers  <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef kopeteonlinestatusmanager_h__
#define kopeteonlinestatusmanager_h__

#include <qobject.h>
#include "kopeteonlinestatus.h"
#include "kaction.h"

class QString;
class QPixmap;
class QColor;
class KActionMenu;

namespace Kopete
{
	class OnlineStatus;
	class Account;


/**
 * OnlineStatusManager is a singleton which manage OnlineStatus
 *
 * @author <NAME> 
 */
class OnlineStatusManager : public QObject
{
	Q_OBJECT
public:
	static OnlineStatusManager* self();
	~OnlineStatusManager();

	/**
	 * Kopete will uses categories to have a more general system than siply globaly away.
	 * 
	 * Idealy, in each protocol, there should be one status per categories (status may be in several or in none categories
	 *
	 * Idle is the status used for auto-away
	 *
	 * Status number are organised so that make a tree.
	 */
	//please be carrefull when modifying values of status.  read comment in onlineStatus()
	enum Categories
	{
		Idle=1<<8,/*1<<9*/     Invisible=1<<10,
		//  \     /             /
		  /*1<<4*/    Busy=1<<5,           FreeForChat=1<<6,         /* 1<<7*/
		//   \       /                         /
		     Away=1<<2,                   /* 1<<3 */
		//       \                           /
						Online=1<<1,
		Offline=1
	};
	

	/**
	 * @see registerOnlineStatus
	 */
	enum Options
	{
		/// The user may set away messages for this online status   
		HasAwayMessage = 0x01,  
		/// The action of the status will be disabled if the account is offline.
		/// use it if your protocol doesn't support connecting with the status as initial status.
		/// You praticaly shouldn't abuse of that, and automaticaly set status after connecting if possible
		DisabledIfOffline = 0x02,
		///  The status will not appears in the action menu. Used if you want to register the status for e.g. autoaway,
		///  without letting the user set itself that status  
		HideFromMenu = 0x04
	};
	
	/**
	 * You need to register each status an account can be.
	 * Registered statuses will appear in the account menu.
	 * 
	 * The Protocol constructor is a good place to call this function.
	 * But if you want, you may use a special OnlineStatus constructor that call this function automaticaly
	 *
	 * You can set the status to be in the predefined categories.
	 * Ideally, each category should own one status.
	 * A status may be in several categories, or in none.<commit_msg>add a category for ExtendedAway<commit_after>/*
    kopeteonlinestatusmanager.h

    Copyright (c) 2004-2005 by <NAME>  <<EMAIL>>

    Kopete    (c) 2004-2005 by the Kopete developers  <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#ifndef kopeteonlinestatusmanager_h__
#define kopeteonlinestatusmanager_h__

#include <qobject.h>
#include "kopeteonlinestatus.h"
#include "kaction.h"

class QString;
class QPixmap;
class QColor;
class KActionMenu;

namespace Kopete
{
	class OnlineStatus;
	class Account;


/**
 * OnlineStatusManager is a singleton which manage OnlineStatus
 *
 * @author <NAME> 
 */
class OnlineStatusManager : public QObject
{
	Q_OBJECT
public:
	static OnlineStatusManager* self();
	~OnlineStatusManager();

	/**
	 * Kopete will uses categories to have a more general system than siply globaly away.
	 * 
	 * Idealy, in each protocol, there should be one status per categories (status may be in several or in none categories
	 *
	 * Idle is the status used for auto-away
	 *
	 * Status number are organised so that make a tree.
	 */
	//please be carrefull when modifying values of status.  read comment in onlineStatus()
	enum Categories
	{
		Idle=1<<8,  ExtendedAway=1<<9 , Invisible=1<<10,
		//  \     /             __________/
		  /*1<<4*/    Busy=1<<5,           FreeForChat=1<<6,         /* 1<<7*/
		//   \       /                         /
		     Away=1<<2,                   /* 1<<3 */
		//       \                           /
						Online=1<<1,
		Offline=1
	};
	

	/**
	 * @see registerOnlineStatus
	 */
	enum Options
	{
		/// The user may set away messages for this online status   
		HasAwayMessage = 0x01,  
		/// The action of the status will be disabled if the account is offline.
		/// use it if your protocol doesn't support connecting with the status as initial status.
		/// You praticaly shouldn't abuse of that, and automaticaly set status after connecting if possible
		DisabledIfOffline = 0x02,
		///  The status will not appears in the action menu. Used if you want to register the status for e.g. autoaway,
		///  without letting the user set itself that status  
		HideFromMenu = 0x04
	};
	
	/**
	 * You need to register each status an account can be.
	 * Registered statuses will appear in the account menu.
	 * 
	 * The Protocol constructor is a good place to call this function.
	 * But if you want, you may use a special OnlineStatus constructor that call this function automaticaly
	 *
	 * You can set the status to be in the predefined categories.
	 * Ideally, each category should own one status.
	 * A status may be in several categories, or in none.
	 * There shouldn't be more than one status per protocol per categories.
{'fraction_non_alphanumeric': 0.11934028318033298, 'fraction_numerical': 0.01369223587988175, 'mean_word_length': 2.3236814891416753, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1542914', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1662, 'n_words': 690}