home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / kopeteglobal.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  5.3 KB  |  177 lines

  1. /*
  2.     kopeteglobal.h - Kopete Globals
  3.  
  4.     Copyright (c) 2004      by Richard Smith         <kde@metafoo.co.uk>
  5.  
  6.     Kopete    (c) 2004      by the Kopete developers <kopete-devel@kde.org>
  7.  
  8.     *************************************************************************
  9.     *                                                                       *
  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.      *
  14.     *                                                                       *
  15.     *************************************************************************
  16. */
  17.  
  18. #ifndef KOPETEGLOBAL_H
  19. #define KOPETEGLOBAL_H
  20.  
  21. #include "kopetecontactproperty.h"
  22.  
  23. #include "kopete_export.h"
  24.  
  25. /**
  26.  * This namespace contains all of Kopete's core classes and functions.
  27.  */
  28. namespace Kopete
  29. {
  30.  
  31. /**
  32.  * This namespace contains Kopete's global settings and functions
  33.  */
  34. namespace Global
  35. {
  36.     class PropertiesPrivate;
  37.  
  38.     /**
  39.      * \brief Installs one or more kopete emoticon themes from a tarball
  40.      * (either .kopete-emoticons or .tar.gz or .tar.bz2)
  41.      *
  42.      * @p localPath Full path to a local emoticon archive, use KIO to download
  43.      * files in case their are non-local.
  44.      *
  45.      * @return true in case install was successful, false otherwise. Errors are
  46.      * displayed by either KIO or by using KMessagebox directly.
  47.      *
  48.      * TODO: If possible, port it to KIO instead of using ugly blocking KTar
  49.      **/
  50.     KOPETE_EXPORT void installEmoticonTheme(const QString &localPath);
  51.  
  52.     /**
  53.      * \brief Global facility to query/store templates that are needed by KopeteContactProperty
  54.      *
  55.      * Basically all a plugin author needs to worry about is creating ContactPropertyTmpl
  56.      * objects for all the properties he wants to set for a Kopete::Contact,
  57.      * everything else is handled behind the scenes.
  58.      **/
  59.     class KOPETE_EXPORT Properties
  60.     {
  61.         friend class Kopete::ContactPropertyTmpl;
  62.         public:
  63.             /**
  64.              * \brief Singleton accessor for this class.
  65.              *
  66.              * Use it to access the global list of property-templates or to get
  67.              * a reference to one of the common ContactPropertyTmpl objects
  68.              */
  69.             static Properties *self();
  70.  
  71.             /**
  72.              * Return a template with defined by @p key, if no such template has
  73.              * been registered ContactPropertyTmpl::null will be returned
  74.              */
  75.             const ContactPropertyTmpl &tmpl(const QString &key) const;
  76.  
  77.             /**
  78.              * @return a ready-to-use template for a contact's full name.
  79.              *
  80.              * This is actually no real property, it makes use of
  81.              * firstName() and lastName() to assemble an name that consists of
  82.              * both name parts
  83.              */
  84.             const ContactPropertyTmpl &fullName() const;
  85.  
  86.             /**
  87.              * Return default template for a contact's idle-time
  88.              */
  89.             const ContactPropertyTmpl &idleTime() const;
  90.             /**
  91.              * Return default template for a contact's online-since time
  92.              * (i.e. time since he went from offline to online)
  93.              */
  94.             const ContactPropertyTmpl &onlineSince() const;
  95.             /**
  96.              * @return default template for a contact's last-seen time
  97.              */
  98.             const ContactPropertyTmpl &lastSeen() const;
  99.             /**
  100.              * @return default template for a contact's away-message
  101.              */
  102.             const ContactPropertyTmpl &awayMessage() const;
  103.             /**
  104.              * @return default template for a contact's first name
  105.              */
  106.             const ContactPropertyTmpl &firstName() const;
  107.             /**
  108.              * @return default template for a contact's last name
  109.              */
  110.             const ContactPropertyTmpl &lastName() const;
  111.             /**
  112.              * @return default template for a contact's email-address
  113.              */
  114.             const ContactPropertyTmpl &emailAddress() const;
  115.             /**
  116.              * @return default template for a contact's private phone number
  117.              */
  118.             const ContactPropertyTmpl &privatePhone() const;
  119.             /**
  120.              * @return default template for a contact's private mobile number
  121.              */
  122.             const ContactPropertyTmpl &privateMobilePhone() const;
  123.             /**
  124.              * @return default template for a contact's work phone number
  125.              */
  126.             const ContactPropertyTmpl &workPhone() const;
  127.             /**
  128.              * @return default template for a contact's work mobile number
  129.              */
  130.             const ContactPropertyTmpl &workMobilePhone() const;
  131.             /**
  132.              * @return default template for a contact's nickname (set by the contact)
  133.              */
  134.             const ContactPropertyTmpl &nickName() const;
  135.             /**
  136.              * default template for a contact's photo.
  137.              *
  138.              * It could be either a QString or a QImage.
  139.              * If it's a QString, it should points to the path the image is stored.
  140.              */
  141.             const ContactPropertyTmpl &photo() const;
  142.  
  143.             /**
  144.              * @return a map of all registered ContactPropertyTmpl object
  145.              */
  146.             const ContactPropertyTmpl::Map &templateMap() const;
  147.  
  148.             /**
  149.              * return true if a template with key @p key is already registered,
  150.              * false otherwise
  151.              */
  152.             bool isRegistered(const QString &key);
  153.  
  154.         private:
  155.             Properties();
  156.             ~Properties();
  157.  
  158.             bool registerTemplate(const QString &key,
  159.                 const ContactPropertyTmpl &tmpl);
  160.             void unregisterTemplate(const QString &key);
  161.  
  162.             const ContactPropertyTmpl &createProp(const QString &key,
  163.                 const QString &label, const QString &icon=QString::null,
  164.                 bool persistent = false) const;
  165.  
  166.         private:
  167.             static Properties *mSelf;
  168.             PropertiesPrivate *d;
  169.     }; // end class Properties
  170.  
  171. } // Global
  172.  
  173. } // Kopete
  174.  
  175. #endif
  176. // vim: set noet ts=4 sts=4 sw=4:
  177.