Version: unspecified (using Devel) OS: Windows CE version 20101219 svn 1207720 Reproducible: Always Steps to Reproduce: 1. Open a composer. 2. Save as template. 3. Select the mail in the local folder/templates. Actual Results: The mail viewer opens. Expected Results: But I expect a composer, so I can send the template mail.
commit 4c987eae234e75fc92a49ea08c67e573e72d5d2a branch master Author: Tobias Koenig <tokoe@kde.org> Date: Tue Dec 28 14:24:15 2010 +0100 Open composer when clicking on template mail BUG: 260795 diff --git a/mobile/mail/kmail-mobile.qml b/mobile/mail/kmail-mobile.qml index 74aca88..0a7b0c0 100644 --- a/mobile/mail/kmail-mobile.qml +++ b/mobile/mail/kmail-mobile.qml @@ -308,6 +308,9 @@ KPIM.MainView { { application.restoreDraft(_itemNavigationModel.currentItemIdHack); updateContextActionStates() + } else if ( application.isTemplateThreadRoot(_threadSelector.currentRow ) ) { + application.restoreTemplate(_itemNavigationModel.currentItemIdHack); + updateContextActionStates() } else { guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState ); } @@ -349,6 +352,9 @@ KPIM.MainView { { application.restoreDraft(threadContentsView.currentItemId); updateContextActionStates() + } else if ( application.isTemplateThreadContent( _threadMailSelector.currentRow ) ) { + application.restoreTemplate(threadContentsView.currentItemId); + updateContextActionStates() } else { guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState ); } diff --git a/mobile/mail/mainview.cpp b/mobile/mail/mainview.cpp index 3ea1cba..4ce8970 100644 --- a/mobile/mail/mainview.cpp +++ b/mobile/mail/mainview.cpp @@ -1044,6 +1044,30 @@ bool MainView::isSingleMessage(int row) return threadSize == 1; } +bool MainView::isTemplateThreadContent( int row ) +{ + static const int column = 0; + const QModelIndex index = m_threadContentsModel->index( row, column ); + + const Item item = index.data( EntityTreeModel::ItemRole ).value<Item>(); + + return folderIsTemplates( item.parentCollection() ); +} + +bool MainView::isTemplateThreadRoot( int row ) +{ + static const int column = 0; + const QModelIndex index = m_threadsModel->index( row, column ); + + const int threadSize = index.data( ThreadModel::ThreadSizeRole ).toInt(); + if ( threadSize != 1 ) + return false; + + const Item item = index.data( EntityTreeModel::ItemRole ).value<Item>(); + + return folderIsTemplates( item.parentCollection() ); +} + // ############################################################# // ### Share the code between these marks with KMail Desktop? @@ -1127,6 +1151,29 @@ bool MainView::folderIsDrafts( const Collection &collection ) return false; } +bool MainView::folderIsTemplates( const Collection &collection ) +{ + const Collection defaultTemplatesCollection = SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Templates ); + + // check if this is the default templates folder + if ( collection == defaultTemplatesCollection ) + return true; + + // check for invalid collection + const QString idString = QString::number( collection.id() ); + if ( idString.isEmpty() ) + return false; + + // search the identities if the folder matches the drafts-folder + const KPIMIdentities::IdentityManager *im = MobileKernel::self()->identityManager(); + for ( KPIMIdentities::IdentityManager::ConstIterator it = im->begin(); it != im->end(); ++it ) { + if ( (*it).templates() == idString ) + return true; + } + + return false; +} + void MainView::deleteItemResult( KJob *job ) { if ( job->error() ) { @@ -1523,6 +1570,14 @@ int MainView::emailTemplateCount() return mEmailTemplateModel ? mEmailTemplateModel->rowCount() : 0; } +void MainView::restoreTemplate( quint64 id ) +{ + ItemFetchJob *job = new ItemFetchJob( Item( id ), this ); + job->fetchScope().fetchFullPayload(); + job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent ); + connect( job, SIGNAL( result( KJob* ) ), SLOT( templateFetchResult( KJob* ) ) ); +} + void MainView::newMessageFromTemplate( int index ) { Akonadi::Item item = mEmailTemplateModel->index( index, 0 ).data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>(); diff --git a/mobile/mail/mainview.h b/mobile/mail/mainview.h index ab66104..0f40c30 100644 --- a/mobile/mail/mainview.h +++ b/mobile/mail/mainview.h @@ -93,6 +93,7 @@ class MainView : public KDeclarativeMainView public Q_SLOTS: void startComposer(); void restoreDraft( quint64 id ); + void restoreTemplate( quint64 id ); void markImportant( bool checked ); void markMailTask( bool checked ); @@ -103,6 +104,9 @@ class MainView : public KDeclarativeMainView bool isDraftThreadRoot( int row ); bool isSingleMessage( int row ); bool folderIsDrafts( const Akonadi::Collection &collection ); + bool isTemplateThreadContent( int row ); + bool isTemplateThreadRoot( int row ); + bool folderIsTemplates( const Akonadi::Collection &collection ); void configureIdentity();
Windows CE Mail Touch 2011-01-16 git-4d1bc61 test of description: passed, but following test failed with a crash. 1. Open Mail Touch 2. Open a composer and enter a subject. 3. Abort the composer and choose save as draft. 4. Switch to the draft folder. 5. Open again the saved mail. 6. Abort, save as draft. 7. Open again the saved mail. => Crash of Mail Touch. Reopened.
Git commit 3c37a2f1afce3749e559849ba013b71709ea588c by Tobias Koenig. Pushed by tokoe into branch 'master'. Fix signal/slot connection for proper cleanup With the broken signal/slot connection the composer view has not been deleted, which might have caused the crash mentioned in bug #260795 because of OOM on WinCE. BUG: 260795 M +1 -1 mobile/mail/composerview.cpp http://commits.kde.org/ee6cc38b/3c37a2f1afce3749e559849ba013b71709ea588c
Indeed this sounds like an oom crash since it might also be caused by other memory leaks in the messagecomposer I would like a retest of the test comment #2
Kontact Touch Windows CE 20110218 22:55 test of comment #2 : failed. Kontact crashed. Reopened