[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [sflphone-kde/abstractmodels] src: [ #24595 ] Enable more warning in CMakeLists
From: Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date: 2013-05-22 20:24:09
Message-ID: 20130522202409.A9A2AA605B () git ! kde ! org
[Download RAW message or body]
Git commit 06e62aba8147371f7f989306a9e533117612590e by Emmanuel Lepage Vallee.
Committed on 22/05/2013 at 22:24.
Pushed by lepagevalleeemmanuel into branch 'abstractmodels'.
[ #24595 ] Enable more warning in CMakeLists
M +19 -1 src/CMakeLists.txt
M +6 -11 src/accountwizard.cpp
M +11 -0 src/accountwizard.h
M +1 -0 src/delegates/historydelegate.cpp
M +2 -2 src/klib/CMakeLists.txt
M +1 -2 src/klib/akonadibackend.cpp
M +5 -0 src/klib/akonadibackend.h
M +6 -1 src/klib/contactproxymodel.cpp
M +2 -1 src/klib/dataengine/sflphoneengine.cpp
M +2 -3 src/klib/dataengine/sflphoneengine.h
D +0 -75 src/klib/sortabledockcommon.cpp
D +0 -128 src/klib/sortabledockcommon.h
D +0 -215 src/klib/sortabledockcommon.hpp
M +1 -1 src/klib/tipmanager.h
M +42 -42 src/lib/audiocodecmodel.cpp
M +3 -0 src/lib/call.cpp
M +5 -1 src/lib/call.h
M +2 -0 src/lib/callmodel.cpp
M +28 -28 src/lib/contactbackend.cpp
M +27 -25 src/lib/credentialmodel.cpp
M +1 -1 src/lib/dbus/metatypes.h
M +48 -94 src/lib/historymodel.cpp
M +18 -16 src/lib/instantmessagingmodel.cpp
M +26 -26 src/lib/videocodecmodel.cpp
M +1 -1 src/lib/videorenderer.cpp
M +1 -0 src/main.cpp
M +1 -1 src/sflphoneview.cpp
http://commits.kde.org/sflphone-kde/06e62aba8147371f7f989306a9e533117612590e
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 5c08225..8c3f5aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,11 +5,29 @@ endif(POLICY CMP0017)
ADD_DEFINITIONS(
${KDE4_DEFINITIONS}
${QT_DEFINITIONS}
- -Wno-reorder
-fexceptions
-Wno-deprecated-declarations
-DDATA_INSTALL_DIR="\\\"${DATA_INSTALL_DIR}\\\""
-DSHARE_INSTALL_PREFIX="\\\"${SHARE_INSTALL_PREFIX}\\\""
+ -Werror
+ -Wall
+ -Wextra
+# -Wmissing-declarations
+ -Wmissing-noreturn
+# -Wshadow
+ -Wpointer-arith
+ -Wcast-align
+ -Wwrite-strings
+ -Wformat-nonliteral
+ -Wformat-security
+ -Wswitch-enum
+# -Wswitch-default
+ -Winit-self
+ -Wmissing-include-dirs
+ -Wundef
+ -Wmissing-format-attribute
+ -pedantic
+ -Wno-reorder
)
ADD_DEFINITIONS("-std=c++0x")
diff --git a/src/accountwizard.cpp b/src/accountwizard.cpp
index 7a301be..14ee0ab 100644
--- a/src/accountwizard.cpp
+++ b/src/accountwizard.cpp
@@ -71,15 +71,10 @@
* *
**************************************************************************/
-typedef struct {
- bool success ;
- QString reason ;
- QString user ;
- QString passwd ;
-} rest_account;
+
///Validate if the connection can be done with the PBX
-int sendRequest(QString host, int port, QString req, QString & ret)
+int AccountWizard::sendRequest(const QString& host, int port, const QString& req, \
QString& ret) {
int s;
struct sockaddr_in servSockAddr;
@@ -105,7 +100,7 @@ int sendRequest(QString host, int port, QString req, QString & \
ret) return -1;
}
- if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) \
sizeof(servSockAddr)) < 0 ) { + if(::connect(s, (const struct sockaddr *) \
&servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) { perror(nullptr);
ret = "connect";
return -1;
@@ -139,14 +134,14 @@ int sendRequest(QString host, int port, QString req, QString & \
ret)
fclose(f);
shutdown(s, 2);
- close(s);
+ ::close(s);
return 0;
}
///
-rest_account get_rest_account(QString host, QString email)
+rest_account AccountWizard::get_rest_account(const QString& host, const QString& \
email) {
- QString req = "GET /rest/accountcreator?email=" + email;
+ const QString req = "GET /rest/accountcreator?email=" + email;
QString ret;
rest_account ra;
kDebug() << "HOST: " << host;
diff --git a/src/accountwizard.h b/src/accountwizard.h
index 5dd3a74..7dac625 100644
--- a/src/accountwizard.h
+++ b/src/accountwizard.h
@@ -28,6 +28,13 @@ class QRadioButton;
class KLineEdit;
class QCheckBox;
+typedef struct {
+ bool success ;
+ QString reason ;
+ QString user ;
+ QString passwd ;
+} rest_account;
+
/**
@author Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>
*/
@@ -40,6 +47,10 @@ public:
explicit AccountWizard(QWidget * parent = nullptr);
~AccountWizard();
void accept();
+private:
+ //Helpers
+ rest_account get_rest_account(const QString& host, const QString& email);
+ int sendRequest(const QString& host, int port, const QString& req, QString& ret);
};
/***************************************************************************
diff --git a/src/delegates/historydelegate.cpp b/src/delegates/historydelegate.cpp
index 2f35940..980d91a 100644
--- a/src/delegates/historydelegate.cpp
+++ b/src/delegates/historydelegate.cpp
@@ -44,6 +44,7 @@ static const char* icnPath[4] = {
};
///Constant
+#pragma GCC diagnostic ignored "-Wmissing-braces"
TypedStateMachine< const char* , Call::State, Call::State::COUNT > callStateIcons = \
{ICON_INCOMING, ICON_RINGING, ICON_CURRENT, ICON_DIALING, ICON_HOLD, ICON_FAILURE, \
ICON_BUSY, ICON_TRANSFER, ICON_TRANSF_HOLD, "", "", ICON_CONFERENCE};
HistoryDelegate::HistoryDelegate(QTreeView* parent) : \
QStyledItemDelegate(parent),m_pParent(parent),m_pDelegatedropoverlay(nullptr)
diff --git a/src/klib/CMakeLists.txt b/src/klib/CMakeLists.txt
index 9446d31..078e5e4 100644
--- a/src/klib/CMakeLists.txt
+++ b/src/klib/CMakeLists.txt
@@ -30,7 +30,7 @@ INCLUDE_DIRECTORIES ( ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
set( ksflphone_LIB_SRCS
helperfunctions.cpp
akonadibackend.cpp
- sortabledockcommon.cpp
+# sortabledockcommon.cpp
configurationskeleton.cpp
tipmanager.cpp
tip.cpp
@@ -60,7 +60,7 @@ set_target_properties( ksflphone
set( ksflphone_LIB_HDRS
akonadibackend.h
helperfunctions.h
- sortabledockcommon.h
+# sortabledockcommon.h
macromodel.h
)
diff --git a/src/klib/akonadibackend.cpp b/src/klib/akonadibackend.cpp
index 3b559bb..153065f 100644
--- a/src/klib/akonadibackend.cpp
+++ b/src/klib/akonadibackend.cpp
@@ -40,7 +40,6 @@
#include <kabc/addressee.h>
#include <kabc/addresseelist.h>
#include <kabc/contactgroup.h>
-#include <kabc/phonenumber.h>
//SFLPhone library
#include "../lib/contact.h"
@@ -150,7 +149,7 @@ const ContactList& AkonadiBackend::getContactList() const
* *
****************************************************************************/
-KABC::PhoneNumber::Type nameToType(QString name)
+KABC::PhoneNumber::Type AkonadiBackend::nameToType(const QString& name)
{
if (name == "Home" ) return KABC::PhoneNumber::Home ;
else if (name == "Work" ) return KABC::PhoneNumber::Work ;
diff --git a/src/klib/akonadibackend.h b/src/klib/akonadibackend.h
index 7616b32..793d3cd 100644
--- a/src/klib/akonadibackend.h
+++ b/src/klib/akonadibackend.h
@@ -30,7 +30,9 @@ class QObject;
//KDE
namespace KABC {
class Addressee ;
+ class PhoneNumber ;
}
+#include <kabc/phonenumber.h>
namespace Akonadi {
class Session ;
@@ -70,6 +72,9 @@ private:
QHash<QString,Akonadi::Item> m_ItemHash ;
ContactList m_pContacts ;
+ //Helper
+ KABC::PhoneNumber::Type nameToType(const QString& name);
+
protected:
ContactList update_slot();
diff --git a/src/klib/contactproxymodel.cpp b/src/klib/contactproxymodel.cpp
index b08d417..e376f11 100644
--- a/src/klib/contactproxymodel.cpp
+++ b/src/klib/contactproxymodel.cpp
@@ -117,6 +117,8 @@ QVariant ContactByNameProxyModel::data( const QModelIndex& index, \
int role) cons switch (role) {
case Qt::DisplayRole:
return ((TopLevelItem*)modelItem)->m_Name;
+ default:
+ break;
}
break;
case ContactTreeBackend::Type::CONTACT: /* && (role == Qt::DisplayRole)) {*/
@@ -152,7 +154,8 @@ QVariant ContactByNameProxyModel::data( const QModelIndex& index, \
int role) cons
Contact* ct = \
m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()];
return ct->getFormattedName()+'\n'+ct->getOrganization()+'\n'+ct->getGroup()+'\n'+ct->getDepartment()+'\n'+ct->getPreferredEmail();
}
- break;
+ default:
+ break;
}
break;
case ContactTreeBackend::Type::NUMBER: /* && (role == Qt::DisplayRole)) {*/
@@ -161,6 +164,8 @@ QVariant ContactByNameProxyModel::data( const QModelIndex& index, \
int role) cons
return QVariant(m_lCategoryCounter[index.parent().parent().row()]->m_lChilds[index.parent().row()]->getPhoneNumbers()[index.row()]->getNumber());
}
break;
+ default:
+ break;
};
return QVariant();
}
diff --git a/src/klib/dataengine/sflphoneengine.cpp \
b/src/klib/dataengine/sflphoneengine.cpp index 992a716..9e83d8a 100644
--- a/src/klib/dataengine/sflphoneengine.cpp
+++ b/src/klib/dataengine/sflphoneengine.cpp
@@ -140,7 +140,7 @@ CallModel* SFLPhoneEngine::getModel()
void SFLPhoneEngine::updateHistory()
{
CallList list = HistoryModel::getHistory().values();
- setHistoryCategory(list,HistorySortingMode::Date);
+// setHistoryCategory(list,HistorySortingMode::Date);
foreach (Call* oldCall, list) {
HashStringString current;
@@ -357,4 +357,5 @@ void SFLPhoneEngine::voiceMailNotifySignal(const QString& \
accountId, int count) //TODO
}
+#pragma GCC diagnostic ignored "-Wmissing-declarations"
K_EXPORT_PLASMA_DATAENGINE(sflphone, SFLPhoneEngine)
diff --git a/src/klib/dataengine/sflphoneengine.h \
b/src/klib/dataengine/sflphoneengine.h index 4b56e04..b703ec9 100644
--- a/src/klib/dataengine/sflphoneengine.h
+++ b/src/klib/dataengine/sflphoneengine.h
@@ -20,7 +20,6 @@
//Base
#include <Plasma/DataEngine>
-#include "../sortabledockcommon.h"
//Qt
#include <QHash>
@@ -36,10 +35,10 @@ namespace Plasma {
//Typedef
typedef QHash<QString,QVariant> HashStringString;
typedef QHash<QString,QHash<QString,QVariant> > ContactHash ;
-class Call;
+#include "../../lib/call.h"
///SFLPhoneEngine: SFLPhone KDE plasma dataengine
-class SFLPhoneEngine : public Plasma::DataEngine,public SortableDockCommon<>
+class SFLPhoneEngine : public Plasma::DataEngine
{
Q_OBJECT
diff --git a/src/klib/sortabledockcommon.cpp b/src/klib/sortabledockcommon.cpp
deleted file mode 100644
index ab9f3a3..0000000
--- a/src/klib/sortabledockcommon.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
- * Copyright (C) 2009-2013 by Savoir-Faire Linux *
- * Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
- * Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#include "sortabledockcommon.h"
-
-//Qt
-#include <QtCore/QDateTime>
-#include <QtCore/QStringList>
-#include <QtCore/QTimer>
-#include <QtCore/QString>
-
-//KDE
-#include <KLocale>
-
-//SFLPhone
-#include "../lib/call.h"
-#include "../lib/contact.h"
-#include "../lib/callmodel.h"
-#include "akonadibackend.h"
-
-///StaticEventHandler constructor
-StaticEventHandler::StaticEventHandler(QObject* parent, QStringList* list) : \
QObject(parent),m_pList(list)
-{
- QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(update()));
- timer->start(86400000); //1 day
- update();
-}
-
-///Update the days constant, necessary to cycle after midnight
-void StaticEventHandler::update()
-{
- (*m_pList) <<
- "Today" <<//0
- "Yesterday" <<//1
- QDate::currentDate().addDays(-2).toString("dddd").toAscii()<<//2
- QDate::currentDate().addDays(-3).toString("dddd").toAscii()<<//3
- QDate::currentDate().addDays(-4).toString("dddd").toAscii()<<//4
- QDate::currentDate().addDays(-5).toString("dddd").toAscii()<<//5
- QDate::currentDate().addDays(-6).toString("dddd").toAscii()<<//6
- "Last week" <<//7
- "Two weeks ago" <<//8
- "Three weeks ago" <<//9
- "Last month" <<//10
- "Two months ago" <<//11
- "Three months ago" <<//12
- "Four months ago" <<//13
- "Five months ago" <<//14
- "Six months ago" <<//15
- "Seven months ago" <<//16
- "Eight months ago" <<//17
- "Nine months ago" <<//18
- "Ten months ago" <<//19
- "Eleven months ago" <<//20
- "Twelve months ago" <<//21
- "Last year" <<//22
- "Very long time ago" <<//23
- "Never" ;//24
-}
diff --git a/src/klib/sortabledockcommon.h b/src/klib/sortabledockcommon.h
deleted file mode 100644
index cd97093..0000000
--- a/src/klib/sortabledockcommon.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
- * Copyright (C) 2009-2013 by Savoir-Faire Linux *
- * Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
- * Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#ifndef SORTABLE_DOCK_COMMON
-#define SORTABLE_DOCK_COMMON
-
-#include <QtCore/QObject>
-#include <QtCore/QHash>
-#include <QtCore/QModelIndex>
-#include <QtGui/QWidget>
-
-#include "helperfunctions.h"
-
-//Qt
-class QString;
-class QStringList;
-class QDate;
-class QDateTime;
-
-//SFLPhone
-class StaticEventHandler;
-class Contact;
-class Call;
-
-///@enum ContactSortingMode Available sorting mode for the contact dock
-enum ContactSortingMode {
- Name ,
- Organisation ,
- Recently_used ,
- Group ,
- Department ,
-};
-
-///@enum HistorySortingMode Mode used to sort the history dock
-enum HistorySortingMode {
- Date = 0,
- Name2 = 1,
- Popularity = 2,
- Length = 3,
-};
-
-///SortableDockCommon: Common code for filtering
-template <typename CallWidget = QWidget*, typename Index = QModelIndex*>
-class LIB_EXPORT SortableDockCommon {
- public:
- friend class StaticEventHandler;
-
- //Helpers
- static QString getIdentity(Call* item);
- static int usableNumberCount(Contact* cont);
- static void setHistoryCategory ( QList<Call*>& calls , \
HistorySortingMode mode );
- static void setContactCategory ( QList<Contact*> contacts , ContactSortingMode \
mode );
-
- protected:
- SortableDockCommon();
- //Helpers
- static QString timeToHistoryCategory ( QDate date );
- static QHash<Contact*, QDateTime> getContactListByTime ( );
-
- //Attributes
- static QStringList m_slHistoryConst;
-
- ///@enum HistoryConst match m_slHistoryConst
- enum HistoryConst {
- Today = 0 ,
- Yesterday = 1 ,
- Two_days_ago = 2 ,
- Three_days_ago = 3 ,
- Four_days_ago = 4 ,
- Five_days_ago = 5 ,
- Six_days_ago = 6 ,
- Last_week = 7 ,
- Two_weeks_ago = 8 ,
- Three_weeks_ago = 9 ,
- Last_month = 10 ,
- Two_months_ago = 11 ,
- Three_months_ago = 12 ,
- Four_months_ago = 13 ,
- Five_months_ago = 14 ,
- Six_months_ago = 15 ,
- Seven_months_ago = 16 ,
- Eight_months_ago = 17 ,
- Nine_months_ago = 18 ,
- Ten_months_ago = 19 ,
- Eleven_months_ago = 20 ,
- Twelve_months_ago = 21 ,
- Last_year = 22 ,
- Very_long_time_ago= 23 ,
- Never = 24
- };
-
- private:
- static StaticEventHandler* m_spEvHandler ;
-};
-
-
-///StaticEventHandler: "cron jobs" for static member;
-class LIB_EXPORT StaticEventHandler : public QObject
-{
- Q_OBJECT
- public:
- StaticEventHandler(QObject* parent, QStringList* list);
-
- public Q_SLOTS:
- void update();
- private:
- QStringList* m_pList;
-};
-
-#include "sortabledockcommon.hpp"
-
-#endif
diff --git a/src/klib/sortabledockcommon.hpp b/src/klib/sortabledockcommon.hpp
deleted file mode 100644
index e0cc719..0000000
--- a/src/klib/sortabledockcommon.hpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
- * Copyright (C) 2009-2013 by Savoir-Faire Linux *
- * Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com> *
- * Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-//Qt
-#include <QtCore/QDateTime>
-#include <QtCore/QStringList>
-#include <QtCore/QString>
-
-//KDE
-#include <KLocale>
-
-//SFLPhone
-#include "../lib/call.h"
-#include "../lib/contact.h"
-#include "../lib/callmodel.h"
-#include "../lib/historymodel.h"
-#include "akonadibackend.h"
-#include "helperfunctions.h"
-#include "configurationskeleton.h"
-
-//Define
-#define CALLMODEL_TEMPLATE template<typename CallWidget, typename Index>
-#define SORTABLE_T SortableDockCommon<CallWidget,Index>
-
-CALLMODEL_TEMPLATE QStringList SORTABLE_T::m_slHistoryConst = QStringList();
-CALLMODEL_TEMPLATE StaticEventHandler* SORTABLE_T::m_spEvHandler = new \
StaticEventHandler(0,&(SORTABLE_T::m_slHistoryConst));
-
-///Constructor
-CALLMODEL_TEMPLATE SORTABLE_T::SortableDockCommon()
-{
-
-}
-
-
-/*****************************************************************************
- * *
- * Helpers *
- * *
- ****************************************************************************/
-
-///Convert call end time stamp to human readable relative date
-CALLMODEL_TEMPLATE QString SORTABLE_T::timeToHistoryCategory(QDate date)
-{
- if (m_slHistoryConst.size() < 10)
- m_spEvHandler->update();
-
- //m_spEvHandler->update();
- if (QDate::currentDate() == date || QDate::currentDate() < date) //The future \
case would be a bug, but it have to be handled anyway or it will appear in "very long \
time ago"
- return i18n(m_slHistoryConst[HistoryConst::Today].toAscii());
-
- //Check for last week
- for (int i=1;i<7;i++) {
- if (QDate::currentDate().addDays(-i) == date)
- return i18n(m_slHistoryConst[i].toAscii()); //Yesterday to Six_days_ago
- }
-
- //Check for last month
- for (int i=1;i<4;i++) {
- if (QDate::currentDate().addDays(-(i*7)) >= date && \
QDate::currentDate().addDays(-(i*7) -7) < date)
- return i18n(m_slHistoryConst[i+Last_week-1].toAscii()); //Last_week to \
Three_weeks_ago
- }
-
- //Check for last year
- for (int i=1;i<12;i++) {
- if (QDate::currentDate().addMonths(-i) >= date && \
QDate::currentDate().addMonths((-i) - 1) < date)
- return i18n(m_slHistoryConst[i+Last_month-1].toAscii()); //Last_month to \
Twelve_months ago
- }
-
- if (QDate::currentDate().addYears(-1) >= date && \
QDate::currentDate().addYears(-2) < date)
- return i18n(m_slHistoryConst[Last_year].toAscii());
-
- //Every other senario
- return i18n(m_slHistoryConst[Very_long_time_ago].toAscii());
-}
-
-///Set category
-CALLMODEL_TEMPLATE void SORTABLE_T::setHistoryCategory(QList<Call*>& \
calls,HistorySortingMode mode)
-{
- QHash<QString,uint> popularityCount;
- QMap<QString, QList<Call*> > byDate;
- switch (mode) {
- case HistorySortingMode::Date:
- foreach (const QString& cat, m_slHistoryConst) {
- byDate[i18n(cat.toAscii())] = QList<Call*>();
- }
- break;
- case HistorySortingMode::Popularity:
- foreach (Call* call, calls) {
- popularityCount[getIdentity(call)]++;
- }
- break;
- default:
- break;
- }
- foreach (Call* call, calls) {
- QString category;
- switch (mode) {
- case HistorySortingMode::Date:
- {
- category = \
timeToHistoryCategory(QDateTime::fromTime_t(call->getStartTimeStamp().toUInt()).date());
- byDate[category] <<call;
- }
- break;
- case HistorySortingMode::Name2:
- category = getIdentity(call);
- break;
- case HistorySortingMode::Popularity:
- {
- QString identity = getIdentity(call);
- category = \
identity+"("+QString::number(popularityCount[identity])+")";
- }
- break;
- case HistorySortingMode::Length:
- category = i18n("TODO");
- break;
- default:
- break;
- }
- call->setProperty("section",category);
- }
- switch (mode) {
- case HistorySortingMode::Date:
- calls.clear();
- foreach (const QString& cat, m_slHistoryConst) {
- foreach (Call* call, byDate[i18n(cat.toAscii())]) {
- calls << call;
- }
- }
- break;
- default:
- break;
- }
-} //setHistoryCategory
-
-///Set contact category
-CALLMODEL_TEMPLATE void SORTABLE_T::setContactCategory(QList<Contact*> \
contacts,ContactSortingMode mode)
-{
- QHash<Contact*, QDateTime> recentlyUsed;
- switch (mode) {
- case ContactSortingMode::Recently_used:
- recentlyUsed = getContactListByTime();
- foreach (const QString& cat, m_slHistoryConst) {
- //m_pContactView->addCategory(cat);
- }
- break;
- default:
- break;
- }
- foreach (Contact* cont, contacts) {
- if (cont->getPhoneNumbers().count() && usableNumberCount(cont)) {
- QString category;
- switch (mode) {
- case ContactSortingMode::Name:
- category = QString(cont->getFormattedName().trimmed()[0]);
- break;
- case ContactSortingMode::Organisation:
- category = (cont->getOrganization().isEmpty())?i18nc("Unknown \
category","Unknown"):cont->getOrganization();
- break;
- case ContactSortingMode::Recently_used:
- if (recentlyUsed.find(cont) != recentlyUsed.end())
- category = timeToHistoryCategory(recentlyUsed[cont].date());
- else
- category = i18n(m_slHistoryConst[Never].toAscii());
- break;
- case ContactSortingMode::Group:
- category = i18n("TODO");
- break;
- case ContactSortingMode::Department:
- category = (cont->getDepartment().isEmpty())?i18nc("Unknown \
category","Unknown"):cont->getDepartment();;
- break;
- default:
- break;
- }
- }
- }
-} //setContactCategory
-
-///Return the identity of the call caller, try to return something useful
-CALLMODEL_TEMPLATE QString SORTABLE_T::getIdentity(Call* item)
-{
- Contact* contact = item->getContact();
- if (contact)
- return contact->getFormattedName();
- else if (!item->getPeerName().isEmpty())
- return item->getPeerName();
- else
- return item->getPeerPhoneNumber();
-}
-
-///How many different number are present for 'cont'
-CALLMODEL_TEMPLATE int SORTABLE_T::usableNumberCount(Contact* cont)
-{
- uint result =0;
- QStringList list = ConfigurationSkeleton::phoneTypeList();
- foreach (Contact::PhoneNumber* pn,cont->getPhoneNumbers()) {
- result += (list.indexOf(pn->getType()) != -1) || (pn->getType().isEmpty()); \
//Always allow empty because of LDAP, vcard
- }
- return result;
-}
diff --git a/src/klib/tipmanager.h b/src/klib/tipmanager.h
index 85331de..2f6d4eb 100644
--- a/src/klib/tipmanager.h
+++ b/src/klib/tipmanager.h
@@ -96,6 +96,6 @@ Q_SIGNALS:
void currentTipChanged(Tip*);
};
-Q_DECLARE_METATYPE(TipManager*);
+Q_DECLARE_METATYPE(TipManager*)
#endif
diff --git a/src/lib/audiocodecmodel.cpp b/src/lib/audiocodecmodel.cpp
index b7b9eae..f74e6a3 100644
--- a/src/lib/audiocodecmodel.cpp
+++ b/src/lib/audiocodecmodel.cpp
@@ -21,71 +21,71 @@
#include <QtCore/QDebug>
///Constructor
-AudioCodecModel::AudioCodecModel(QObject* parent) : QAbstractListModel(parent) {
+AudioCodecModel::AudioCodecModel(QObject* par) : QAbstractListModel(par) {
}
///Model data
-QVariant AudioCodecModel::data(const QModelIndex& index, int role) const {
- if(index.column() == 0 && role == Qt::DisplayRole ) {
- return QVariant(m_lAudioCodecs[index.row()]->name);
+QVariant AudioCodecModel::data(const QModelIndex& idx, int role) const {
+ if(idx.column() == 0 && role == Qt::DisplayRole ) {
+ return QVariant(m_lAudioCodecs[idx.row()]->name);
}
- else if(index.column() == 0 && role == Qt::CheckStateRole ) {
- return QVariant(m_lEnabledCodecs[m_lAudioCodecs[index.row()]->id] ? \
Qt::Checked : Qt::Unchecked); + else if(idx.column() == 0 && role == \
Qt::CheckStateRole ) { + return \
QVariant(m_lEnabledCodecs[m_lAudioCodecs[idx.row()]->id] ? Qt::Checked : \
Qt::Unchecked); }
- else if (index.column() == 0 && role == AudioCodecModel::NAME_ROLE ) {
- return m_lAudioCodecs[index.row()]->name;
+ else if (idx.column() == 0 && role == AudioCodecModel::NAME_ROLE ) {
+ return m_lAudioCodecs[idx.row()]->name;
}
- else if (index.column() == 0 && role == AudioCodecModel::BITRATE_ROLE ) {
- return m_lAudioCodecs[index.row()]->bitrate;
+ else if (idx.column() == 0 && role == AudioCodecModel::BITRATE_ROLE ) {
+ return m_lAudioCodecs[idx.row()]->bitrate;
}
- else if (index.column() == 0 && role == AudioCodecModel::SAMPLERATE_ROLE ) {
- return m_lAudioCodecs[index.row()]->samplerate;
+ else if (idx.column() == 0 && role == AudioCodecModel::SAMPLERATE_ROLE ) {
+ return m_lAudioCodecs[idx.row()]->samplerate;
}
- else if (index.column() == 0 && role == AudioCodecModel::ID_ROLE ) {
- return m_lAudioCodecs[index.row()]->id;
+ else if (idx.column() == 0 && role == AudioCodecModel::ID_ROLE ) {
+ return m_lAudioCodecs[idx.row()]->id;
}
return QVariant();
}
///Number of audio codecs
-int AudioCodecModel::rowCount(const QModelIndex& parent) const {
- Q_UNUSED(parent)
+int AudioCodecModel::rowCount(const QModelIndex& par) const {
+ Q_UNUSED(par)
return m_lAudioCodecs.size();
}
///Model flags
-Qt::ItemFlags AudioCodecModel::flags(const QModelIndex& index) const {
- if (index.column() == 0)
- return QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable;
- return QAbstractItemModel::flags(index);
+Qt::ItemFlags AudioCodecModel::flags(const QModelIndex& idx) const {
+ if (idx.column() == 0)
+ return QAbstractItemModel::flags(idx) | Qt::ItemIsUserCheckable | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable; + return QAbstractItemModel::flags(idx);
}
///Set audio codec data
-bool AudioCodecModel::setData( const QModelIndex& index, const QVariant &value, int \
role) {
- if (index.column() == 0 && role == AudioCodecModel::NAME_ROLE) {
- m_lAudioCodecs[index.row()]->name = value.toString();
- emit dataChanged(index, index);
+bool AudioCodecModel::setData( const QModelIndex& idx, const QVariant &value, int \
role) { + if (idx.column() == 0 && role == AudioCodecModel::NAME_ROLE) {
+ m_lAudioCodecs[idx.row()]->name = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == AudioCodecModel::BITRATE_ROLE) {
- m_lAudioCodecs[index.row()]->bitrate = value.toString();
- emit dataChanged(index, index);
+ else if (idx.column() == 0 && role == AudioCodecModel::BITRATE_ROLE) {
+ m_lAudioCodecs[idx.row()]->bitrate = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
- else if(index.column() == 0 && role == Qt::CheckStateRole) {
- m_lEnabledCodecs[m_lAudioCodecs[index.row()]->id] = value.toBool();
- emit dataChanged(index, index);
+ else if(idx.column() == 0 && role == Qt::CheckStateRole) {
+ m_lEnabledCodecs[m_lAudioCodecs[idx.row()]->id] = value.toBool();
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == AudioCodecModel::SAMPLERATE_ROLE) {
- m_lAudioCodecs[index.row()]->samplerate = value.toString();
- emit dataChanged(index, index);
+ else if (idx.column() == 0 && role == AudioCodecModel::SAMPLERATE_ROLE) {
+ m_lAudioCodecs[idx.row()]->samplerate = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == AudioCodecModel::ID_ROLE) {
- m_lAudioCodecs[index.row()]->id = value.toInt();
- emit dataChanged(index, index);
+ else if (idx.column() == 0 && role == AudioCodecModel::ID_ROLE) {
+ m_lAudioCodecs[idx.row()]->id = value.toInt();
+ emit dataChanged(idx, idx);
return true;
}
return false;
@@ -114,8 +114,8 @@ void AudioCodecModel::removeAudioCodec(QModelIndex idx) {
///Remove everything
void AudioCodecModel::clear()
{
- foreach(AudioCodecData* data, m_lAudioCodecs) {
- delete data;
+ foreach(AudioCodecData* data2, m_lAudioCodecs) {
+ delete data2;
}
m_lAudioCodecs.clear ();
m_lEnabledCodecs.clear();
@@ -125,9 +125,9 @@ void AudioCodecModel::clear()
bool AudioCodecModel::moveUp(QModelIndex idx)
{
if(idx.row() > 0 && idx.row() <= rowCount()) {
- AudioCodecData* data = m_lAudioCodecs[idx.row()];
+ AudioCodecData* data2 = m_lAudioCodecs[idx.row()];
m_lAudioCodecs.removeAt(idx.row());
- m_lAudioCodecs.insert(idx.row() - 1, data);
+ m_lAudioCodecs.insert(idx.row() - 1, data2);
emit dataChanged(index(idx.row() - 1, 0, QModelIndex()), index(idx.row(), 0, \
QModelIndex())); return true;
}
@@ -138,9 +138,9 @@ bool AudioCodecModel::moveUp(QModelIndex idx)
bool AudioCodecModel::moveDown(QModelIndex idx)
{
if(idx.row() >= 0 && idx.row() < rowCount()) {
- AudioCodecData* data = m_lAudioCodecs[idx.row()];
+ AudioCodecData* data2 = m_lAudioCodecs[idx.row()];
m_lAudioCodecs.removeAt(idx.row());
- m_lAudioCodecs.insert(idx.row() + 1, data);
+ m_lAudioCodecs.insert(idx.row() + 1, data2);
emit dataChanged(index(idx.row(), 0, QModelIndex()), index(idx.row() + 1, 0, \
QModelIndex())); return true;
}
diff --git a/src/lib/call.cpp b/src/lib/call.cpp
index f7c928b..b442c0e 100644
--- a/src/lib/call.cpp
+++ b/src/lib/call.cpp
@@ -404,6 +404,7 @@ const QString Call::toHumanStateName(const Call::State cur)
break;
case Call::State::CONFERENCE_HOLD:
return ( "Conference (hold)" );
+ case Call::State::COUNT:
default:
return "";
}
@@ -951,6 +952,7 @@ void Call::appendText(const QString& str)
case Call::State::ERROR:
case Call::State::CONFERENCE:
case Call::State::CONFERENCE_HOLD:
+ case Call::State::COUNT:
default :
qDebug() << "Backspace on call not editable. Doing nothing.";
return;
@@ -985,6 +987,7 @@ void Call::backspaceItemText()
case Call::State::ERROR:
case Call::State::CONFERENCE:
case Call::State::CONFERENCE_HOLD:
+ case Call::State::COUNT:
default :
qDebug() << "Backspace on call not editable. Doing nothing.";
return;
diff --git a/src/lib/call.h b/src/lib/call.h
index f505b2d..5217af0 100644
--- a/src/lib/call.h
+++ b/src/lib/call.h
@@ -351,6 +351,10 @@ Q_SIGNALS:
void playbackStarted();
};
-Q_DECLARE_METATYPE(Call*);
+Q_DECLARE_METATYPE(Call*)
+
+QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::State& c );
+QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::DaemonState& c );
+QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::Action& c );
#endif
diff --git a/src/lib/callmodel.cpp b/src/lib/callmodel.cpp
index a2b21b0..351106a 100644
--- a/src/lib/callmodel.cpp
+++ b/src/lib/callmodel.cpp
@@ -137,9 +137,11 @@ int CallModel::size()
CallList CallModel::getCallList()
{
CallList callList;
+ #pragma GCC diagnostic ignored "-Wshadow"
foreach(InternalStruct* internalS, m_lInternalModel) {
callList.push_back(internalS->call_real);
if (internalS->m_lChildren.size()) {
+ #pragma GCC diagnostic ignored "-Wshadow"
foreach(InternalStruct* childInt,internalS->m_lChildren) {
callList.push_back(childInt->call_real);
}
diff --git a/src/lib/contactbackend.cpp b/src/lib/contactbackend.cpp
index 99533ab..c167ab9 100644
--- a/src/lib/contactbackend.cpp
+++ b/src/lib/contactbackend.cpp
@@ -30,7 +30,7 @@
#include <QtCore/QDebug>
///Constructor
-ContactBackend::ContactBackend(QObject* parent) : \
QAbstractItemModel(parent),m_UpdatesCounter(0) \
+ContactBackend::ContactBackend(QObject* par) : \
QAbstractItemModel(par),m_UpdatesCounter(0) {
connect(this,SIGNAL(collectionChanged()),this,SLOT(slotReloadModel()));
}
@@ -92,23 +92,23 @@ QString ContactBackend::getHostNameFromPhone(QString phoneNumber)
****************************************************************************/
-bool ContactBackend::setData( const QModelIndex& index, const QVariant &value, int \
role) +bool ContactBackend::setData( const QModelIndex& idx, const QVariant &value, \
int role) {
- Q_UNUSED(index)
+ Q_UNUSED(idx)
Q_UNUSED(value)
Q_UNUSED(role)
return false;
}
-QVariant ContactBackend::data( const QModelIndex& index, int role) const
+QVariant ContactBackend::data( const QModelIndex& idx, int role) const
{
- if (!index.isValid())
+ if (!idx.isValid())
return QVariant();
- if (!index.parent().isValid() && (role == Qt::DisplayRole || role == \
Qt::EditRole)) {
- return QVariant(getContactList()[index.row()]->getFormattedName());
+ if (!idx.parent().isValid() && (role == Qt::DisplayRole || role == Qt::EditRole)) \
{ + return QVariant(getContactList()[idx.row()]->getFormattedName());
}
- else if (index.parent().isValid() && (role == Qt::DisplayRole || role == \
Qt::EditRole)) {
- return QVariant(getContactList()[index.parent().row()]->getPhoneNumbers()[index.row()]->getNumber());
+ else if (idx.parent().isValid() && (role == Qt::DisplayRole || role == \
Qt::EditRole)) { + return \
QVariant(getContactList()[idx.parent().row()]->getPhoneNumbers()[idx.row()]->getNumber());
}
return QVariant();
}
@@ -121,51 +121,51 @@ QVariant ContactBackend::headerData(int section, \
Qt::Orientation orientation, in return QVariant();
}
-int ContactBackend::rowCount( const QModelIndex& parent ) const
+int ContactBackend::rowCount( const QModelIndex& par ) const
{
- if (!parent.isValid()) {
+ if (!par.isValid()) {
return getContactList().size();
}
- else if (!parent.parent().isValid() && parent.row() < getContactList().size()) {
- return getContactList()[parent.row()]->getPhoneNumbers().size();
+ else if (!par.parent().isValid() && par.row() < getContactList().size()) {
+ return getContactList()[par.row()]->getPhoneNumbers().size();
}
return 0;
}
-Qt::ItemFlags ContactBackend::flags( const QModelIndex& index ) const
+Qt::ItemFlags ContactBackend::flags( const QModelIndex& idx ) const
{
- if (!index.isValid())
+ if (!idx.isValid())
return 0;
- return Qt::ItemIsEnabled | \
((index.parent().isValid())?Qt::ItemIsSelectable:Qt::ItemIsEnabled); + return \
Qt::ItemIsEnabled | ((idx.parent().isValid())?Qt::ItemIsSelectable:Qt::ItemIsEnabled);
}
-int ContactBackend::columnCount ( const QModelIndex& parent) const
+int ContactBackend::columnCount ( const QModelIndex& par) const
{
- Q_UNUSED(parent)
+ Q_UNUSED(par)
return 1;
}
-QModelIndex ContactBackend::parent( const QModelIndex& index) const
+QModelIndex ContactBackend::parent( const QModelIndex& idx) const
{
- if (!index.isValid())
+ if (!idx.isValid())
return QModelIndex();
- ContactTreeBackend* modelItem = (ContactTreeBackend*)index.internalPointer();
+ ContactTreeBackend* modelItem = (ContactTreeBackend*)idx.internalPointer();
if (modelItem && modelItem->type3() == ContactTreeBackend::Type::NUMBER) {
- int idx = getContactList().indexOf(((Contact::PhoneNumbers*)modelItem)->contact());
- if (idx != -1) {
- return ContactBackend::index(idx,0,QModelIndex());
+ int idx2 = getContactList().indexOf(((Contact::PhoneNumbers*)modelItem)->contact());
+ if (idx2 != -1) {
+ return ContactBackend::index(idx2,0,QModelIndex());
}
}
return QModelIndex();
}
-QModelIndex ContactBackend::index( int row, int column, const QModelIndex& parent) \
const +QModelIndex ContactBackend::index( int row, int column, const QModelIndex& \
par) const {
- if (!parent.isValid() && m_ContactByPhone.size() > row) {
+ if (!par.isValid() && m_ContactByPhone.size() > row) {
return createIndex(row,column,getContactList()[row]);
}
- else if (parent.isValid() && \
getContactList()[parent.row()]->getPhoneNumbers().size() > row) {
- return createIndex(row,column,(ContactTreeBackend*)(&(getContactList()[parent.row()]->getPhoneNumbers())));
+ else if (par.isValid() && getContactList()[par.row()]->getPhoneNumbers().size() \
> row) { + return \
> createIndex(row,column,(ContactTreeBackend*)(&(getContactList()[par.row()]->getPhoneNumbers())));
>
}
return QModelIndex();
}
diff --git a/src/lib/credentialmodel.cpp b/src/lib/credentialmodel.cpp
index 13b7328..fc7eff7 100644
--- a/src/lib/credentialmodel.cpp
+++ b/src/lib/credentialmodel.cpp
@@ -20,25 +20,27 @@
#include <QtCore/QDebug>
///Constructor
-CredentialModel::CredentialModel(QObject* parent) : QAbstractListModel(parent) {
+CredentialModel::CredentialModel(QObject* par) : QAbstractListModel(par) {
}
///Model data
-QVariant CredentialModel::data(const QModelIndex& index, int role) const {
- if (index.column() == 0) {
+QVariant CredentialModel::data(const QModelIndex& idx, int role) const {
+ if (idx.column() == 0) {
switch (role) {
case Qt::DisplayRole:
- return QVariant(m_lCredentials[index.row()]->name);
+ return QVariant(m_lCredentials[idx.row()]->name);
break;
case CredentialModel::NAME_ROLE:
- return m_lCredentials[index.row()]->name;
+ return m_lCredentials[idx.row()]->name;
break;
case CredentialModel::PASSWORD_ROLE:
- return m_lCredentials[index.row()]->password;
+ return m_lCredentials[idx.row()]->password;
break;
case CredentialModel::REALM_ROLE:
- return m_lCredentials[index.row()]->realm;
+ return m_lCredentials[idx.row()]->realm;
+ break;
+ default:
break;
}
}
@@ -46,33 +48,33 @@ QVariant CredentialModel::data(const QModelIndex& index, int \
role) const { }
///Number of credentials
-int CredentialModel::rowCount(const QModelIndex& parent) const {
- Q_UNUSED(parent)
+int CredentialModel::rowCount(const QModelIndex& par) const {
+ Q_UNUSED(par)
return m_lCredentials.size();
}
///Model flags
-Qt::ItemFlags CredentialModel::flags(const QModelIndex& index) const {
- if (index.column() == 0)
- return QAbstractItemModel::flags(index) /*| Qt::ItemIsUserCheckable*/ | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable;
- return QAbstractItemModel::flags(index);
+Qt::ItemFlags CredentialModel::flags(const QModelIndex& idx) const {
+ if (idx.column() == 0)
+ return QAbstractItemModel::flags(idx) /*| Qt::ItemIsUserCheckable*/ | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable; + return QAbstractItemModel::flags(idx);
}
///Set credential data
-bool CredentialModel::setData( const QModelIndex& index, const QVariant &value, int \
role) {
- if (index.column() == 0 && role == CredentialModel::NAME_ROLE) {
- m_lCredentials[index.row()]->name = value.toString();
- emit dataChanged(index, index);
+bool CredentialModel::setData( const QModelIndex& idx, const QVariant &value, int \
role) { + if (idx.column() == 0 && role == CredentialModel::NAME_ROLE) {
+ m_lCredentials[idx.row()]->name = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == CredentialModel::PASSWORD_ROLE) {
- m_lCredentials[index.row()]->password = value.toString();
- emit dataChanged(index, index);
+ else if (idx.column() == 0 && role == CredentialModel::PASSWORD_ROLE) {
+ m_lCredentials[idx.row()]->password = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == CredentialModel::REALM_ROLE) {
- m_lCredentials[index.row()]->realm = value.toString();
- emit dataChanged(index, index);
+ else if (idx.column() == 0 && role == CredentialModel::REALM_ROLE) {
+ m_lCredentials[idx.row()]->realm = value.toString();
+ emit dataChanged(idx, idx);
return true;
}
return false;
@@ -101,8 +103,8 @@ void CredentialModel::removeCredentials(QModelIndex idx) {
///Remove everything
void CredentialModel::clear()
{
- foreach(CredentialData2* data, m_lCredentials) {
- delete data;
+ foreach(CredentialData2* data2, m_lCredentials) {
+ delete data2;
}
m_lCredentials.clear();
}
diff --git a/src/lib/dbus/metatypes.h b/src/lib/dbus/metatypes.h
index 4d69b57..af4f955 100644
--- a/src/lib/dbus/metatypes.h
+++ b/src/lib/dbus/metatypes.h
@@ -33,7 +33,7 @@ typedef QVector< QMap<QString, QString> > VectorMapStringString;
Q_DECLARE_METATYPE(MapStringString)
Q_DECLARE_METATYPE(MapStringInt)
Q_DECLARE_METATYPE(VectorMapStringString)
-Q_DECLARE_METATYPE(VectorInt);
+Q_DECLARE_METATYPE(VectorInt)
static bool dbus_metaTypeInit = false;
inline void registerCommTypes() {
diff --git a/src/lib/historymodel.cpp b/src/lib/historymodel.cpp
index 3553951..2246b7f 100644
--- a/src/lib/historymodel.cpp
+++ b/src/lib/historymodel.cpp
@@ -240,41 +240,44 @@ void HistoryModel::reloadCategories()
emit dataChanged(index(0,0),index(rowCount()-1,0));
}
-bool HistoryModel::setData( const QModelIndex& index, const QVariant &value, int \
role) +bool HistoryModel::setData( const QModelIndex& idx, const QVariant &value, int \
role) {
- if (index.isValid() && index.parent().isValid()) {
- HistoryTreeBackend* modelItem = (HistoryTreeBackend*)index.internalPointer();
+ if (idx.isValid() && idx.parent().isValid()) {
+ HistoryTreeBackend* modelItem = (HistoryTreeBackend*)idx.internalPointer();
if (role == Call::Role::DropState) {
modelItem->setDropState(value.toInt());
- emit dataChanged(index, index);
+ emit dataChanged(idx, idx);
}
}
return false;
}
-QVariant HistoryModel::data( const QModelIndex& index, int role) const
+QVariant HistoryModel::data( const QModelIndex& idx, int role) const
{
- if (!index.isValid())
+ if (!idx.isValid())
return QVariant();
- HistoryTreeBackend* modelItem = (HistoryTreeBackend*)index.internalPointer();
+ HistoryTreeBackend* modelItem = (HistoryTreeBackend*)idx.internalPointer();
switch (modelItem->type3()) {
case HistoryTreeBackend::Type::TOP_LEVEL:
switch (role) {
case Qt::DisplayRole:
return ((TopLevelItem*)modelItem)->m_Name;
+ default:
+ break;
}
break;
case HistoryTreeBackend::Type::CALL:
if (role == Call::Role::DropState)
return QVariant(modelItem->dropState());
- else if (m_lCategoryCounter.size() >= index.parent().row()
- && m_lCategoryCounter[index.parent().row()]
- && m_lCategoryCounter[index.parent().row()]->m_lChilds.size() >= \
index.row())
- return m_lCategoryCounter[index.parent().row()]->m_lChilds[index.row()]->getRoleData((Call::Role)role);
+ else if (m_lCategoryCounter.size() >= idx.parent().row()
+ && m_lCategoryCounter[idx.parent().row()]
+ && m_lCategoryCounter[idx.parent().row()]->m_lChilds.size() >= idx.row())
+ return m_lCategoryCounter[idx.parent().row()]->m_lChilds[idx.row()]->getRoleData((Call::Role)role);
break;
case HistoryTreeBackend::Type::NUMBER:
case HistoryTreeBackend::Type::BOOKMARK:
+ default:
break;
};
return QVariant();
@@ -290,13 +293,13 @@ QVariant HistoryModel::headerData(int section, Qt::Orientation \
orientation, int return QVariant();
}
-int HistoryModel::rowCount( const QModelIndex& parent ) const
+int HistoryModel::rowCount( const QModelIndex& parentIdx ) const
{
- if (!parent.isValid() || !parent.internalPointer()) {
+ if (!parentIdx.isValid() || !parentIdx.internalPointer()) {
return m_lCategoryCounter.size();
}
- else if (!parent.parent().isValid()) {
- return m_lCategoryCounter[parent.row()]->m_lChilds.size();
+ else if (!parentIdx.parent().isValid()) {
+ return m_lCategoryCounter[parentIdx.row()]->m_lChilds.size();
}
// else if (parent.parent().isValid() && !parent.parent().parent().isValid()) {
// return m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->getPhoneNumbers().size();
@@ -304,27 +307,27 @@ int HistoryModel::rowCount( const QModelIndex& parent ) const
return 0;
}
-Qt::ItemFlags HistoryModel::flags( const QModelIndex& index ) const
+Qt::ItemFlags HistoryModel::flags( const QModelIndex& idx ) const
{
- if (!index.isValid())
+ if (!idx.isValid())
return 0;
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | \
(index.parent().isValid()?Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled:Qt::ItemIsEnabled);
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | \
(idx.parent().isValid()?Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled:Qt::ItemIsEnabled);
}
-int HistoryModel::columnCount ( const QModelIndex& parent) const
+int HistoryModel::columnCount ( const QModelIndex& parentIdx) const
{
- Q_UNUSED(parent)
+ Q_UNUSED(parentIdx)
return 1;
}
-QModelIndex HistoryModel::parent( const QModelIndex& index) const
+QModelIndex HistoryModel::parent( const QModelIndex& idx) const
{
- if (!index.isValid() || !index.internalPointer()) {
+ if (!idx.isValid() || !idx.internalPointer()) {
return QModelIndex();
}
- HistoryTreeBackend* modelItem = \
static_cast<HistoryTreeBackend*>(index.internalPointer()); + HistoryTreeBackend* \
modelItem = static_cast<HistoryTreeBackend*>(idx.internalPointer()); if (modelItem \
&& (long long)modelItem > 100 && modelItem->type3() == \
HistoryTreeBackend::Type::CALL) {
- Call* call = (Call*)((HistoryTreeBackend*)(index.internalPointer()))->getSelf();
+ Call* call = \
(Call*)((HistoryTreeBackend*)(idx.internalPointer()))->getSelf(); QString val = \
category(call); if (m_hCategories[val])
return HistoryModel::index(m_lCategoryCounter.indexOf(m_hCategories[val]),0);
@@ -345,13 +348,13 @@ QModelIndex HistoryModel::parent( const QModelIndex& index) \
const return QModelIndex();
}
-QModelIndex HistoryModel::index( int row, int column, const QModelIndex& parent) \
const +QModelIndex HistoryModel::index( int row, int column, const QModelIndex& \
parentIdx) const {
- if (!parent.isValid()) {
+ if (!parentIdx.isValid()) {
return createIndex(row,column,m_lCategoryCounter[row]);
}
- else if (!parent.parent().isValid() && column < \
m_lCategoryCounter[parent.row()]->m_lChilds.size() ) {
- return createIndex(row,column,(void*)dynamic_cast<HistoryTreeBackend*>(m_lCategoryCounter[parent.row()]->m_lChilds[row]));
+ else if (!parentIdx.parent().isValid() && column < \
m_lCategoryCounter[parentIdx.row()]->m_lChilds.size() ) { + return \
createIndex(row,column,(void*)dynamic_cast<HistoryTreeBackend*>(m_lCategoryCounter[parentIdx.row()]->m_lChilds[row]));
}
// else if (parent.parent().isValid()) {
// return createIndex(row,column,(void*)&m_lCategoryCounter[parent.parent().row()]->m_lChilds[parent.row()]->getPhoneNumbers());
@@ -366,28 +369,30 @@ QStringList HistoryModel::mimeTypes() const
QMimeData* HistoryModel::mimeData(const QModelIndexList &indexes) const
{
- QMimeData *mimeData = new QMimeData();
- foreach (const QModelIndex &index, indexes) {
- if (index.isValid()) {
- QString text = data(index, Call::Role::Number).toString();
- mimeData->setData(MIME_PLAIN_TEXT , text.toUtf8());
- mimeData->setData(MIME_PHONENUMBER, text.toUtf8());
- mimeData->setData(MIME_HISTORYID , \
((Call*)index.internalPointer())->getCallId().toUtf8());
- return mimeData;
+ QMimeData *mimeData2 = new QMimeData();
+ foreach (const QModelIndex &idx, indexes) {
+ if (idx.isValid()) {
+ QString text = data(idx, Call::Role::Number).toString();
+ mimeData2->setData(MIME_PLAIN_TEXT , text.toUtf8());
+ mimeData2->setData(MIME_PHONENUMBER, text.toUtf8());
+ mimeData2->setData(MIME_HISTORYID , \
((Call*)idx.internalPointer())->getCallId().toUtf8()); + return mimeData2;
}
}
- return mimeData;
+ return mimeData2;
}
-bool HistoryModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int \
row, int column, const QModelIndex &parent) +bool HistoryModel::dropMimeData(const \
QMimeData *mime, Qt::DropAction action, int row, int column, const QModelIndex \
&parentIdx) {
+ Q_UNUSED(row)
+ Q_UNUSED(column)
// QModelIndex idx = index(row,column,parent);
- qDebug() << "DROPPED" << action << parent.data(Qt::DisplayRole) << \
parent.isValid() << parent.data(Qt::DisplayRole);
- setData(parent,-1,Call::Role::DropState);
- QByteArray encodedCallId = data->data( MIME_CALLID );
- QByteArray encodedPhoneNumber = data->data( MIME_PHONENUMBER );
- QByteArray encodedContact = data->data( MIME_CONTACT );
+ qDebug() << "DROPPED" << action << parentIdx.data(Qt::DisplayRole) << \
parentIdx.isValid() << parentIdx.data(Qt::DisplayRole); + \
setData(parentIdx,-1,Call::Role::DropState); + QByteArray encodedCallId = \
mime->data( MIME_CALLID ); + QByteArray encodedPhoneNumber = mime->data( \
MIME_PHONENUMBER ); + QByteArray encodedContact = mime->data( MIME_CONTACT \
);
// if (data->hasFormat( MIME_CALLID) && !QString(encodedCallId).isEmpty()) {
// qDebug() << "CallId dropped"<< QString(encodedCallId);
@@ -408,57 +413,6 @@ bool HistoryModel::dropMimeData(const QMimeData *data, \
Qt::DropAction action, in return false;
}
-// QVariant HistoryModel::commonCallInfo(Call* call, int role) const
-// {
-// if (!call)
-// return QVariant();
-// QVariant cat;
-// Contact* ct = call->getContact();
-// switch (role) {
-// case Qt::DisplayRole:
-// case Call::Role::Name:
-// cat = ct?ct->getFormattedName():call->getPeerName();
-// break;
-// case Call::Role::Number:
-// cat = call->getPeerPhoneNumber();
-// break;
-// case Call::Role::Direction:
-// cat = call->getHistoryState();
-// break;
-// case Call::Role::Date:
-// cat = call->getStartTimeStamp();
-// break;
-// case Call::Role::Length:
-// cat = call->getLength();
-// break;
-// case Call::Role::FormattedDate:
-// cat = QDateTime::fromTime_t(call->getStartTimeStamp().toUInt()).toString();
-// break;
-// case Call::Role::HasRecording:
-// cat = call->hasRecording();
-// break;
-// case Call::Role::HistoryState:
-// cat = call->getHistoryState();
-// break;
-// case Call::Role::Filter:
-// cat = call->getHistoryState()+'\n'+commonCallInfo(call,Call::Role::Name).toString()+'\n'+commonCallInfo(call,Call::Role::Number).toString();
-// break;
-// case Call::Role::FuzzyDate:
-// cat = timeToHistoryCategory(QDateTime::fromTime_t(call->getStartTimeStamp().toUInt()).date());
-// break;
-// case Call::Role::IsBookmark:
-// cat = false;
-// break;
-// case Call::Role::Object:
-// return QVariant::fromValue(call);
-// break;
-// // case Call::Role::PhotoPtr:
-// // return QVariant::fromValue((void*)(ct?ct->getPhoto():nullptr));
-// // break;
-// }
-// return cat;
-// }
-
QString HistoryModel::category(Call* call) const
{
QString cat = call->getRoleData((Call::Role)m_Role).toString();
diff --git a/src/lib/instantmessagingmodel.cpp b/src/lib/instantmessagingmodel.cpp
index 84e028f..f6d456a 100644
--- a/src/lib/instantmessagingmodel.cpp
+++ b/src/lib/instantmessagingmodel.cpp
@@ -74,24 +74,24 @@ InstantMessagingModel* \
InstantMessagingModelManager::getModel(Call* call) { }
///Constructor
-InstantMessagingModel::InstantMessagingModel(Call* call, QObject* parent) : \
QAbstractListModel(parent),m_pCall(call) \
+InstantMessagingModel::InstantMessagingModel(Call* call, QObject* par) : \
QAbstractListModel(par),m_pCall(call) {
//QStringList callList = callManager.getCallList();
}
///Get data from the model
-QVariant InstantMessagingModel::data( const QModelIndex& index, int role) const
+QVariant InstantMessagingModel::data( const QModelIndex& idx, int role) const
{
- if (index.column() == 0) {
+ if (idx.column() == 0) {
switch (role) {
case Qt::DisplayRole:
- return QVariant(m_lMessages[index.row()].message);
+ return QVariant(m_lMessages[idx.row()].message);
break;
case MESSAGE_TYPE_ROLE:
- return QVariant(m_lMessages[index.row()].message);
+ return QVariant(m_lMessages[idx.row()].message);
break;
case MESSAGE_FROM_ROLE:
- return QVariant(m_lMessages[index.row()].from);
+ return QVariant(m_lMessages[idx.row()].from);
break;
case MESSAGE_TEXT_ROLE:
return INCOMMING_IM;
@@ -102,8 +102,8 @@ QVariant InstantMessagingModel::data( const QModelIndex& index, \
int role) const }
break;
case MESSAGE_IMAGE_ROLE: {
- if (m_lImages.find(index) != m_lImages.end())
- return m_lImages[index];
+ if (m_lImages.find(idx) != m_lImages.end())
+ return m_lImages[idx];
Contact* c =m_pCall->getContact();
if (c && c->getPhoto()) {
return QVariant::fromValue<void*>((void*)c->getPhoto());
@@ -111,33 +111,35 @@ QVariant InstantMessagingModel::data( const QModelIndex& index, \
int role) const return QVariant();
break;
}
+ default:
+ break;
}
}
return QVariant();
}
///Number of row
-int InstantMessagingModel::rowCount(const QModelIndex& parent) const
+int InstantMessagingModel::rowCount(const QModelIndex& parentIdx) const
{
- Q_UNUSED(parent)
+ Q_UNUSED(parentIdx)
return m_lMessages.size();
}
///Model flags
-Qt::ItemFlags InstantMessagingModel::flags(const QModelIndex& index) const
+Qt::ItemFlags InstantMessagingModel::flags(const QModelIndex& idx) const
{
- Q_UNUSED(index)
+ Q_UNUSED(idx)
return Qt::ItemIsEnabled;
}
///Set model data
-bool InstantMessagingModel::setData(const QModelIndex& index, const QVariant &value, \
int role) +bool InstantMessagingModel::setData(const QModelIndex& idx, const QVariant \
&value, int role) {
- Q_UNUSED(index)
+ Q_UNUSED(idx)
Q_UNUSED(value)
Q_UNUSED(role)
- if (index.column() == 0 && role == MESSAGE_IMAGE_ROLE ) {
- m_lImages[index] = value;
+ if (idx.column() == 0 && role == MESSAGE_IMAGE_ROLE ) {
+ m_lImages[idx] = value;
}
return false;
}
diff --git a/src/lib/videocodecmodel.cpp b/src/lib/videocodecmodel.cpp
index aa88b18..e368831 100644
--- a/src/lib/videocodecmodel.cpp
+++ b/src/lib/videocodecmodel.cpp
@@ -21,49 +21,49 @@
#include "video_interface_singleton.h"
///Get data from the model
-QVariant VideoCodecModel::data( const QModelIndex& index, int role) const
+QVariant VideoCodecModel::data( const QModelIndex& idx, int role) const
{
- if(index.column() == 0 && role == Qt::DisplayRole)
- return QVariant(m_lCodecs[index.row()]->getName());
- else if(index.column() == 0 && role == Qt::CheckStateRole) {
- return QVariant(m_lCodecs[index.row()]->getEnabled()?Qt::Checked:Qt::Unchecked);
+ if(idx.column() == 0 && role == Qt::DisplayRole)
+ return QVariant(m_lCodecs[idx.row()]->getName());
+ else if(idx.column() == 0 && role == Qt::CheckStateRole) {
+ return QVariant(m_lCodecs[idx.row()]->getEnabled()?Qt::Checked:Qt::Unchecked);
}
- else if (index.column() == 0 && role == VideoCodecModel::BITRATE_ROLE)
- return QVariant(m_lCodecs[index.row()]->getBitrate());
+ else if (idx.column() == 0 && role == VideoCodecModel::BITRATE_ROLE)
+ return QVariant(m_lCodecs[idx.row()]->getBitrate());
return QVariant();
}
///The number of codec
-int VideoCodecModel::rowCount( const QModelIndex& parent ) const
+int VideoCodecModel::rowCount( const QModelIndex& par ) const
{
- Q_UNUSED(parent)
+ Q_UNUSED(par)
return m_lCodecs.size();
}
///Items flag
-Qt::ItemFlags VideoCodecModel::flags( const QModelIndex& index ) const
+Qt::ItemFlags VideoCodecModel::flags( const QModelIndex& idx ) const
{
- if (index.column() == 0)
- return QAbstractItemModel::flags(index) | Qt::ItemIsUserCheckable | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable;
- return QAbstractItemModel::flags(index);
+ if (idx.column() == 0)
+ return QAbstractItemModel::flags(idx) | Qt::ItemIsUserCheckable | \
Qt::ItemIsEnabled | Qt::ItemIsSelectable; + return QAbstractItemModel::flags(idx);
}
///Set the codec data (codecs can't be added or removed that way)
-bool VideoCodecModel::setData(const QModelIndex& index, const QVariant &value, int \
role) +bool VideoCodecModel::setData(const QModelIndex& idx, const QVariant &value, \
int role) {
- if (index.column() == 0 && role == Qt::CheckStateRole) {
- bool changed = m_lCodecs[index.row()]->getEnabled() != (value == Qt::Checked);
- m_lCodecs[index.row()]->setEnabled(value == Qt::Checked);
+ if (idx.column() == 0 && role == Qt::CheckStateRole) {
+ bool changed = m_lCodecs[idx.row()]->getEnabled() != (value == Qt::Checked);
+ m_lCodecs[idx.row()]->setEnabled(value == Qt::Checked);
if (changed)
- emit dataChanged(index, index);
+ emit dataChanged(idx, idx);
return true;
}
- else if (index.column() == 0 && role == VideoCodecModel::BITRATE_ROLE) {
- bool changed = m_lCodecs[index.row()]->getBitrate() != value.toUInt();
- m_lCodecs[index.row()]->setBitrate(value.toInt());
+ else if (idx.column() == 0 && role == VideoCodecModel::BITRATE_ROLE) {
+ bool changed = m_lCodecs[idx.row()]->getBitrate() != value.toUInt();
+ m_lCodecs[idx.row()]->setBitrate(value.toInt());
if (changed)
- emit dataChanged(index, index);
+ emit dataChanged(idx, idx);
return true;
}
return false;
@@ -107,9 +107,9 @@ void VideoCodecModel::save()
bool VideoCodecModel::moveUp(QModelIndex idx)
{
if(idx.row() > 0 && idx.row() <= rowCount()) {
- VideoCodec* data = m_lCodecs[idx.row()];
+ VideoCodec* data2 = m_lCodecs[idx.row()];
m_lCodecs.removeAt(idx.row());
- m_lCodecs.insert(idx.row() - 1, data);
+ m_lCodecs.insert(idx.row() - 1, data2);
emit dataChanged(index(idx.row() - 1, 0, QModelIndex()), index(idx.row(), 0, \
QModelIndex())); return true;
}
@@ -120,9 +120,9 @@ bool VideoCodecModel::moveUp(QModelIndex idx)
bool VideoCodecModel::moveDown(QModelIndex idx)
{
if(idx.row() >= 0 && idx.row() < rowCount()) {
- VideoCodec* data = m_lCodecs[idx.row()];
+ VideoCodec* data2 = m_lCodecs[idx.row()];
m_lCodecs.removeAt(idx.row());
- m_lCodecs.insert(idx.row() + 1, data);
+ m_lCodecs.insert(idx.row() + 1, data2);
emit dataChanged(index(idx.row(), 0, QModelIndex()), index(idx.row() + 1, 0, \
QModelIndex())); return true;
}
diff --git a/src/lib/videorenderer.cpp b/src/lib/videorenderer.cpp
index 4a9a6e1..9363189 100644
--- a/src/lib/videorenderer.cpp
+++ b/src/lib/videorenderer.cpp
@@ -44,7 +44,7 @@ struct SHMHeader {
unsigned m_BufferGen;
int m_BufferSize;
- char m_Data[0];
+ char *m_Data;
};
///Constructor
diff --git a/src/main.cpp b/src/main.cpp
index b9ca692..c4ef048 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -41,6 +41,7 @@ static const char description[] = "A KDE 4 Client for SFLphone";
static const char version[] = "1.2.2";
SFLPhoneApplication* app;
+void quitOnSignal(int signal);
void quitOnSignal(int signal)
{
Q_UNUSED(signal);
diff --git a/src/sflphoneview.cpp b/src/sflphoneview.cpp
index bc514c6..ce204c8 100644
--- a/src/sflphoneview.cpp
+++ b/src/sflphoneview.cpp
@@ -662,7 +662,7 @@ void SFLPhoneView::updateWindowCallState()
TipCollection::manager()->hideTip(TipCollection::dragAndDrop());
}
break;
-
+ case Call::State::COUNT:
default:
kDebug() << "Error : Reached unexisting state for call " << \
call->getCallId() << "(" << call->getState() << "!"; break;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic