1
/***************************************************************************
2
* Copyright (C) 2009-2013 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >*
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 3 of the License, or *
8
* (at your option) any later version. *
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. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17
**************************************************************************/
22
#include <QtGui/QTreeWidget>
25
#include "lib/callmodel.h"
28
class QTreeWidgetItem;
35
class CallTreeItemDelegate;
36
class CallViewOverlayToolbar;
37
class CallViewOverlay;
40
typedef CallModel<CallTreeItem*,QTreeWidgetItem*> TreeWidgetCallModel;
42
///CallView: Central tree widget managing active calls
43
class CallView : public QTreeWidget {
45
friend class CallTreeItemDelegate;
48
explicit CallView ( QWidget* parent = 0 );
52
Call* getCurrentItem ( );
53
QWidget* getWidget ( );
55
virtual QMimeData* mimeData ( const QList<QTreeWidgetItem *> items ) const;
56
CallViewOverlayToolbar* overlayToolbar() { return m_pCanvasToolbar; };
59
void setTitle ( const QString& title );
62
bool removeItem ( Call* item );
63
bool dropMimeData ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action );
64
bool callToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action );
65
bool phoneNumberToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action );
66
bool contactToCall ( QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action );
67
void moveSelectedItem ( Qt::Key direction );
68
void selectFirstItem ( );
72
QTreeWidgetItem* extractItem ( const QString& callId );
73
QTreeWidgetItem* extractItem ( QTreeWidgetItem* item );
74
CallTreeItem* insertItem ( QTreeWidgetItem* item, QTreeWidgetItem* parent=0 );
75
CallTreeItem* insertItem ( QTreeWidgetItem* item, Call* parent );
76
void clearArtefact ( );
79
KLineEdit* m_pTransferLE ;
80
CallViewOverlay* m_pTransferOverlay ;
81
CallViewOverlay* m_pActiveOverlay ;
82
Call* m_pCallPendingTransfer;
83
CallViewOverlayToolbar* m_pCanvasToolbar ;
87
virtual void dragEnterEvent ( QDragEnterEvent *e );
88
virtual void dragMoveEvent ( QDragMoveEvent *e );
89
virtual void dragLeaveEvent ( QDragLeaveEvent *e );
90
virtual void resizeEvent ( QResizeEvent *e );
91
virtual void drawBranches(QPainter* painter, const QRect& rect, const QModelIndex& index) const;
94
void destroyCall ( Call* toDestroy);
95
void itemDoubleClicked ( QTreeWidgetItem* item, int column );
96
void itemClicked ( QTreeWidgetItem* item, int column =0 );
97
Call* addCall ( Call* call, Call* parent =0 );
98
Call* addConference ( Call* conf );
99
bool conferenceChanged ( Call* conf );
100
void conferenceRemoved ( Call* conf );
102
virtual void keyPressEvent(QKeyEvent* event);
106
void showTransferOverlay(Call* call);
108
void transferDropEvent(Call* call,QMimeData* data);
109
void conversationDropEvent(Call* call,QMimeData* data);
111
void moveCanvasTip();
114
///Emitted when one of the call item change
115
void itemChanged(Call*);