• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/kopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • kopete
  • chatwindow
chatview.h
Go to the documentation of this file.
1 /*
2  chatview.h - Chat View
3 
4  Copyright (c) 2008 by Benson Tsai <btsai@vrwarp.com>
5  Copyright (c) 2002-2004 by Olivier Goffart <ogoffart@kde.org>
6 
7  Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #ifndef CHATVIEW_H
20 #define CHATVIEW_H
21 
22 
23 #include "kopeteview.h"
24 #include "kopeteviewplugin.h"
25 //#include <k3dockwidget.h>
26 #include <ktextedit.h> // for covariant return type of editWidget
27 #include <QDragEnterEvent>
28 #include <QDropEvent>
29 #include <QMap>
30 #include <kvbox.h>
31 
32 #include <kopete_export.h>
33 
34 class QTimer;
35 
36 class ChatTextEditPart;
37 class ChatMessagePart;
38 
39 class KopeteChatWindow;
40 
41 class KopeteChatViewPrivate;
42 class ChatWindowPlugin;
43 
44 namespace KParts
45 {
46  class Part;
47 }
48 
49 namespace Kopete
50 {
51  class Contact;
52  class ChatSession;
53  class OnlineStatus;
54  class PropertyContainer;
55 }
56 
57 typedef QMap<const Kopete::Contact*,QTimer*> TypingMap;
58 
62 class ChatView : public KVBox, public KopeteView
63 {
64  Q_OBJECT
65 public:
66  ChatView( Kopete::ChatSession *manager, ChatWindowPlugin *parent );
67  ~ChatView();
68 
70  enum KopeteTabState { Normal, Highlighted, Changed, Typing, Message, Undefined };
71 
72  ChatMessagePart *messagePart() const { return m_messagePart; }
73  ChatTextEditPart *editPart() const { return m_editPart; }
74 
79  void addText( const QString &text );
80 
84  void saveOptions();
85 
89  void setActive( bool value );
90 
94  void saveChatSettings();
95 
99  void loadChatSettings();
100 
106  virtual void clear();
107 
111  void setCaption( const QString &text, bool modified );
112 
117  void setMainWindow( KopeteChatWindow* parent );
118 
125  virtual Kopete::Message currentMessage();
126 
133  virtual void setCurrentMessage( const Kopete::Message &newMessage );
134 
139  KopeteChatWindow *mainWindow() const { return m_mainWindow; }
140 
141  const QString &statusText();
142 
143  QString &caption() const;
144 
145  bool sendInProgress() const;
146 
148  virtual void raise( bool activate=false );
149 
151  virtual void makeVisible();
152 
154  virtual bool isVisible();
155 
157  virtual QWidget *mainWidget();
158 
159  KTextEdit *editWidget();
160 
161  bool canSend() const;
162  bool canSendFile() const;
163 
165  virtual void registerContextMenuHandler( QObject *target, const char* slot );
166 
168  virtual void registerTooltipHandler( QObject *target, const char* slot );
169 
170 public slots:
174  void cut();
175 
181  void copy();
182 
186  void paste();
187 
188  void nickComplete();
189 
193  void resetFontAndColor();
194 
198  virtual void sendMessage();
199 
204  virtual void appendMessage( Kopete::Message &message );
205 
209  void sendFile();
210 
217  void remoteTyping( const Kopete::Contact *contact, bool typing );
218 
223  void setStatusText( const QString &text );
224 
229  void slotRecalculateSize(int difference);
230 
232  virtual void messageSentSuccessfully();
233 
234  virtual bool closeView( bool force = false );
235 
236  virtual void dropEvent ( QDropEvent * );
237  bool isDragEventAccepted( const QDragMoveEvent * ) const;
238 
240  KopeteTabState tabState() const;
241 
242 signals:
247  void messageSent( Kopete::Message & );
248 
249  void messageSuccess( ChatView* );
250 
254  void shown();
255 
256  void closing( KopeteView* );
257 
258  void activated( KopeteView* );
259 
260  void captionChanged( bool active );
261 
262  void updateStatusIcon( ChatView* );
263 
265  void updateChatTooltip( ChatView*, const QString& );
266 
268  void updateChatState( ChatView*, int );
269 
271  void updateChatLabel( ChatView*, const QString& );
272 
276  void canSendChanged(bool);
277 
278  void canAcceptFilesChanged();
279 
283  void windowCreated();
284 
288  void rtfEnabled( ChatView*, bool );
289 
290  void autoSpellCheckEnabled( ChatView*, bool );
291 
292 private slots:
293  void slotRemoteTypingTimeout();
294 
301  void slotContactAdded( const Kopete::Contact *c, bool suppress );
302 
311  void slotContactRemoved( const Kopete::Contact *c, const QString& reason, Qt::TextFormat format, bool suppressNotification=false );
312 
320  void slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldstatus );
321 
326  void slotStatusMessageChanged( Kopete::Contact *contact );
327 
331  void slotChatDisplayNameChanged();
332 
333  void slotMarkMessageRead();
334 
335  void slotToggleRtfToolbar( bool enabled );
336 
340  void slotDisplayNameChanged(const QString &oldValue, const QString &newValue);
341 
342 protected:
343  virtual void dragEnterEvent ( QDragEnterEvent * );
344  virtual void dragMoveEvent ( QDragMoveEvent * );
345 
346 private:
347  // widget stuff
348  KopeteChatWindow *m_mainWindow;
349 
350 // K3DockWidget *viewDock;
351  ChatMessagePart *m_messagePart;
352 
353 // K3DockWidget *editDock;
354  ChatTextEditPart *m_editPart;
355 
356  KopeteTabState m_tabState;
357 
358  // miscellany
359  TypingMap m_remoteTypingMap;
360  QString unreadMessageFrom;
361  QString m_status;
362 
363  void updateChatState( KopeteTabState state = Undefined );
364 
368  void readOptions();
369 
370  void sendInternalMessage( const QString &msg, Qt::TextFormat format = Qt::PlainText );
371 
372  KopeteTabState currentState() const;
373 
374  KopeteChatViewPrivate *d;
375 };
376 
380 class ChatWindowPlugin : public Kopete::ViewPlugin
381 {
382  public:
383  ChatWindowPlugin(QObject *parent, const QVariantList &args);
384  KopeteView* createView( Kopete::ChatSession *manager );
385 };
386 
387 #endif
388 
389 // vim: set noet ts=4 sts=4 sw=4:
390 
ChatView::loadChatSettings
void loadChatSettings()
read the chat settings (rich text, auto spelling)
Definition: chatview.cpp:846
ChatView
Definition: chatview.h:62
ChatView::editPart
ChatTextEditPart * editPart() const
Definition: chatview.h:73
ChatView::Undefined
Definition: chatview.h:70
ChatView::setCaption
void setCaption(const QString &text, bool modified)
Sets the text to be displayed on tab label and window caption.
Definition: chatview.cpp:659
QWidget
ChatView::caption
QString & caption() const
Definition: chatview.cpp:654
KVBox
ChatView::cut
void cut()
Initiates a cut action on the edit area of the chat view.
Definition: chatview.cpp:221
ChatView::closeView
virtual bool closeView(bool force=false)
Definition: chatview.cpp:345
ChatView::dragMoveEvent
virtual void dragMoveEvent(QDragMoveEvent *)
Definition: chatview.cpp:918
ChatView::windowCreated
void windowCreated()
Emitted when we re-parent ourselves with a new window.
ChatWindowPlugin
This is the class that makes the chatwindow a plugin.
Definition: chatview.h:380
TypingMap
QMap< const Kopete::Contact *, QTimer * > TypingMap
Definition: chatview.h:57
ChatView::tabState
KopeteTabState tabState() const
Retrieves the tab state.
Definition: chatview.cpp:390
QDragMoveEvent
ChatView::dropEvent
virtual void dropEvent(QDropEvent *)
Definition: chatview.cpp:965
ChatView::isDragEventAccepted
bool isDragEventAccepted(const QDragMoveEvent *) const
Definition: chatview.cpp:929
ChatView::registerContextMenuHandler
virtual void registerContextMenuHandler(QObject *target, const char *slot)
Reimplemented from KopeteView.
Definition: chatview.cpp:1022
ChatView::captionChanged
void captionChanged(bool active)
QMap< const Kopete::Contact *, QTimer * >
manager
virtual Kopete::ChatSession * manager(Kopete::Contact::CanCreateFlags)
Definition: chatwindowconfig.cpp:94
ChatMessagePart
Definition: chatmessagepart.h:44
ChatView::saveOptions
void saveOptions()
Saves window settings such as splitter positions.
Definition: chatview.cpp:808
ChatView::addText
void addText(const QString &text)
Adds text into the edit area.
Definition: chatview.cpp:244
ChatView::appendMessage
virtual void appendMessage(Kopete::Message &message)
Called when a message is received from someone.
Definition: chatview.cpp:685
ChatView::dragEnterEvent
virtual void dragEnterEvent(QDragEnterEvent *)
Definition: chatview.cpp:907
ChatView::canSendFile
bool canSendFile() const
Definition: chatview.cpp:202
ChatView::Normal
Definition: chatview.h:70
ChatView::nickComplete
void nickComplete()
Definition: chatview.cpp:239
ChatView::editWidget
KTextEdit * editWidget()
Definition: chatview.cpp:187
ChatView::Highlighted
Definition: chatview.h:70
ChatWindowPlugin::ChatWindowPlugin
ChatWindowPlugin(QObject *parent, const QVariantList &args)
Definition: chatview.cpp:58
ChatView::clear
virtual void clear()
Clears the chat buffer.
Definition: chatview.cpp:249
ChatView::setActive
void setActive(bool value)
Tells this view it is the active view.
Definition: chatview.cpp:873
ChatView::isVisible
virtual bool isVisible()
Reimplemented from KopeteView.
Definition: chatview.cpp:335
ChatView::remoteTyping
void remoteTyping(const Kopete::Contact *contact, bool typing)
Called when a typing event is received from a contact Updates the typing map and outputs the typing m...
Definition: chatview.cpp:432
ChatView::mainWindow
KopeteChatWindow * mainWindow() const
Returns the chat window this view is in.
Definition: chatview.h:139
ChatView::statusText
const QString & statusText()
Definition: chatview.cpp:503
ChatView::mainWidget
virtual QWidget * mainWidget()
Reimplemented from KopeteView.
Definition: chatview.cpp:192
ChatView::canSend
bool canSend() const
Definition: chatview.cpp:197
QTimer
ChatView::messageSent
void messageSent(Kopete::Message &)
Emitted when a message is sent.
QObject
ChatView::updateChatState
void updateChatState(ChatView *, int)
Emitted when the state of the chat changes.
QDropEvent
ChatView::copy
void copy()
Initiates a copy action If there is text selected in the HTML view, that text is copied Otherwise...
Definition: chatview.cpp:226
ChatView::makeVisible
virtual void makeVisible()
Reimplemented from KopeteView.
Definition: chatview.cpp:312
ChatView::setStatusText
void setStatusText(const QString &text)
Sets the text to be displayed on the status label.
Definition: chatview.cpp:478
ChatView::currentMessage
virtual Kopete::Message currentMessage()
Returns the message currently in the edit area.
Definition: chatview.cpp:211
ChatTextEditPart
An instant message composition part.
Definition: chattexteditpart.h:61
ChatView::KopeteTabState
KopeteTabState
the state of our chat
Definition: chatview.h:70
QString
ChatView::Typing
Definition: chatview.h:70
ChatView::activated
void activated(KopeteView *)
ChatView::paste
void paste()
Initiates a paste action into the edit area of the chat view.
Definition: chatview.cpp:234
ChatView::sendInProgress
bool sendInProgress() const
Definition: chatview.cpp:340
ChatView::resetFontAndColor
void resetFontAndColor()
Reset font and color of the edit area and outgoing messages.
Definition: chatview.cpp:264
ChatView::saveChatSettings
void saveChatSettings()
save the chat settings (rich text, auto spelling)
Definition: chatview.cpp:817
ChatView::rtfEnabled
void rtfEnabled(ChatView *, bool)
Emitted when the state of RTF has changed.
ChatView::slotRecalculateSize
void slotRecalculateSize(int difference)
Triggers text edit's size recalculation.
Definition: chatview.cpp:485
ChatView::updateStatusIcon
void updateStatusIcon(ChatView *)
ChatView::setCurrentMessage
virtual void setCurrentMessage(const Kopete::Message &newMessage)
Sets the current message in the chat window.
Definition: chatview.cpp:216
QDragEnterEvent
ChatView::setMainWindow
void setMainWindow(KopeteChatWindow *parent)
Changes the pointer to the chat window.
Definition: chatview.cpp:417
ChatView::closing
void closing(KopeteView *)
ChatView::registerTooltipHandler
virtual void registerTooltipHandler(QObject *target, const char *slot)
Reimplemented from KopeteView.
Definition: chatview.cpp:1031
ChatWindowPlugin::createView
KopeteView * createView(Kopete::ChatSession *manager)
Definition: chatview.cpp:65
ChatView::messageSuccess
void messageSuccess(ChatView *)
ChatView::Message
Definition: chatview.h:70
ChatView::sendFile
void sendFile()
Send file (opens file dialog)
Definition: chatview.cpp:718
ChatView::sendMessage
virtual void sendMessage()
Sends the text currently entered into the edit area.
Definition: chatview.cpp:796
KopeteChatWindow
Definition: kopetechatwindow.h:61
ChatView::~ChatView
~ChatView()
Definition: chatview.cpp:178
ChatView::updateChatTooltip
void updateChatTooltip(ChatView *, const QString &)
Emitted when a possible tab tooltip needs updating.
ChatView::ChatView
ChatView(Kopete::ChatSession *manager, ChatWindowPlugin *parent)
Definition: chatview.cpp:82
ChatView::canSendChanged
void canSendChanged(bool)
Our send-button-enabled flag has changed.
KopeteView
ChatView::autoSpellCheckEnabled
void autoSpellCheckEnabled(ChatView *, bool)
ChatView::canAcceptFilesChanged
void canAcceptFilesChanged()
ChatView::messagePart
ChatMessagePart * messagePart() const
Definition: chatview.h:72
ChatView::shown
void shown()
Emits when the chat view is shown.
ChatView::messageSentSuccessfully
virtual void messageSentSuccessfully()
Reimplemented from KopeteView.
Definition: chatview.cpp:802
ChatView::updateChatLabel
void updateChatLabel(ChatView *, const QString &)
Emitted when a possible tab label needs updating.
ChatView::Changed
Definition: chatview.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal