kopete/kopete
kopetechatwindow.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
00019 #ifndef KOPETECHATWINDOW_H
00020 #define KOPETECHATWINDOW_H
00021
00022 #include <kparts/mainwindow.h>
00023 #include <qmovie.h>
00024
00025 #include <QPixmap>
00026 #include <QLabel>
00027 #include <QVBoxLayout>
00028 #include <QFrame>
00029 #include <QCloseEvent>
00030 #include <QList>
00031 #include "kopetecontact.h"
00032 #include "kdeversion.h"
00033 #include <kopetechatsession.h>
00034
00035 #include <kopete_export.h>
00036
00037 class KAction;
00038 class KToggleAction;
00039 class KActionMenu;
00040 class KTemporaryFile;
00041 class QPixmap;
00042 class QTabWidget;
00043 class KSqueezedTextLabel;
00044 class KPushButton;
00045 class QVBoxLayout;
00046 class QFrame;
00047 class KTabWidget;
00048 class QLabel;
00049 class KopeteEmoticonAction;
00050 class ChatView;
00051 class SidebarWidget;
00052 class QDockWidget;
00053
00054 namespace Kopete
00055 {
00056 class Message;
00057 class Contact;
00058 typedef QList<Contact*> ContactPtrList;
00059 }
00060
00061 typedef QList<ChatView*> ChatViewList;
00062
00063 class KopeteChatWindow : public KXmlGuiWindow
00064 {
00065 Q_OBJECT
00066
00067 enum {NEW_WINDOW, GROUP_BY_ACCOUNT, GROUP_ALL, GROUP_BY_GROUP, GROUP_BY_METACONTACT};
00068
00069 public:
00077 static KopeteChatWindow *window( Kopete::ChatSession *manager );
00078 ~KopeteChatWindow();
00079
00084 void attachChatView( ChatView *chat );
00085
00090 void detachChatView( ChatView *chat );
00091
00095 const int chatViewCount() { return chatViewList.count(); }
00096
00101 ChatView *activeView();
00102
00103 void setStatus( const QString & );
00104
00109 virtual bool queryClose();
00110 virtual bool queryExit();
00111
00112 KTemporaryFile *backgroundFile;
00113 ChatViewList chatViewList;
00114
00115 private:
00116
00117 KopeteChatWindow( Kopete::ChatSession::Form form, QWidget *parent = 0 );
00118
00123 static void windowListChanged();
00124
00125 void initActions(void);
00126 void saveOptions(void);
00127 void readOptions(void);
00128 void checkDetachEnable();
00129 void createTabBar();
00130 void deleteTabBar();
00131 void addTab( ChatView* );
00132 void setPrimaryChatView( ChatView* );
00133
00134
00135
00136
00137 QDockWidget *m_participantsWidget;
00138
00139
00140 QPointer<ChatView> m_activeView;
00141 ChatView *m_popupView;
00142 bool m_alwaysShowTabs;
00143 bool updateBg;
00144 KTabWidget *m_tabBar;
00145 KPushButton *m_button_send;
00146 KSqueezedTextLabel *m_status_text;
00147 QVBoxLayout *mainLayout;
00148 QFrame *mainArea;
00149 QLabel *anim;
00150 QMovie animIcon;
00151 QPixmap normalIcon;
00152
00153 KAction *chatSend;
00154 KAction *historyUp;
00155 KAction *historyDown;
00156 KAction *nickComplete;
00157
00158 KToggleAction *mStatusbarAction;
00159
00160 KAction *tabLeft;
00161 KAction *tabRight;
00162 KAction *tabDetach;
00163 KAction* tabClose;
00164
00165 KToggleAction* toggleAutoSpellCheck;
00166
00167 KopeteEmoticonAction *actionSmileyMenu;
00168 KActionMenu *actionActionMenu;
00169 KActionMenu *actionContactMenu;
00170 KActionMenu *actionDetachMenu;
00171 KActionMenu *actionTabPlacementMenu;
00172 QString statusMsg;
00173 Kopete::ChatSession::Form initialForm;
00174
00175 signals:
00176 void closing( KopeteChatWindow* );
00177 void chatSessionChanged( Kopete::ChatSession *newSession);
00178
00179 public slots:
00180 void slotSmileyActivated( const QString & );
00181 void setActiveView( QWidget *active );
00182 void updateBackground( const QPixmap &pm );
00183
00184 private slots:
00185
00186 void slotPrepareContactMenu();
00187 void slotPrepareDetachMenu();
00188 void slotPreparePlacementMenu();
00189 void slotUpdateSendEnabled();
00190
00191 void slotCut();
00192 void slotCopy();
00193 void slotPaste();
00194
00195 void slotSetBgColor();
00196 void slotSetFgColor();
00197 void slotSetFont();
00198
00199 void slotHistoryUp();
00200 void slotHistoryDown();
00201 void slotPageUp();
00202 void slotPageDown();
00203
00204 void slotSendMessage();
00205 void slotChatSave();
00206 void slotChatPrint();
00207
00208 void slotPreviousTab();
00209 void slotNextTab();
00210 void slotDetachChat(QAction* = 0);
00211 void slotPlaceTabs( QAction* );
00212
00213 void slotEnableUpdateBg() { updateBg = true; }
00214
00215 void toggleAutoSpellChecking();
00216 void slotRTFEnabled( ChatView*, bool );
00217 void slotAutoSpellCheckEnabled( ChatView*, bool );
00218
00219 void slotSetCaption( bool );
00220 void slotUpdateCaptionIcons( ChatView * );
00221 void slotChatClosed();
00222 void slotTabContextMenu( QWidget*, const QPoint & );
00223 void slotStopAnimation( ChatView* );
00224 void slotNickComplete();
00225 void slotCloseChat( QWidget* );
00226
00227
00228 void updateChatState( ChatView* cv, int state );
00229 void updateChatTooltip( ChatView* cv );
00230 void updateChatLabel();
00231
00232 private:
00233 void updateSpellCheckAction();
00234
00235 protected:
00236 virtual void closeEvent( QCloseEvent *e );
00237 virtual void changeEvent( QEvent *e );
00238 };
00239
00240 #endif
00241
00242
00243