Fix undo move mail. And add dialog when there is a error

(cherry picked from commit 71adab0d59a22b7e122a18bedf7b358f2207c7ad)
wilder-work
Montel Laurent 15 years ago
parent 9423346638
commit e5dc44b4a7
  1. 12
      undostack.cpp
  2. 5
      undostack.h

@ -23,7 +23,7 @@
#include "kmmainwin.h"
#include "kmkernel.h"
#include <KJob>
#include <akonadi/itemmovejob.h>
#include <kmessagebox.h>
@ -90,8 +90,8 @@ void UndoStack::undo()
{
UndoInfo *info = mStack.takeFirst();
emit undoStackChanged();
Akonadi::ItemMoveJob( info->items, info->srcFolder, this );
// TODO: handle job error?
Akonadi::ItemMoveJob * job = new Akonadi::ItemMoveJob( info->items, info->srcFolder, this );
connect( job, SIGNAL(result(KJob*)), this, SLOT(slotMoveResult(KJob*)) );
delete info;
}
else
@ -101,6 +101,12 @@ void UndoStack::undo()
}
}
void UndoStack::slotMoveResult( KJob *job )
{
if ( job->error() )
KMessageBox::sorry( kmkernel->mainWin(), i18n("Can not move message. %1").arg( job->errorString() ) );
}
void
UndoStack::pushSingleAction(const Akonadi::Item &item, const Akonadi::Collection &folder, const Akonadi::Collection &destFolder)
{

@ -26,6 +26,8 @@
#include <QObject>
#include <akonadi/collection.h>
#include <akonadi/item.h>
class KJob;
namespace KMail {
/** A class for storing Undo information. */
@ -58,6 +60,9 @@ public:
public slots:
void msgDestroyed( const Akonadi::Item &msg);
protected slots:
void slotMoveResult(KJob*);
protected:
QList<UndoInfo*> mStack;
int mSize;

Loading…
Cancel
Save