1
/****************************************************************************
2
* Copyright (C) 2013-2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
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. *
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. *
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 NUMBERCOMPLETIONMODEL_H
19
#define NUMBERCOMPLETIONMODEL_H
21
#include <QtCore/QAbstractTableModel>
23
#include "phonedirectorymodel.h"
29
class LIB_EXPORT NumberCompletionModel : public QAbstractTableModel {
35
Q_PROPERTY(QString prefix READ prefix WRITE setPrefix)
38
ALTERNATE_ACCOUNT= 100,
43
NumberCompletionModel();
44
virtual ~NumberCompletionModel();
46
//Abstract model member
47
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole ) const;
48
int rowCount(const QModelIndex& parent = QModelIndex() ) const;
49
Qt::ItemFlags flags(const QModelIndex& index ) const;
50
virtual bool setData(const QModelIndex& index, const QVariant &value, int role);
51
virtual int columnCount(const QModelIndex& parent = QModelIndex() ) const;
52
virtual QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
55
void setCall(Call* call);
56
void setUseUnregisteredAccounts(bool value);
60
PhoneNumber* number(const QModelIndex& idx) const;
61
bool isUsingUnregisteredAccounts();
62
QString prefix() const;
66
void getRange(QMap<QString,PhoneDirectoryModel::NumberWrapper*> map, const QString& prefix, QSet<PhoneNumber*>& set) const;
80
void locateNameRange (const QString& prefix, QSet<PhoneNumber*>& set);
81
void locateNumberRange(const QString& prefix, QSet<PhoneNumber*>& set);
82
uint getWeight(PhoneNumber* number);
85
QMultiMap<int,PhoneNumber*> m_hNumbers ;
89
bool m_UseUnregisteredAccount;
93
void setPrefix(const QString& str);