kopete/kopete
chattexteditpart.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CHATTEXTEDITPART_H
00019 #define CHATTEXTEDITPART_H
00020
00021 #include "krichtexteditpart.h"
00022 #include <QtCore/QStringList>
00023
00024 #include <kopete_export.h>
00025
00026 class QTimer;
00027
00028 class KCompletion;
00029
00030 namespace Sonnet {
00031 class Highlighter;
00032 }
00033
00034 namespace Kopete
00035 {
00036 class Message;
00037 class Contact;
00038 class OnlineStatus;
00039 class ChatSession;
00040 class Protocol;
00041 class PropertyContainer;
00042 }
00043
00053 class KOPETECHATWINDOW_SHARED_EXPORT ChatTextEditPart : public KRichTextEditPart
00054 {
00055 Q_OBJECT
00056 public:
00057 ChatTextEditPart( Kopete::ChatSession *session, QWidget *parent);
00058 ~ChatTextEditPart();
00059
00064 Kopete::Message contents();
00065
00070 void setContents( const Kopete::Message &message );
00071
00076 void addText( const QString &text );
00077
00081 bool canSend();
00082
00086 bool isTyping();
00087
00092 void toggleAutoSpellCheck( bool enabled );
00093
00098 bool autoSpellCheckEnabled() const;
00099
00100 public slots:
00104 void historyUp();
00105
00109 void historyDown();
00110
00114 void complete();
00115
00119 void sendMessage();
00120
00121 signals:
00126 void messageSent( Kopete::Message &message );
00127
00132 void typing( bool typing );
00133
00138 void canSendChanged( bool canSend );
00139
00140 private slots:
00146 void slotContactAdded( const Kopete::Contact *c );
00147
00153 void slotContactRemoved( const Kopete::Contact *c );
00154
00160 void slotContactStatusChanged( Kopete::Contact *contact, const Kopete::OnlineStatus &status, const Kopete::OnlineStatus &oldstatus );
00161
00165 void slotTextChanged();
00166
00171 void slotRepeatTypingTimer();
00172
00176 void slotStoppedTypingTimer();
00177
00181 void slotPropertyChanged( Kopete::PropertyContainer *, const QString &key, const QVariant &oldValue, const QVariant &newValue );
00182
00183 private:
00184 Sonnet::Highlighter* spellHighlighter();
00185 void setProtocolRichTextSupport();
00186
00187 private:
00188 Kopete::ChatSession *m_session;
00189
00198 QStringList historyList;
00199 int historyPos;
00200
00201 KCompletion *mComplete;
00202 QString m_lastMatch;
00203
00204 QTimer *m_typingRepeatTimer;
00205 QTimer *m_typingStopTimer;
00206 bool m_autoSpellCheckEnabled;
00207 Sonnet::Highlighter *m_highlighter;
00208 };
00209
00210 #endif
00211
00212