libqutim  0.3.1.0
systemintegration.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** qutIM - instant messenger
00004 **
00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
00006 **
00007 *****************************************************************************
00008 **
00009 ** $QUTIM_BEGIN_LICENSE$
00010 ** This program is free software: you can redistribute it and/or modify
00011 ** it under the terms of the GNU General Public License as published by
00012 ** the Free Software Foundation, either version 3 of the License, or
00013 ** (at your option) any later version.
00014 **
00015 ** This program is distributed in the hope that it will be useful,
00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 ** See the GNU General Public License for more details.
00019 **
00020 ** You should have received a copy of the GNU General Public License
00021 ** along with this program.  If not, see http://www.gnu.org/licenses/.
00022 ** $QUTIM_END_LICENSE$
00023 **
00024 ****************************************************************************/
00025 
00026 #ifndef SYSTEMINTEGRATION_H
00027 #define SYSTEMINTEGRATION_H
00028 
00029 #include "libqutim_global.h"
00030 #include <QVariant>
00031 
00032 class QAbstractSocket;
00033 
00034 namespace qutim_sdk_0_3
00035 {
00036 class LIBQUTIM_EXPORT SystemIntegration : public QObject
00037 {
00038     Q_OBJECT
00039 public:
00040     enum Attribute {
00041         UserLogin,
00042         UserName,
00043         CurrentLanguage, // not the same as locale
00044         ExtensionsForMimeType, // /etc/mime.types
00045         TimeZone,
00046         TimeZoneName,
00047         TimeZoneShortName,
00048         IconSize, //default icon size
00049         CurrentProxyInfo
00050     };
00051     
00052     enum Operation
00053     {
00054         ShowWidget,
00055         KeepAliveSocket
00056     };
00057 
00058     enum IconSizeEnum
00059     {
00060         //By size
00061         IconSizeSmall,
00062         IconSizeMedium,
00063         IconSizeLarge,
00064         IconSizeHuge,
00065         //By Role
00066         IconSizeToolBar,
00067         IconSizeContactsView,
00068         IconSizeListView,
00069         IconSizeIconView
00070     };
00071 
00072     enum Priority
00073     {
00074         BaseSystem = 0, // Unix
00075         WindowManager = 127, // X11
00076         DesktopEnvironment = 255 // KDE
00077     };
00078 
00079     SystemIntegration();
00080     virtual ~SystemIntegration();
00081 
00082     virtual void init() = 0;
00083     virtual bool isAvailable() const = 0;
00084     virtual int priority() = 0;
00085     
00086     static void show(QWidget *widget);
00087     static void keepAlive(QAbstractSocket *socket);
00088     static QVariant value(Attribute attr, const QVariant &data = QVariant());
00089     static QVariant process(Operation act, const QVariant &data = QVariant());
00090 //  virtual void show(QWidget *widget);
00091 
00092 protected:
00093     virtual QVariant doGetValue(Attribute attr, const QVariant &data) const = 0;
00094     virtual QVariant doProcess(Operation act, const QVariant &data) const = 0;
00095     virtual bool canHandle(Attribute attribute) const = 0;
00096     virtual bool canHandle(Operation operation) const = 0;
00097     virtual void virtual_hook(int, void *);
00098     friend struct IntegrationData;
00099 };
00100 }
00101 
00102 #endif // SYSTEMINTEGRATION_H
00103