From 0046568cffeaa58758f7767921cdac5de108f5f5 Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Wed, 25 Feb 2015 19:00:02 +0000
Subject: [PATCH] Enable Q_DECLARE_METATYPE on some "enum class" types

Refs #66615
---
 src/call.cpp                               | 8 ++++----
 src/call.h                                 | 4 ++++
 src/delegates/pixmapmanipulationdelegate.h | 2 +-
 src/historytimecategorymodel.h             | 2 ++
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/call.cpp b/src/call.cpp
index 6ab460dc..b763b819 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -1637,7 +1637,7 @@ QVariant Call::roleData(int role) const
          return peerContactMethod()->uri();
          break;
       case Call::Role::Direction2:
-         return static_cast<int>(d_ptr->m_Direction); //TODO Qt5, use the Q_ENUM
+         return QVariant::fromValue(d_ptr->m_Direction);
          break;
       case Call::Role::Date:
          return (int)startTimeStamp();
@@ -1652,7 +1652,7 @@ QVariant Call::roleData(int role) const
          return hasRecording();
          break;
       case Call::Role::Historystate:
-         return static_cast<int>(historyState());
+         return QVariant::fromValue(historyState());
          break;
       case Call::Role::Filter: {
          QString normStripppedC;
@@ -1665,7 +1665,7 @@ QVariant Call::roleData(int role) const
          }
          break;
       case Call::Role::FuzzyDate:
-         return (int)d_ptr->m_HistoryConst; //TODO Qt5, use the Q_ENUM
+         return QVariant::fromValue(d_ptr->m_HistoryConst);
          break;
       case Call::Role::IsBookmark:
          return false;
@@ -1692,7 +1692,7 @@ QVariant Call::roleData(int role) const
          return ct?ct->photo():QVariant();
          break;
       case Call::Role::CallState:
-         return static_cast<int>(state()); //TODO Qt5, use the Q_ENUM
+         return QVariant::fromValue(state());
          break;
       case Call::Role::Id:
          return id();
diff --git a/src/call.h b/src/call.h
index 4f54122c..1584ba36 100644
--- a/src/call.h
+++ b/src/call.h
@@ -148,6 +148,7 @@ public:
       MISSED  , /*!< The call has been missed */
       NONE      /*!< The legacy state is not set */
    };
+   Q_ENUMS(LegacyHistoryState)
 
    ///@enum Direction If the user have been called or have called
    enum class Direction : int {
@@ -349,6 +350,9 @@ Q_SIGNALS:
 };
 
 Q_DECLARE_METATYPE(Call*)
+Q_DECLARE_METATYPE(Call::State)
+Q_DECLARE_METATYPE(Call::Direction)
+Q_DECLARE_METATYPE(Call::LegacyHistoryState)
 
 QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::State& c       );
 QDebug LIB_EXPORT operator<<(QDebug dbg, const Call::DaemonState& c );
diff --git a/src/delegates/pixmapmanipulationdelegate.h b/src/delegates/pixmapmanipulationdelegate.h
index af14e8f4..cc2b353c 100644
--- a/src/delegates/pixmapmanipulationdelegate.h
+++ b/src/delegates/pixmapmanipulationdelegate.h
@@ -17,7 +17,7 @@
  ***************************************************************************/
 #ifndef PIXMAPMANIPULATIONVISITOR_H
 #define PIXMAPMANIPULATIONVISITOR_H
-#include "../typedefs.h"
+#include <typedefs.h>
 
 //Qt
 #include <QtCore/QVariant>
diff --git a/src/historytimecategorymodel.h b/src/historytimecategorymodel.h
index 22d0ee9b..8ab20526 100644
--- a/src/historytimecategorymodel.h
+++ b/src/historytimecategorymodel.h
@@ -84,5 +84,7 @@ private:
    HistoryTimeCategoryModelPrivate* d_ptr;
    Q_DECLARE_PRIVATE(HistoryTimeCategoryModel)
 };
+Q_DECLARE_METATYPE(HistoryTimeCategoryModel::HistoryConst)
+Q_DECLARE_METATYPE(HistoryTimeCategoryModel*)
 
 #endif
-- 
GitLab