source: psi/trunk/src/tabdlg.cpp@ 189

Last change on this file since 189 was 49, checked in by dmik, 19 years ago

Psi: Improved: Pressing ESC in a chat or a group chat window minimizes it.

File size: 9.8 KB
Line 
1/*
2 * tabdlg.cpp - 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#include "tabdlg.h"
22#include "chatdlg.h"
23#include "iconwidget.h"
24#include "iconset.h"
25#include "common.h"
26#include "psicon.h"
27#include <qmenubar.h>
28#include <qcursor.h>
29#include <qdragobject.h>
30#include "psitabwidget.h"
31
32#ifdef Q_WS_WIN
33#include<windows.h>
34#endif
35
36//----------------------------------------------------------------------------
37// TabDlg
38//----------------------------------------------------------------------------
39TabDlg::TabDlg(PsiCon *psiCon)
40{
41 psi=psiCon;
42
43 //this->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
44
45 tabMenu = new QPopupMenu( this );
46 connect( tabMenu, SIGNAL( aboutToShow() ), SLOT( buildTabMenu() ) );
47
48 tabs = new KTabWidget (this);
49
50 closeCross = new QPushButton(this);
51 //closeCross->setText("x");
52 closeCross->setIconSet(IconsetFactory::icon("psi/closetab").iconSet());
53 closeCross->hide();
54 if (option.usePerTabCloseButton)
55 tabs->setHoverCloseButton(true);
56 else
57 {
58 tabs->setHoverCloseButton(false);
59 tabs->setCornerWidget( closeCross );
60 closeCross->show();
61 }
62
63 tabs->setHoverCloseButtonDelayed(false); //people may want this enabled, but it's currently horribly broken.
64 tabs->setTabReorderingEnabled(true);
65 tabs->setCloseIcon(IconsetFactory::icon("psi/closetab").iconSet());
66 connect (tabs, SIGNAL( mouseDoubleClick( QWidget* ) ), SLOT( detachChat( QWidget* ) ) );
67 connect (tabs, SIGNAL( testCanDecode(const QDragMoveEvent*, bool&) ), SLOT( tabTestCanDecode(const QDragMoveEvent*, bool&) ) );
68 connect (tabs, SIGNAL( receivedDropEvent( QDropEvent* ) ), SLOT( tabReceivedDropEvent( QDropEvent* ) ) );
69 connect (tabs, SIGNAL( receivedDropEvent( QWidget*, QDropEvent* ) ), SLOT( tabReceivedDropEvent( QWidget*, QDropEvent* ) ) );
70 connect (tabs, SIGNAL( initiateDrag( QWidget* ) ), SLOT( startDrag( QWidget* ) ) );
71 connect (tabs, SIGNAL( closeRequest( QWidget* ) ), SLOT( closeChat( QWidget* ) ) );
72
73
74 QVBoxLayout *vert1 = new QVBoxLayout( this, 1);
75 vert1->addWidget(tabs);
76 chats.setAutoDelete( FALSE );
77 X11WM_CLASS("chat");