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

kopete/kopete

chatview.h

Go to the documentation of this file.
00001 /*
00002     chatview.h - Chat View
00003 
00004     Copyright (c) 2002-2004 by Olivier Goffart       <ogoffart@kde.org>
00005 
00006     Kopete    (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
00007 
00008     *************************************************************************
00009     *                                                                       *
00010     * This program is free software; you can redistribute it and/or modify  *
00011     * it under the terms of the GNU General Public License as published by  *
00012     * the Free Software Foundation; either version 2 of the License, or     *
00013     * (at your option) any later version.                                   *
00014     *                                                                       *
00015     *************************************************************************
00016 */
00017 
00018 #ifndef CHATVIEW_H
00019 #define CHATVIEW_H
00020 
00021 
00022 #include "kopeteview.h"
00023 #include "kopeteviewplugin.h"
00024 //#include <k3dockwidget.h>
00025 #include <ktextedit.h> // for covariant return type of editWidget
00026 #include <QDragEnterEvent>
00027 #include <QDropEvent>
00028 #include <QMap>
00029 #include <kvbox.h>
00030 
00031 #include <kopete_export.h>
00032 
00033 class QTimer;
00034 
00035 class ChatTextEditPart;
00036 class ChatMessagePart;
00037 
00038 class KopeteChatWindow;
00039 
00040 class KopeteChatViewPrivate;
00041 class ChatWindowPlugin;
00042 
00043 namespace KParts
00044 {
00045     class Part;
00046 }
00047 
00048 namespace Kopete
00049 {
00050     class Contact;
00051     class ChatSession;
00052     class OnlineStatus;
00053     class PropertyContainer;
00054 }
00055 
00056 typedef QMap<const Kopete::Contact*,QTimer*> TypingMap;
00057 
00061 class ChatView : public KVBox, public KopeteView
00062 {
00063     Q_OBJECT
00064 public:
00065     ChatView( Kopete::ChatSession *manager, ChatWindowPlugin *parent );
00066     ~ChatView();
00067 
00069     enum KopeteTabState { Normal, Highlighted, Changed, Typing, Message, Undefined };
00070 
00071     ChatMessagePart *messagePart() const { return m_messagePart; }
00072     ChatTextEditPart *editPart() const { return m_editPart; }
00073 
00078     void addText( const QString &text );
00079 
00083     void saveOptions();
00084 
00088     void setActive( bool value );
00089 
00093     void saveChatSettings();
00094 
00098     void loadChatSettings();
00099 
00105     virtual void clear();
00106 
00110     void setCaption( const QString &text, bool modified );
00111 
00116     void setMainWindow( KopeteChatWindow* parent );
00117 
00124     virtual Kopete::Message currentMessage();
00125 
00132     virtual void setCurrentMessage( const Kopete::Message &newMessage );
00133 
00138     KopeteChatWindow *mainWindow() const { return m_mainWindow; }
00139 
00140     const QString &statusText();
00141 
00142     QString &caption() const;
00143 
00144     bool sendInProgress();
00145 
00147     virtual void raise( bool activate=false );
00148 
00150     virtual void makeVisible();
00151 
00153     virtual bool isVisible();
00154 
00156     virtual QWidget *mainWidget();
00157 
00158     KTextEdit *editWidget();
00159 
00160     bool canSend();
00161 
00163     virtual void registerContextMenuHandler( QObject *target, const char* slot );
00164 
00166     virtual void registerTooltipHandler( QObject *target, const char* slot );
00167 
00168 public slots:
00172     void cut();
00173 
00179     void copy();
00180 
00184     void paste();
00185 
00186     void nickComplete();
00187 
00193     void setFgColor( const QColor &newColor = QColor() );
00194 
00199     void setFont( const QFont &newFont );
00200 
00204     void setFont();
00205 
00209     QFont font();
00210 
00216     void setBgColor( const QColor &newColor = QColor() );
00217 
00221     virtual void sendMessage();
00222 
00227     virtual void appendMessage( Kopete::Message &message );
00228 
00235     void remoteTyping( const Kopete::Contact *contact, bool typing );
00236 
00241     void setStatusText( const QString &text );
00242 
00244     virtual void messageSentSuccessfully();
00245 
00246     virtual bool closeView( bool force = false );
00247 
00248 signals:
00253     void messageSent( Kopete::Message & );
00254 
00255     void messageSuccess( ChatView* );
00256 
00260     void shown();
00261 
00262     void closing( KopeteView* );
00263 
00264     void activated( KopeteView* );
00265 
00266     void captionChanged( bool active );
00267 
00268     void updateStatusIcon( ChatView* );
00269 
00271     void updateChatTooltip( ChatView*, const QString& );
00272 
00274     void updateChatState( ChatView*, int );
00275 
00277     void updateChatLabel( ChatView*, const QString& );
00278 
00282     void canSendChanged(bool);
00283 
00287     void windowCreated();
00288 
00292     void rtfEnabled( ChatView*, bool );
00293 
00294     void autoSpellCheckEnabled( ChatView*, bool );
00295 
00296 private slots:
00297     void slotRemoteTypingTimeout();
00301     void slotPropertyChanged( Kopete::PropertyContainer *contact, const QString &key, const QVariant &oldValue, const QVariant &newValue  );
00302 
00309     void slotContactAdded( const Kopete::Contact *c, bool suppress );
00310 
00319     void slotContactRemoved( const Kopete::Contact *c, const QString& reason, Qt::TextFormat format, bool suppressNotification=false );
00320 
00328     void slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldstatus );
00329 
00333     void slotChatDisplayNameChanged();
00334 
00335     void slotMarkMessageRead();
00336 
00337     void slotToggleRtfToolbar( bool enabled );
00338 
00342     void slotDisplayNameChanged(const QString &oldValue, const QString &newValue);
00343 
00344 protected:
00345     virtual void dragEnterEvent ( QDragEnterEvent * );
00346     virtual void dropEvent ( QDropEvent * );
00347 
00348 private:
00349     // widget stuff
00350     KopeteChatWindow *m_mainWindow;
00351 
00352 //  K3DockWidget *viewDock;
00353     ChatMessagePart *m_messagePart;
00354 
00355 //  K3DockWidget *editDock;
00356     ChatTextEditPart *m_editPart;
00357 
00358     KopeteTabState m_tabState;
00359 
00360     // miscellany
00361     TypingMap m_remoteTypingMap;
00362     QString unreadMessageFrom;
00363     QString m_status;
00364 
00365     void updateChatState( KopeteTabState state = Undefined );
00366 
00370     void readOptions();
00371 
00372     void sendInternalMessage( const QString &msg, Qt::TextFormat format = Qt::PlainText );
00373 
00374     KopeteChatViewPrivate *d;
00375 };
00376 
00380 class ChatWindowPlugin : public Kopete::ViewPlugin
00381 {
00382     public:
00383         ChatWindowPlugin(QObject *parent, const QStringList &args);
00384         KopeteView* createView( Kopete::ChatSession *manager );
00385 };
00386 
00387 #endif
00388 
00389 // vim: set noet ts=4 sts=4 sw=4:
00390 

kopete/kopete

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

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal