Hello community, here is the log from the commit of package kdepim4-runtime for openSUSE:Factory checked in at 2014-05-01 07:51:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdepim4-runtime (Old) and /work/SRC/openSUSE:Factory/.kdepim4-runtime.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "kdepim4-runtime" Changes: -------- --- /work/SRC/openSUSE:Factory/kdepim4-runtime/kdepim4-runtime.changes 2014-04-18 12:37:18.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kdepim4-runtime.new/kdepim4-runtime.changes 2014-05-01 07:51:24.000000000 +0200 @@ -1,0 +2,6 @@ +Mon Apr 28 08:08:09 UTC 2014 - tittiatcoke@gmail.com + +- Add upstream patch use_existing_notes.diff to resolve the issue + that after migration the old notes were not visible (bko#333640) + +------------------------------------------------------------------- New: ---- use_existing_notes.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdepim4-runtime.spec ++++++ --- /var/tmp/diff_new_pack.bC6O5e/_old 2014-05-01 07:51:25.000000000 +0200 +++ /var/tmp/diff_new_pack.bC6O5e/_new 2014-05-01 07:51:25.000000000 +0200 @@ -25,6 +25,8 @@ Url: http://www.kde.org Source0: kdepim-runtime-%{version}.tar.xz Source1: akonadi.png +# PATCH-FIX-UPSTREAM After migration also start using the already existing notes +Patch1: use_existing_notes.diff BuildRequires: fdupes BuildRequires: libkdepimlibs4-devel >= %{version} BuildRequires: libkfbapi-devel @@ -48,6 +50,7 @@ %prep %setup -q -n kdepim-runtime-%{version} +%patch1 -p1 %build %ifarch ppc64 ++++++ use_existing_notes.diff ++++++ commit 69321dd246202d572ccba35ab36f9dd7d5a18925 Author: Montel Laurent <montel@kde.org> Date: Mon Apr 28 07:56:23 2014 +0200 Fix Bug 333640 - Knotes version 4.13 don't inherit previous notes FIXED-IN: 4.13.1 BUG: 333640 diff --git a/migration/knotes/knotesmigrator.cpp b/migration/knotes/knotesmigrator.cpp index 42ae784..3e5516b 100644 --- a/migration/knotes/knotesmigrator.cpp +++ b/migration/knotes/knotesmigrator.cpp @@ -39,6 +39,7 @@ #include <KMime/Message> #include <KDebug> +#include <KStandardDirs> #include "maildirsettings.h" #include <krandom.h> @@ -46,53 +47,76 @@ using namespace Akonadi; KNotesMigrator::KNotesMigrator() : - KResMigrator<KRES::Resource>( QLatin1String("notes"), QString() ), m_notesResource( 0 ) + KMigratorBase(), mIndexResource(-1), m_notesResource( 0 ) { Akonadi::AttributeFactory::registerAttribute<NoteLockAttribute>(); Akonadi::AttributeFactory::registerAttribute<NoteAlarmAttribute>(); Akonadi::AttributeFactory::registerAttribute<NoteDisplayAttribute>(); Akonadi::AttributeFactory::registerAttribute<ShowFolderNotesAttribute>(); + const QString kresCfgFile = KStandardDirs::locateLocal( "config", QLatin1String( "kresources/notes/stdrc" ) ); + mConfig = new KConfig( kresCfgFile ); + const KConfigGroup generalGroup( mConfig, QLatin1String( "General" ) ); + mUnknownTypeResources = generalGroup.readEntry( QLatin1String( "ResourceKeys" ), QStringList() ); + m_notesResource = new KCal::CalendarLocal( QString() ); } KNotesMigrator::~KNotesMigrator() { delete m_notesResource; + delete mConfig; +} + +void KNotesMigrator::migrate() +{ + emit message( Info, i18n( "Beginning KNotes migration..." ) ); + migrateNext(); } -bool KNotesMigrator::migrateResource( KRES::Resource* res) +void KNotesMigrator::migrateNext() { - if ( res->type() == QLatin1String("file") ) + ++mIndexResource; + + if (mUnknownTypeResources.isEmpty() || mIndexResource >= mUnknownTypeResources.count()) { + emit message( Info, i18n( "KNotes migration finished" ) ); + deleteLater(); + return; + } + + const KConfigGroup kresCfgGroup( mConfig, QString::fromLatin1( "Resource_%1" ).arg( mUnknownTypeResources.at(mIndexResource) ) ); + const QString resourceType = kresCfgGroup.readEntry( QLatin1String( "ResourceType" ), QString() ); + if (resourceType == QLatin1String("file")) { createAgentInstance( QLatin1String("akonadi_akonotes_resource"), this, SLOT(notesResourceCreated(KJob*)) ); - else - return false; - return true; + } else { + migrateNext(); + } } void KNotesMigrator::notesResourceCreated(KJob * job) { if ( job->error() ) { migrationFailed( i18n( "Failed to create resource: %1", job->errorText() ) ); + migrateNext(); return; } - KRES::Resource *res = currentResource(); + const KConfigGroup kresCfgGroup( mConfig, QString::fromLatin1( "Resource_%1" ).arg( mUnknownTypeResources.at(mIndexResource) ) ); + m_agentInstance = static_cast<AgentInstanceCreateJob*>( job )->instance(); - const KConfigGroup kresCfg = kresConfig( res ); - m_agentInstance.setName( kresCfg.readEntry( "ResourceName", "Migrated Notes" ) ); + m_agentInstance.setName( kresCfgGroup.readEntry( "ResourceName", "Migrated Notes" ) ); - QString resourcePath = kresCfg.readEntry( "NotesURL" ); + const QString resourcePath = kresCfgGroup.readEntry( "NotesURL" ); KUrl url( resourcePath ); if ( !QFile::exists( url.toLocalFile() ) ) { - migrationCompleted( m_agentInstance ); + migrateNext(); return; } - m_notesResource = new KCal::CalendarLocal( QString() ); bool success = m_notesResource->load( url.toLocalFile() ); if ( !success ) { migrationFailed( i18n( "Failed to open file for reading: %1" , resourcePath ) ); + migrateNext(); return; } @@ -103,9 +127,11 @@ void KNotesMigrator::notesResourceCreated(KJob * job) if ( !iface->isValid() ) { migrationFailed( i18n( "Failed to obtain D-Bus interface for remote configuration." ), m_agentInstance ); delete iface; + migrateNext(); return; } - iface->setReadOnly( res->readOnly() ); + bool isReadOnly = kresCfgGroup.readEntry("ResourceIsReadOnly", false); + iface->setReadOnly( isReadOnly ); QDBusPendingReply<void> response = iface->setPath( KGlobal::dirs()->localxdgdatadir() + QLatin1String("/notes/") + KRandom::randomString( 10 ) ); @@ -149,6 +175,7 @@ void KNotesMigrator::rootCollectionsRecieved( const Akonadi::Collection::List &l } } emit message( Error, i18n( "Could not find root collection for resource \"%1\"" ,m_agentInstance.identifier() ) ); + migrateNext(); } void KNotesMigrator::startMigration() @@ -236,5 +263,12 @@ void KNotesMigrator::showDefaultCollection() void KNotesMigrator::slotCollectionModify(KJob* job) { Q_UNUSED( job ); - migrationCompleted( m_agentInstance ); + migrateNext(); } + +void KNotesMigrator::migrationFailed( const QString& errorMsg, const Akonadi::AgentInstance& instance ) +{ + Q_UNUSED( instance ) + emit message( Error, i18n( "Migration failed: %1" ,errorMsg ) ); +} + diff --git a/migration/knotes/knotesmigrator.h b/migration/knotes/knotesmigrator.h index 75ec992..117f732 100644 --- a/migration/knotes/knotesmigrator.h +++ b/migration/knotes/knotesmigrator.h @@ -22,8 +22,7 @@ #ifndef KNOTESMIGRATOR_H #define KNOTESMIGRATOR_H -#include "kresmigrator.h" - +#include "kmigratorbase.h" #include <kcal/resourcecalendar.h> #include <kcal/calendarlocal.h> #include <akonadi/collection.h> @@ -37,13 +36,17 @@ class KJob; /** * Migrate KNotes resources to Akonadi */ -class KNotesMigrator : public KResMigrator<KRES::Resource> +class KNotesMigrator : public KMigratorBase { Q_OBJECT public: KNotesMigrator(); ~KNotesMigrator(); - bool migrateResource( KRES::Resource *res ); + + /* reimp */ void migrate(); + /* reimp */ void migrateNext(); +protected: + /* reimp */ void migrationFailed( const QString& errorMsg, const Akonadi::AgentInstance& instance = Akonadi::AgentInstance() ); private slots: void notesResourceCreated( KJob* job ); @@ -58,10 +61,13 @@ private: void showDefaultCollection(); private: + int mIndexResource; + QStringList mUnknownTypeResources; Akonadi::Collection m_resourceCollection; - AgentInstance m_agentInstance; + Akonadi::AgentInstance m_agentInstance; KCal::CalendarLocal *m_notesResource; + KConfig *mConfig; }; #endif diff --git a/migration/knotes/main.cpp b/migration/knotes/main.cpp index df5254e..aa480d2 100644 --- a/migration/knotes/main.cpp +++ b/migration/knotes/main.cpp @@ -64,8 +64,6 @@ int main( int argc, char **argv ) args->clear(); KNotesMigrator *migrator = new KNotesMigrator; - migrator->setBridgingOnly(false); - migrator->setOmitClientBridge(false); if ( infoDialog && migrator ) { infoDialog->migratorAdded(); QObject::connect( migrator, SIGNAL(message(KMigratorBase::MessageType,QString)), -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org