1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
/*
Copyright (C) 2010 David Edmundson <kde@davidedmundson.co.uk>
Copyright (C) 2011 Dominik Schmidt <dev@dominik-schmidt.de>
Copyright (C) 2011 Francesco Nwokeka <francesco.nwokeka@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CHATWINDOW_H
#define CHATWINDOW_H
#include "chat-widget.h"
#include <KXmlGuiWindow>
#include <KTabWidget>
namespace Sonnet {
class DictionaryComboBox;
}
class KIcon;
class ChatTab;
class QLabel;
class ChatWindow : public KXmlGuiWindow
{
Q_OBJECT
public:
ChatWindow();
virtual ~ChatWindow();
enum NotificationType {
SystemErrorMessage,
SystemInfoMessage
};
void destroyTab(ChatTab *tab);
void setTabText(int index, const QString &newTitle);
void setTabIcon(int index, const KIcon &newIcon);
void setTabTextColor(int index,const QColor &color);
/** retrieves tab with given textChannel if it exists
* @param incomingTextChannel textChannel to search for
*/
ChatTab* getTab(const Tp::TextChannelPtr &incomingTextChannel);
void focusChat(ChatTab* tab);
void addTab(ChatTab* tab);
void removeTab(ChatTab* tab);
Q_SIGNALS:
/** to emit before closing a window. This signal tells telepathyChatUi to remove the closed
* window from it's list of open windows */
void aboutToClose(ChatWindow *window);
void detachRequested(ChatTab *tab);
public Q_SLOTS:
void destroyTab(QWidget *chatWidget);
protected:
virtual bool event(QEvent *e);
private Q_SLOTS:
void tabBarContextMenu(int index, const QPoint & globalPos);
void closeCurrentTab();
void onAudioCallTriggered(); /** start an audio call */
void onBlockContactTriggered(); /** Blocks contact */
void onCurrentIndexChanged(int index);
void onEnableSearchActions(bool enable); /** enables/disables menu search actions */
void onFileTransferTriggered(); /** start a file transfer (to be used only for 1on1 chats!) */
void onFindNextText(); /** go to next text the user is searching for */
void onFindPreviousText(); /** go to previous text the user is searching for */
void onGenericOperationFinished(Tp::PendingOperation *op);
void onInviteToChatTriggered(); /** invite contact(s) to chat */
void onNextTabActionTriggered(); /** go to next tab in the tabwidget */
void onPreviousTabActionTriggered(); /** go to previous tab in the tabwidget */
void onSearchActionToggled(); /** toggle search bar visibility */
void onTabStateChanged();
void onTabTextChanged(const QString &newTitle);
void onTabIconChanged(const KIcon &newIcon);
void onVideoCallTriggered(); /** start a video call */
void onUserTypingChanged(Tp::ChannelChatState state);
void onUnblockContactTriggered(); /** Unblocks contact when already blocked */
void onShareDesktopTriggered(); /** start a desktop share */
void onOpenLogTriggered(); /** Starts ktp-log-viewer accountId contactId */
void setTabSpellDictionary(const QString &dict); /** set the spelling language for the current chat tab*/
void toggleBlockButton(bool contactIsBlocked); /** Toggle block/unblock action according to the flag */
protected Q_SLOTS:
void showSettingsDialog();
void showNotificationsDialog();
private:
/** sends notification to the user via plasma desktop notification system
* @param type notification type
* @param errorMsg message to display
*/
void sendNotificationToUser(NotificationType type, const QString &errorMsg);
/** removes chat tab signals. This is used when reparenting the chat tab
* (see "detachTab" )
*/
void removeChatTabSignals(ChatTab *chatTab);
/** connects the necessary chat tab signals with slots in chatwindow
* @param chatTab chatTab object to connect
*/
void setupChatTabSignals(ChatTab *chatTab);
/** creates and adds custom actions for the chat window */
void setupCustomActions();
/** setters for chat actions */
void setAudioCallEnabled(bool enable);
void setBlockEnabled(bool enable);
void setFileTransferEnabled(bool enable);
void setInviteToChatEnabled(bool enable);
void setVideoCallEnabled(bool enable);
void setShareDesktopEnabled(bool enable);
void setPreviousConversationsEnabled(bool enable);
/** setter for account icon fake action */
void setAccountIcon(const QIcon &protocolIcon);
/** starts audio call with given contact
* @param account account sending the audio call request
* @param contact contact with whom to start audio call
*/
void startAudioCall(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
/** starts file transfer
* @param account account starting the file transfer
* @param contact contact with whom to start file transfer
*/
void startFileTransfer(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
/** starts a video call with given contact
* @param account account starting the video call
* @param contact contact with whom to start the video call
*/
void startVideoCall(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
/** starts a desktop sharing session with given contact
* @param account account starting the desktop share
* @param contact contact with whom to start desktop share
*/
void startShareDesktop(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
KTabWidget *m_tabWidget;
Sonnet::DictionaryComboBox *m_spellDictCombo;
QLabel *m_accountIconLabel;
};
#endif // CHATWINDOW_H
|