~ubuntu-branches/ubuntu/trusty/sflphone/trusty

« back to all changes in this revision

Viewing changes to kde/src/klib/sortabledockcommon.h

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (4.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20140128182336-jrsv0k9u6cawc068
Tags: 1.3.0-1
* 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
 
/****************************************************************************
2
 
 *   Copyright (C) 2009-2013 by Savoir-Faire Linux                          *
3
 
 *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>          *
4
 
 *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
 
 *                                                                          *
6
 
 *   This library is free software; you can redistribute it and/or          *
7
 
 *   modify it under the terms of the GNU Lesser General Public             *
8
 
 *   License as published by the Free Software Foundation; either           *
9
 
 *   version 2.1 of the License, or (at your option) any later version.     *
10
 
 *                                                                          *
11
 
 *   This library is distributed in the hope that it will be useful,        *
12
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
13
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
14
 
 *   Lesser General Public License for more details.                        *
15
 
 *                                                                          *
16
 
 *   You should have received a copy of the GNU General Public License      *
17
 
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
18
 
 ***************************************************************************/
19
 
 
20
 
#ifndef SORTABLE_DOCK_COMMON
21
 
#define SORTABLE_DOCK_COMMON
22
 
 
23
 
#include <QtCore/QObject>
24
 
#include <QtCore/QHash>
25
 
#include <QtCore/QModelIndex>
26
 
#include <QtGui/QWidget>
27
 
 
28
 
#include "helperfunctions.h"
29
 
 
30
 
//Qt
31
 
class QString;
32
 
class QStringList;
33
 
class QDate;
34
 
class QDateTime;
35
 
 
36
 
//SFLPhone
37
 
class StaticEventHandler;
38
 
class Contact;
39
 
class Call;
40
 
 
41
 
///@enum ContactSortingMode Available sorting mode for the contact dock
42
 
enum ContactSortingMode {
43
 
   Name              ,
44
 
   Organisation      ,
45
 
   Recently_used     ,
46
 
   Group             ,
47
 
   Department        ,
48
 
};
49
 
 
50
 
///@enum HistorySortingMode Mode used to sort the history dock
51
 
enum HistorySortingMode {
52
 
   Date       = 0,
53
 
   Name2      = 1,
54
 
   Popularity = 2,
55
 
   Length     = 3,
56
 
};
57
 
 
58
 
///SortableDockCommon: Common code for filtering
59
 
template  <typename CallWidget = QWidget*, typename Index = QModelIndex*>
60
 
class LIB_EXPORT SortableDockCommon {
61
 
   public:
62
 
      friend class StaticEventHandler;
63
 
      
64
 
      //Helpers
65
 
      static QString getIdentity(Call* item);
66
 
      static int usableNumberCount(Contact* cont);
67
 
      static void setHistoryCategory ( QList<Call*>& calls       , HistorySortingMode mode );
68
 
      static void setContactCategory ( QList<Contact*> contacts , ContactSortingMode mode );
69
 
      
70
 
   protected:
71
 
      SortableDockCommon();
72
 
      //Helpers
73
 
      static QString                    timeToHistoryCategory ( QDate date );
74
 
      static QHash<Contact*, QDateTime> getContactListByTime  (            );
75
 
 
76
 
      //Attributes
77
 
      static QStringList         m_slHistoryConst;
78
 
      
79
 
      ///@enum HistoryConst match m_slHistoryConst
80
 
      enum HistoryConst {
81
 
         Today             = 0  ,
82
 
         Yesterday         = 1  ,
83
 
         Two_days_ago      = 2  ,
84
 
         Three_days_ago    = 3  ,
85
 
         Four_days_ago     = 4  ,
86
 
         Five_days_ago     = 5  ,
87
 
         Six_days_ago      = 6  ,
88
 
         Last_week         = 7  ,
89
 
         Two_weeks_ago     = 8  ,
90
 
         Three_weeks_ago   = 9  ,
91
 
         Last_month        = 10 ,
92
 
         Two_months_ago    = 11 ,
93
 
         Three_months_ago  = 12 ,
94
 
         Four_months_ago   = 13 ,
95
 
         Five_months_ago   = 14 ,
96
 
         Six_months_ago    = 15 ,
97
 
         Seven_months_ago  = 16 ,
98
 
         Eight_months_ago  = 17 ,
99
 
         Nine_months_ago   = 18 ,
100
 
         Ten_months_ago    = 19 ,
101
 
         Eleven_months_ago = 20 ,
102
 
         Twelve_months_ago = 21 ,
103
 
         Last_year         = 22 ,
104
 
         Very_long_time_ago= 23 ,
105
 
         Never             = 24
106
 
      };
107
 
 
108
 
   private:
109
 
      static StaticEventHandler* m_spEvHandler   ;
110
 
};
111
 
 
112
 
 
113
 
///StaticEventHandler: "cron jobs" for static member;
114
 
class LIB_EXPORT StaticEventHandler : public QObject
115
 
{
116
 
   Q_OBJECT
117
 
   public:
118
 
      StaticEventHandler(QObject* parent, QStringList* list);
119
 
 
120
 
   public Q_SLOTS:
121
 
      void update();
122
 
   private:
123
 
      QStringList* m_pList;
124
 
};
125
 
 
126
 
#include "sortabledockcommon.hpp"
127
 
 
128
 
#endif