[kdepimlibs] cherry-pick a few upstream patches (#815047)

Rex Dieter rdieter at fedoraproject.org
Mon Nov 26 16:17:51 UTC 2012


commit 076ba53c41f31dc64d7d9845610ced74a2fc4771
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Mon Nov 26 10:17:59 2012 -0600

    cherry-pick a few upstream patches (#815047)

 ...o-html-image-when-image-has-specific-size.patch |   32 +++++
 ...ic-fallback-for-SSL-TLS-protocol-versions.patch |  139 ++++++++++++++++++++
 ...accept-richtext-it-stores-data-as-plainte.patch |   24 ++++
 ...-Fix-error-reporting-by-Albert-Astals-Cid.patch |   55 ++++++++
 ...online-offline-setting-requested-by-a-cli.patch |  130 ++++++++++++++++++
 kdepimlibs.spec                                    |   17 +++-
 6 files changed, 396 insertions(+), 1 deletions(-)
---
diff --git a/0001-Fix-reply-to-html-image-when-image-has-specific-size.patch b/0001-Fix-reply-to-html-image-when-image-has-specific-size.patch
new file mode 100644
index 0000000..b1b4d86
--- /dev/null
+++ b/0001-Fix-reply-to-html-image-when-image-has-specific-size.patch
@@ -0,0 +1,32 @@
+From d923d8298981b33da8348738a8a6537a69a49572 Mon Sep 17 00:00:00 2001
+From: Montel Laurent <montel at kde.org>
+Date: Fri, 9 Nov 2012 17:07:27 +0100
+Subject: [PATCH 1/8] Fix reply to html + image (when image has specific size)
+
+---
+ kpimtextedit/textedit.cpp | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/kpimtextedit/textedit.cpp b/kpimtextedit/textedit.cpp
+index c7f9354..ecc77fe 100644
+--- a/kpimtextedit/textedit.cpp
++++ b/kpimtextedit/textedit.cpp
+@@ -434,7 +434,14 @@ void TextEdit::loadImage ( const QImage &image, const QString &matchName,
+             cursor.removeSelectedText();
+             document()->addResource( QTextDocument::ImageResource,
+                                      QUrl( resourceName ), QVariant( image ) );
+-            cursor.insertImage( resourceName );
++            QTextImageFormat format;
++            format.setName( resourceName );
++            if ( (imageFormat.width()!=0) && (imageFormat.height()!=0) ) {
++              format.setWidth( imageFormat.width() );
++              format.setHeight( imageFormat.height() );
++            }
++            cursor.insertImage( format );
++
+ 
+             // The textfragment iterator is now invalid, restart from the beginning
+             // Take care not to replace the same fragment again, or we would be in
+-- 
+1.8.0
+
diff --git a/0003-automatic-fallback-for-SSL-TLS-protocol-versions.patch b/0003-automatic-fallback-for-SSL-TLS-protocol-versions.patch
new file mode 100644
index 0000000..8464d18
--- /dev/null
+++ b/0003-automatic-fallback-for-SSL-TLS-protocol-versions.patch
@@ -0,0 +1,139 @@
+From d8eeb4cb0c0c7aa3600216b9409750f7adaa3131 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens at rwth-aachen.de>
+Date: Sun, 11 Nov 2012 20:18:18 +0100
+Subject: [PATCH 3/8] automatic fallback for SSL/TLS protocol versions
+
+Unfortunately some servers are to dump to fall back to the highest
+supported version when the connection is initiated with e.g. an
+TLS 1.2 ClientHello. This happens with openSSL 1.0.1 on the client side.
+
+The server setup dialog is affected as well and will return encryption
+unsupported for the server, this is not fixed yet.
+
+BUG: 306964
+REVIEW: 107099
+FIXED-IN: 4.9.4
+FIXED-IN: 4.10.0
+
+Conflicts:
+	kimap/sessionthread.cpp
+---
+ kimap/sessionthread.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++-----
+ kimap/sessionthread_p.h |  4 ++++
+ 2 files changed, 49 insertions(+), 5 deletions(-)
+
+diff --git a/kimap/sessionthread.cpp b/kimap/sessionthread.cpp
+index 2976c34..4333b2a 100644
+--- a/kimap/sessionthread.cpp
++++ b/kimap/sessionthread.cpp
+@@ -36,8 +36,9 @@ static const int _kimap_socketErrorTypeId = qRegisterMetaType<KTcpSocket::Error>
+ static const int _kimap_sslErrorUiData = qRegisterMetaType<KSslErrorUiData>();
+ 
+ SessionThread::SessionThread( const QString &hostName, quint16 port, Session *parent )
+-  : QThread(), m_hostName(hostName), m_port(port),
+-    m_session(parent), m_socket(0), m_stream(0), m_encryptedMode(false)
++  : QThread(), m_hostName( hostName ), m_port( port ),
++    m_session( parent ), m_socket( 0 ), m_stream( 0 ), m_encryptedMode( false ),
++    triedSslVersions( 0 ), doSslFallback( false )
+ {
+   // Yeah, sounds weird, but QThread object is linked to the parent
+   // thread not to itself, and I'm too lazy to introduce yet another
+@@ -160,11 +161,11 @@ void SessionThread::run()
+            this, SLOT(readMessage()), Qt::QueuedConnection );
+ 
+   connect( m_socket, SIGNAL(disconnected()),
+-           m_session, SLOT(socketDisconnected()) );
++           this, SLOT(socketDisconnected()) );
+   connect( m_socket, SIGNAL(connected()),
+            m_session, SLOT(socketConnected()) );
+   connect( m_socket, SIGNAL(error(KTcpSocket::Error)),
+-           m_session, SLOT(socketError()) );
++           this, SLOT(socketError()) );
+   connect( m_socket, SIGNAL(bytesWritten(qint64)),
+            m_session, SLOT(socketActivity()) );
+   if ( m_socket->metaObject()->indexOfSignal("encryptedBytesWritten(qint64)" ) > -1 ) {
+@@ -188,12 +189,50 @@ void SessionThread::startSsl(const KTcpSocket::SslVersion &version)
+ {
+   QMutexLocker locker(&m_mutex);
+ 
+-  m_socket->setAdvertisedSslVersion(version);
++  if ( version == KTcpSocket::AnySslVersion ) {
++    doSslFallback = true;
++    if ( m_socket->advertisedSslVersion() == KTcpSocket::UnknownSslVersion ) {
++      m_socket->setAdvertisedSslVersion( KTcpSocket::AnySslVersion );
++    } else if ( !( triedSslVersions & KTcpSocket::TlsV1 ) ) {
++      triedSslVersions |= KTcpSocket::TlsV1;
++      m_socket->setAdvertisedSslVersion( KTcpSocket::TlsV1 );
++    } else if ( !( triedSslVersions & KTcpSocket::SslV3 ) ) {
++      triedSslVersions |= KTcpSocket::SslV3;
++      m_socket->setAdvertisedSslVersion( KTcpSocket::SslV3 );
++    } else if ( !( triedSslVersions & KTcpSocket::SslV2 ) ) {
++      triedSslVersions |= KTcpSocket::SslV2;
++      m_socket->setAdvertisedSslVersion( KTcpSocket::SslV2 );
++      doSslFallback = false;
++    }
++  } else {
++    m_socket->setAdvertisedSslVersion( version );
++  }
++
+   m_socket->ignoreSslErrors();
+   connect(m_socket, SIGNAL(encrypted()), this, SLOT(sslConnected()));
+   m_socket->startClientEncryption();
+ }
+ 
++void SessionThread::socketDisconnected()
++{
++  if ( doSslFallback ) {
++    reconnect();
++  } else {
++    QMetaObject::invokeMethod( m_session, "socketDisconnected" );
++  }
++}
++
++void SessionThread::socketError()
++{
++  QMutexLocker locker( &m_mutex );
++
++  if ( doSslFallback ) {
++    m_socket->disconnectFromHost();
++  } else {
++    QMetaObject::invokeMethod( m_session, "socketError" );
++  }
++}
++
+ void SessionThread::sslConnected()
+ {
+   QMutexLocker locker(&m_mutex);
+@@ -209,6 +248,7 @@ void SessionThread::sslConnected()
+      KSslErrorUiData errorData(m_socket);
+      emit sslError(errorData);
+   } else {
++    doSslFallback = false;
+     kDebug() << "TLS negotiation done.";
+     m_encryptedMode = true;
+     emit encryptionNegotiationResult(true, m_socket->negotiatedSslVersion());
+diff --git a/kimap/sessionthread_p.h b/kimap/sessionthread_p.h
+index 672c418..5e83102 100644
+--- a/kimap/sessionthread_p.h
++++ b/kimap/sessionthread_p.h
+@@ -64,6 +64,8 @@ class SessionThread : public QThread
+     void sslConnected();
+     void sslErrorHandlerResponse(bool result);
+     void doCloseSocket();
++    void socketError();
++    void socketDisconnected();
+ 
+   private:
+     QString m_hostName;
+@@ -78,6 +80,8 @@ class SessionThread : public QThread
+     QMutex m_mutex;
+ 
+     bool m_encryptedMode;
++    KTcpSocket::SslVersions triedSslVersions;
++    bool doSslFallback;
+ };
+ 
+ }
+-- 
+1.8.0
+
diff --git a/0004-Note-don-t-accept-richtext-it-stores-data-as-plainte.patch b/0004-Note-don-t-accept-richtext-it-stores-data-as-plainte.patch
new file mode 100644
index 0000000..93270e1
--- /dev/null
+++ b/0004-Note-don-t-accept-richtext-it-stores-data-as-plainte.patch
@@ -0,0 +1,24 @@
+From 2f8cbcaea2edd996d8432cfb961fc551f181b8ec Mon Sep 17 00:00:00 2001
+From: Montel Laurent <montel at kde.org>
+Date: Wed, 14 Nov 2012 09:50:24 +0100
+Subject: [PATCH 4/8] Note don't accept richtext (it stores data as plaintext)
+
+---
+ akonadi/contact/editor/contacteditorwidget.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/akonadi/contact/editor/contacteditorwidget.cpp b/akonadi/contact/editor/contacteditorwidget.cpp
+index 2cad304..7e423bf 100644
+--- a/akonadi/contact/editor/contacteditorwidget.cpp
++++ b/akonadi/contact/editor/contacteditorwidget.cpp
+@@ -464,6 +464,7 @@ void ContactEditorWidget::Private::initGuiNotesTab()
+   mTabWidget->addTab( widget, i18nc( "@title:tab", "Notes" ) );
+ 
+   mNotesWidget = new KTextEdit;
++  mNotesWidget->setAcceptRichText(false);
+   layout->addWidget( mNotesWidget );
+ }
+ 
+-- 
+1.8.0
+
diff --git a/0005-Fix-error-reporting-by-Albert-Astals-Cid.patch b/0005-Fix-error-reporting-by-Albert-Astals-Cid.patch
new file mode 100644
index 0000000..397287c
--- /dev/null
+++ b/0005-Fix-error-reporting-by-Albert-Astals-Cid.patch
@@ -0,0 +1,55 @@
+From 45dd31840a4ea2f4464adefe45f2e13ecf656c58 Mon Sep 17 00:00:00 2001
+From: Montel Laurent <montel at kde.org>
+Date: Fri, 16 Nov 2012 08:07:04 +0100
+Subject: [PATCH 5/8] Fix error reporting by 	Albert Astals Cid
+
+Thanks
+CCMAIL: <aacid at kde.org>
+CCMAIL: kde-pim at kde.org
+---
+ akonadi/contact/editor/geoeditwidget.cpp | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/akonadi/contact/editor/geoeditwidget.cpp b/akonadi/contact/editor/geoeditwidget.cpp
+index d26832e..21570ef 100644
+--- a/akonadi/contact/editor/geoeditwidget.cpp
++++ b/akonadi/contact/editor/geoeditwidget.cpp
+@@ -405,6 +405,12 @@ void GeoDialog::updateInputs( ExceptType type )
+   mLongSeconds->blockSignals( true );
+   mLongDirection->blockSignals( true );
+ 
++  if ( !( type & ExceptDecimal ) ) {
++    mLatitude->setValue( mCoordinates.latitude() );
++    mLongitude->setValue( mCoordinates.longitude() );
++  }
++
++
+   if ( !(type & ExceptSexagesimal) ) {
+     int degrees, minutes, seconds;
+     double latitude = mCoordinates.latitude();
+@@ -421,7 +427,7 @@ void GeoDialog::updateInputs( ExceptType type )
+     mLatMinutes->setValue( minutes );
+     mLatSeconds->setValue( seconds );
+ 
+-    mLatDirection->setCurrentIndex( mLatitude < 0 ? 1 : 0 );
++    mLatDirection->setCurrentIndex( mLatitude->value() < 0 ? 1 : 0 );
+ 
+     degrees = (int)( longitude * 1 );
+     minutes = (int)( ( longitude - degrees ) * 60 );
+@@ -430,12 +436,7 @@ void GeoDialog::updateInputs( ExceptType type )
+     mLongDegrees->setValue( degrees );
+     mLongMinutes->setValue( minutes );
+     mLongSeconds->setValue( seconds );
+-    mLongDirection->setCurrentIndex( mLongitude < 0 ? 1 : 0 );
+-  }
+-
+-  if ( !(type & ExceptDecimal) ) {
+-    mLatitude->setValue( mCoordinates.latitude() );
+-    mLongitude->setValue( mCoordinates.longitude() );
++    mLongDirection->setCurrentIndex( mLongitude->value() < 0 ? 1 : 0 );
+   }
+ 
+   if ( !(type & ExceptCity) ) {
+-- 
+1.8.0
+
diff --git a/0007-Honour-the-online-offline-setting-requested-by-a-cli.patch b/0007-Honour-the-online-offline-setting-requested-by-a-cli.patch
new file mode 100644
index 0000000..44a2eaa
--- /dev/null
+++ b/0007-Honour-the-online-offline-setting-requested-by-a-cli.patch
@@ -0,0 +1,130 @@
+From 5a3856c2e51f4b11ec374b3ad4214ae008e1be5e Mon Sep 17 00:00:00 2001
+From: Andras Mantia <amantia at kde.org>
+Date: Sun, 25 Nov 2012 17:38:18 +0200
+Subject: [PATCH 7/8] Honour the online/offline setting requested by a client
+ application in every case. Previously it could happen
+ that the resources were set to offline mode, but due to
+ an event, like resume from suspend, or network
+ reconnect, the resource went online. This had bad
+ side-effects, like downloading mails while KMail was in
+ offline mode.
+
+Yes, it is a bug, that was there even in KMail1 times. :)
+I CC to other bugs about offline mode, although I'm not confident it fixes those problems.
+Feel free to report success/failure for those cases.
+
+FIXED-IN: 4.9.4
+BUG: 195300
+CCBUG: 300086
+CCBUG: 298956
+(cherry picked from commit 75a744dd473e57285e417456a2295400b95f9ac2)
+
+Conflicts:
+	akonadi/agentbase.cpp
+---
+ akonadi/agentbase.cpp | 22 ++++++++++++++++------
+ akonadi/agentbase.h   |  1 +
+ akonadi/agentbase_p.h |  1 +
+ 3 files changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/akonadi/agentbase.cpp b/akonadi/agentbase.cpp
+index 83b637c..c6f8e62 100644
+--- a/akonadi/agentbase.cpp
++++ b/akonadi/agentbase.cpp
+@@ -170,6 +170,7 @@ AgentBasePrivate::AgentBasePrivate( AgentBase *parent )
+     mProgress( 0 ),
+     mNeedsNetwork( false ),
+     mOnline( false ),
++    mDesiredOnlineState( false ),
+     mSettings( 0 ),
+     mObserver( 0 )
+ {
+@@ -215,7 +216,8 @@ void AgentBasePrivate::init()
+   mChangeRecorder->itemFetchScope().setCacheOnly( true );
+   mChangeRecorder->setConfig( mSettings );
+ 
+-  mOnline = mSettings->value( QLatin1String( "Agent/Online" ), true ).toBool();
++  mDesiredOnlineState = mSettings->value( QLatin1String( "Agent/DesiredOnlineState" ), true ).toBool();
++  mOnline = mDesiredOnlineState;
+ 
+   // reinitialize the status message now that online state is available
+   mStatusMessage = defaultReadyMessage();
+@@ -285,9 +287,10 @@ void AgentBasePrivate::delayedInit()
+ {
+   Q_Q( AgentBase );
+   const QString serviceId = QLatin1String(  "org.freedesktop.Akonadi.Agent." ) + mId;
+-  if ( !DBusConnectionPool::threadConnection().registerService( serviceId ) )
++  if ( !DBusConnectionPool::threadConnection().registerService( serviceId ) ) {
+     kFatal() << "Unable to register service" << serviceId << "at dbus:" << DBusConnectionPool::threadConnection().lastError().message();
+-  q->setOnline( mOnline );
++  }
++  q->setOnlineInternal( mDesiredOnlineState );
+ }
+ 
+ void AgentBasePrivate::setProgramName()
+@@ -479,7 +482,7 @@ void AgentBasePrivate::slotError( const QString& message )
+ void AgentBasePrivate::slotNetworkStatusChange( Solid::Networking::Status stat )
+ {
+   Q_Q( AgentBase );
+-  q->setOnline( stat == Solid::Networking::Unknown || stat == Solid::Networking::Connected );
++  q->setOnlineInternal( mDesiredOnlineState && ( stat == Solid::Networking::Unknown || stat == Solid::Networking::Connected ) );
+ }
+ 
+ void AgentBasePrivate::slotResumedFromSuspend()
+@@ -600,20 +603,27 @@ void AgentBase::setNeedsNetwork( bool needsNetwork )
+ 
+   } else {
+     disconnect( Solid::Networking::notifier(), 0, 0, 0 );
+-    setOnline( true );
++    setOnlineInternal( d->mDesiredOnlineState );
+   }
+ }
+ 
+ void AgentBase::setOnline( bool state )
+ {
+   Q_D( AgentBase );
++  d->mDesiredOnlineState = state;
++  d->mSettings->setValue( QLatin1String( "Agent/DesiredOnlineState" ), state );
++  setOnlineInternal( state );
++}
++
++void AgentBase::setOnlineInternal( bool state )
++{
++  Q_D( AgentBase );
+   d->mOnline = state;
+ 
+   const QString newMessage = d->defaultReadyMessage();
+   if ( d->mStatusMessage != newMessage && d->mStatusCode != AgentBase::Broken )
+     emit status( d->mStatusCode, newMessage );
+ 
+-  d->mSettings->setValue( QLatin1String( "Agent/Online" ), state );
+   doSetOnline( state );
+   emit onlineChanged( state );
+ }
+diff --git a/akonadi/agentbase.h b/akonadi/agentbase.h
+index 5127445..7721734 100644
+--- a/akonadi/agentbase.h
++++ b/akonadi/agentbase.h
+@@ -615,6 +615,7 @@ class AKONADI_EXPORT AgentBase : public QObject, protected QDBusContext
+     //@cond PRIVATE
+     static QString parseArguments( int, char** );
+     static int init( AgentBase *r );
++    void setOnlineInternal( bool state );
+ 
+     // D-Bus interface stuff
+     void abort();
+diff --git a/akonadi/agentbase_p.h b/akonadi/agentbase_p.h
+index 0f90e85..c89a4f5 100644
+--- a/akonadi/agentbase_p.h
++++ b/akonadi/agentbase_p.h
+@@ -90,6 +90,7 @@ class AgentBasePrivate : public QObject
+ 
+     bool mNeedsNetwork;
+     bool mOnline;
++    bool mDesiredOnlineState;
+ 
+     QSettings *mSettings;
+ 
+-- 
+1.8.0
+
diff --git a/kdepimlibs.spec b/kdepimlibs.spec
index 6f8788f..a9fe5ea 100644
--- a/kdepimlibs.spec
+++ b/kdepimlibs.spec
@@ -7,7 +7,7 @@
 Name: kdepimlibs
 Summary: KDE PIM Libraries
 Version: 4.9.3
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License: LGPLv2+
@@ -21,6 +21,12 @@ URL: http://www.kde.org/
 Source0: http://download.kde.org/%{stable}/%{version}/src/kdepimlibs-%{version}.tar.xz
 
 ## upstream patches
+# cherry-pick a few upstream commits since 4.9.3
+Patch101: 0001-Fix-reply-to-html-image-when-image-has-specific-size.patch
+Patch103: 0003-automatic-fallback-for-SSL-TLS-protocol-versions.patch
+Patch104: 0004-Note-don-t-accept-richtext-it-stores-data-as-plainte.patch
+Patch105: 0005-Fix-error-reporting-by-Albert-Astals-Cid.patch
+Patch107: 0007-Honour-the-online-offline-setting-requested-by-a-cli.patch
 
 Requires: %{name}-kxmlrpcclient%{?_isa} = %{version}-%{release}
 %if ! 0%{?akonadi_subpkg}
@@ -99,6 +105,12 @@ quite easy to use.
 %prep
 %setup -q
 
+%patch101 -p1 -b .0001
+%patch103 -p1 -b .0003
+%patch104 -p1 -b .0004
+%patch105 -p1 -b .0005
+%patch107 -p1 -b .0007
+
 
 %build
 mkdir -p %{_target_platform}
@@ -274,6 +286,9 @@ update-mime-database %{_kde4_datadir}/mime >& /dev/null
 
 
 %changelog
+* Mon Nov 26 2012 Rex Dieter <rdieter at fedoraproject.org> 4.9.3-2
+- cherry-pick a few upstream patches (#815047)
+
 * Fri Nov 02 2012 Rex Dieter <rdieter at fedoraproject.org> 4.9.3-1
 - 4.9.3
 


More information about the scm-commits mailing list