Interfaces
kimproxy.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KIMPROXY_H
00025 #define KIMPROXY_H
00026
00027 #include <QtCore/QHash>
00028 #include <QtCore/QMap>
00029 #include <QtCore/QStringList>
00030 #include <QtGui/QPixmap>
00031
00032 #include <kimproxy_export.h>
00033
00034 #define IM_SERVICE_TYPE "DBUS/InstantMessenger"
00035 #define IM_CLIENT_PREFERENCES_FILE "default_components"
00036 #define IM_CLIENT_PREFERENCES_SECTION "InstantMessenger"
00037 #define IM_CLIENT_PREFERENCES_ENTRY "imClient"
00038
00039 class KUrl;
00040 class ContactPresenceListCurrent;
00041 class OrgKdeKIMInterface;
00042
00044 typedef QMap<QString, int> AppPresence;
00045 typedef QHash<QString, AppPresence*> PresenceMap;
00047 typedef QMap<QString, ContactPresenceListCurrent> PresenceStringMap;
00048
00068 class KIMPROXY_EXPORT KIMProxy : public QObject
00069 {
00070 Q_OBJECT
00071 public:
00072 ~KIMProxy();
00077 static KIMProxy * instance();
00078
00084 bool initialize();
00085
00086 public Q_SLOTS:
00092 QStringList allContacts();
00093
00099 QStringList reachableContacts();
00100
00106 QStringList onlineContacts();
00107
00113 QStringList fileTransferContacts();
00114
00120 bool isPresent( const QString& uid );
00121
00128 QString displayName( const QString& uid );
00129
00135 int presenceNumeric( const QString& uid );
00136
00142 QString presenceString( const QString& uid );
00143
00149 QPixmap presenceIcon( const QString& uid );
00150
00156 bool canReceiveFiles( const QString & uid );
00157
00163 bool canRespond( const QString & uid );
00164
00172 QString locate( const QString & contactId, const QString & protocol );
00173
00179 QString context( const QString & uid );
00180
00185 void chatWithContact( const QString& uid );
00186
00194 void messageContact( const QString& uid, const QString& message );
00195
00203 void sendFile(const QString &uid, const QString &sourceURL, const QString &altFileName = QString(), uint fileSize = 0);
00204
00211 bool addContact( const QString &contactId, const QString &protocol );
00212
00217 bool imAppsAvailable();
00218
00223 bool startPreferredApp();
00224
00228 void contactPresenceChanged( const QString& uid, const QString& appId, int presence );
00229
00230 private Q_SLOTS:
00231 void nameOwnerChanged( const QString &name, const QString &oldOwner, const QString &newOwner);
00232 Q_SIGNALS:
00237 void sigContactPresenceChanged( const QString &uid );
00238
00243 void sigPresenceInfoExpired();
00244 protected:
00248 void pollApp( const QString & appId );
00252 void pollAll( const QString &uid );
00253
00257 bool updatePresence( const QString &uid, const QString &appId, int presence );
00258
00262 QString preferredApp();
00263
00267 OrgKdeKIMInterface * stubForUid( const QString &uid );
00268
00273 OrgKdeKIMInterface * stubForProtocol( const QString &protocol );
00274
00275 private:
00276
00277
00278 QHash<QString, OrgKdeKIMInterface*> m_im_client_stubs;
00279
00280
00281 PresenceMap m_presence_map;
00282
00283
00284 class Private;
00285
00286 Private * const d;
00287 bool m_apps_available;
00288 bool m_initialized;
00292 KIMProxy();
00293 };
00294
00295 #endif
00296