1
1
/***************************************************************************
2
* Copyright (C) 2009-2013 by Savoir-Faire Linux *
2
* Copyright (C) 2009-2014 by Savoir-Faire Linux *
3
3
* Author : Emmanuel Lepage Valle <emmanuel.lepage@savoirfairelinux.com >*
5
5
* This program is free software; you can redistribute it and/or modify *
18
18
#ifndef HISTORY_DOCK_H
19
19
#define HISTORY_DOCK_H
21
#include "ui_dockbase.h"
21
22
#include <QtGui/QDockWidget>
22
24
#include <QtGui/QTreeWidget>
23
25
#include <QtGui/QTreeWidgetItem>
26
#include <QtGui/QSortFilterProxyModel>
24
27
#include <QtCore/QDate>
25
#include "../klib/sortabledockcommon.h"
26
#include "categorizedtreewidget.h"
27
#include "calltreeitem.h"
30
class QTreeWidgetItem;
44
class HistoryTreeItem;
40
#include "../lib/historymodel.h"
46
41
class KeyPressEater;
47
class QNumericTreeWidgetItem;
50
typedef QList<HistoryTreeItem*> HistoryList;
51
typedef QHash<QString,QNumericTreeWidgetItem*> GroupHash;
53
45
///HistoryDock: Dock to see the previous SFLPhone calls
54
class HistoryDock : public QDockWidget, public SortableDockCommon<CallTreeItem*,QTreeWidgetItem*> {
46
class HistoryDock : public QDockWidget, public Ui_DockBase {
62
54
explicit HistoryDock(QWidget* parent = nullptr);
63
55
virtual ~HistoryDock();
58
time_t stopTime () const;
59
time_t startTime() const;
67
HistoryTree* m_pItemView ;
68
KLineEdit* m_pFilterLE ;
69
KComboBox* m_pSortByCBB ;
73
KDateWidget* m_pFromDW ;
74
KDateWidget* m_pToDW ;
75
QCheckBox* m_pAllTimeCB ;
76
QPushButton* m_pLinkPB ;
77
HistoryList m_History ;
78
QDate m_CurrentFromDate ;
79
QDate m_CurrentToDate ;
80
KeyPressEater* m_pKeyPressEater ;
65
KDateWidget* m_pFromDW ;
66
KDateWidget* m_pToDW ;
67
QCheckBox* m_pAllTimeCB ;
68
QPushButton* m_pLinkPB ;
69
KeyPressEater* m_pKeyPressEater ;
70
QSortFilterProxyModel* m_pProxyModel ;
75
KAction* m_pCallAgain ;
76
KAction* m_pAddContact ;
77
KAction* m_pAddToContact ;
80
KAction* m_pBookmark ;
82
Call* m_pCurrentCall ;
85
85
void updateLinkedDate(KDateWidget* item, QDate& prevDate, QDate& newDate);
88
96
void enableDateRange(bool disable);
89
97
virtual void keyPressEvent(QKeyEvent* event);
98
void slotDateRangeCanched();
92
void filter ( QString text );
93
void updateLinkedFromDate ( QDate date );
94
void updateLinkedToDate ( QDate date );
96
void updateContactInfo ( );
97
void newHistoryCall ( Call* call );
102
void slotSetSortRole ( int );
103
void slotDoubleClick(const QModelIndex& index);
106
void slotContextMenu(const QModelIndex& index);
107
void slotSendEmail ();
108
void slotCallAgain ();
110
void slotAddContact ();
111
void slotAddToContact ();
112
void slotBookmark ();
101
///HistoryTree: Simple tree view with additional keybpard filter
102
class HistoryTree : public CategorizedTreeWidget {
115
///Tuned sorting model for the history model
116
class HistorySortFilterProxyModel : public QSortFilterProxyModel
105
explicit HistoryTree(QWidget* parent) : CategorizedTreeWidget(parent) {}
106
virtual QMimeData* mimeData( const QList<QTreeWidgetItem *> items) const;
107
bool dropMimeData(QTreeWidgetItem *parent, int index, const QMimeData *data, Qt::DropAction action);
120
explicit HistorySortFilterProxyModel(HistoryDock* parent) :
121
QSortFilterProxyModel(parent),m_pParent(parent) {}
122
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
124
virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
126
HistoryDock* m_pParent;
110
129
///KeyPressEater: Intercept each keypress to manage it globally