libqutim  0.3.2.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 class QDialog;
00034 
00035 namespace qutim_sdk_0_3
00036 {
00037 class SettingsItem;
00038 class ObjectGenerator;
00039 
00040 class LIBQUTIM_EXPORT SystemIntegration : public QObject
00041 {
00042     Q_OBJECT
00043 public:
00044     enum Attribute {
00045         UserLogin,
00046         UserName,
00047         CurrentLanguage, // not the same as locale
00048         ExtensionsForMimeType, // /etc/mime.types
00049         TimeZone,
00050         TimeZoneName,
00051         TimeZoneShortName,
00052         IconSize, //default icon size
00053         CurrentProxyInfo
00054     };
00055     
00056     enum Operation
00057     {
00058         ShowWidget,
00059         KeepAliveSocket,
00060         GetSettingsGenerator,
00061         OpenDialog
00062     };
00063 
00064     enum IconSizeEnum
00065     {
00066         //By size
00067         IconSizeSmall,
00068         IconSizeMedium,
00069         IconSizeLarge,
00070         IconSizeHuge,
00071         //By Role
00072         IconSizeToolBar,
00073         IconSizeContactsView,
00074         IconSizeListView,
00075         IconSizeIconView
00076     };
00077 
00078     enum Priority
00079     {
00080         BaseSystem = 0, // Unix
00081         WindowManager = 127, // X11
00082         DesktopEnvironment = 255 // KDE
00083     };
00084 
00085     SystemIntegration();
00086     virtual ~SystemIntegration();
00087 
00088     virtual void init() = 0;
00089     virtual bool isAvailable() const = 0;
00090     virtual int priority() = 0;
00091     
00092     static void show(QWidget *widget);
00093     static void open(QDialog *dialog);
00094     static void keepAlive(QAbstractSocket *socket);
00095     static ObjectGenerator *settingsGenerator(SettingsItem *item);
00096     static QVariant value(Attribute attr, const QVariant &data = QVariant());
00097     static QVariant process(Operation act, const QVariant &data = QVariant());
00098 //  virtual void show(QWidget *widget);
00099 
00100 protected:
00101     virtual QVariant doGetValue(Attribute attr, const QVariant &data) const = 0;
00102     virtual QVariant doProcess(Operation act, const QVariant &data) const = 0;
00103     virtual bool canHandle(Attribute attribute) const = 0;
00104     virtual bool canHandle(Operation operation) const = 0;
00105     virtual void virtual_hook(int, void *);
00106     friend struct IntegrationData;
00107 };
00108 }
00109 
00110 Q_DECLARE_METATYPE(qutim_sdk_0_3::ObjectGenerator*)
00111 
00112 #endif // SYSTEMINTEGRATION_H
00113