| 1 | /*
|
|---|
| 2 | * tabdlg.h - dialog for handling tabbed chats
|
|---|
| 3 | * Copyright (C) 2005 Kevin Smith
|
|---|
| 4 | *
|
|---|
| 5 | * This program is free software; you can redistribute it and/or
|
|---|
| 6 | * modify it under the terms of the GNU General Public License
|
|---|
| 7 | * as published by the Free Software Foundation; either version 2
|
|---|
| 8 | * of the License, or (at your option) any later version.
|
|---|
| 9 | *
|
|---|
| 10 | * This program is distributed in the hope that it will be useful,
|
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 13 | * GNU General Public License for more details.
|
|---|
| 14 | *
|
|---|
| 15 | * You should have received a copy of the GNU General Public License
|
|---|
| 16 | * along with this library; if not, write to the Free Software
|
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 18 | *
|
|---|
| 19 | */
|
|---|
| 20 |
|
|---|
| 21 | #ifndef TABDLG_H
|
|---|
| 22 | #define TABDLG_H
|
|---|
| 23 |
|
|---|
| 24 | #include <qwidget.h>
|
|---|
| 25 | #include <qptrlist.h>
|
|---|
| 26 | #include <qtabwidget.h>
|
|---|
| 27 | #include <qlayout.h>
|
|---|
| 28 | #include <qpushbutton.h>
|
|---|
| 29 | #include "im.h"
|
|---|
| 30 | #include <qmap.h>
|
|---|
| 31 | #include "psitabwidget.h"
|
|---|
| 32 | #include "advwidget.h"
|
|---|
| 33 | using namespace XMPP;
|
|---|
| 34 |
|
|---|
| 35 | class ChatDlg;
|
|---|
| 36 | class PsiCon;
|
|---|
| 37 | class ChatTabs;
|
|---|
| 38 |
|
|---|
| 39 | class QDragObject;
|
|---|
| 40 | class QContextMenuEvent;
|
|---|
| 41 |
|
|---|
| 42 | /*class PsiAccount;
|
|---|
| 43 | class UserListItem;
|
|---|
| 44 | class QDropEvent;
|
|---|
| 45 | class QDragEnterEvent;*/
|
|---|
| 46 |
|
|---|
| 47 | class TabDlg : public AdvancedWidget<QWidget>//, public QWidget
|
|---|
| 48 | {
|
|---|
| 49 | Q_OBJECT
|
|---|
| 50 | public:
|
|---|
| 51 | TabDlg(PsiCon*);
|
|---|
| 52 | ~TabDlg();
|
|---|
| 53 | bool managesChat(ChatDlg*);
|
|---|
| 54 | bool chatOnTop(ChatDlg*);
|
|---|
| 55 | QString getName();
|
|---|
| 56 |
|
|---|
| 57 | signals:
|
|---|
| 58 | void isDying(TabDlg*);
|
|---|
| 59 | protected:
|
|---|
| 60 | void closeEvent( QCloseEvent* );
|
|---|
| 61 | void keyPressEvent(QKeyEvent *);
|
|---|
| 62 | void windowActivationChange(bool);
|
|---|
| 63 | void resizeEvent(QResizeEvent *);
|
|---|
| 64 | protected slots:
|
|---|
| 65 | void detachChat();
|
|---|
| 66 | void detachChat(QWidget*);
|
|---|
| 67 | void closeChat();
|
|---|
| 68 | void closeChat(QWidget*);
|
|---|
| 69 | void buildTabMenu();
|
|---|
| 70 | void sendChatTo(QWidget*, TabDlg *);
|
|---|
| 71 | public slots:
|
|---|
| 72 | void addChat(ChatDlg *chat);
|
|---|
| 73 | void setLooks();
|
|---|
| 74 | bool closeChat(ChatDlg*,bool);
|
|---|
| 75 | void selectTab(ChatDlg*);
|
|---|
| 76 | void activated();
|
|---|
| 77 | private slots:
|
|---|
| 78 | void tabSelected(QWidget* chat);
|
|---|
| 79 | void checkHasChats();
|
|---|
| 80 | void closeMe();
|
|---|
| 81 | void updateTab(ChatDlg*);
|
|---|
| 82 | void nextTab();
|
|---|
| 83 | void previousTab();
|
|---|
| 84 | void setTabComposing(ChatDlg*, bool);
|
|---|
| 85 | void setTabHasMessages(ChatDlg*, int);
|
|---|
| 86 | void tabTestCanDecode(const QDragMoveEvent*, bool&);
|
|---|
| 87 | void tabReceivedDropEvent(QDropEvent*);
|
|---|
| 88 | void tabReceivedDropEvent(QWidget*, QDropEvent*);
|
|---|
| 89 | void startDrag(QWidget*);
|
|---|
| 90 |
|
|---|
| 91 | public:
|
|---|
| 92 | ChatDlg* getChatPointer(QString fullJid);
|
|---|
| 93 | private:
|
|---|
| 94 | void updateCaption();
|
|---|
| 95 | PsiCon *psi;
|
|---|
| 96 | QPtrList<ChatDlg> chats;
|
|---|
| 97 | KTabWidget *tabs;
|
|---|
| 98 | QPushButton *detachButton, *closeButton, *closeCross;
|
|---|
| 99 | QPopupMenu *tabMenu;
|
|---|
| 100 | QMap<ChatDlg*, bool> tabIsComposing;
|
|---|
| 101 | QMap<ChatDlg*, bool> tabHasMessages;
|
|---|
| 102 |
|
|---|
| 103 | QSize chatSize;
|
|---|
| 104 | };
|
|---|
| 105 |
|
|---|
| 106 | #endif
|
|---|