diff --git a/kmcommands.cpp b/kmcommands.cpp index 541029e98..282267b12 100644 --- a/kmcommands.cpp +++ b/kmcommands.cpp @@ -2015,14 +2015,14 @@ KMCommand::Result KMMailingListFilterCommand::execute() } } -KMCopyCommand::KMCopyCommand( KMFolder* destFolder, +KMCopyCommand::KMCopyCommand( const Akonadi::Collection& destFolder, const QList &msgList ) :mDestFolder( destFolder ), mMsgList( msgList ) { setDeletesItself( true ); } -KMCopyCommand::KMCopyCommand( KMFolder* destFolder, const Akonadi::Item& msg ) +KMCopyCommand::KMCopyCommand( const Akonadi::Collection& destFolder, const Akonadi::Item& msg ) :mDestFolder( destFolder ) { setDeletesItself( true ); @@ -2175,7 +2175,7 @@ void KMCopyCommand::slotJobFinished(KMail::FolderJob * job) if ( mPendingJobs.isEmpty() ) { - mDestFolder->close( "kmcommand" ); + //mDestFolder->close( "kmcommand" ); emit completed( this ); deleteLater(); } @@ -2186,7 +2186,7 @@ void KMCopyCommand::slotFolderComplete( KMFolderImap*, bool success ) kDebug() << success; if ( !success ) setResult( Failed ); - mDestFolder->close( "kmcommand" ); + //mDestFolder->close( "kmcommand" ); emit completed( this ); deleteLater(); } diff --git a/kmcommands.h b/kmcommands.h index 054e2d824..c5e54fd08 100644 --- a/kmcommands.h +++ b/kmcommands.h @@ -710,8 +710,8 @@ class KMAIL_EXPORT KMCopyCommand : public KMCommand Q_OBJECT public: - KMCopyCommand( KMFolder* destFolder, const QList &msgList ); - KMCopyCommand( KMFolder* destFolder, const Akonadi::Item &msg ); + KMCopyCommand( const Akonadi::Collection &destFolder, const QList &msgList ); + KMCopyCommand( const Akonadi::Collection& destFolder, const Akonadi::Item &msg ); protected slots: void slotJobFinished( KMail::FolderJob *job ); @@ -721,7 +721,7 @@ protected slots: private: virtual Result execute(); - KMFolder *mDestFolder; + Akonadi::Collection mDestFolder; QList mMsgList; QList mPendingJobs; }; diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 6b29482db..7c153939d 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -2008,56 +2008,25 @@ void KMMainWidget::copyMessageSelected( const QList &selectMsg, c { if ( selectMsg.isEmpty() ) return; - //TODO - BroadcastStatus::instance()->setStatusMsg( i18n( "Copying messages..." ) ); -} - -//----------------------------------------------------------------------------- -// Message copying -// FIXME: Couldn't parts of it be merged with moving code ? -// -#ifdef OLD_MESSAGELIST -void KMMainWidget::copyMessageSet( KMail::MessageListView::MessageSet * set, KMFolder * destination ) -{ - Q_ASSERT( set ); - Q_ASSERT( destination ); - - if ( !set->isValid() ) - { - delete set; - return; - } - - Q_ASSERT( set->folder() ); // must exist since the set is valid - - // Get the list of messages - QList< KMMsgBase * > selectedMessages = set->contentsAsMsgBaseList(); - if ( selectedMessages.isEmpty() ) - { - delete set; - return; - } - - // And stuff them into a KMCopyCommand :) - KMCommand *command = new KMCopyCommand( destination, selectedMessages ); - + // And stuff them into a KMCopyCommand :) + KMCommand *command = new KMCopyCommand( dest, selectMsg ); +#if 0 // Reparent the set to the command so it's deleted even if the command // doesn't notify the completion for some reason. set->setParent( command ); // so it will be deleted when the command finishes // Set the name to something unique so we can find it back later in the children list set->setObjectName( QString( "copyMsgCommandMessageSet" ) ); - +#endif QObject::connect( command, SIGNAL( completed( KMCommand * ) ), this, SLOT( slotCopyMessagesCompleted( KMCommand * ) ) ); - command->start(); - BroadcastStatus::instance()->setStatusMsg( i18n( "Copying messages..." ) ); } -#endif + + void KMMainWidget::slotCopyMessagesCompleted( KMCommand *command ) { Q_ASSERT( command ); @@ -2068,7 +2037,7 @@ void KMMainWidget::slotCopyMessagesCompleted( KMCommand *command ) command->findChild< KMail::MessageListView::MessageSet * >( QString( "copyMsgCommandMessageSet" ) ); Q_ASSERT( set ); - +#endif if ( command->result() == KMCommand::OK ) { BroadcastStatus::instance()->setStatusMsg( i18n( "Messages copied successfully." ) ); @@ -2078,7 +2047,6 @@ void KMMainWidget::slotCopyMessagesCompleted( KMCommand *command ) else BroadcastStatus::instance()->setStatusMsg( i18n( "Copying messages canceled." ) ); } -#endif // The command will autodelete itself and will also kill the set. }