Remove duplicate code

wilder-work
Montel Laurent 11 years ago
parent 5eaec26b5a
commit 0fab06e92e
  1. 25
      editor/kmcomposewin.cpp
  2. 1
      editor/kmcomposewin.h

@ -43,7 +43,7 @@
#include "messagecore/utils/stringutil.h"
#include "messagecore/attachment/attachmentcollector.h"
#include "util.h"
#include "editor/snippetwidget.h"
#include "editor/widgets/snippetwidget.h"
#include "templatesconfiguration_kfg.h"
#include "foldercollectionmonitor.h"
#include "kernel/mailkernel.h"
@ -55,7 +55,7 @@
#include "job/createnewcontactjob.h"
#include "job/savedraftjob.h"
#include "warningwidgets/externaleditorwarning.h"
#include "cryptostateindicatorwidget.h"
#include "widgets/cryptostateindicatorwidget.h"
#include "validatesendmailshortcut.h"
#include "job/saveasfilejob.h"
#include "editor/kmstorageservice.h"
@ -2117,14 +2117,21 @@ void KMComposeWin::slotInsertRecentFile( const KUrl &u )
job->start();
}
void KMComposeWin::slotInsertTextFile(KJob*job)
bool KMComposeWin::showErrorMessage(KJob*job)
{
if ( job->error() ) {
if ( static_cast<KIO::Job*>(job)->ui() )
static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
else
kDebug()<<" job->errorString() :"<<job->errorString();
return true;
}
return false;
}
void KMComposeWin::slotInsertTextFile(KJob*job)
{
showErrorMessage(job);
}
void KMComposeWin::slotSelectCryptoModule( bool init )
@ -2275,11 +2282,7 @@ void KMComposeWin::slotPasteAsAttachment()
void KMComposeWin::slotFetchJob(KJob*job)
{
if ( job->error() ) {
if ( static_cast<KIO::Job*>(job)->ui() )
static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
else
kDebug()<<" job->errorString() :"<<job->errorString();
if (showErrorMessage(job)) {
return;
}
Akonadi::ItemFetchJob *fjob = dynamic_cast<Akonadi::ItemFetchJob*>( job );
@ -2580,11 +2583,7 @@ void KMComposeWin::printComposeResult( KJob *job, bool preview )
command->setPrintPreview( preview );
command->start();
} else {
if ( static_cast<KIO::Job*>(job)->ui() ) {
static_cast<KIO::Job*>(job)->ui()->showErrorMessage();
} else {
kWarning() << "Composer for printing failed:" << composer->errorString();
}
showErrorMessage(job);
}
}

@ -594,6 +594,7 @@ private:
inline bool encryptToSelf() const;
private:
bool showErrorMessage(KJob *job);
int validateLineWrapWidth();
Akonadi::Collection mCollectionForNewMessage;
QMap<QByteArray, QString> mExtraHeaders;

Loading…
Cancel
Save