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

« back to all changes in this revision

Viewing changes to kde/src/lib/itembackendmodel.h

  • Committer: Package Import Robot
  • Author(s): Francois Marier, Francois Marier, Mark Purcell
  • Date: 2014-10-18 15:08:50 UTC
  • mfrom: (1.1.12)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20141018150850-2exfk34ckb15pcwi
Tags: 1.4.1-0.1
[ Francois Marier ]
* Non-maintainer upload
* New upstream release (closes: #759576, #741130)
  - debian/rules +PJPROJECT_VERSION := 2.2.1
  - add upstream patch to fix broken TLS support
  - add patch to fix pjproject regression

[ Mark Purcell ]
* Build-Depends:
  - sflphone-daemon + libavformat-dev, libavcodec-dev, libswscale-dev,
  libavdevice-dev, libavutil-dev
  - sflphone-gnome + libclutter-gtk-1.0-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
 *   Copyright (C) 2014 by Savoir-Faire Linux                               *
 
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
 
4
 *                                                                          *
 
5
 *   This library is free software; you can redistribute it and/or          *
 
6
 *   modify it under the terms of the GNU Lesser General Public             *
 
7
 *   License as published by the Free Software Foundation; either           *
 
8
 *   version 2.1 of the License, or (at your option) any later version.     *
 
9
 *                                                                          *
 
10
 *   This library 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 GNU      *
 
13
 *   Lesser General Public License for more details.                        *
 
14
 *                                                                          *
 
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
 ***************************************************************************/
 
18
#ifndef COMMONITEMBACKENDMODEL_H
 
19
#define COMMONITEMBACKENDMODEL_H
 
20
 
 
21
#include "typedefs.h"
 
22
#include "contact.h"
 
23
 
 
24
#include <QtCore/QAbstractItemModel>
 
25
 
 
26
#include "commonbackendmanagerinterface.h"
 
27
#include "contactmodel.h"
 
28
#include "abstractitembackend.h"
 
29
 
 
30
//SFLPhone
 
31
class AbstractItemBackendModelExtension;
 
32
 
 
33
 
 
34
class LIB_EXPORT CommonItemBackendModel : public QAbstractTableModel
 
35
{
 
36
   Q_OBJECT
 
37
public:
 
38
   explicit CommonItemBackendModel(QObject* parent = nullptr);
 
39
   ~CommonItemBackendModel();
 
40
 
 
41
   QVariant data                (const QModelIndex& index, int role = Qt::DisplayRole      ) const;
 
42
   virtual int rowCount         (const QModelIndex& parent = QModelIndex()                 ) const;
 
43
   virtual int columnCount      (const QModelIndex& parent = QModelIndex()                 ) const;
 
44
   virtual Qt::ItemFlags flags  (const QModelIndex& index                                  ) const;
 
45
   virtual QVariant headerData  (int section, Qt::Orientation orientation, int role        ) const;
 
46
   virtual bool setData         (const QModelIndex& index, const QVariant &value, int role );
 
47
   virtual QModelIndex   parent      ( const QModelIndex& index                                    ) const;
 
48
   virtual QModelIndex   index       ( int row, int column, const QModelIndex& parent=QModelIndex()) const;
 
49
 
 
50
   AbstractContactBackend* backendAt(const QModelIndex& index);
 
51
 
 
52
   void addExtension(AbstractItemBackendModelExtension* extension);
 
53
 
 
54
   bool save();
 
55
   bool load();
 
56
 
 
57
private Q_SLOTS:
 
58
   void slotUpdate();
 
59
   void slotExtensionDataChanged(const QModelIndex& idx);
 
60
 
 
61
Q_SIGNALS:
 
62
   void checkStateChanged();
 
63
 
 
64
private:
 
65
   /*
 
66
    * This is not very efficient, it doesn't really have to be given the low
 
67
    * volume. If it ever have to scale, a better mapToSource using persistent
 
68
    * index have to be implemented.
 
69
    */
 
70
   struct ProxyItem {
 
71
      ProxyItem() : parent(nullptr),col(1),row(0),backend(nullptr){}
 
72
      int row;
 
73
      int col;
 
74
      AbstractContactBackend* backend;
 
75
      ProxyItem* parent;
 
76
      QVector<ProxyItem*> m_Children;
 
77
   };
 
78
   QHash<AbstractContactBackend*,ProxyItem*> m_hBackendsNodes;
 
79
   QVector<ProxyItem*> m_lTopLevelBackends;
 
80
   QVector<AbstractItemBackendModelExtension*> m_lExtensions;
 
81
 
 
82
};
 
83
 
 
84
#endif