diff --git a/kde/src/CMakeLists.txt b/kde/src/CMakeLists.txt
index 3501aa3825b1ccf111176f462f758a893ec94a09..2e1af6b3ffe31a053534b0fa9c4ec1d7442f7a49 100755
--- a/kde/src/CMakeLists.txt
+++ b/kde/src/CMakeLists.txt
@@ -42,7 +42,6 @@ SET(
    conf/dlgaudio.cpp
    conf/dlgaddressbook.cpp
    conf/dlghooks.cpp
-   conf/ConfigurationSkeleton.cpp
    conf/ConfigAccountList.cpp
    widgets/Dialpad.cpp
    widgets/ContactItemWidget.cpp
@@ -52,7 +51,6 @@ SET(
    widgets/TranslucentButtons.cpp
    widgets/CategoryDrawer.cpp
    widgets/CategorizedTreeWidget.cpp
-   widgets/SortableDockCommon.cpp
    Codec.cpp
    AccountListModel.cpp
    CallView.cpp
@@ -79,8 +77,6 @@ SET(
 
 KDE4_ADD_UI_FILES(sflphone_client_kde_SRCS ui/SFLPhoneView_base.ui  ${config_ui_files}  )
 
-KDE4_ADD_KCFG_FILES(sflphone_client_kde_SRCS conf/kcfg_settings.kcfgc)
-INSTALL(FILES conf/sflphone-client-kde.kcfg DESTINATION ${KCFG_INSTALL_DIR})
 
 KDE4_ADD_EXECUTABLE(sflphone-client-kde ${sflphone_client_kde_SRCS} ${QtApp_RCC_SRCS})
 
diff --git a/kde/src/SFLPhone.cpp b/kde/src/SFLPhone.cpp
index 24c246b725d46eedc07c1b977dd01d757bebe4e5..adaf9693d80bc6f7308443a796fb89b855f78ddb 100755
--- a/kde/src/SFLPhone.cpp
+++ b/kde/src/SFLPhone.cpp
@@ -54,7 +54,7 @@
 #include "widgets/ContactDock.h"
 #include "widgets/HistoryDock.h"
 #include "widgets/BookmarkDock.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 
 SFLPhone* SFLPhone::m_sApp = NULL;
 TreeWidgetCallModel* SFLPhone::m_pModel = NULL;
diff --git a/kde/src/SFLPhoneView.cpp b/kde/src/SFLPhoneView.cpp
index 1eabaacf8fbfc4b50d1a687f782e3829ac55de21..d6c7475e6d093ad908593e4be1668fb35fe81239 100755
--- a/kde/src/SFLPhoneView.cpp
+++ b/kde/src/SFLPhoneView.cpp
@@ -38,7 +38,7 @@
 
 //SFLPhone
 #include "conf/ConfigurationDialog.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "AccountWizard.h"
 #include "ActionSetAccountFirst.h"
 #include "SFLPhone.h"
diff --git a/kde/src/conf/ConfigurationDialog.cpp b/kde/src/conf/ConfigurationDialog.cpp
index 0cc5f16e3a7ec4149c7054088f45e185a972a21b..3c65966eb867514b2f7efb54daf7407131432e76 100755
--- a/kde/src/conf/ConfigurationDialog.cpp
+++ b/kde/src/conf/ConfigurationDialog.cpp
@@ -24,7 +24,7 @@
 #include <KDebug>
 
 
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 
 #include "dlggeneral.h"
 #include "dlgdisplay.h"
diff --git a/kde/src/conf/ConfigurationDialog.h b/kde/src/conf/ConfigurationDialog.h
index 06bc43c9ae9c398982f6116a9047ff38849fe644..4669efc65408ea650499eb6dda19a9d29ce70cb9 100755
--- a/kde/src/conf/ConfigurationDialog.h
+++ b/kde/src/conf/ConfigurationDialog.h
@@ -24,7 +24,7 @@
 #include <kconfigdialog.h>
 
 
-#include "kcfg_settings.h"
+#include "klib/kcfg_settings.h"
 #include "SFLPhoneView.h"
 
 
diff --git a/kde/src/conf/dlgaddressbook.cpp b/kde/src/conf/dlgaddressbook.cpp
index 8145b7cc337d9be0f68920a3159923f4fbb26d94..f568fa645203908c14e5910f201ebfef0b3ba5d1 100755
--- a/kde/src/conf/dlgaddressbook.cpp
+++ b/kde/src/conf/dlgaddressbook.cpp
@@ -20,7 +20,7 @@
  ***************************************************************************/
 #include "dlgaddressbook.h"
 
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 
 DlgAddressBook::DlgAddressBook(QWidget *parent)
  : QWidget(parent)
diff --git a/kde/src/conf/dlgaudio.cpp b/kde/src/conf/dlgaudio.cpp
index 1366b5457d58858d5055528a4ce9ace00f37e8ab..95a77beb2d5cd860da3b144f41cce17ff382af7c 100755
--- a/kde/src/conf/dlgaudio.cpp
+++ b/kde/src/conf/dlgaudio.cpp
@@ -22,7 +22,7 @@
 
 #include <KLineEdit>
 #include "lib/configurationmanager_interface_singleton.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "conf/ConfigurationDialog.h"
 #include <QtGui/QHeaderView>
 #include <KStandardDirs>
diff --git a/kde/src/conf/dlgaudio.h b/kde/src/conf/dlgaudio.h
index 5b9a9885e3f41c5ed6539c38c011761e65b0d774..c3d7fa7e326beabcf5403b5d5c8978fc6de074ed 100755
--- a/kde/src/conf/dlgaudio.h
+++ b/kde/src/conf/dlgaudio.h
@@ -25,7 +25,7 @@
 #include <kconfigdialog.h>
 
 #include "ui_dlgaudiobase.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 
 /**
    @author Jérémy Quentin <jeremy.quentin@gmail.com>
diff --git a/kde/src/conf/dlggeneral.cpp b/kde/src/conf/dlggeneral.cpp
index ea7f3a6a811784ee1480a4466d83cd1e79ade071..3424327b6c31b004a7b8becad403eb9979221b44 100755
--- a/kde/src/conf/dlggeneral.cpp
+++ b/kde/src/conf/dlggeneral.cpp
@@ -22,7 +22,7 @@
 #include <QToolButton>
 #include <QAction>
 
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "conf/ConfigurationDialog.h"
 
 DlgGeneral::DlgGeneral(QWidget *parent)
diff --git a/kde/src/klib/AkonadiBackend.cpp b/kde/src/klib/AkonadiBackend.cpp
index 04700f27e486c4e598f77426608039d19a5d977c..f47c793f6d494feee856dbd428ebc1e65c44ffed 100644
--- a/kde/src/klib/AkonadiBackend.cpp
+++ b/kde/src/klib/AkonadiBackend.cpp
@@ -53,7 +53,7 @@
 
 ///Init static attributes
 AkonadiBackend*  AkonadiBackend::m_pInstance = 0;
-CallModel<>*     AkonadiBackend::m_pModel = 0;
+CallModel<>*     AkonadiBackend::m_pModel    = 0;
 
 ///Constructor
 AkonadiBackend::AkonadiBackend(QObject* parent) : ContactBackend(parent)
@@ -127,10 +127,9 @@ Contact* AkonadiBackend::getContactByUid(const QString& uid)
 ContactList AkonadiBackend::update(Akonadi::Collection collection)
 {
    m_Collection = collection;
-   ContactList contacts;
    if ( !collection.isValid() ) {
       kDebug() << "The current collection is not valid";
-      return contacts;
+      return ContactList();
    }
 
    Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob( collection, QStringList() << KABC::Addressee::mimeType() << KABC::ContactGroup::mimeType());
@@ -171,12 +170,11 @@ ContactList AkonadiBackend::update(Akonadi::Collection collection)
                aContact->setPhoto(new QPixmap(QPixmap::fromImage( tmp.photo().data()).scaled(QSize(48,48))));
             else
                aContact->setPhoto(0);
-            contacts << aContact;
          }
       }
       m_pContacts = m_ContactByUid.values();
    }
-   return contacts;
+   return m_ContactByUid.values();
 }
 
 ///Edit backend value using an updated frontend contact
diff --git a/kde/src/klib/AkonadiBackend.h b/kde/src/klib/AkonadiBackend.h
index 180a5b6a5ab99811efcff5580995dbf728cf9bd2..e2d9a57c2204a1b2d544b20bf9952bb0cd42f55f 100644
--- a/kde/src/klib/AkonadiBackend.h
+++ b/kde/src/klib/AkonadiBackend.h
@@ -43,8 +43,6 @@ namespace Akonadi {
 //SFLPhone
 class Contact;
 
-typedef QList<Contact*> ContactList;
-
 ///@class AkonadiBackend Implement a backend for Akonadi
 class LIB_EXPORT AkonadiBackend : public ContactBackend {
    Q_OBJECT
diff --git a/kde/src/klib/CMakeLists.txt b/kde/src/klib/CMakeLists.txt
index 84e63ee843222be901bec721d2430346e7088a8a..ac2581263fb133df34b900ee27bd2db3b9dadb98 100644
--- a/kde/src/klib/CMakeLists.txt
+++ b/kde/src/klib/CMakeLists.txt
@@ -11,6 +11,7 @@ PROJECT(ksflphone)
 
 SET ( KDE4_KABC_LIBS  -lkabc )
 
+
 add_subdirectory(dataengine)
 
 SET(LOCAL_CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
@@ -27,8 +28,13 @@ INCLUDE_DIRECTORIES ( ${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
 
 #File to compile
 set( ksflphone_LIB_SRCS
+   HelperFunctions.cpp
    AkonadiBackend.cpp
+   SortableDockCommon.cpp
+   ConfigurationSkeleton.cpp
 )
+
+KDE4_ADD_KCFG_FILES(ksflphone_LIB_SRCS kcfg_settings.kcfgc)
  
 kde4_add_library( ksflphone  SHARED ${ksflphone_LIB_SRCS} )
  
@@ -47,8 +53,12 @@ set_target_properties( ksflphone
 
 set( ksflphone_LIB_HDRS
   AkonadiBackend.h
+  HelperFunctions.h
+  SortableDockCommon.h
 )
 
+INSTALL(FILES sflphone-client-kde.kcfg DESTINATION ${KCFG_INSTALL_DIR})
+
 install( FILES ${ksflphone_LIB_HDRS}
   DESTINATION ${INCLUDE_INSTALL_DIR}/ksflphone
   COMPONENT Devel
diff --git a/kde/src/conf/ConfigurationSkeleton.cpp b/kde/src/klib/ConfigurationSkeleton.cpp
similarity index 99%
rename from kde/src/conf/ConfigurationSkeleton.cpp
rename to kde/src/klib/ConfigurationSkeleton.cpp
index 2efa9721a8c9b73c71e6a4f865c3be18729045aa..c7d07ef85067a9293f81c62b43ca0c3f5e02b2ae 100755
--- a/kde/src/conf/ConfigurationSkeleton.cpp
+++ b/kde/src/klib/ConfigurationSkeleton.cpp
@@ -20,8 +20,8 @@
  ***************************************************************************/
 #include "ConfigurationSkeleton.h"
 
-#include "lib/configurationmanager_interface_singleton.h"
-#include "lib/sflphone_const.h"
+#include "../lib/configurationmanager_interface_singleton.h"
+#include "../lib/sflphone_const.h"
 
 //KDE
 #include <KDebug>
diff --git a/kde/src/conf/ConfigurationSkeleton.h b/kde/src/klib/ConfigurationSkeleton.h
similarity index 95%
rename from kde/src/conf/ConfigurationSkeleton.h
rename to kde/src/klib/ConfigurationSkeleton.h
index cd99acd48a1770c1f31181f2677f399355c01fd2..389535463c510deb5b91dc2fc250888d917522a8 100755
--- a/kde/src/conf/ConfigurationSkeleton.h
+++ b/kde/src/klib/ConfigurationSkeleton.h
@@ -22,10 +22,10 @@
 #define CONFIGURATIONSKELETON_H
 
 #include <QWidget>
+#include "../lib/typedefs.h"
 
-#include "kcfg_settings.h"
+#include "src/klib/kcfg_settings.h"
 //#include "CodecListModel.h"
-#include "AccountListModel.h"
 
 /**
    @author Jérémy Quentin <jeremy.quentin@gmail.com>
@@ -38,7 +38,7 @@
    This class reimplements the writeConfig and readConfig functions to ask the
    daemon instead of the normal behavior (read and write in a kconfig file).
 */
-class ConfigurationSkeleton : public ConfigurationSkeletonBase
+class LIB_EXPORT ConfigurationSkeleton : public ConfigurationSkeletonBase
 {
 Q_OBJECT
 
diff --git a/kde/src/klib/HelperFunctions.cpp b/kde/src/klib/HelperFunctions.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c94a1eda75568325c6d4a5d05a8f76703b686bef
--- /dev/null
+++ b/kde/src/klib/HelperFunctions.cpp
@@ -0,0 +1,16 @@
+#include "HelperFunctions.h"
+
+//Qt
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+
+//SFLPhone
+#include "../lib/Contact.h"
+
+ContactHash HelperFunctions::toHash(QList<Contact*> contacts) {
+   QHash<QString,QHash<QString,QVariant> > hash;
+   for (int i=0;i<contacts.size();i++) {
+      hash[contacts[i]->getUid()] = contacts[i]->toHash();
+   }
+   return hash;
+}
\ No newline at end of file
diff --git a/kde/src/klib/HelperFunctions.h b/kde/src/klib/HelperFunctions.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ff2dff4475067edc853f149b15ef4d33ba3e34f
--- /dev/null
+++ b/kde/src/klib/HelperFunctions.h
@@ -0,0 +1,22 @@
+#ifndef HELPER_FUNCTIONS
+#define HELPER_FUNCTIONS
+
+//Qt
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <QtCore/QHash>
+#include <QtCore/QList>
+
+//SFLPhone
+#include "../lib/Contact.h"
+
+//Typedef
+typedef QHash<QString,QHash<QString,QVariant> > ContactHash;
+
+///@class HelperFunctions little visitor not belonging to libqtsflphone
+///Ramdom mix of dynamic property and transtypping
+class LIB_EXPORT HelperFunctions {
+public:
+   static ContactHash toHash(QList<Contact*> contacts);
+};
+#endif
\ No newline at end of file
diff --git a/kde/src/klib/SortableDockCommon.cpp b/kde/src/klib/SortableDockCommon.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fc33fd17ae5298456ade30a8c7ee9475def89454
--- /dev/null
+++ b/kde/src/klib/SortableDockCommon.cpp
@@ -0,0 +1,53 @@
+#include "SortableDockCommon.h"
+
+//Qt
+#include <QtCore/QDateTime>
+#include <QtCore/QStringList>
+#include <QtCore/QTimer>
+
+//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"),//2
+      QDate::currentDate().addDays(-3).toString("dddd"),//3
+      QDate::currentDate().addDays(-4).toString("dddd"),//4
+      QDate::currentDate().addDays(-5).toString("dddd"),//5
+      QDate::currentDate().addDays(-6).toString("dddd"),//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/kde/src/widgets/SortableDockCommon.h b/kde/src/klib/SortableDockCommon.h
similarity index 52%
rename from kde/src/widgets/SortableDockCommon.h
rename to kde/src/klib/SortableDockCommon.h
index 04ad4ac3d519528f529a6351f9a9962e1b4e8bcd..7e873d7787a313d00e5a0d26722f9d003d428620 100644
--- a/kde/src/widgets/SortableDockCommon.h
+++ b/kde/src/klib/SortableDockCommon.h
@@ -1,8 +1,12 @@
 #ifndef SORTABLE_DOCK_COMMON
 #define SORTABLE_DOCK_COMMON
 
-#include <QObject>
-#include <QHash>
+#include <QtCore/QObject>
+#include <QtCore/QHash>
+#include <QtCore/QModelIndex>
+#include <QtGui/QWidget>
+
+#include "HelperFunctions.h"
 
 //Qt
 class QString;
@@ -13,16 +17,41 @@ class QDateTime;
 //SFLPhone
 class StaticEventHandler;
 class Contact;
+class Call;
+
+///@enum ContactSortingMode Available sorting mode
+enum ContactSortingMode {
+   Name              ,
+   Organisation      ,
+   Recently_used     ,
+   Group             ,
+   Department
+};
+
+///@enum HistorySortingMode
+enum HistorySortingMode {
+   Date       = 0,
+   Name2      = 1,
+   Popularity = 2,
+   Length   = 3
+};
 
-class SortableDockCommon {
+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(){};
+      SortableDockCommon();
       //Helpers
-      static QString timeToHistoryCategory(QDate date);
-      static QHash<Contact*, QDateTime> getContactListByTime(/*ContactList list*/);
+      static QString                    timeToHistoryCategory ( QDate date                                         );
+      static QHash<Contact*, QDateTime> getContactListByTime  ( /*ContactList list*/                               );
 
       //Attributes
       static QStringList         m_slHistoryConst;
@@ -62,14 +91,18 @@ class SortableDockCommon {
 
 
 ///@class StaticEventHandler "cron jobs" for static member;
-class StaticEventHandler : public QObject
+class LIB_EXPORT StaticEventHandler : public QObject
 {
    Q_OBJECT
    public:
-      StaticEventHandler(QObject* parent);
+      StaticEventHandler(QObject* parent, QStringList* list);
 
-   private slots:
+   public slots:
       void update();
+   private:
+      QStringList* m_pList;
 };
 
+#include "SortableDockCommon.hpp"
+
 #endif
\ No newline at end of file
diff --git a/kde/src/klib/SortableDockCommon.hpp b/kde/src/klib/SortableDockCommon.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..213752e004640d78cac3cf4b296eed16dbda68b3
--- /dev/null
+++ b/kde/src/klib/SortableDockCommon.hpp
@@ -0,0 +1,211 @@
+//Qt
+#include <QtCore/QDateTime>
+#include <QtCore/QStringList>
+#include <QtCore/QTimer>
+
+//SFLPhone
+#include "../lib/Call.h"
+#include "../lib/Contact.h"
+#include "../lib/CallModel.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));
+
+CALLMODEL_TEMPLATE SORTABLE_T::SortableDockCommon()
+{
+   /*if (not m_spEvHandler) {
+      m_spEvHandler = new StaticEventHandler(0,&(SORTABLE_T::m_slHistoryConst));
+   }*/
+}
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                                  Helpers                                  *
+ *                                                                           *
+ ****************************************************************************/
+
+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 m_slHistoryConst[HistoryConst::Today];
+
+   //Check for last week
+   for (int i=1;i<7;i++) {
+      if (QDate::currentDate().addDays(-i)  == date)
+         return m_slHistoryConst[i]; //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 m_slHistoryConst[i+Last_week-1]; //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 m_slHistoryConst[i+Last_month-1]; //Last_month to Twelve_months ago
+   }
+
+   if (QDate::currentDate().addYears(-1)  >= date && QDate::currentDate().addYears(-2)  < date)
+      return m_slHistoryConst[Last_year];
+
+   //Every other senario
+   return m_slHistoryConst[Very_long_time_ago];
+}
+
+///Return the list of contact from history (in order, most recently used first)
+CALLMODEL_TEMPLATE QHash<Contact*, QDateTime> SORTABLE_T::getContactListByTime(/*ContactList list*/)
+{
+   const CallMap& history= CallModel<CallWidget,Index>::getHistory();
+   QHash<Contact*, QDateTime> toReturn;
+   QSet<QString> alreadyUsed;
+   QMapIterator<QString, Call*> i(history);
+   i.toBack();
+   while (i.hasPrevious()) { //Iterate from the end up
+      i.previous();
+      (alreadyUsed.find(i.value()->getPeerPhoneNumber()) == alreadyUsed.constEnd()); //Don't ask, leave it there Elv13(2012)
+      if (alreadyUsed.find(i.value()->getPeerPhoneNumber()) == alreadyUsed.constEnd()) {
+         Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(i.value()->getPeerPhoneNumber(),true);
+         if (contact && toReturn.find(contact) == toReturn.end()) {
+            toReturn[contact] = QDateTime::fromTime_t(i.value()->getStartTimeStamp().toUInt());
+         }
+         alreadyUsed << i.value()->getPeerPhoneNumber();
+      }
+   }
+   return toReturn;
+}
+
+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 (QString cat, m_slHistoryConst) {
+            byDate[cat] = 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 = "TODO";
+            break;
+         default:
+            break;
+      }
+      call->setProperty("section",category);
+   }
+   switch (mode) {
+      case HistorySortingMode::Date:
+         calls.clear();
+         foreach (QString cat, m_slHistoryConst) {
+            foreach (Call* call, byDate[cat]) {
+               calls << call;
+            }
+         }
+         break;
+      default:
+         break;
+   }
+}
+
+CALLMODEL_TEMPLATE void SORTABLE_T::setContactCategory(QList<Contact*> contacts,ContactSortingMode mode)
+{
+   QHash<Contact*, QDateTime> recentlyUsed;
+   switch (mode) {
+      case ContactSortingMode::Recently_used:
+         recentlyUsed = getContactListByTime();
+         foreach (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()[0]);
+               break;
+            case ContactSortingMode::Organisation:
+               category = (cont->getOrganization().isEmpty())?"Unknow":cont->getOrganization();
+               break;
+            case ContactSortingMode::Recently_used:
+               if (recentlyUsed.find(cont) != recentlyUsed.end())
+                  category = timeToHistoryCategory(recentlyUsed[cont].date());
+               else
+                  category = m_slHistoryConst[Never];
+               break;
+            case ContactSortingMode::Group:
+               category = "TODO";
+               break;
+            case ContactSortingMode::Department:
+               category = (cont->getDepartment().isEmpty())?"Unknow":cont->getDepartment();;
+               break;
+            default:
+               break;
+         }
+      }
+   }
+}
+
+///Return the identity of the call caller, try to return something usefull
+CALLMODEL_TEMPLATE QString SORTABLE_T::getIdentity(Call* item)
+{
+   Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(item->getPeerPhoneNumber());
+   if (contact)
+      return contact->getFormattedName();
+   else if (!item->getPeerName().isEmpty())
+      return item->getPeerName();
+   else
+      return item->getPeerPhoneNumber();
+}
+
+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;
+   }
+   return result;
+}
diff --git a/kde/src/klib/dataengine/CMakeLists.txt b/kde/src/klib/dataengine/CMakeLists.txt
index 5dacb41fed29a63ed0ce3c54eb576fac844b10ea..94632a980d0533e4e9244ed7cea09d4b262dfb20 100644
--- a/kde/src/klib/dataengine/CMakeLists.txt
+++ b/kde/src/klib/dataengine/CMakeLists.txt
@@ -22,7 +22,10 @@ target_link_libraries(plasma_engine_sflphone
                       qtsflphone
                       ksflphone
                       ${KDE4_KDECORE_LIBS}
-                      ${KDE4_PLASMA_LIBS})
+                      ${KDE4_PLASMA_LIBS}
+                      ${KDEPIMLIBS_AKONADI_KMIME_LIBS}
+                      ${KDEPIMLIBS_AKONADI_LIBS}
+                      ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} )
 
 install(TARGETS plasma_engine_sflphone
         DESTINATION ${PLUGIN_INSTALL_DIR})
@@ -33,4 +36,3 @@ install(FILES plasma-engine-sflphone.desktop
 install(FILES sflphone.operations
         DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
 
-#TARGET_LINK_LIBRARIES(sflphone-client-kde sflphonekde ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KABC_LIBS})
diff --git a/kde/src/klib/dataengine/sflphonEngine.cpp b/kde/src/klib/dataengine/sflphonEngine.cpp
index 4837ef82d05c14230a705cdb1a32f66b825322a1..ee22c1e9ae28f00123fea74f437fe2e5c1f46208 100644
--- a/kde/src/klib/dataengine/sflphonEngine.cpp
+++ b/kde/src/klib/dataengine/sflphonEngine.cpp
@@ -10,7 +10,9 @@
 #include "../../lib/configurationmanager_interface_singleton.h"
 #include "../../lib/callmanager_interface_singleton.h"
 #include "../../lib/sflphone_const.h"
-#include "sflphoneService.h"
+#include "../../klib/AkonadiBackend.h"
+#include "../../klib/HelperFunctions.h"
+#include "sflphoneService.h">
 
 CallModel<>* SFLPhoneEngine::m_pModel = NULL;
 
@@ -24,12 +26,15 @@ SFLPhoneEngine::SFLPhoneEngine(QObject* parent, const QVariantList& args)
       m_pModel->initHistory();
    }
 
-   CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
+   //CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
 
-   connect(m_pModel              , SIGNAL( callStateChanged(Call*))  , this , SLOT(callStateChangedSignal(Call*)  ));
-   connect(&callManager          , SIGNAL( incomingCall(Call*))      , this , SLOT(incomingCallSignal(Call*)      ));
-   connect(&callManager          , SIGNAL( conferenceCreated(Call*)) , this , SLOT(conferenceCreatedSignal(Call*) ));
-   connect(&callManager          , SIGNAL( conferenceChanged(Call*)) , this , SLOT(conferenceChangedSignal(Call*) ));
+   connect(m_pModel                     , SIGNAL( callStateChanged(Call*))  , this , SLOT(callStateChangedSignal(Call*)  ));
+   //connect(&callManager                 , SIGNAL( incomingCall(Call*))      , this , SLOT(incomingCallSignal(Call*)      ));
+   //connect(&callManager                 , SIGNAL( conferenceCreated(Call*)) , this , SLOT(conferenceCreatedSignal(Call*) ));
+   //connect(&callManager                 , SIGNAL( conferenceChanged(Call*)) , this , SLOT(conferenceChangedSignal(Call*) ));
+   connect(AkonadiBackend::getInstance(), SIGNAL( collectionChanged())      , this , SLOT(updateCollection()             ));
+   
+   //updateContacts();
 }
 
 bool SFLPhoneEngine::sourceRequestEvent(const QString &name)
@@ -49,6 +54,9 @@ bool SFLPhoneEngine::sourceRequestEvent(const QString &name)
    else if ( name == "accounts"    ) {
       updateAccounts();
    }
+   else if ( name == "contacts"    ) {
+      updateContacts();
+   }
    return true;//updateSourceEvent(name);
 }
 
@@ -60,15 +68,15 @@ bool SFLPhoneEngine::updateSourceEvent(const QString &name)
 
 QStringList SFLPhoneEngine::sources() const {
    QStringList toReturn;
-   toReturn << "calls" << "history" << "conferences" << "info" << "accounts";
+   toReturn << "calls" << "history" << "conferences" << "info" << "accounts" << "contacts";
    return toReturn;
 }
 
 Plasma::Service* SFLPhoneEngine::serviceForSource(const QString &source)
 {
-    /*if (source != "calls") {
+    if (source != "calls") {
         return 0;
-    }*/
+    }
 
     SFLPhoneService *service = new SFLPhoneService(this);
     service->setParent(this);
@@ -105,11 +113,18 @@ QString SFLPhoneEngine::getCallStateName(call_state state)
 
 void SFLPhoneEngine::updateHistory()
 {
-   foreach (Call* oldCall, m_pModel->getHistory()) {
-      historyCall[oldCall->getCallId()][ "Name"   ] = oldCall->getPeerName();
-      historyCall[oldCall->getCallId()][ "Number" ] = oldCall->getPeerPhoneNumber();
-      historyCall[oldCall->getCallId()][ "Date"   ] = oldCall->getStopTimeStamp();
-      setData("history", I18N_NOOP(oldCall->getCallId()), historyCall[oldCall->getCallId()]);
+   CallList list = m_pModel->getHistory().values();
+   setHistoryCategory(list,HistorySortingMode::Date);
+
+   foreach (Call* oldCall, list) {
+      qDebug() << oldCall->getStopTimeStamp();
+      historyCall[oldCall->getCallId()][ "peerName"   ] = oldCall->getPeerName();
+      historyCall[oldCall->getCallId()][ "peerNumber" ] = oldCall->getPeerPhoneNumber();
+      historyCall[oldCall->getCallId()][ "length"     ] = oldCall->getStopTimeStamp().toInt() - oldCall->getStartTimeStamp().toInt();
+      historyCall[oldCall->getCallId()][ "date"       ] = oldCall->getStopTimeStamp();
+      if (oldCall->property("section").isValid())
+         historyCall[oldCall->getCallId()][ "section"    ] = oldCall->property("section");
+      setData("history", oldCall->getCallId() , historyCall[oldCall->getCallId()]);
    }
 }
 
@@ -117,10 +132,10 @@ void SFLPhoneEngine::updateCallList()
 {
    foreach (Call* call, m_pModel->getCalls()) {
       if ((!m_pModel->isConference(call)) && (call->getState() != CALL_STATE_OVER)) {
-         currentCall[call->getCallId()][ "Name"      ] = call->getPeerName();
-         currentCall[call->getCallId()][ "Number"    ] = call->getPeerPhoneNumber();
-         currentCall[call->getCallId()][ "StateName" ] = getCallStateName(call->getState());
-         currentCall[call->getCallId()][ "State"     ] = call->getState();
+         currentCall[call->getCallId()][ "peerName"      ] = call->getPeerName();
+         currentCall[call->getCallId()][ "peerNumber"    ] = call->getPeerPhoneNumber();
+         currentCall[call->getCallId()][ "stateName"     ] = getCallStateName(call->getState());
+         currentCall[call->getCallId()][ "state"         ] = call->getState();
          setData("calls", call->getCallId(), currentCall[call->getCallId()]);
       }
    }
@@ -137,14 +152,47 @@ void SFLPhoneEngine::updateConferenceList()
    }
 }
 
-void SFLPhoneEngine::updateContacts()
+void SFLPhoneEngine::updateCollection()
 {
    
+   typedef QHash<QString,QVariant> SerializedContact;
+   ContactList list = AkonadiBackend::getInstance()->update();
+   if (!list.size())
+      return;
+   ContactHash hash = HelperFunctions::toHash(list);
+   foreach (SerializedContact cont, hash) {
+      if (!m_hContacts[hash.key(cont)].size()) {
+         m_hContacts[hash.key(cont)] = cont;
+      }
+      //
+   }
+   removeAllData("contacts");
+   int i=0;
+   foreach (SerializedContact cont, m_hContacts) {
+      cont["section"] = "test";
+      setData("contacts", QString::number(i), QVariant(cont));
+      i++;
+   }
+}
+
+void SFLPhoneEngine::updateContacts()
+{
+   QHash<QString,QVariant> test;
+   test[ "nickName"       ] = "";
+   test[ "firstName"      ] = "";
+   test[ "secondName"     ] = "";
+   test[ "formattedName"  ] = "";
+   test[ "organization"   ] = "";
+   test[ "Uid"            ] = "";
+   test[ "preferredEmail" ] = "";
+   test[ "type"           ] = "";
+   test[ "group"          ] = "";
+   test[ "department"     ] = "";
+   setData("contacts", "fake",test );
 }
 
 void SFLPhoneEngine::updateInfo()
 {
-   qDebug() << "Currentaccount: " << m_pModel->getCurrentAccountId();
    setData("info", I18N_NOOP("Current_account"), m_pModel->getCurrentAccountId());
 }
 
@@ -152,7 +200,6 @@ void SFLPhoneEngine::updateAccounts()
 {
    const QVector<Account*>& list = m_pModel->getAccountList()->getAccounts();
    foreach(Account* a,list) {
-      qDebug() << "Account: " << a->getAccountId();
       setData("accounts", a->getAccountDetail(ACCOUNT_ALIAS), a->getAccountId());
    }
 }
@@ -197,7 +244,7 @@ void SFLPhoneEngine::voiceMailNotifySignal(const QString& accountId, int count)
 
 void SFLPhoneEngine::accountChanged()
 {
-
+   
 }
 
 CallModel<>* SFLPhoneEngine::getModel()
diff --git a/kde/src/klib/dataengine/sflphonEngine.h b/kde/src/klib/dataengine/sflphonEngine.h
index 3ef48b5ffbd1236277437a362186a742051fa71e..47370f3065ebfaa6671d5fcc08aec33dc0e04448 100644
--- a/kde/src/klib/dataengine/sflphonEngine.h
+++ b/kde/src/klib/dataengine/sflphonEngine.h
@@ -26,11 +26,13 @@
 #include <QHash>
 
 #include "../../lib/CallModel.h"
+#include "../SortableDockCommon.h"
 
 typedef QHash<QString,QVariant> HashStringString;
+typedef QHash<QString,QHash<QString,QVariant> > ContactHash;
 class Call;
 
-class SFLPhoneEngine : public Plasma::DataEngine
+class SFLPhoneEngine : public Plasma::DataEngine,public SortableDockCommon<>
 {
    Q_OBJECT
 
@@ -48,18 +50,20 @@ class SFLPhoneEngine : public Plasma::DataEngine
       bool updateSourceEvent(const QString& source);
 
    private:
-      QHash<QString, HashStringString > historyCall  ;
-      QHash<QString, HashStringString > currentCall  ;
-      QHash<QString, QStringList> currentConferences ;
-      static CallModel<>* m_pModel;
+      QHash<QString, HashStringString > historyCall        ;
+      QHash<QString, HashStringString > currentCall        ;
+      QHash<QString, QStringList>       currentConferences ;
+      static CallModel<>*               m_pModel           ;
+      ContactHash                       m_hContacts        ;
       QString getCallStateName(call_state state);
       void updateHistory        ();
       void updateCallList       ();
-      void updateContacts       ();
       void updateAccounts       ();
       void updateConferenceList ();
+      void updateContacts       ();
       void updateInfo();
    private slots:
+      void updateCollection();
       void callStateChangedSignal  (Call* call);
       void incomingCallSignal      (Call* conf);
       void conferenceCreatedSignal (Call* conf);
diff --git a/kde/src/klib/dataengine/sflphoneService.cpp b/kde/src/klib/dataengine/sflphoneService.cpp
index 3f37f36ccaa6bf3ee6c29d9a39de3d6449a2b36a..9a0e455f2fb8318e0890c9c60ac60556abcb3ba1 100644
--- a/kde/src/klib/dataengine/sflphoneService.cpp
+++ b/kde/src/klib/dataengine/sflphoneService.cpp
@@ -18,7 +18,6 @@ ServiceJob *SFLPhoneService::createJob(const QString &operation, QMap<QString, Q
     if (operation == "Call") {
        return new CallJob(this, operation,parameters);
     }
-    qDebug() << "\n\n\nIN SERVICE" << parameters["query"];
     m_engine->setData(operation, parameters["query"]);
     return 0;
 }
\ No newline at end of file
diff --git a/kde/src/klib/dataengine/sflphoneService.h b/kde/src/klib/dataengine/sflphoneService.h
index a71dfa675aa7c90a11d267248ca9b663eeaf3f61..bca8880bfbe0beaa42f57fdf77dc59db7da62a64 100644
--- a/kde/src/klib/dataengine/sflphoneService.h
+++ b/kde/src/klib/dataengine/sflphoneService.h
@@ -17,8 +17,7 @@ class SFLPhoneService : public Plasma::Service
 
 public:
     SFLPhoneService(SFLPhoneEngine *engine);
-    ServiceJob *createJob(const QString &operation,
-                          QMap<QString, QVariant> &parameters);
+    ServiceJob *createJob(const QString &operation, QMap<QString, QVariant> &parameters);
 
 private:
     SFLPhoneEngine *m_engine;
@@ -31,16 +30,15 @@ class CallJob : public Plasma::ServiceJob
 public:
     CallJob(QObject* parent, const QString& operation, const QVariantMap& parameters = QVariantMap())
         : Plasma::ServiceJob("", operation, parameters, parent)
-        , m_AccountId ( parameters["AccountId"].toString() )
-        , m_Number    ( parameters["Number"].toString()    )
+        , m_AccountId ( parameters[ "AccountId" ].toString() )
+        , m_Number    ( parameters[ "Number"    ].toString() )
     {}
 
     void start()
     {
-      qDebug() << "TRYING TO CALL USING" << m_AccountId << m_Number;
-//       Call* call = SFLPhoneEngine::getModel()->addDialingCall("112",m_AccountId);
-//       call->setCallNumber(m_Number);
-//       call->actionPerformed(CALL_ACTION_ACCEPT);
+      Call* call = SFLPhoneEngine::getModel()->addDialingCall("112",m_AccountId);
+      call->setCallNumber(m_Number);
+      call->actionPerformed(CALL_ACTION_ACCEPT);
     }
 
 private:
diff --git a/kde/src/conf/kcfg_settings.kcfgc b/kde/src/klib/kcfg_settings.kcfgc
similarity index 61%
rename from kde/src/conf/kcfg_settings.kcfgc
rename to kde/src/klib/kcfg_settings.kcfgc
index b14ca1863f8e830d10729b176f512a36358b339b..d64e6e44c5aca7b83f34998d1795e2ef470e1c44 100755
--- a/kde/src/conf/kcfg_settings.kcfgc
+++ b/kde/src/klib/kcfg_settings.kcfgc
@@ -3,3 +3,5 @@ File=sflphone-client-kde.kcfg
 ClassName=ConfigurationSkeletonBase
 Singleton=true
 Mutators=true
+Visibility=LIB_EXPORT
+IncludeFiles=\"../src/lib/typedefs.h\"
\ No newline at end of file
diff --git a/kde/src/conf/sflphone-client-kde.kcfg b/kde/src/klib/sflphone-client-kde.kcfg
similarity index 100%
rename from kde/src/conf/sflphone-client-kde.kcfg
rename to kde/src/klib/sflphone-client-kde.kcfg
diff --git a/kde/src/lib/Call.cpp b/kde/src/lib/Call.cpp
index 223bb0706ee3ea48dc282718db565aabb10b2257..b1683e4b4a22008fbb906172fff0a4d936f755f6 100644
--- a/kde/src/lib/Call.cpp
+++ b/kde/src/lib/Call.cpp
@@ -471,6 +471,12 @@ void Call::setRecordingPath(const QString& path)
    m_RecordingPath = path;
 }
 
+///Set peer name
+void Call::setPeerName(const QString& name)
+{
+   m_PeerName = name;
+}
+
 /*****************************************************************************
  *                                                                           *
  *                                  Mutator                                  *
diff --git a/kde/src/lib/Call.h b/kde/src/lib/Call.h
index 4d763bf472382627dd873f99db678a8a7d3891f5..ad2fbdc004fedf5bd57fa8549ee36db4b2183bde 100644
--- a/kde/src/lib/Call.h
+++ b/kde/src/lib/Call.h
@@ -158,11 +158,12 @@ public:
    call_state actionPerformed(call_action action);
    
    //Setters
-   void setConference(bool value);
-   void setConfId(QString value);
-   void setTransferNumber(const QString& number);
-   void setCallNumber(const QString& number);
-   void setRecordingPath(const QString& path);
+   void setConference     ( bool value            );
+   void setConfId         ( QString value         );
+   void setTransferNumber ( const QString& number );
+   void setCallNumber     ( const QString& number );
+   void setRecordingPath  ( const QString& path   );
+   void setPeerName       ( const QString& name   );
    
    //Mutators
    void appendText(const QString& str);
diff --git a/kde/src/lib/CallModel.h b/kde/src/lib/CallModel.h
index ae19567b0c0fafd667a57f5cc60d959daff8309f..d5654546c3c3fae720be34358874229956e48e23 100644
--- a/kde/src/lib/CallModel.h
+++ b/kde/src/lib/CallModel.h
@@ -128,11 +128,11 @@ class LIB_EXPORT CallModel : public CallModelBase {
       void removeConference          ( Call* call                                  );
 
       //Getters
-      int size                                                     ();
-      CallList                              getCallList            ();
-      static const CallMap&                getHistory             ();
-      static const QStringList              getNumbersByPopularity ();
-      static const QStringList getHistoryCallId                    ();
+      int size                                        ();
+      CallList                 getCallList            ();
+      static const CallMap&    getHistory             ();
+      static const QStringList getNumbersByPopularity ();
+      static const QStringList getHistoryCallId       ();
 
       //Account related
       static Account* getCurrentAccount  (                     );
diff --git a/kde/src/lib/CallModel.hpp b/kde/src/lib/CallModel.hpp
index cff7ce9808ea661e696bac41aa5885e1b15e86b6..43b667221cb0dcd8f1337a302d0f05f2346fa080 100644
--- a/kde/src/lib/CallModel.hpp
+++ b/kde/src/lib/CallModel.hpp
@@ -38,20 +38,24 @@
 //System
 #include "unistd.h"
 
+//Define
+#define CALLMODEL_TEMPLATE template<typename CallWidget, typename Index>
+#define CALLMODEL_T CallModel<CallWidget,Index>
+
 //Static member
-template  <typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::m_sPriorAccountId   = ""    ;
-template  <typename CallWidget, typename Index> AccountList* CallModel<CallWidget,Index>::m_spAccountList = 0    ;
-template  <typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::m_sInstanceInit        = false ;
-template  <typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::m_sCallInit            = false ;
-template  <typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::m_sHistoryInit         = false ;
+CALLMODEL_TEMPLATE QString CALLMODEL_T::m_sPriorAccountId   = ""    ;
+CALLMODEL_TEMPLATE AccountList* CALLMODEL_T::m_spAccountList = 0    ;
+CALLMODEL_TEMPLATE bool CALLMODEL_T::m_sInstanceInit        = false ;
+CALLMODEL_TEMPLATE bool CALLMODEL_T::m_sCallInit            = false ;
+CALLMODEL_TEMPLATE bool CALLMODEL_T::m_sHistoryInit         = false ;
 
-template  <typename CallWidget, typename Index> CallMap CallModel<CallWidget,Index>::m_sActiveCalls  ;
-template  <typename CallWidget, typename Index> CallMap CallModel<CallWidget,Index>::m_sHistoryCalls ;
+CALLMODEL_TEMPLATE CallMap CALLMODEL_T::m_sActiveCalls  ;
+CALLMODEL_TEMPLATE CallMap CALLMODEL_T::m_sHistoryCalls ;
 
-template  <typename CallWidget, typename Index> typename CallModel<CallWidget,Index>::InternalCall   CallModel<CallWidget,Index>::m_sPrivateCallList_call   ;
-template  <typename CallWidget, typename Index> typename CallModel<CallWidget,Index>::InternalCallId CallModel<CallWidget,Index>::m_sPrivateCallList_callId ;
-template  <typename CallWidget, typename Index> typename CallModel<CallWidget,Index>::InternalIndex  CallModel<CallWidget,Index>::m_sPrivateCallList_index  ;
-template  <typename CallWidget, typename Index> typename CallModel<CallWidget,Index>::InternalWidget CallModel<CallWidget,Index>::m_sPrivateCallList_widget ;
+CALLMODEL_TEMPLATE typename CALLMODEL_T::InternalCall   CALLMODEL_T::m_sPrivateCallList_call   ;
+CALLMODEL_TEMPLATE typename CALLMODEL_T::InternalCallId CALLMODEL_T::m_sPrivateCallList_callId ;
+CALLMODEL_TEMPLATE typename CALLMODEL_T::InternalIndex  CALLMODEL_T::m_sPrivateCallList_index  ;
+CALLMODEL_TEMPLATE typename CALLMODEL_T::InternalWidget CALLMODEL_T::m_sPrivateCallList_widget ;
 
 /*****************************************************************************
  *                                                                           *
@@ -81,7 +85,7 @@ inline bool operator< (const SortableCallSource & s1, const SortableCallSource &
  ****************************************************************************/
 
 ///Retrieve current and older calls from the daemon, fill history and the calls TreeView and enable drag n' drop
-template<typename CallWidget, typename Index> CallModel<CallWidget,Index>::CallModel(ModelType type) : CallModelBase(0)
+CALLMODEL_TEMPLATE CALLMODEL_T::CallModel(ModelType type) : CallModelBase(0)
 {
    Q_UNUSED(type)
    init();
@@ -89,7 +93,7 @@ template<typename CallWidget, typename Index> CallModel<CallWidget,Index>::CallM
 }
 
 ///Open the connection to the daemon and register this client
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::init() 
+CALLMODEL_TEMPLATE bool CALLMODEL_T::init()
 {
    if (!m_sInstanceInit) {
       registerCommTypes();
@@ -106,7 +110,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 
 ///Fill the call list
 ///@warning This solution wont scale to multiple call or history model implementation. Some static addCall + foreach for each call would be needed if this case ever become unavoidable
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::initCall()
+CALLMODEL_TEMPLATE bool CALLMODEL_T::initCall()
 {
    if (!m_sCallInit) {
       CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
@@ -127,14 +131,14 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Set how the call can find more informations about the call it receive
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::initContact ( ContactBackend* be )
+CALLMODEL_TEMPLATE void CALLMODEL_T::initContact ( ContactBackend* be )
 {
    Call::setContactBackend(be);
 }
 
 ///Fill the history list
 ///@warning This solution wont scale to multiple call or history model implementation. Some static addCall + foreach for each call would be needed if this case ever become unavoidable
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::initHistory()
+CALLMODEL_TEMPLATE bool CALLMODEL_T::initHistory()
 {
    if (!m_sHistoryInit) {
       ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
@@ -149,6 +153,9 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
                   hc[ PEER_NUMBER_KEY     ]         ,
                   hc[ STATE_KEY           ]
          );
+         if (pastCall->getPeerName().isEmpty()) {
+            pastCall->setPeerName("Unknow");
+         }
          pastCall->setRecordingPath(hc[ RECORDING_PATH_KEY ]);
          m_sHistoryCalls[ hc[TIMESTAMP_START_KEY ]] = pastCall;
          addCall(pastCall);
@@ -167,19 +174,19 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
  ****************************************************************************/
 
 ///Return the active call count
-template<typename CallWidget, typename Index> int CallModel<CallWidget,Index>::size() 
+CALLMODEL_TEMPLATE int CALLMODEL_T::size()
 {
    return m_sActiveCalls.size();
 }
 
 ///Return a call corresponding to this ID or NULL
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::findCallByCallId(const QString& callId)
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::findCallByCallId(const QString& callId)
 {
    return m_sActiveCalls[callId];
 }
 
 ///Return the action call list
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCallList() 
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCallList()
 {
    QList<Call*> callList;
    foreach(Call* call, m_sActiveCalls) {
@@ -196,7 +203,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
  ****************************************************************************/
 
 ///Add a call in the model structure, the call must exist before being added to the model
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addCall(Call* call, Call* parent) 
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addCall(Call* call, Call* parent)
 {
    Q_UNUSED(parent)
    if (!call)
@@ -215,7 +222,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Common set of instruction shared by all call adder
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addCallCommon(Call* call)
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addCallCommon(Call* call)
 {
    m_sActiveCalls[call->getCallId()] = call;
    addCall(call);
@@ -224,7 +231,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Create a new dialing call from peer name and the account ID
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addDialingCall(const QString& peerName, QString account)
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addDialingCall(const QString& peerName, QString account)
 {
    QString account2 = account;
    if (account2.isEmpty()) {
@@ -236,21 +243,21 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Create a new incomming call when the daemon is being called
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addIncomingCall(const QString& callId)
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addIncomingCall(const QString& callId)
 {
    Call* call = Call::buildIncomingCall(callId);
    return addCallCommon(call);
 }
 
 ///Create a ringing call
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addRingingCall(const QString& callId)
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addRingingCall(const QString& callId)
 {
    Call* call = Call::buildRingingCall(callId);
    return addCallCommon(call);
 }
 
 ///Generate a new random call unique identifier (callId)
-template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::generateCallId()
+CALLMODEL_TEMPLATE QString CALLMODEL_T::generateCallId()
 {
    int id = qrand();
    QString res = QString::number(id);
@@ -258,7 +265,7 @@ template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index
 }
 
 ///Remove a call and update the internal structure
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::removeCall(Call* call)
+CALLMODEL_TEMPLATE void CALLMODEL_T::removeCall(Call* call)
 {
    InternalStruct* internal = m_sPrivateCallList_call[call];
 
@@ -285,7 +292,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
 }
 
 ///Transfer "toTransfer" to "target" and wait to see it it succeeded
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::attendedTransfer(Call* toTransfer, Call* target)
+CALLMODEL_TEMPLATE void CALLMODEL_T::attendedTransfer(Call* toTransfer, Call* target)
 {
    CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
    callManager.attendedTransfer(toTransfer->getCallId(),target->getCallId());
@@ -296,7 +303,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
 }
 
 ///Transfer this call to  "target" number
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::transfer(Call* toTransfer, QString target)
+CALLMODEL_TEMPLATE void CALLMODEL_T::transfer(Call* toTransfer, QString target)
 {
    qDebug() << "Transferring call " << toTransfer->getCallId() << "to" << target;
    toTransfer->setTransferNumber(target);
@@ -312,7 +319,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
  ****************************************************************************/
 
 ///Add a new conference, get the call list and update the interface as needed
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::addConference(const QString & confID) 
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::addConference(const QString & confID)
 {
    qDebug() << "Notified of a new conference " << confID;
    CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
@@ -341,7 +348,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Join two call to create a conference, the conference will be created later (see addConference)
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::createConferenceFromCall(Call* call1, Call* call2) 
+CALLMODEL_TEMPLATE bool CALLMODEL_T::createConferenceFromCall(Call* call1, Call* call2)
 {
   qDebug() << "Joining call: " << call1->getCallId() << " and " << call2->getCallId();
   CallManagerInterface &callManager = CallManagerInterfaceSingleton::getInstance();
@@ -350,7 +357,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Add a new participant to a conference
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::addParticipant(Call* call2, Call* conference) 
+CALLMODEL_TEMPLATE bool CALLMODEL_T::addParticipant(Call* call2, Call* conference)
 {
    if (conference->isConference()) {
       CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
@@ -364,7 +371,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Remove a participant from a conference
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::detachParticipant(Call* call) 
+CALLMODEL_TEMPLATE bool CALLMODEL_T::detachParticipant(Call* call)
 {
    CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
    callManager.detachParticipant(call->getCallId());
@@ -372,7 +379,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Merge two conferences
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::mergeConferences(Call* conf1, Call* conf2) 
+CALLMODEL_TEMPLATE bool CALLMODEL_T::mergeConferences(Call* conf1, Call* conf2)
 {
    CallManagerInterface& callManager = CallManagerInterfaceSingleton::getInstance();
    callManager.joinConference(conf1->getConfId(),conf2->getConfId());
@@ -380,7 +387,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Executed when the daemon signal a modification in an existing conference. Update the call list and update the TreeView
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::changeConference(const QString& confId, const QString& state)
+CALLMODEL_TEMPLATE bool CALLMODEL_T::changeConference(const QString& confId, const QString& state)
 {
    qDebug() << "Conf changed";
    Q_UNUSED(state)
@@ -398,14 +405,14 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Remove a conference from the model and the TreeView
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::removeConference(const QString &confId)
+CALLMODEL_TEMPLATE void CALLMODEL_T::removeConference(const QString &confId)
 {
    qDebug() << "Ending conversation containing " << m_sPrivateCallList_callId[confId]->children.size() << " participants";
    removeConference(getCall(confId));
 }
 
 ///Remove a conference using it's call object
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::removeConference(Call* call)
+CALLMODEL_TEMPLATE void CALLMODEL_T::removeConference(Call* call)
 {
    InternalStruct* internal = m_sPrivateCallList_call[call];
    
@@ -424,7 +431,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
  ****************************************************************************/
 
 ///Return a list of all previous calls
-template<typename CallWidget, typename Index> const QStringList CallModel<CallWidget,Index>::getHistoryCallId() 
+CALLMODEL_TEMPLATE const QStringList CALLMODEL_T::getHistoryCallId()
 {
    QStringList toReturn;
    foreach(Call* call, m_sHistoryCalls) {
@@ -434,13 +441,13 @@ template<typename CallWidget, typename Index> const QStringList CallModel<CallWi
 }
 
 ///Return the history list
-template<typename CallWidget, typename Index> const CallMap& CallModel<CallWidget,Index>::getHistory()
+CALLMODEL_TEMPLATE const CallMap& CALLMODEL_T::getHistory()
 {
    return m_sHistoryCalls;
 }
 
 ///Add to history
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::addToHistory(Call* call)
+CALLMODEL_TEMPLATE void CALLMODEL_T::addToHistory(Call* call)
 {
    if (call) {
       m_sHistoryCalls[call->getStartTimeStamp()] = call;
@@ -448,7 +455,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
 }
 
 ///Sort all history call by popularity and return the result (most popular first)
-template<typename CallWidget, typename Index> const QStringList CallModel<CallWidget,Index>::getNumbersByPopularity()
+CALLMODEL_TEMPLATE const QStringList CALLMODEL_T::getNumbersByPopularity()
 {
    QHash<QString,SortableCallSource*> hc;
    foreach (Call* call, getHistory()) {
@@ -481,7 +488,7 @@ template<typename CallWidget, typename Index> const QStringList CallModel<CallWi
  ****************************************************************************/
 
 ///Return the current account id (do not put in the cpp file)
-template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::getCurrentAccountId()
+CALLMODEL_TEMPLATE QString CALLMODEL_T::getCurrentAccountId()
 {
    Account* firstRegistered = getCurrentAccount();
    if(firstRegistered == NULL) {
@@ -494,7 +501,7 @@ template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index
 
 
 ///Return the current account
-template<typename CallWidget, typename Index> Account* CallModel<CallWidget,Index>::getCurrentAccount()
+CALLMODEL_TEMPLATE Account* CALLMODEL_T::getCurrentAccount()
 {
    Account* priorAccount = getAccountList()->getAccountById(m_sPriorAccountId);
    if(priorAccount && priorAccount->getAccountDetail(ACCOUNT_REGISTRATION_STATUS) == ACCOUNT_STATE_REGISTERED ) {
@@ -507,7 +514,7 @@ template<typename CallWidget, typename Index> Account* CallModel<CallWidget,Inde
 }
 
 ///Return a list of registered accounts
-template<typename CallWidget, typename Index> AccountList* CallModel<CallWidget,Index>::getAccountList()
+CALLMODEL_TEMPLATE AccountList* CALLMODEL_T::getAccountList()
 {
    if (m_spAccountList == NULL) {
       m_spAccountList = new AccountList(true);
@@ -516,13 +523,13 @@ template<typename CallWidget, typename Index> AccountList* CallModel<CallWidget,
 }
 
 ///Return the previously used account ID
-template<typename CallWidget, typename Index> QString CallModel<CallWidget,Index>::getPriorAccoundId() 
+CALLMODEL_TEMPLATE QString CALLMODEL_T::getPriorAccoundId()
 {
    return m_sPriorAccountId;
 }
 
 ///Set the previous account used
-template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::setPriorAccountId(const QString& value) {
+CALLMODEL_TEMPLATE void CALLMODEL_T::setPriorAccountId(const QString& value) {
    m_sPriorAccountId = value;
 }
 
@@ -533,7 +540,7 @@ template<typename CallWidget, typename Index> void CallModel<CallWidget,Index>::
  ****************************************************************************/
 
 ///Get a call from it's widget                                     
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::getCall         ( const CallWidget widget     ) const
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::getCall         ( const CallWidget widget     ) const
 {
    if (m_sPrivateCallList_widget[widget]) {
       return m_sPrivateCallList_widget[widget]->call_real;
@@ -542,7 +549,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Get a call list from a conference                               
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCalls ( const CallWidget widget     ) const
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCalls ( const CallWidget widget     ) const
 {
    QList<Call*> toReturn;
    if (m_sPrivateCallList_widget[widget] && m_sPrivateCallList_widget[widget]->conference) {
@@ -554,7 +561,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
 }
 
 ///Get a list of every call                                        
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCalls (                             )
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCalls (                             )
 {
    QList<Call*> toReturn;
    foreach (InternalStruct* child, m_sPrivateCallList_call) {
@@ -564,7 +571,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
 }
 
 ///Is the call associated with that widget a conference            
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::isConference     ( const CallWidget widget      ) const
+CALLMODEL_TEMPLATE bool CALLMODEL_T::isConference     ( const CallWidget widget      ) const
 {
    if (m_sPrivateCallList_widget[widget]) {
       return m_sPrivateCallList_widget[widget]->conference;
@@ -573,7 +580,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Is that call a conference                                       
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::isConference     ( const Call* call             ) const
+CALLMODEL_TEMPLATE bool CALLMODEL_T::isConference     ( const Call* call             ) const
 {
    if (m_sPrivateCallList_call[(Call*)call]) {
       return m_sPrivateCallList_call[(Call*)call]->conference;
@@ -582,13 +589,13 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Do nothing, provided for API consistency                        
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::getCall         ( const Call* call             ) const
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::getCall         ( const Call* call             ) const
 { 
    return call;
 }
 
 ///Return the calls from the "call" conference                     
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCalls ( const Call* call             ) const
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCalls ( const Call* call             ) const
 { 
    QList<Call*> toReturn;
    if (m_sPrivateCallList_call[call] && m_sPrivateCallList_call[call]->conference) {
@@ -600,7 +607,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
 }
 
 ///Is the call associated with that Index a conference             
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::isConference     ( const Index idx              ) const
+CALLMODEL_TEMPLATE bool CALLMODEL_T::isConference     ( const Index idx              ) const
 { 
    if (m_sPrivateCallList_index[idx]) {
       return m_sPrivateCallList_index[idx]->conference;
@@ -609,7 +616,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Get the call associated with this index                         
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::getCall         ( const Index idx              ) const
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::getCall         ( const Index idx              ) const
 { 
    if (m_sPrivateCallList_index[idx]) {
       return m_sPrivateCallList_index[idx]->call_real;
@@ -619,7 +626,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Get the call associated with that conference index              
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCalls ( const Index idx              ) const
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCalls ( const Index idx              ) const
 { 
    QList<Call*> toReturn;
    if (m_sPrivateCallList_index[idx] && m_sPrivateCallList_index[idx]->conference) {
@@ -631,7 +638,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
 }
 
 ///Is the call associated with that ID a conference                
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::isConference     ( const QString& callId        ) const
+CALLMODEL_TEMPLATE bool CALLMODEL_T::isConference     ( const QString& callId        ) const
 { 
    if (m_sPrivateCallList_callId[callId]) {
       return m_sPrivateCallList_callId[callId]->conference;
@@ -640,7 +647,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Get the call associated with this ID                            
-template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>::getCall         ( const QString& callId        ) const
+CALLMODEL_TEMPLATE Call* CALLMODEL_T::getCall         ( const QString& callId        ) const
 { 
    if (m_sPrivateCallList_callId[callId]) {
       return m_sPrivateCallList_callId[callId]->call_real;
@@ -649,7 +656,7 @@ template<typename CallWidget, typename Index> Call* CallModel<CallWidget,Index>:
 }
 
 ///Get the calls associated with this ID                           
-template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,Index>::getCalls ( const QString& callId        ) const
+CALLMODEL_TEMPLATE QList<Call*> CALLMODEL_T::getCalls ( const QString& callId        ) const
 {
    QList<Call*> toReturn;
    if (m_sPrivateCallList_callId[callId] && m_sPrivateCallList_callId[callId]->conference) {
@@ -661,7 +668,7 @@ template<typename CallWidget, typename Index> QList<Call*> CallModel<CallWidget,
 }
 
 ///Get the index associated with this call                         
-template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>::getIndex        ( const Call* call             ) const
+CALLMODEL_TEMPLATE Index CALLMODEL_T::getIndex        ( const Call* call             ) const
 {
    if (m_sPrivateCallList_call[(Call*)call]) {
       return m_sPrivateCallList_call[(Call*)call]->index;
@@ -670,7 +677,7 @@ template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>:
 }
 
 ///Get the index associated with this index (dummy implementation) 
-template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>::getIndex        ( const Index idx              ) const
+CALLMODEL_TEMPLATE Index CALLMODEL_T::getIndex        ( const Index idx              ) const
 {
    if (m_sPrivateCallList_index[idx]) {
       return m_sPrivateCallList_index[idx]->index;
@@ -679,7 +686,7 @@ template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>:
 }
 
 ///Get the index associated with this call                         
-template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>::getIndex        ( const CallWidget widget      ) const
+CALLMODEL_TEMPLATE Index CALLMODEL_T::getIndex        ( const CallWidget widget      ) const
 {
    if (m_sPrivateCallList_widget[widget]) {
       return m_sPrivateCallList_widget[widget]->index;
@@ -688,7 +695,7 @@ template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>:
 }
 
 ///Get the index associated with this ID                           
-template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>::getIndex        ( const QString& callId        ) const
+CALLMODEL_TEMPLATE Index CALLMODEL_T::getIndex        ( const QString& callId        ) const
 {
    if (m_sPrivateCallList_callId[callId]) {
       return m_sPrivateCallList_callId[callId]->index;
@@ -697,7 +704,7 @@ template<typename CallWidget, typename Index> Index CallModel<CallWidget,Index>:
 }
 
 ///Get the widget associated with this call                        
-template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,Index>::getWidget  ( const Call* call             ) const
+CALLMODEL_TEMPLATE CallWidget CALLMODEL_T::getWidget  ( const Call* call             ) const
 {
    if (m_sPrivateCallList_call[call]) {
       return m_sPrivateCallList_call[call]->call;
@@ -706,7 +713,7 @@ template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,In
 }
 
 ///Get the widget associated with this ID                          
-template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,Index>::getWidget  ( const Index idx              ) const
+CALLMODEL_TEMPLATE CallWidget CALLMODEL_T::getWidget  ( const Index idx              ) const
 {
    if (m_sPrivateCallList_index[idx]) {
       return m_sPrivateCallList_index[idx]->call;
@@ -715,7 +722,7 @@ template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,In
 }
 
 ///Get the widget associated with this widget (dummy)              
-template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,Index>::getWidget  ( const CallWidget widget      ) const
+CALLMODEL_TEMPLATE CallWidget CALLMODEL_T::getWidget  ( const CallWidget widget      ) const
 {
    if (m_sPrivateCallList_widget[widget]) {
       return m_sPrivateCallList_widget[widget]->call;
@@ -724,7 +731,7 @@ template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,In
 }
 
 ///Get the widget associated with this ID                          
-template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,Index>::getWidget  ( const QString& widget        ) const
+CALLMODEL_TEMPLATE CallWidget CALLMODEL_T::getWidget  ( const QString& widget        ) const
 {
    if (m_sPrivateCallList_widget[widget]) {
       return m_sPrivateCallList_widget[widget]->call;
@@ -733,7 +740,7 @@ template<typename CallWidget, typename Index> CallWidget CallModel<CallWidget,In
 }
 
 ///Common set of instruction shared by all gui updater
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::updateCommon(Call* call)
+CALLMODEL_TEMPLATE bool CALLMODEL_T::updateCommon(Call* call)
 {
    if (!m_sPrivateCallList_call[call] && dynamic_cast<Call*>(call)) {
       m_sPrivateCallList_call   [ call              ]             = new InternalStruct            ;
@@ -747,7 +754,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Update the widget associated with this call                     
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::updateWidget     (Call* call, CallWidget value )
+CALLMODEL_TEMPLATE bool CALLMODEL_T::updateWidget     (Call* call, CallWidget value )
 {
    if (!updateCommon(call)) return false;
    m_sPrivateCallList_call[call]->call = value                         ;
@@ -756,7 +763,7 @@ template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::
 }
 
 ///Update the index associated with this call
-template<typename CallWidget, typename Index> bool CallModel<CallWidget,Index>::updateIndex      (Call* call, Index value      )
+CALLMODEL_TEMPLATE bool CALLMODEL_T::updateIndex      (Call* call, Index value      )
 {
    updateCommon(call);
    m_sPrivateCallList_call[call]->index = value                         ;
diff --git a/kde/src/lib/Contact.cpp b/kde/src/lib/Contact.cpp
index bc64c91e69fffad8b49cef54460f5efd63ac1067..ce53582cb4a15610822ae89fdeea38205fc087f2 100644
--- a/kde/src/lib/Contact.cpp
+++ b/kde/src/lib/Contact.cpp
@@ -187,4 +187,23 @@ void Contact::setGroup(const QString& name)
 void Contact::setDepartment(const QString& name)
 {
    m_Department = name;
+}
+
+///Turn the contact into QString-QString hash
+QHash<QString,QVariant> Contact::toHash()
+{
+   QHash<QString,QVariant> aContact;
+   //aContact[""] = PhoneNumbers   getPhoneNumbers()    const;
+   aContact[ "nickName"       ] = getNickName();
+   aContact[ "firstName"      ] = getFirstName();
+   aContact[ "secondName"     ] = getSecondName();
+   aContact[ "formattedName"  ] = getFormattedName();
+   aContact[ "organization"   ] = getOrganization();
+   aContact[ "Uid"            ] = getUid();
+   aContact[ "preferredEmail" ] = getPreferredEmail();
+   //aContact["Photo"] = getPhoto(      const;
+   aContact[ "type"           ] = getType();
+   aContact[ "group"          ] = getGroup();
+   aContact[ "department"     ] = getDepartment();
+   return aContact;
 }
\ No newline at end of file
diff --git a/kde/src/lib/Contact.h b/kde/src/lib/Contact.h
index 0e23260292183429759f88788e3bab275335e4be..c13a6e0d01b25b5191564fccfda7c8a497960d79 100644
--- a/kde/src/lib/Contact.h
+++ b/kde/src/lib/Contact.h
@@ -21,7 +21,8 @@
 #ifndef CONTACT_H
 #define CONTACT_H
 
-#include <QObject>
+#include <QtCore/QObject>
+#include <QtCore/QVariant>
 
 //Qt
 class QListWidgetItem;
@@ -106,6 +107,9 @@ public:
    virtual void setDepartment     ( const QString& name   );
    virtual void setUid            ( const QString& id     );
    virtual void setPhoto          ( QPixmap* photo        );
+
+   //Mutator
+   QHash<QString,QVariant> toHash();
    
 protected:
    virtual void initItemWidget();
diff --git a/kde/src/lib/ContactBackend.h b/kde/src/lib/ContactBackend.h
index 66d65cd8dae12ed87942f5bc46c2daab109e9995..64ad72cca992066de42adf718fc3d821d7bbdfc7 100644
--- a/kde/src/lib/ContactBackend.h
+++ b/kde/src/lib/ContactBackend.h
@@ -24,12 +24,16 @@
 
 #include <QObject>
 #include <QHash>
+#include <QStringList>
+#include <QVariant>
 
 #include "typedefs.h"
+#include "Contact.h"
 
 //SFLPhone
 class Contact;
 
+//Typedef
 typedef QList<Contact*> ContactList;
 
 ///@class ContactBackend Allow different way to handle contact without poluting the library
diff --git a/kde/src/main.cpp b/kde/src/main.cpp
index f91419b4ffb3540ee6335b4d9b6c4160bbab439c..69053c16b48251e16f31e442224e22fe8ed3652f 100755
--- a/kde/src/main.cpp
+++ b/kde/src/main.cpp
@@ -41,7 +41,7 @@
 #include "AccountWizard.h"
 #include "SFLPhoneapplication.h"
 #include "conf/ConfigurationDialog.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "CallView.h"
 #include "SFLPhone.h"
 #include "AccountListModel.h"
diff --git a/kde/src/widgets/BookmarkDock.cpp b/kde/src/widgets/BookmarkDock.cpp
index 82195d52f4d7935fea7e8dd34231c7edd6f29b0c..cd4a08861379376ba81439494d3297058ffe7e84 100644
--- a/kde/src/widgets/BookmarkDock.cpp
+++ b/kde/src/widgets/BookmarkDock.cpp
@@ -35,7 +35,7 @@
 #include <KLineEdit>
 
 //SFLPhone
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "widgets/HistoryTreeItem.h"
 #include "SFLPhone.h"
 #include "widgets/CategoryDrawer.h"
diff --git a/kde/src/widgets/ContactDock.cpp b/kde/src/widgets/ContactDock.cpp
index 80119af710445aee824f7e6a3b08e61e22fcf59b..349be089f88c4354433e7dec2d28ce51404e426d 100644
--- a/kde/src/widgets/ContactDock.cpp
+++ b/kde/src/widgets/ContactDock.cpp
@@ -43,7 +43,7 @@
 #include "klib/AkonadiBackend.h"
 #include "ContactItemWidget.h"
 #include "SFLPhone.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 #include "CallView.h"
 #include "SFLPhoneView.h"
 
@@ -74,15 +74,6 @@ class QNumericTreeWidgetItem_hist : public QTreeWidgetItem {
       }
 };
 
-///@enum SortingMode Available sorting mode
-enum SortingMode {
-   Name              ,
-   Organisation      ,
-   Recently_used     ,
-   Group             ,
-   Department
-};
-
 ///Forward keypresses to the filter line edit
 bool KeyPressEaterC::eventFilter(QObject *obj, QEvent *event)
 {
@@ -390,13 +381,3 @@ void ContactDock::keyPressEvent(QKeyEvent* event) {
  *                                  Helpers                                  *
  *                                                                           *
  ****************************************************************************/
-
-int ContactDock::usableNumberCount(Contact* cont)
-{
-   uint result =0;
-   QStringList list = ConfigurationSkeleton::phoneTypeList();
-   foreach (Contact::PhoneNumber* pn,cont->getPhoneNumbers()) {
-      result += list.indexOf(pn->getType()) != -1;
-   }
-   return result;
-}
diff --git a/kde/src/widgets/ContactDock.h b/kde/src/widgets/ContactDock.h
index 06dbe812456297cff4f258a6c7284ebf9178caa9..c7318a0b4f6a1d0a986a0d73a5c8ce80019f412d 100644
--- a/kde/src/widgets/ContactDock.h
+++ b/kde/src/widgets/ContactDock.h
@@ -23,7 +23,9 @@
 #include <QtCore/QHash>
 #include <QtGui/QDockWidget>
 #include "CategorizedTreeWidget.h"
-#include "SortableDockCommon.h"
+#include "../klib/SortableDockCommon.h"
+#include "CallTreeItem.h"
+#include <QtGui/QTreeWidgetItem>
 
 //Qt
 class QSplitter;
@@ -57,7 +59,7 @@ class StaticEventHandler;
 class Contact;
 
 ///@class ContactDock Dock to access contacts
-class ContactDock : public QDockWidget, public SortableDockCommon
+class ContactDock : public QDockWidget, public SortableDockCommon<CallTreeItem*,QTreeWidgetItem*>
 {
    Q_OBJECT
 public:
@@ -75,9 +77,6 @@ private:
    QCheckBox*                   m_pShowHistoCK;
    QList<ContactItemWidget*>    m_Contacts;
 
-   //Helpers
-   int usableNumberCount(Contact* cont);
-
 public slots:
    virtual void keyPressEvent(QKeyEvent* event);
 
diff --git a/kde/src/widgets/HistoryDock.cpp b/kde/src/widgets/HistoryDock.cpp
index b53bfa1f78fc82c81fdaf1540548599a7b3c4ff5..6dad617dee1c63ec8ac302b95a594a6824dee54a 100644
--- a/kde/src/widgets/HistoryDock.cpp
+++ b/kde/src/widgets/HistoryDock.cpp
@@ -43,7 +43,7 @@
 #include "SFLPhone.h"
 #include "widgets/HistoryTreeItem.h"
 #include "klib/AkonadiBackend.h"
-#include "conf/ConfigurationSkeleton.h"
+#include "klib/ConfigurationSkeleton.h"
 
 //SFLPhone library
 #include "lib/sflphone_const.h"
@@ -122,7 +122,7 @@ HistoryDock::HistoryDock(QWidget* parent) : QDockWidget(parent)
    m_pFilterLE->setClearButtonShown(true);
 
    QStringList sortBy;
-   sortBy << "Date" << "Name" << "Popularity" << "Duration";
+   sortBy << "Date" << "Name" << "Popularity" << "Length";
    m_pSortByCBB->addItems(sortBy);
 
    QWidget* mainWidget = new QWidget(this);
@@ -174,15 +174,6 @@ HistoryDock::~HistoryDock()
  *                                                                           *
  ****************************************************************************/
 
-///Return the identity of the call caller
-QString HistoryDock::getIdentity(HistoryTreeItem* item)
-{
-   if (item->getName().trimmed().isEmpty())
-      return item->getPhoneNumber();
-   else
-      return item->getName();
-}
-
 
 /*****************************************************************************
  *                                                                           *
@@ -234,7 +225,7 @@ void HistoryDock::reload()
             m_pItemView->setItemWidget(item,0,hitem);
          }
          break;
-      case Name: {
+      case Name2: {
          QHash<QString,QTreeWidgetItem*> group;
          foreach(HistoryTreeItem* item, m_History) {
 //             if (!group[getIdentity(item)]) {
@@ -242,7 +233,7 @@ void HistoryDock::reload()
 //                group[getIdentity(item)]->setText(0,getIdentity(item));
 //                m_pItemView->addTopLevelItem(group[getIdentity(item)]);
 //             }
-            QNumericTreeWidgetItem* twItem = m_pItemView->addItem<QNumericTreeWidgetItem>(getIdentity(item));
+            QNumericTreeWidgetItem* twItem = m_pItemView->addItem<QNumericTreeWidgetItem>(getIdentity(item->call()));
             item->setItem(twItem);
             twItem->widget = item;
             m_pItemView->setItemWidget(twItem,0,item);
@@ -252,24 +243,24 @@ void HistoryDock::reload()
       case Popularity: {
          QHash<QString,QNumericTreeWidgetItem*> group;
          foreach(HistoryTreeItem* item, m_History) {
-            if (!group[getIdentity(item)]) {
-               group[getIdentity(item)] = m_pItemView->addCategory<QNumericTreeWidgetItem>(getIdentity(item));
-               group[getIdentity(item)]->weight = 0;
-               m_pItemView->addTopLevelItem(group[getIdentity(item)]);
+            if (!group[getIdentity(item->call())]) {
+               group[getIdentity(item->call())] = m_pItemView->addCategory<QNumericTreeWidgetItem>(getIdentity(item->call()));
+               group[getIdentity(item->call())]->weight = 0;
+               m_pItemView->addTopLevelItem(group[getIdentity(item->call())]);
             }
-            group[getIdentity(item)]->weight++;
-            group[getIdentity(item)]->setText(0,getIdentity(item)+" ("+QString::number(group[getIdentity(item)]->weight)+")");
-            QNumericTreeWidgetItem* twItem = m_pItemView->addItem<QNumericTreeWidgetItem>(getIdentity(item));
+            group[getIdentity(item->call())]->weight++;
+            group[getIdentity(item->call())]->setText(0,getIdentity(item->call())+" ("+QString::number(group[getIdentity(item->call())]->weight)+")");
+            QNumericTreeWidgetItem* twItem = m_pItemView->addItem<QNumericTreeWidgetItem>(getIdentity(item->call()));
             item->setItem(twItem);
             twItem->widget = item;
             m_pItemView->setItemWidget(twItem,0,item);
          }
          break;
       }
-      case Duration:
+      case Length:
          foreach(HistoryTreeItem* hitem, m_History) {
             QNumericTreeWidgetItem* item = m_pItemView->addItem<QNumericTreeWidgetItem>(" ");
-            item->weight = hitem->getDuration();
+            item->weight = hitem->getLength();
             hitem->setItem(item);
             m_pItemView->addTopLevelItem(item);
             m_pItemView->setItemWidget(item,0,hitem);
diff --git a/kde/src/widgets/HistoryDock.h b/kde/src/widgets/HistoryDock.h
index f82e8d022b6cece1c79dbebb1fa17440efaad0ae..51ce18b1ec07b05ff5a84f19b8b00956703db9c2 100644
--- a/kde/src/widgets/HistoryDock.h
+++ b/kde/src/widgets/HistoryDock.h
@@ -23,8 +23,10 @@
 #include <QtGui/QDockWidget>
 #include <QtGui/QTreeWidget>
 #include <QtCore/QDate>
-#include "SortableDockCommon.h"
+#include "../klib/SortableDockCommon.h"
 #include "CategorizedTreeWidget.h"
+#include "CallTreeItem.h"
+#include <QtGui/QTreeWidgetItem>
 
 //Qt
 class QTreeWidgetItem;
@@ -48,7 +50,7 @@ class HistoryTree;
 typedef QList<HistoryTreeItem*> HistoryList;
 
 ///@class HistoryDock Dock to see the previous SFLPhone calls
-class HistoryDock : public QDockWidget, public SortableDockCommon {
+class HistoryDock : public QDockWidget, public SortableDockCommon<CallTreeItem*,QTreeWidgetItem*> {
    Q_OBJECT
 
 public:
@@ -60,17 +62,6 @@ public:
    virtual ~HistoryDock();
 
 private:
-   //Enum
-   enum SortBy {
-      Date       = 0,
-      Name       = 1,
-      Popularity = 2,
-      Duration   = 3
-   };
-
-   //Getters
-   QString getIdentity(HistoryTreeItem* item);
-
    //Attributes
    HistoryTree*  m_pItemView        ;
    KLineEdit*    m_pFilterLE        ;
diff --git a/kde/src/widgets/HistoryTreeItem.cpp b/kde/src/widgets/HistoryTreeItem.cpp
index 3b6612e0c3f7f68654ddcd2a7b9057a3410259b5..656b957513ddb499a47ef3dbe46c61a44ba3a77c 100644
--- a/kde/src/widgets/HistoryTreeItem.cpp
+++ b/kde/src/widgets/HistoryTreeItem.cpp
@@ -140,7 +140,7 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone)
    m_pIconL         = new QLabel( this );
    m_pPeerNameL     = new QLabel( this );
    m_pCallNumberL   = new QLabel( this );
-   m_pDurationL     = new QLabel( this );
+   m_pLengthL     = new QLabel( this );
    m_pTimeL         = new QLabel( this );
 
    m_pIconL->setMinimumSize(70,0);
@@ -155,7 +155,7 @@ HistoryTreeItem::HistoryTreeItem(QWidget *parent ,QString phone)
    m_pMainLayout->addItem   ( verticalSpacer , 4 , 1         );
    m_pMainLayout->addWidget ( m_pPlay        , 0 , 2 , 4 , 1 );
    m_pMainLayout->addWidget ( m_pRemove      , 0 , 3 , 4 , 1 );
-   m_pMainLayout->addWidget ( m_pDurationL   , 0 , 4 , 4 , 1 );
+   m_pMainLayout->addWidget ( m_pLengthL   , 0 , 4 , 4 , 1 );
    setLayout(m_pMainLayout);
    setMinimumSize(QSize(50, 30));
    setMaximumSize(QSize(300,99999));
@@ -483,13 +483,13 @@ void HistoryTreeItem::setCall(Call *call)
    m_pTimeL->setText(QDateTime::fromTime_t(m_pItemCall->getStartTimeStamp().toUInt()).toString());
 
    int dur = m_pItemCall->getStopTimeStamp().toInt() - m_pItemCall->getStartTimeStamp().toInt();
-   m_pDurationL->setText(QString("%1").arg(dur/3600,2).trimmed()+":"+QString("%1").arg((dur%3600)/60,2).trimmed()+":"+QString("%1").arg((dur%3600)%60,2).trimmed()+" ");
+   m_pLengthL->setText(QString("%1").arg(dur/3600,2).trimmed()+":"+QString("%1").arg((dur%3600)/60,2).trimmed()+":"+QString("%1").arg((dur%3600)%60,2).trimmed()+" ");
 
    connect(m_pItemCall , SIGNAL(changed())                          , this , SLOT(updated()           ));
    updated();
 
    m_TimeStamp   = m_pItemCall->getStartTimeStamp().toUInt();
-   m_Duration    = dur;
+   m_Length    = dur;
    m_Name        = m_pItemCall->getPeerName();
    m_PhoneNumber = m_pItemCall->getPeerPhoneNumber();
 
@@ -505,8 +505,8 @@ void HistoryTreeItem::setItem(QTreeWidgetItem* item)
 
 void HistoryTreeItem::setDurWidth(uint width)
 {
-   m_pDurationL->setMaximumSize(width, 9999 );
-   m_pDurationL->setMinimumSize(width, 0    );
+   m_pLengthL->setMaximumSize(width, 9999 );
+   m_pLengthL->setMinimumSize(width, 0    );
 }
 
 
@@ -543,9 +543,9 @@ uint HistoryTreeItem::getTimeStamp()
 }
 
 ///Return the duration
-uint HistoryTreeItem::getDuration()
+uint HistoryTreeItem::getLength()
 {
-   return m_Duration;
+   return m_Length;
 }
 
 ///Return the caller name
@@ -575,6 +575,6 @@ QTreeWidgetItem* HistoryTreeItem::getItem()
 ///Get the width of the durationWidget
 uint HistoryTreeItem::getDurWidth()
 {
-   QFontMetrics fm(m_pDurationL->font());
-   return fm.width(m_pDurationL->text());
+   QFontMetrics fm(m_pLengthL->font());
+   return fm.width(m_pLengthL->text());
 }
diff --git a/kde/src/widgets/HistoryTreeItem.h b/kde/src/widgets/HistoryTreeItem.h
index 308fd0fcb8207488920fcb0469b0f75f7c2f6504..8533ed91fc09b0d48beb8097970551fc2041c073 100644
--- a/kde/src/widgets/HistoryTreeItem.h
+++ b/kde/src/widgets/HistoryTreeItem.h
@@ -65,7 +65,7 @@ class HistoryTreeItem : public QWidget
     //Getters
     Call*            call           () const;
     uint             getTimeStamp   ();
-    uint             getDuration    ();
+    uint             getLength    ();
     QString          getName        ();
     QString          getPhoneNumber ();
     QTreeWidgetItem* getItem        ();
@@ -87,7 +87,7 @@ class HistoryTreeItem : public QWidget
     QLabel*      m_pPeerNameL     ;
     QLabel*      m_pCallNumberL   ;
     QLabel*      m_pTimeL         ;
-    QLabel*      m_pDurationL     ;
+    QLabel*      m_pLengthL     ;
 
     KAction*     m_pCallAgain     ;
     KAction*     m_pAddContact    ;
@@ -101,7 +101,7 @@ class HistoryTreeItem : public QWidget
     QToolButton* m_pRemove        ;
 
     uint         m_TimeStamp      ;
-    uint         m_Duration       ;
+    uint         m_Length       ;
     QString      m_Name           ;
     QString      m_PhoneNumber    ;
     QGridLayout* m_pMainLayout    ;
diff --git a/kde/src/widgets/SortableDockCommon.cpp b/kde/src/widgets/SortableDockCommon.cpp
deleted file mode 100644
index 6740f7921e4ff6d6686ff31846d2ca5b4d1ee5e6..0000000000000000000000000000000000000000
--- a/kde/src/widgets/SortableDockCommon.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-#include "SortableDockCommon.h"
-
-//Qt
-#include <QtCore/QDateTime>
-#include <QtCore/QStringList>
-#include <QtCore/QTimer>
-
-//SFLPhone
-#include "lib/Call.h"
-#include "lib/Contact.h"
-#include "lib/CallModel.h"
-#include "SFLPhone.h"
-#include "klib/AkonadiBackend.h"
-
-///StaticEventHandler constructor
-StaticEventHandler::StaticEventHandler(QObject* parent) : QObject(parent)
-{
-   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()
-{
-   SortableDockCommon::m_slHistoryConst = {
-      "Today"                                          ,//0
-      "Yesterday"                                      ,//1
-      QDate::currentDate().addDays(-2).toString("dddd"),//2
-      QDate::currentDate().addDays(-3).toString("dddd"),//3
-      QDate::currentDate().addDays(-4).toString("dddd"),//4
-      QDate::currentDate().addDays(-5).toString("dddd"),//5
-      QDate::currentDate().addDays(-6).toString("dddd"),//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
-   };
-}
-
-QStringList         SortableDockCommon::m_slHistoryConst;
-StaticEventHandler* SortableDockCommon::m_spEvHandler = new StaticEventHandler(0);
-
-/*****************************************************************************
- *                                                                           *
- *                                  Helpers                                  *
- *                                                                           *
- ****************************************************************************/
-
-QString SortableDockCommon::timeToHistoryCategory(QDate date)
-{
-   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 m_slHistoryConst[HistoryConst::Today];
-
-   //Check for last week
-   for (int i=1;i<7;i++) {
-      if (QDate::currentDate().addDays(-i)  == date)
-         return m_slHistoryConst[i]; //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 m_slHistoryConst[i+Last_week-1]; //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 m_slHistoryConst[i+Last_month-1]; //Last_month to Twelve_months ago
-   }
-
-   if (QDate::currentDate().addYears(-1)  >= date && QDate::currentDate().addYears(-2)  < date)
-      return m_slHistoryConst[Last_year];
-
-   //Every other senario
-   return m_slHistoryConst[Very_long_time_ago];
-}
-
-///Return the list of contact from history (in order, most recently used first)
-QHash<Contact*, QDateTime> SortableDockCommon::getContactListByTime(/*ContactList list*/)
-{
-   const CallMap& history= SFLPhone::model()->getHistory();
-   QHash<Contact*, QDateTime> toReturn;
-   QSet<QString> alreadyUsed;
-   QMapIterator<QString, Call*> i(history);
-   i.toBack();
-   while (i.hasPrevious()) { //Iterate from the end up
-      i.previous();
-      (alreadyUsed.find(i.value()->getPeerPhoneNumber()) == alreadyUsed.constEnd()); //Don't ask, leave it there Elv13(2012)
-      if (alreadyUsed.find(i.value()->getPeerPhoneNumber()) == alreadyUsed.constEnd()) {
-         Contact* contact = AkonadiBackend::getInstance()->getContactByPhone(i.value()->getPeerPhoneNumber(),true);
-         if (contact && toReturn.find(contact) == toReturn.end()) {
-            toReturn[contact] = QDateTime::fromTime_t(i.value()->getStartTimeStamp().toUInt());
-         }
-         alreadyUsed << i.value()->getPeerPhoneNumber();
-      }
-   }
-   return toReturn;
-}
\ No newline at end of file