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

List:       kde-commits
Subject:    [calligra/plan-kdepimlibs-dependency-dag] /: Make kdepimlibs dependency optional
From:       Dag Andersen <danders () get2net ! dk>
Date:       2012-01-26 14:31:32
Message-ID: 20120126143132.35D4DA60A6 () git ! kde ! org
[Download RAW message or body]

Git commit a1ceec90956d034cbdd7e1826af8d60e7630686b by Dag Andersen.
Committed on 26/01/2012 at 15:30.
Pushed by danders into branch 'plan-kdepimlibs-dependency-dag'.

Make kdepimlibs dependency optional

M  +0    -5    CMakeLists.txt
M  +5    -1    plan/CMakeLists.txt
M  +3    -1    plan/kptpart.cpp
M  +37   -6    plan/kpttaskdefaultpanel.cpp
M  +0    -3    plan/kptworkpackageconfigpanel.cpp
M  +0    -2    plan/libs/models/kptresourceallocationmodel.cpp
M  +1    -55   plan/libs/models/kptresourceappointmentsmodel.cpp
M  +1    -9    plan/libs/models/kptresourceappointmentsmodel.h
M  +13   -4    plan/libs/models/kptresourcemodel.cpp
M  +0    -2    plan/libs/ui/kptcalendareditor.cpp
M  +0    -3    plan/libs/ui/kpthtmlview.cpp
M  +0    -3    plan/libs/ui/kptresourceallocationeditor.cpp
M  +0    -3    plan/libs/ui/kptresourceappointmentsview.cpp
M  +1    -3    plan/libs/ui/kptresourceeditor.cpp
M  +5    -0    plan/libs/ui/kpttaskgeneralpanel.cpp
M  +2    -0    plan/workpackage/part.cpp

http://commits.kde.org/calligra/a1ceec90956d034cbdd7e1826af8d60e7630686b

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d394f9c..647cf2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -490,11 +490,6 @@ if(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT \
HAVE_REQUIRED_LCMS_VERSION)  set(SHOULD_BUILD_KRITA FALSE)
 endif(NOT EIGEN2_FOUND OR NOT EXIV2_FOUND OR NOT HAVE_REQUIRED_LCMS_VERSION)
 
-### Plan: kdepimlibs
-if(NOT KdepimLibs_FOUND)
-    set(SHOULD_BUILD_PLAN FALSE)
-endif(NOT KdepimLibs_FOUND)
-
 ### Active needs tables, stage and words
 if (NOT SHOULD_BUILD_TABLES OR NOT SHOULD_BUILD_STAGE OR NOT SHOULD_BUILD_WORDS)
     set(SHOULD_BUILD_ACTIVE FALSE)
diff --git a/plan/CMakeLists.txt b/plan/CMakeLists.txt
index 75df0f8..56404e9 100644
--- a/plan/CMakeLists.txt
+++ b/plan/CMakeLists.txt
@@ -9,6 +9,10 @@ if(KDE4_BUILD_TESTS)
     add_definitions(-DCOMPILING_TESTS)
 endif(KDE4_BUILD_TESTS)
 
+if (KdepimLibs_FOUND)
+#     add_definitions(-DKDEPIMLIBS_FOUND)
+endif (KdepimLibs_FOUND)
+
 set( KPLATO_INCLUDES
     ${CMAKE_SOURCE_DIR}/plan/libs/kernel
     ${CMAKE_SOURCE_DIR}/plan/libs/models
@@ -90,7 +94,7 @@ kde4_add_kcfg_files(plansettings_SRCS plansettings.kcfgc)
 
 kde4_add_library(planprivate SHARED ${planprivate_LIB_SRCS} ${libkdgantt_SRCS} \
${plansettings_SRCS} )  
-target_link_libraries(planprivate ${KDE4_KABC_LIBS} kplatokernel kplatomodels \
kplatoui ${KDE4_KHTML_LIBS} ${KDE4_KPIMUTILS_LIBS} komain) \
+target_link_libraries(planprivate kplatokernel kplatomodels kplatoui \
${KDE4_KHTML_LIBS} ${KDEPIMLIBS_AKONADI_CONTACT_LIBS}  komain)  
 set_target_properties(planprivate PROPERTIES VERSION ${GENERIC_CALLIGRA_LIB_VERSION} \
SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION} )  
diff --git a/plan/kptpart.cpp b/plan/kptpart.cpp
index 3737de3..10927e0 100644
--- a/plan/kptpart.cpp
+++ b/plan/kptpart.cpp
@@ -84,8 +84,10 @@ Part::Part( QWidget *parentWidget, QObject *parent, bool \
singleViewMode )  if ( locale ) {
         locale->insertCatalog( "planlibs" );
         locale->insertCatalog( "kdgantt" );
-        locale->insertCatalog( "kabc" );
         locale->insertCatalog( "timezones4" );
+#ifdef KDEPIMLIBS_FOUND
+        locale->insertCatalog( "kabc" );
+#endif
 
         m_config.setLocale( new KLocale( *locale ) );
     }
diff --git a/plan/kpttaskdefaultpanel.cpp b/plan/kpttaskdefaultpanel.cpp
index b9e7152..f8e4a45 100644
--- a/plan/kpttaskdefaultpanel.cpp
+++ b/plan/kpttaskdefaultpanel.cpp
@@ -23,8 +23,13 @@
 #include "kptmycombobox_p.h"
 #include "plansettings.h"
 
-#include <kabc/addressee.h>
-#include <kabc/addresseedialog.h>
+#ifdef KDEPIMLIBS_FOUND
+#if KDE_IS_VERSION( 4, 5, 0 )
+#include <akonadi/contact/emailaddressselectiondialog.h>
+#include <akonadi/contact/emailaddressselectionwidget.h>
+#include <akonadi/contact/emailaddressselection.h>
+#endif
+#endif
 
 #include <QDateTime>
 #include <QDateTimeEdit>
@@ -51,6 +56,10 @@ ConfigTaskPanelImpl::ConfigTaskPanelImpl(QWidget *p )
     kcfg_ExpectedEstimate->setMinimumUnit( \
                (Duration::Unit)KPlatoSettings::self()->minimumDurationUnit() );
     kcfg_ExpectedEstimate->setMaximumUnit( \
(Duration::Unit)KPlatoSettings::self()->maximumDurationUnit() );  
+#ifndef KDEPIMLIBS_FOUND
+    chooseLeader.hide();
+#endif
+
     initDescription();
 
     connect(chooseLeader, SIGNAL(clicked()), SLOT(changeLeader()));
@@ -109,11 +118,33 @@ void ConfigTaskPanelImpl::initDescription()
 
 void ConfigTaskPanelImpl::changeLeader()
 {
-    KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
-    if (!a.isEmpty())
-    {
-        kcfg_Leader->setText(a.fullEmail());
+#ifdef KDEPIMLIBS_FOUND
+#if KDE_IS_VERSION( 4, 5, 0 )
+    QPointer<Akonadi::EmailAddressSelectionDialog> dlg = new \
Akonadi::EmailAddressSelectionDialog( this ); +    if ( dlg->exec() && dlg ) {
+        QStringList names;
+        const Akonadi::EmailAddressSelection::List selections = \
dlg->selectedAddresses(); +        foreach ( const Akonadi::EmailAddressSelection \
&selection, selections ) { +            QString s = selection.name();
+            if ( ! selection.email().isEmpty() ) {
+                if ( ! selection.name().isEmpty() ) {
+                    s += " <";
+                }
+                s += selection.email();
+                if ( ! selection.name().isEmpty() ) {
+                    s += ">";
+                }
+                if ( ! s.isEmpty() ) {
+                    names << s;
+                }
+            }
+        }
+        if ( ! names.isEmpty() ) {
+            kcfg_Leader->setText( names.join( ", " ) );
+        }
     }
+#endif
+#endif
 }
 
 void ConfigTaskPanelImpl::startDateTimeChanged( const QDateTime &dt )
diff --git a/plan/kptworkpackageconfigpanel.cpp b/plan/kptworkpackageconfigpanel.cpp
index 664f26b..99996ad 100644
--- a/plan/kptworkpackageconfigpanel.cpp
+++ b/plan/kptworkpackageconfigpanel.cpp
@@ -23,9 +23,6 @@
 #include "kptmycombobox_p.h"
 #include "plansettings.h"
 
-#include <kabc/addressee.h>
-#include <kabc/addresseedialog.h>
-
 #include <QDateTime>
 #include <QDateTimeEdit>
 #include <QComboBox>
diff --git a/plan/libs/models/kptresourceallocationmodel.cpp \
b/plan/libs/models/kptresourceallocationmodel.cpp index 1664987..d318d96 100644
--- a/plan/libs/models/kptresourceallocationmodel.cpp
+++ b/plan/libs/models/kptresourceallocationmodel.cpp
@@ -40,8 +40,6 @@
 #include <klocale.h>
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
 
 #include <kdebug.h>
 
diff --git a/plan/libs/models/kptresourceappointmentsmodel.cpp \
b/plan/libs/models/kptresourceappointmentsmodel.cpp index 1386172..814356c 100644
--- a/plan/libs/models/kptresourceappointmentsmodel.cpp
+++ b/plan/libs/models/kptresourceappointmentsmodel.cpp
@@ -1,5 +1,5 @@
 /* This file is part of the KDE project
-   Copyright (C) 2007 Dag Andersen danders@get2net>
+   Copyright (C) 2007, 2011 Dag Andersen danders@get2net>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -34,7 +34,6 @@
 #include "kptdatetime.h"
 
 #include <QDate>
-#include <QMimeData>
 #include <QList>
 #include <QObject>
 #include <QStringList>
@@ -43,9 +42,6 @@
 #include <kglobal.h>
 #include <klocale.h>
 
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-
 #include "kdganttglobal.h"
 
 #include <kdebug.h>
@@ -1078,56 +1074,6 @@ void ResourceAppointmentsItemModel::slotResourceGroupChanged( \
ResourceGroup *res  }
 }
 
-Qt::DropActions ResourceAppointmentsItemModel::supportedDropActions() const
-{
-    return Qt::CopyAction;
-}
-
-
-QStringList ResourceAppointmentsItemModel::mimeTypes() const
-{
-    return QStringList() << "text/x-vcard";
-}
-
-bool ResourceAppointmentsItemModel::dropMimeData( const QMimeData *data, \
                Qt::DropAction action, int row, int column, const QModelIndex &parent \
                )
-{
-    kDebug()<<row<<" p:"<<parent.row()<<endl;
-    if (action == Qt::IgnoreAction)
-        return true;
-
-    if (column > 0) {
-        return false;
-    }
-    //kDebug()<<row<<" p:"<<parent.row()<<endl;
-    ResourceGroup *g = 0;
-    if ( parent.isValid() ) {
-        g = resourcegroup( parent );
-    } else {
-        g = resourcegroup( index( row, column, parent ) );
-    }
-    if ( g == 0 ) {
-        return false;
-    }
-    //kDebug()<<data->formats()<<endl;
-    MacroCommand *m = 0;
-    if ( data->hasFormat( "text/x-vcard" ) ) {
-        QByteArray vcard = data->data( "text/x-vcard" );
-        KABC::VCardConverter vc;
-        KABC::Addressee::List lst = vc.parseVCards( vcard );
-        foreach( const KABC::Addressee &a, lst ) {
-            if ( m == 0 ) m = new MacroCommand( i18ncp( "(qtundo-format)", "Add \
                resource from address book", "Add %1 resources from address book", \
                lst.count() ) );
-            Resource *r = new Resource();
-            r->setName( a.formattedName() );
-            r->setEmail( a.preferredEmail() );
-            m->addCommand( new AddResourceCmd( g, r ) );
-        }
-    }
-    if ( m ) {
-        emit executeCommand( m );
-    }
-    return true;
-}
-
 //-------------------------------------------------------
 class ResourceAppointmentsRowModel::Private
 {
diff --git a/plan/libs/models/kptresourceappointmentsmodel.h \
b/plan/libs/models/kptresourceappointmentsmodel.h index f43fa17..099e4a9 100644
--- a/plan/libs/models/kptresourceappointmentsmodel.h
+++ b/plan/libs/models/kptresourceappointmentsmodel.h
@@ -1,5 +1,5 @@
  /* This file is part of the KDE project
-   Copyright (C) 2005 - 2007 Dag Andersen <danders@get2net>
+   Copyright (C) 2005 - 2007, 2011 Dag Andersen <danders@get2net>
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -25,10 +25,6 @@
 #include <kptitemmodelbase.h>
 #include "kpteffortcostmap.h"
 
-class QDropEvent;
-class QDragMoveEvent;
-class QDragEnterEvent;
-
 
 namespace KPlato
 {
@@ -75,10 +71,6 @@ public:
 
     virtual QVariant headerData( int section, Qt::Orientation orientation, int role \
= Qt::DisplayRole ) const;  
-    virtual QStringList mimeTypes () const;
-    virtual Qt::DropActions supportedDropActions() const;
-    virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int \
                row, int column, const QModelIndex &parent );
-  
 
     QObject *object( const QModelIndex &index ) const;
     Node *node( const QModelIndex &index ) const;
diff --git a/plan/libs/models/kptresourcemodel.cpp \
b/plan/libs/models/kptresourcemodel.cpp index 3e7deae..c0c2de3 100644
--- a/plan/libs/models/kptresourcemodel.cpp
+++ b/plan/libs/models/kptresourcemodel.cpp
@@ -41,13 +41,16 @@
 #include <klocale.h>
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
 #include <kio/netaccess.h>
 #include <kmimetype.h>
 #include <kio/job.h>
 #include <kdebug.h>
 
+#ifdef KDEPIMLIBS_FOUND
+#include <kabc/addressee.h>
+#include <kabc/vcardconverter.h>
+#endif
+
 namespace KPlato
 {
 
@@ -1188,9 +1191,9 @@ Qt::DropActions ResourceItemModel::supportedDropActions() const
 
 bool ResourceItemModel::dropAllowed( const QModelIndex &index, int \
dropIndicatorPosition, const QMimeData *data )  {
-//     kDebug()<<index<<data;
     Q_UNUSED(data);
-    //kDebug()<<index;
+
+    //kDebug()<<index<<data;
     // TODO: if internal, don't allow dropping on my own parent
     switch ( dropIndicatorPosition ) {
         case ItemModelBase::OnItem:
@@ -1204,9 +1207,11 @@ bool ResourceItemModel::dropAllowed( const QModelIndex &index, \
int dropIndicator  QStringList ResourceItemModel::mimeTypes() const
 {
     return QStringList()
+#ifdef KDEPIMLIBS_FOUND
             << "text/x-vcard"
             << "text/directory"
             << "text/uri-list"
+#endif
             << "application/x-vnd.kde.plan.resourceitemmodel.internal";
 }
 
@@ -1243,6 +1248,7 @@ void ResourceItemModel::slotJobFinished( KJob *job )
 
 bool ResourceItemModel::createResources( ResourceGroup *group, const QByteArray \
&data )  {
+#ifdef KDEPIMLIBS_FOUND
     KABC::VCardConverter vc;
     KABC::Addressee::List lst = vc.parseVCards( data );
     MacroCommand *m = new MacroCommand( i18ncp( "(qtundo-format)", "Add resource \
from address book", "Add %1 resources from address book", lst.count() ) ); @@ -1262,6 \
+1268,9 @@ bool ResourceItemModel::createResources( ResourceGroup *group, const \
QByteArray  }
     emit executeCommand( m );
     return true;
+#else
+    return false;
+#endif
 }
 
 bool ResourceItemModel::dropMimeData( const QMimeData *data, Qt::DropAction action, \
                int row, int column, const QModelIndex &parent )
diff --git a/plan/libs/ui/kptcalendareditor.cpp b/plan/libs/ui/kptcalendareditor.cpp
index d3d282d..82adb03 100644
--- a/plan/libs/ui/kptcalendareditor.cpp
+++ b/plan/libs/ui/kptcalendareditor.cpp
@@ -48,8 +48,6 @@
 #include <kxmlguifactory.h>
 #include <ksystemtimezone.h>
 #include <ktimezone.h>
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
 #include <kmenu.h>
 
 #include <kdebug.h>
diff --git a/plan/libs/ui/kpthtmlview.cpp b/plan/libs/ui/kpthtmlview.cpp
index 180c2c1..99f5ee3 100644
--- a/plan/libs/ui/kpthtmlview.cpp
+++ b/plan/libs/ui/kpthtmlview.cpp
@@ -35,9 +35,6 @@
 #include <kxmlguifactory.h>
 #include <khtmlview.h>
 
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-
 #include <kdebug.h>
 
 namespace KPlato
diff --git a/plan/libs/ui/kptresourceallocationeditor.cpp \
b/plan/libs/ui/kptresourceallocationeditor.cpp index 4868acc..ae802b7 100644
--- a/plan/libs/ui/kptresourceallocationeditor.cpp
+++ b/plan/libs/ui/kptresourceallocationeditor.cpp
@@ -46,9 +46,6 @@
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
 
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-
 #include <kdebug.h>
 
 namespace KPlato
diff --git a/plan/libs/ui/kptresourceappointmentsview.cpp \
b/plan/libs/ui/kptresourceappointmentsview.cpp index d891603..7968f80 100644
--- a/plan/libs/ui/kptresourceappointmentsview.cpp
+++ b/plan/libs/ui/kptresourceappointmentsview.cpp
@@ -46,9 +46,6 @@
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
 
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-
 #include <kdebug.h>
 
 namespace KPlato
diff --git a/plan/libs/ui/kptresourceeditor.cpp b/plan/libs/ui/kptresourceeditor.cpp
index 5e94cbc..49c6980 100644
--- a/plan/libs/ui/kptresourceeditor.cpp
+++ b/plan/libs/ui/kptresourceeditor.cpp
@@ -46,9 +46,6 @@
 #include <kactioncollection.h>
 #include <kxmlguifactory.h>
 
-#include <kabc/addressee.h>
-#include <kabc/vcardconverter.h>
-
 #include <kdebug.h>
 
 namespace KPlato
@@ -74,6 +71,7 @@ ResourceTreeView::ResourceTreeView( QWidget *parent )
 
 void ResourceTreeView::slotDropAllowed( const QModelIndex &index, int \
dropIndicatorPosition, QDragMoveEvent *event )  {
+    event->ignore();
     if ( model()->dropAllowed( index, dropIndicatorPosition, event->mimeData() ) ) {
         event->accept();
     }
diff --git a/plan/libs/ui/kpttaskgeneralpanel.cpp \
b/plan/libs/ui/kpttaskgeneralpanel.cpp index f804ae8..6453b19 100644
--- a/plan/libs/ui/kpttaskgeneralpanel.cpp
+++ b/plan/libs/ui/kpttaskgeneralpanel.cpp
@@ -36,11 +36,13 @@
 #include <kdatewidget.h>
 
 #include <kdeversion.h>
+#ifdef KDEPIMLIBS_FOUND
 #if KDE_IS_VERSION( 4, 5, 0 )
 #include <akonadi/contact/emailaddressselectiondialog.h>
 #include <akonadi/contact/emailaddressselectionwidget.h>
 #include <akonadi/contact/emailaddressselection.h>
 #endif
+#endif
 
 #include <qdatetime.h>
 #include <QPushButton>
@@ -224,9 +226,12 @@ TaskGeneralPanelImpl::TaskGeneralPanelImpl(QWidget *p, const \
char *n)  
     setObjectName(n);
     setupUi(this);
+
+#ifndef KDEPIMLIBS_FOUND
 #if ! KDE_IS_VERSION( 4, 5, 0 )
     chooseLeader->hide();
 #endif
+#endif
 
     connect(namefield, SIGNAL(textChanged(const QString &)), \
                SLOT(checkAllFieldsFilled()));
     connect(leaderfield, SIGNAL(textChanged(const QString &)), \
                SLOT(checkAllFieldsFilled()));
diff --git a/plan/workpackage/part.cpp b/plan/workpackage/part.cpp
index 37bf04d..a7f81dd 100644
--- a/plan/workpackage/part.cpp
+++ b/plan/workpackage/part.cpp
@@ -355,7 +355,9 @@ Part::Part( QWidget *parentWidget, QObject *parent, const \
QVariantList & /*args*  KLocale *locale = KGlobal::locale();
     if ( locale ) {
         locale->insertCatalog( "planlibs" );
+#ifdef KDEPIMLIBS_FOUND
         locale->insertCatalog( "kabc" );
+#endif
     }
     if ( isReadWrite() ) {
         setXMLFile( "planwork.rc" );


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

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