[calligra] plan/libs/ui: Remove depreciated KABC, use akonadi.

Cyrille Berger Skott cberger at cberger.net
Wed Nov 16 18:18:01 GMT 2011


Hi,

I get the following compilation error with KDE 4.4 :
http://my.cdash.org/viewBuildError.php?buildid=259809

On Wednesday 16 November 2011, Dag Andersen wrote:
> Git commit 7f6682e4db13adbd6ad7e2b7f83f02bc5b5b48bb by Dag Andersen.
> Committed on 16/11/2011 at 15:10.
> Pushed by danders into branch 'master'.
> 
> Remove depreciated KABC, use akonadi.
> 
> M  +1    -1    plan/libs/ui/CMakeLists.txt
> M  +26   -7    plan/libs/ui/kptmainprojectpanel.cpp
> M  +18   -12   plan/libs/ui/kptresourcedialog.cpp
> M  +26   -7    plan/libs/ui/kptsummarytaskgeneralpanel.cpp
> M  +26   -7    plan/libs/ui/kpttaskgeneralpanel.cpp
> 
> http://commits.kde.org/calligra/7f6682e4db13adbd6ad7e2b7f83f02bc5b5b48bb
> 
> diff --git a/plan/libs/ui/CMakeLists.txt b/plan/libs/ui/CMakeLists.txt
> index dd373ff..30dc45b 100644
> --- a/plan/libs/ui/CMakeLists.txt
> +++ b/plan/libs/ui/CMakeLists.txt
> @@ -148,7 +148,7 @@ add_definitions(-DKDGANTT_STATICLIB)
>  kde4_add_library(kplatoui SHARED ${kplatoui_LIB_SRCS} ${libkdgantt_SRCS})
> 
>  set ( KPLATO_REPORTS_LIBS koreport koproperty )
> -target_link_libraries(kplatoui ${KDE4_KABC_LIBS} ${KPLATO_REPORTS_LIBS}
> komain kplatokernel kplatomodels kdchart  ${KDE4_KHTML_LIBS}
> ${QT_QT3SUPPORT_LIBRARY} ) +target_link_libraries(kplatoui
> ${KDEPIMLIBS_AKONADI_CONTACT_LIBS} ${KPLATO_REPORTS_LIBS} komain
> kplatokernel kplatomodels kdchart  ${KDE4_KHTML_LIBS}
> ${QT_QT3SUPPORT_LIBRARY} )
> 
>  set_target_properties(kplatoui PROPERTIES VERSION
> ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION
> ${GENERIC_CALLIGRA_LIB_SOVERSION} )
> 
> diff --git a/plan/libs/ui/kptmainprojectpanel.cpp
> b/plan/libs/ui/kptmainprojectpanel.cpp index 671fcfd..2113e6f 100644
> --- a/plan/libs/ui/kptmainprojectpanel.cpp
> +++ b/plan/libs/ui/kptmainprojectpanel.cpp
> @@ -1,5 +1,5 @@
>  /* This file is part of the KDE project
> -   Copyright (C) 2004-2007 Dag Andersen <danders at get2net.dk>
> +   Copyright (C) 2004-2007, 2011 Dag Andersen <danders at get2net.dk>
> 
>     This library is free software; you can redistribute it and/or
>     modify it under the terms of the GNU Library General Public
> @@ -27,8 +27,9 @@
>  #include <kdatewidget.h>
>  #include <klocale.h>
>  #include <kmessagebox.h>
> -#include <kabc/addressee.h>
> -#include <kabc/addresseedialog.h>
> +#include <akonadi/contact/emailaddressselectiondialog.h>
> +#include <akonadi/contact/emailaddressselectionwidget.h>
> +#include <akonadi/contact/emailaddressselection.h>
> 
>  #include <kdebug.h>
> 
> @@ -124,10 +125,28 @@ void MainProjectPanel::slotCheckAllFieldsFilled()
> 
>  void MainProjectPanel::slotChooseLeader()
>  {
> -    KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
> -    if (!a.isEmpty())
> -    {
> -        leaderfield->setText(a.fullEmail());
> +    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() ) {
> +            leaderfield->setText( names.join( ", " ) );
> +        }
>      }
>  }
> 
> diff --git a/plan/libs/ui/kptresourcedialog.cpp
> b/plan/libs/ui/kptresourcedialog.cpp index 906180c..0f427f7 100644
> --- a/plan/libs/ui/kptresourcedialog.cpp
> +++ b/plan/libs/ui/kptresourcedialog.cpp
> @@ -30,8 +30,9 @@
>  #include <QSortFilterProxyModel>
>  #include <QStandardItem>
> 
> -#include <kabc/addressee.h>
> -#include <kabc/addresseedialog.h>
> +#include <akonadi/contact/emailaddressselectiondialog.h>
> +#include <akonadi/contact/emailaddressselectionwidget.h>
> +#include <akonadi/contact/emailaddressselection.h>
> 
>  #include <k3command.h>
>  #include <kdatetimewidget.h>
> @@ -193,17 +194,22 @@ void ResourceDialogImpl::slotCalculationNeeded(const
> QString&) {
> 
>  void ResourceDialogImpl::slotChooseResource()
>  {
> -    KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
> -    if (!a.isEmpty()) {
> -        nameEdit->setText(a.assembledName());
> -        emailEdit->setText(a.preferredEmail());
> -        QStringList l = a.assembledName().split(' ');
> -        QString in;
> -        QStringList::Iterator it = l.begin();
> -        for (/*int i = 0*/; it != l.end(); ++it) {
> -            in += (*it)[0];
> +    QPointer<Akonadi::EmailAddressSelectionDialog> dlg = new
> Akonadi::EmailAddressSelectionDialog( this ); +    if ( dlg->exec() && dlg
> ) {
> +        QStringList s;
> +        const Akonadi::EmailAddressSelection::List selections =
> dlg->selectedAddresses(); +        if ( ! selections.isEmpty() ) {
> +            const Akonadi::EmailAddressSelection s = selections.first();
> +            nameEdit->setText( s.name() );
> +            emailEdit->setText( s.email() );
> +            QStringList l = s.name().split(' ');
> +            QString in;
> +            QStringList::Iterator it = l.begin();
> +            for (/*int i = 0*/; it != l.end(); ++it) {
> +                in += (*it)[0];
> +            }
> +            initialsEdit->setText(in);
>          }
> -        initialsEdit->setText(in);
>      }
>  }
> 
> diff --git a/plan/libs/ui/kptsummarytaskgeneralpanel.cpp
> b/plan/libs/ui/kptsummarytaskgeneralpanel.cpp index 4cf35e3..1b55717
> 100644
> --- a/plan/libs/ui/kptsummarytaskgeneralpanel.cpp
> +++ b/plan/libs/ui/kptsummarytaskgeneralpanel.cpp
> @@ -1,5 +1,5 @@
>  /* This file is part of the KDE project
> -   Copyright (C) 2004 - 2007 Dag Andersen <danders at get2net.dk>
> +   Copyright (C) 2004 - 2007, 2011 Dag Andersen <danders at get2net.dk>
> 
>     This library is free software; you can redistribute it and/or
>     modify it under the terms of the GNU Library General Public
> @@ -29,8 +29,9 @@
>  #include <kcombobox.h>
>  #include <kdatetimewidget.h>
>  #include <klocale.h>
> -#include <kabc/addressee.h>
> -#include <kabc/addresseedialog.h>
> +#include <akonadi/contact/emailaddressselectiondialog.h>
> +#include <akonadi/contact/emailaddressselectionwidget.h>
> +#include <akonadi/contact/emailaddressselection.h>
> 
>  #include <QPushButton>
>  #include <kdebug.h>
> @@ -113,10 +114,28 @@ bool SummaryTaskGeneralPanel::ok() {
>  }
> 
>  void SummaryTaskGeneralPanel::slotChooseResponsible() {
> -    KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
> -    if (!a.isEmpty()) {
> -        leaderfield->setText(a.fullEmail());
> -        leaderfield->setFocus();
> +    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() ) {
> +            leaderfield->setText( names.join( ", " ) );
> +        }
>      }
>  }
> 
> diff --git a/plan/libs/ui/kpttaskgeneralpanel.cpp
> b/plan/libs/ui/kpttaskgeneralpanel.cpp index 0122f4c..fd31a79 100644
> --- a/plan/libs/ui/kpttaskgeneralpanel.cpp
> +++ b/plan/libs/ui/kpttaskgeneralpanel.cpp
> @@ -1,5 +1,5 @@
>  /* This file is part of the KDE project
> -   Copyright (C) 2004 - 2007 Dag Andersen <danders at get2net.dk>
> +   Copyright (C) 2004 - 2007, 2011 Dag Andersen <danders at get2net.dk>
> 
>     This library is free software; you can redistribute it and/or
>     modify it under the terms of the GNU Library General Public
> @@ -34,9 +34,10 @@
>  #include <kdatetimewidget.h>
>  #include <klocale.h>
>  #include <k3command.h>
> -#include <kabc/addressee.h>
> -#include <kabc/addresseedialog.h>
>  #include <kdatewidget.h>
> +#include <akonadi/contact/emailaddressselectiondialog.h>
> +#include <akonadi/contact/emailaddressselectionwidget.h>
> +#include <akonadi/contact/emailaddressselection.h>
> 
>  #include <qdatetime.h>
>  #include <QPushButton>
> @@ -252,10 +253,28 @@ int TaskGeneralPanelImpl::schedulingType() const
> 
>  void TaskGeneralPanelImpl::changeLeader()
>  {
> -    KABC::Addressee a = KABC::AddresseeDialog::getAddressee(this);
> -    if (!a.isEmpty())
> -    {
> -        leaderfield->setText(a.fullEmail());
> +    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() ) {
> +            leaderfield->setText( names.join( ", " ) );
> +        }
>      }
>  }


-- 
Cyrille Berger Skott



More information about the calligra-devel mailing list