00001 /* 00002 * Copyright (C) 2008 Nokia Corporation. 00003 * 00004 * Contact: Marius Vollmer <marius.vollmer@nokia.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. 00009 * 00010 * This library is distributed in the hope that it will be useful, but 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00018 * 02110-1301 USA 00019 * 00020 */ 00021 00022 #ifndef CONTEXTPROPERTYINFO_H 00023 #define CONTEXTPROPERTYINFO_H 00024 00025 #include <QVariant> 00026 #include <QStringList> 00027 #include <QObject> 00028 #include <QDBusConnection> 00029 #include <QMutex> 00030 #include "contextproviderinfo.h" 00031 #include "contexttypeinfo.h" 00032 00033 class ContextPropertyInfo : public QObject 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 enum ResolutionStrategy { LastValue }; 00039 00040 explicit ContextPropertyInfo(const QString &key, QObject *parent = 0); 00041 00043 virtual ~ContextPropertyInfo() {} 00044 00045 QString key() const; 00046 QString doc() const; 00047 QString type() const; 00048 ContextTypeInfo typeInfo() const; 00049 bool exists() const; 00050 bool declared() const; 00051 bool provided() const; 00052 bool deprecated() const; 00053 00054 QString providerDBusName() const; 00055 QDBusConnection::BusType providerDBusType() const; 00056 00057 QString plugin() const; 00058 QString constructionString() const; 00059 virtual const QList<ContextProviderInfo> providers() const; 00060 ResolutionStrategy resolutionStrategy() const; 00061 00062 protected: 00063 virtual void connectNotify(const char *signal); 00064 00065 private: 00066 QString keyName; 00067 QString cachedDoc; 00068 ContextTypeInfo cachedTypeInfo; 00069 bool cachedDeclared; 00070 00071 QList<ContextProviderInfo> cachedProviders; 00072 mutable QMutex cacheLock; 00073 00074 QString providerDBusName_i() const; 00075 QDBusConnection::BusType providerDBusType_i() const; 00076 QString plugin_i() const; 00077 QString constructionString_i() const; 00078 00079 private Q_SLOTS: 00080 void onKeyChanged(const QString& key); 00081 00082 Q_SIGNALS: 00088 void providerChanged(const QString& newProvider); 00089 00095 void providerDBusTypeChanged(QDBusConnection::BusType newBusType); 00096 00102 void typeChanged(const QString& newType); 00103 00110 void existsChanged(bool exists); 00111 00118 void providedChanged(bool provided); 00119 00126 void pluginChanged(QString plugin, QString constructionString); 00127 00131 void changed(QString key); 00132 00133 friend class ContextPropertyInfoUnitTest; 00134 }; 00135 00136 #endif // CONTEXTPROPERTYINFO_H