[kdepimlibs] fix FTBFS against akonadi-1.8.1

Rex Dieter rdieter at fedoraproject.org
Fri Oct 26 14:23:59 UTC 2012


commit 76c4755a15f567ded949a74ef7236a389331326c
Author: Rex Dieter <rdieter at fedoraproject.org>
Date:   Fri Oct 26 09:24:03 2012 -0500

    fix FTBFS against akonadi-1.8.1

 ...equestItemDeliveryV2-that-returns-the-err.patch |  160 ++++++++++++++++++++
 kdepimlibs.spec                                    |    6 +-
 2 files changed, 165 insertions(+), 1 deletions(-)
---
diff --git a/0002-Add-a-new-requestItemDeliveryV2-that-returns-the-err.patch b/0002-Add-a-new-requestItemDeliveryV2-that-returns-the-err.patch
new file mode 100644
index 0000000..598036a
--- /dev/null
+++ b/0002-Add-a-new-requestItemDeliveryV2-that-returns-the-err.patch
@@ -0,0 +1,160 @@
+From e1861658fe4b4ec75998c5d08b26e6fbfbe0cdf9 Mon Sep 17 00:00:00 2001
+From: Andras Mantia <amantia at kde.org>
+Date: Sun, 30 Sep 2012 13:58:35 +0300
+Subject: [PATCH 02/42] Add a new requestItemDeliveryV2 that returns the error
+ message. It needed some refactoring in how the error
+ is sent through dbus. Mark some strings to be
+ translated that were not marked before.
+
+REVIEW: 106629
+(cherry picked from commit 14ec9116e0c2059c424751ca25a1ae88de972281)
+---
+ akonadi/resourcebase.cpp      | 27 +++++++++++++++++----------
+ akonadi/resourcebase.h        |  2 ++
+ akonadi/resourcescheduler.cpp | 19 ++++++++++++++-----
+ akonadi/resourcescheduler_p.h |  2 +-
+ 4 files changed, 34 insertions(+), 16 deletions(-)
+
+diff --git a/akonadi/resourcebase.cpp b/akonadi/resourcebase.cpp
+index 575dac0..e4c44cc 100644
+--- a/akonadi/resourcebase.cpp
++++ b/akonadi/resourcebase.cpp
+@@ -466,7 +466,7 @@ void ResourceBase::itemRetrieved( const Item &item )
+   Q_D( ResourceBase );
+   Q_ASSERT( d->scheduler->currentTask().type == ResourceScheduler::FetchItem );
+   if ( !item.isValid() ) {
+-    d->scheduler->currentTask().sendDBusReplies( false );
++    d->scheduler->currentTask().sendDBusReplies( i18nc( "@info", "Invalid item retrieved" ) );
+     d->scheduler->taskDone();
+     return;
+   }
+@@ -490,9 +490,9 @@ void ResourceBasePrivate::slotDeliveryDone(KJob * job)
+   Q_Q( ResourceBase );
+   Q_ASSERT( scheduler->currentTask().type == ResourceScheduler::FetchItem );
+   if ( job->error() ) {
+-    emit q->error( QLatin1String( "Error while creating item: " ) + job->errorString() );
++    emit q->error( i18nc( "@info", "Error while creating item: %1" ).arg( job->errorString() ) );
+   }
+-  scheduler->currentTask().sendDBusReplies( !job->error() );
++  scheduler->currentTask().sendDBusReplies( job->error() ? job->errorString() : QString() );
+   scheduler->taskDone();
+ }
+ 
+@@ -515,7 +515,7 @@ void ResourceBasePrivate::slotCollectionAttributesSyncDone(KJob * job)
+   Q_Q( ResourceBase );
+   Q_ASSERT( scheduler->currentTask().type == ResourceScheduler::SyncCollectionAttributes );
+   if ( job->error() ) {
+-    emit q->error( QLatin1String( "Error while updating collection: " ) + job->errorString() );
++    emit q->error( i18nc( "@info", "Error while updating collection: %1" ).arg( job->errorString() ) );
+   }
+   emit q->attributesSynchronized( scheduler->currentTask().collection.id() );
+   scheduler->taskDone();
+@@ -591,13 +591,19 @@ void ResourceBasePrivate::changeCommittedResult( KJob *job )
+   changeProcessed();
+ }
+ 
+-bool ResourceBase::requestItemDelivery( qint64 uid, const QString & remoteId,
+-                                        const QString &mimeType, const QStringList &_parts )
++bool ResourceBase::requestItemDelivery( qint64 uid, const QString &remoteId,
++                                        const QString &mimeType, const QStringList &parts )
++{
++  return requestItemDeliveryV2( uid, remoteId, mimeType, parts ).isEmpty();
++}
++
++QString ResourceBase::requestItemDeliveryV2(qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &_parts)
+ {
+   Q_D( ResourceBase );
+   if ( !isOnline() ) {
+-    emit error( i18nc( "@info", "Cannot fetch item in offline mode." ) );
+-    return false;
++    const QString errorMsg = i18nc( "@info", "Cannot fetch item in offline mode." );
++    emit error( errorMsg );
++    return errorMsg;
+   }
+ 
+   setDelayedReply( true );
+@@ -610,9 +616,10 @@ bool ResourceBase::requestItemDelivery( qint64 uid, const QString & remoteId,
+   Q_FOREACH( const QString &str, _parts )
+     parts.insert( str.toLatin1() );
+ 
+-  d->scheduler->scheduleItemFetch( item, parts, message().createReply() );
++  d->scheduler->scheduleItemFetch( item, parts, message() );
++
++  return QString();
+ 
+-  return true;
+ }
+ 
+ void ResourceBase::collectionsRetrieved( const Collection::List & collections )
+diff --git a/akonadi/resourcebase.h b/akonadi/resourcebase.h
+index d453d6c..2e112b5 100644
+--- a/akonadi/resourcebase.h
++++ b/akonadi/resourcebase.h
+@@ -627,6 +627,8 @@ class AKONADI_EXPORT ResourceBase : public AgentBase
+ 
+     bool requestItemDelivery( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
+ 
++    QString requestItemDeliveryV2( qint64 uid, const QString &remoteId, const QString &mimeType, const QStringList &parts );
++
+   private:
+     Q_DECLARE_PRIVATE( ResourceBase )
+ 
+diff --git a/akonadi/resourcescheduler.cpp b/akonadi/resourcescheduler.cpp
+index ca0611b..76e6f9d 100644
+--- a/akonadi/resourcescheduler.cpp
++++ b/akonadi/resourcescheduler.cpp
+@@ -386,12 +386,12 @@ void ResourceScheduler::setOnline(bool state)
+     TaskList& itemFetchQueue = queueForTaskType( FetchItem );
+     for ( QList< Task >::iterator it = itemFetchQueue.begin(); it != itemFetchQueue.end(); ) {
+       if ( (*it).type == FetchItem ) {
+-        (*it).sendDBusReplies( false );
++        (*it).sendDBusReplies( i18nc( "@info", "Job canceled." ) );
+         it = itemFetchQueue.erase( it );
+         if ( s_resourcetracker ) {
+           QList<QVariant> argumentList;
+           argumentList << QString::number( mCurrentTask.serial )
+-                       << QLatin1String( "Job canceled." );
++                       << i18nc( "@info", "Job canceled." );
+           s_resourcetracker->asyncCallWithArgumentList( QLatin1String( "jobEnded" ), argumentList );
+         }
+       } else {
+@@ -435,11 +435,20 @@ void ResourceScheduler::collectionRemoved( const Akonadi::Collection &collection
+   }
+ }
+ 
+-void ResourceScheduler::Task::sendDBusReplies( bool success )
++void ResourceScheduler::Task::sendDBusReplies( const QString &errorMsg )
+ {
+   Q_FOREACH( const QDBusMessage &msg, dbusMsgs ) {
+-    QDBusMessage reply( msg );
+-    reply << success;
++    QDBusMessage reply( msg.createReply() );
++    const QString methodName = msg.member();
++    if (methodName == QLatin1String("requestItemDelivery")) {
++      reply << errorMsg.isEmpty();
++    } else if (methodName == QLatin1String("requestItemDeliveryV2")) {
++      reply << errorMsg;
++    } else if (methodName.isEmpty()) {
++      continue; // unittest calls scheduleItemFetch with empty QDBusMessage
++    } else {
++      kFatal() << "Got unexpected member:" << methodName;
++    }
+     DBusConnectionPool::threadConnection().send( reply );
+   }
+ }
+diff --git a/akonadi/resourcescheduler_p.h b/akonadi/resourcescheduler_p.h
+index aadd930..16ec454 100644
+--- a/akonadi/resourcescheduler_p.h
++++ b/akonadi/resourcescheduler_p.h
+@@ -79,7 +79,7 @@ class ResourceScheduler : public QObject
+         QByteArray methodName;
+         QVariant argument;
+ 
+-        void sendDBusReplies( bool success );
++        void sendDBusReplies( const QString &errorMsg );
+ 
+         bool operator==( const Task &other ) const
+         {
+-- 
+1.7.12.1
+
diff --git a/kdepimlibs.spec b/kdepimlibs.spec
index 2621ff9..b753fe1 100644
--- a/kdepimlibs.spec
+++ b/kdepimlibs.spec
@@ -23,6 +23,8 @@ Source0: ftp://ftp.kde.org/pub/kde/%{stable}/%{version}/src/kdepimlibs-%{version
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 ## upstream patches
+# fix FTBFS against akonadi-1.8.1+
+Patch102: 0002-Add-a-new-requestItemDeliveryV2-that-returns-the-err.patch
 
 %if ! 0%{?akonadi_subpkg}
 Obsoletes: %{name}-akonadi < %{version}-%{release}
@@ -91,6 +93,8 @@ format for easy browsing.
 %prep
 %setup -q
 
+%patch102 -p1 -b .0002
+
 
 %build
 mkdir -p %{_target_platform}
@@ -265,7 +269,7 @@ update-mime-database %{_kde4_datadir}/mime >& /dev/null
 
 %changelog
 * Fri Oct 26 2012 Rex Dieter <rdieter at fedoraproject.org> 4.9.2-3
-- rebuild (akonadi)
+- fix FTBFS against akonadi-1.8.1 
 
 * Thu Oct 04 2012 Rex Dieter <rdieter at fedoraproject.org> 4.9.2-2
 - fix/update HTML docbook multilib hack (#862388)


More information about the scm-commits mailing list