1 /** \file TocBaseMainWindow.h
2 * \brief Declaration of TocBaseMainWindow class
4 * Tieto Open Communicator - Client for the Telepathy communications framework.
5 * Copyright (c) 2010, Tieto Corporation
8 * Redistribution and use in source and binary forms, with or without modification,
9 * are permitted provided that the following conditions are met:
11 * Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * Neither the name of the Tieto Corporation nor the names of its contributors
17 * may be used to endorse or promote products derived from this software without
18 * specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #ifndef TOCBASEMAINWINDOW_H
33 #define TOCBASEMAINWINDOW_H
35 #include <QtGui/QMainWindow>
40 /** \brief TocBaseMainWindow class
42 * A base class for any Ui class that
43 * wants to comunicate with TocEngine.
46 class TocBaseMainWindow : public QMainWindow
51 TocBaseMainWindow( TocBaseEngine* engine, QWidget * parent = 0, Qt::WindowFlags flags = 0 );
56 /** \brief Emited when a user wants to change presence
58 * This signal is emited when user changes presence in TocMainToolbar.
59 * Note: this is only a request, You should wait for the PresenceUpdated signal from TocEngine
60 * to actualy show to the user his new presence.
62 * @param presence Requested presence
63 * @param desc Requested description
65 void presenceChanged(Presence presence, QString desc);
67 /** \brief Emited when a session is finished
69 * This signal is emited when a TocChatWidget is closed.
71 * @param uid Contact's ID
73 void sessionClosed(QString uid);
75 /** \brief Emited when a new message is ready to send
77 * This signal is emited when user sends a message in one of chatwindows.
79 * @param uid Contact's ID
80 * @param message Message to be sent
82 void newMessageReady(QString uid, Message message);
84 /** \brief Emited when user adds a new contact
86 * This should be emited when user prepares new contact data
87 * using TocUserInfoWidget in "Add mode".
89 * @param pContact Pointer to a contact to be added.
91 void addContact(TocContact* pContact);
93 /** \brief Emited when user edits an existing contact
95 * This signal is emited when user changes contact data
96 * using TocUserInfoWidget in "Edit mode".
98 * @param pContact Pointer to a contact to be altered.
99 * @param oldUid Previous Contact's ID
101 void editContact(TocContact* pContact, QString oldUid);
103 /** \brief Emited when user deletes an existing contact
105 * This should be emited when user removes a contact from contact list.
107 * @param uid Contact's ID
109 void removeContact(QString uid);
111 /** \brief Emited when user creates a new account
113 * This signal is emited when user decides to accept or deny request for subscription from someone.
115 * @param uid User ID of the new account
116 * @param authorized Flag that indicates the answer
118 void subscriptionAccepted(QString uid, bool authorized);
120 /** \brief Emited when user changes the account settings
123 void accountSettingsChanged();
127 /** \brief Slot invoked when someone wants to add us to his contact list
129 * We just received request for subsciption and need to decide whether accept it
130 * or discard. This should be connected to the TocEngine's `AuthorizationRequest` signal.
132 * @param uid An identificator of a peer that wants to subscribe our account to his contact list
134 virtual void onAuthorizationRequest(QString uid) = 0;
136 /** \brief Slot invoked when our request for subscription has been accepted
138 * This should be connected to the TocEngine's `SubscriptionAccepted` signal.
140 * @param uid An identificator of a contact that was requested for subscription
142 virtual void onSubscriptionAccepted(QString uid) = 0;
144 /** \brief Slot handling own status change
146 * Thanks this UI can be informed about change in account status.
147 * This should be connected to the TocEngine's `StatusChanged` signal.
149 * @param status New status of the account
150 * @param reason The reason of the change
152 virtual void onStatusChange(Status status, Reason reason) = 0;
154 /** \brief Slot handling own presence change
156 * This should be connected to the TocEngine's `PresenceUpdated` signal.
158 * @param presence New presence of the account
159 * @param desc New presence description of the account
161 virtual void onPresenceUpdate(Presence presence, QString desc) = 0;
163 /** \brief Slot handling contact's presence change
165 * This should be connected to the TocEngine's `ContactPresenceUpdated` signal.
167 * @param uid Contact's ID
168 * @param presence New presence of the contact
169 * @param desc New presence description of the contact
171 virtual void onContactPresenceUpdate(QString uid, Presence presence, QString desc) = 0;
173 /** \brief Slot handling incoming message
175 * This should be connected to the TocEngine's `MessageReceived` signal.
177 * @param uid Contact's ID
178 * @param message New message to be handled
180 virtual void onIncomingMessage(QString uid, Message message) = 0;
182 /** \brief Invoked when new contact list is available
184 * This should be connected to the TocEngine's `NewContactList` signal.
186 * @param cList New contact list to be used
188 virtual void onContactListReceived(const TocContactList& cList) = 0;
192 #endif // TOCBASEMAINWINDOW_H