~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/widgets/historydock.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 >*
4
4
 *                                                                         *
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
20
20
 
 
21
#include "ui_dockbase.h"
21
22
#include <QtGui/QDockWidget>
 
23
 
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"
28
28
 
29
29
//Qt
30
 
class QTreeWidgetItem;
31
 
class QString;
32
 
class QTreeWidget;
33
 
class KComboBox;
34
30
class QLabel;
35
31
class QCheckBox;
36
32
class QPushButton;
37
33
class QDate;
38
34
 
39
35
//KDE
40
 
class KLineEdit;
41
36
class KDateWidget;
 
37
class KAction;
42
38
 
43
39
//SFLPhone
44
 
class HistoryTreeItem;
45
 
class HistoryTree;
 
40
#include "../lib/historymodel.h"
46
41
class KeyPressEater;
47
 
class QNumericTreeWidgetItem;
48
42
 
49
43
//Typedef
50
 
typedef QList<HistoryTreeItem*> HistoryList;
51
 
typedef QHash<QString,QNumericTreeWidgetItem*> GroupHash;
52
44
 
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 {
55
47
   Q_OBJECT
56
48
 
57
49
public:
62
54
   explicit HistoryDock(QWidget* parent = nullptr);
63
55
   virtual ~HistoryDock();
64
56
 
 
57
   //Getters
 
58
   time_t stopTime () const;
 
59
   time_t startTime() const;
 
60
 
65
61
private:
66
62
   //Attributes
67
 
   HistoryTree*   m_pItemView        ;
68
 
   KLineEdit*     m_pFilterLE        ;
69
 
   KComboBox*     m_pSortByCBB       ;
70
 
   QLabel*        m_pSortByL         ;
71
 
   QLabel*        m_pFromL           ;
72
 
   QLabel*        m_pToL             ;
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   ;
81
 
   GroupHash      m_hGroup           ;
82
 
   int            m_LastNewCall      ;
 
63
   QLabel*                m_pFromL           ;
 
64
   QLabel*                m_pToL             ;
 
65
   KDateWidget*           m_pFromDW          ;
 
66
   KDateWidget*           m_pToDW            ;
 
67
   QCheckBox*             m_pAllTimeCB       ;
 
68
   QPushButton*           m_pLinkPB          ;
 
69
   KeyPressEater*         m_pKeyPressEater   ;
 
70
   QSortFilterProxyModel* m_pProxyModel      ;
 
71
   time_t                 m_StartTime        ;
 
72
   time_t                 m_StopTime         ;
 
73
 
 
74
   //Menu
 
75
    KAction*     m_pCallAgain     ;
 
76
    KAction*     m_pAddContact    ;
 
77
    KAction*     m_pAddToContact  ;
 
78
    KAction*     m_pCopy          ;
 
79
    KAction*     m_pEmail         ;
 
80
    KAction*     m_pBookmark      ;
 
81
    QMenu*       m_pMenu          ;
 
82
    Call*        m_pCurrentCall   ;
83
83
 
84
84
   //Mutator
85
85
   void updateLinkedDate(KDateWidget* item, QDate& prevDate, QDate& newDate);
86
86
 
 
87
   enum Role {
 
88
      Date =0,
 
89
      Name,
 
90
      Popularity,
 
91
      Length,
 
92
      SpentTime,
 
93
   };
 
94
 
87
95
public Q_SLOTS:
88
96
   void enableDateRange(bool disable);
89
97
   virtual void keyPressEvent(QKeyEvent* event);
 
98
   void slotDateRangeCanched();
90
99
 
91
100
private Q_SLOTS:
92
 
   void filter               ( QString text );
93
 
   void updateLinkedFromDate ( QDate   date );
94
 
   void updateLinkedToDate   ( QDate   date );
95
 
   void reload               (              );
96
 
   void updateContactInfo    (              );
97
 
   void newHistoryCall       ( Call*   call );
 
101
   void expandTree           (              );
 
102
   void slotSetSortRole      ( int          );
 
103
   void slotDoubleClick(const QModelIndex& index);
 
104
   
 
105
   //Menu
 
106
   void slotContextMenu(const QModelIndex& index);
 
107
   void slotSendEmail        ();
 
108
   void slotCallAgain        ();
 
109
   void slotCopy             ();
 
110
   void slotAddContact       ();
 
111
   void slotAddToContact     ();
 
112
   void slotBookmark         ();
98
113
};
99
114
 
100
 
 
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
 
117
{
103
118
   Q_OBJECT
104
119
public:
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;
 
123
protected:
 
124
   virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
 
125
private:
 
126
   HistoryDock* m_pParent;
108
127
};
109
128
 
110
129
///KeyPressEater: Intercept each keypress to manage it globally