[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kaddressbook
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2010-07-19 6:23:28
Message-ID: 20100719062328.7F37CAC7E9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1151563 by tokoe:

Add Grantlee based contact formatter

If Grantlee is available, KAddressBook will use a Grantlee based
contact formatter for the contact viewer. This allows usage of custom
viewer layouts (e.g. for desktop and mobile versions).


 M  +15 -0     CMakeLists.txt  
 A             grantleecontactformatter.cpp   [License: LGPL (v2+)]
 A             grantleecontactformatter.h   [License: LGPL (v2+)]
 M  +12 -0     mainwidget.cpp  
 A             viewertemplates (directory)  
 A             viewertemplates/contact.html  
 A             viewertemplates/contact_embedded.html  
 A             viewertemplates/row.html  


--- trunk/KDE/kdepim/kaddressbook/CMakeLists.txt #1151562:1151563
@@ -4,6 +4,7 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/xxport/shared
     ${QT_QTDBUS_INCLUDE_DIR}
     ${Boost_INCLUDE_DIR}
+    ${Grantlee_INCLUDE_DIRS}
 )
 
 set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
@@ -63,6 +64,12 @@
   ${kaddressbook_xxport_SRCS}
 )
 
+if (Grantlee_FOUND)
+  set( kaddressbook_LIB_SRCS ${kaddressbook_LIB_SRCS}
+       grantleecontactformatter.cpp )
+  add_definitions(-DGRANTLEE_FOUND)
+endif (Grantlee_FOUND)
+
 kde4_add_kcfg_files(kaddressbook_LIB_SRCS settings.kcfgc)
 kde4_add_library(kaddressbookprivate SHARED ${kaddressbook_LIB_SRCS})
 target_link_libraries(kaddressbookprivate kdepim akonadi_next ${KDE4_KDEUI_LIBS} \
${KDEPIMLIBS_AKONADI_LIBS} ${KDEPIMLIBS_KABC_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} \
${KDEPIMLIBS_KLDAP_LIBS} ${KDE4_KCMUTILS_LIBS} ) @@ -71,6 +78,9 @@
   target_link_libraries(kaddressbookprivate ${QGPGME_LIBRARIES})
 endif(QGPGME_FOUND)
 
+if (Grantlee_FOUND)
+  target_link_libraries(kaddressbookprivate ${Grantlee_CORE_LIBRARIES})
+endif (Grantlee_FOUND)
 
 set_target_properties(kaddressbookprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} \
SOVERSION ${GENERIC_LIB_SOVERSION} )  install(TARGETS kaddressbookprivate \
${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) @@ -106,3 +116,8 @@
 install(TARGETS kaddressbookpart DESTINATION ${PLUGIN_INSTALL_DIR})
 install(FILES kaddressbookpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
 
+install( FILES
+         viewertemplates/contact.html
+         viewertemplates/contact_embedded.html
+         viewertemplates/row.html
+         DESTINATION ${DATA_INSTALL_DIR}/kaddressbook/viewertemplates/default/)
--- trunk/KDE/kdepim/kaddressbook/mainwidget.cpp #1151562:1151563
@@ -30,6 +30,10 @@
 #include "standardcontactactionmanager.h"
 #include "xxportmanager.h"
 
+#ifdef GRANTLEE_FOUND
+#include "grantleecontactformatter.h"
+#endif
+
 #include <akonadi/akonadi_next/collectionselectionproxymodel.h>
 #include <akonadi/akonadi_next/etmstatesaver.h>
 #include <akonadi/collectionfilterproxymodel.h>
@@ -57,6 +61,7 @@
 #include <klineedit.h>
 #include <klocale.h>
 #include <kselectionproxymodel.h>
+#include <kstandarddirs.h>
 #include <ktextbrowser.h>
 #include <ktoggleaction.h>
 #include <ktoolbar.h>
@@ -375,6 +380,13 @@
   Akonadi::ContactDefaultActions *actions = new Akonadi::ContactDefaultActions( this \
);  actions->connectToView( mContactDetails );
   actions->connectToView( mContactGroupDetails );
+
+#ifdef GRANTLEE_FOUND
+ Akonadi::GrantleeContactFormatter *formatter =
+       new Akonadi::GrantleeContactFormatter( KStandardDirs::locate( "data", \
QLatin1String( "kaddressbook/viewertemplates/" ) ) ); +
+ mContactDetails->setContactFormatter( formatter );
+#endif
 }
 
 void MainWidget::setupActions( KActionCollection *collection )


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic