| Home · All Classes · All Namespaces · Modules · Functions · Files

# requestable-channel-class-spec.h

    00001 /*
    00002  * This file is part of TelepathyQt4
    00003  *
    00004  * Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
    00005  * Copyright (C) 2010 Nokia Corporation
    00006  *
    00007  * This library is free software; you can redistribute it and/or
    00008  * modify it under the terms of the GNU Lesser General Public
    00009  * License as published by the Free Software Foundation; either
    00010  * version 2.1 of the License, or (at your option) any later version.
    00011  *
    00012  * This library is distributed in the hope that it will be useful,
    00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015  * Lesser General Public License for more details.
    00016  *
    00017  * You should have received a copy of the GNU Lesser General Public
    00018  * License along with this library; if not, write to the Free Software
    00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    00020  */
    00021
    00022 #ifndef _TelepathyQt4_requestable_channel_class_spec_h_HEADER_GUARD_
    00023 #define _TelepathyQt4_requestable_channel_class_spec_h_HEADER_GUARD_
    00024
    00025 #ifndef IN_TELEPATHY_QT4_HEADER
    00026 #error IN_TELEPATHY_QT4_HEADER
    00027 #endif
    00028
    00029 #include <TelepathyQt4/Constants>
    00030 #include <TelepathyQt4/Types>
    00031
    00032 namespace Tp
    00033 {
    00034
    00035 class TELEPATHY_QT4_EXPORT RequestableChannelClassSpec
    00036 {
    00037 public:
    00038     RequestableChannelClassSpec();
    00039     RequestableChannelClassSpec(const RequestableChannelClass &rcc);
    00040     RequestableChannelClassSpec(const RequestableChannelClassSpec &other);
    00041     ~RequestableChannelClassSpec();
    00042
    00043     static RequestableChannelClassSpec textChat();
    00044     static RequestableChannelClassSpec textChatroom();
    00045
    00046     static RequestableChannelClassSpec streamedMediaCall();
    00047     static RequestableChannelClassSpec streamedMediaAudioCall();
    00048     static RequestableChannelClassSpec streamedMediaVideoCall();
    00049     static RequestableChannelClassSpec streamedMediaVideoCallWithAudio();
    00050
    00051     static RequestableChannelClassSpec fileTransfer();
    00052
    00053     static RequestableChannelClassSpec conferenceTextChat();
    00054     static RequestableChannelClassSpec conferenceTextChatWithInvitees();
    00055     static RequestableChannelClassSpec conferenceTextChatroom();
    00056     static RequestableChannelClassSpec conferenceTextChatroomWithInvitees();
    00057     static RequestableChannelClassSpec conferenceStreamedMediaCall();
    00058     static RequestableChannelClassSpec conferenceStreamedMediaCallWithInvitees();
    00059
    00060     static RequestableChannelClassSpec contactSearch();
    00061     static RequestableChannelClassSpec contactSearchWithSpecificServer();
    00062     static RequestableChannelClassSpec contactSearchWithLimit();
    00063     static RequestableChannelClassSpec contactSearchWithSpecificServerAndLimit();
    00064
    00065     bool isValid() const { return mPriv.constData() != 0; }
    00066
    00067     RequestableChannelClassSpec &operator=(const RequestableChannelClassSpec &other);
    00068     bool operator==(const RequestableChannelClassSpec &other) const;
    00069
    00070     bool supports(const RequestableChannelClassSpec &spec) const;
    00071
    00072     QString channelType() const;
    00073
    00074     bool hasTargetHandleType() const;
    00075     // FIXME: (API/ABI break) Use TargetHandleType instead of uint
    00076     uint targetHandleType() const;
    00077
    00078     bool hasFixedProperty(const QString &name) const;
    00079     QVariant fixedProperty(const QString &name) const;
    00080     QVariantMap fixedProperties() const;
    00081
    00082     bool allowsProperty(const QString &name) const;
    00083     QStringList allowedProperties() const;
    00084
    00085     RequestableChannelClass bareClass() const;
    00086
    00087 private:
    00088     struct Private;
    00089     friend struct Private;
    00090     QSharedDataPointer<Private> mPriv;
    00091 };
    00092
    00093 class TELEPATHY_QT4_EXPORT RequestableChannelClassSpecList :
    00094                 public QList<RequestableChannelClassSpec>
    00095 {
    00096 public:
    00097     RequestableChannelClassSpecList() { }
    00098     RequestableChannelClassSpecList(const RequestableChannelClass &rcc)
    00099     {
    00100         append(RequestableChannelClassSpec(rcc));
    00101     }
    00102     RequestableChannelClassSpecList(const RequestableChannelClassList &rccs)
    00103     {
    00104         Q_FOREACH (const RequestableChannelClass &rcc, rccs) {
    00105             append(RequestableChannelClassSpec(rcc));
    00106         }
    00107     }
    00108     RequestableChannelClassSpecList(const RequestableChannelClassSpec &rccSpec)
    00109     {
    00110         append(rccSpec);
    00111     }
    00112     RequestableChannelClassSpecList(const QList<RequestableChannelClassSpec> &other)
    00113         : QList<RequestableChannelClassSpec>(other)
    00114     {
    00115     }
    00116
    00117     RequestableChannelClassList bareClasses() const
    00118     {
    00119         RequestableChannelClassList list;
    00120         Q_FOREACH (const RequestableChannelClassSpec &rccSpec, *this) {
    00121             list.append(rccSpec.bareClass());
    00122         }
    00123         return list;
    00124     }
    00125 };
    00126
    00127 } // Tp
    00128
    00129 Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpec);
    00130 Q_DECLARE_METATYPE(Tp::RequestableChannelClassSpecList);
    00131
    00132 #endif