diff --git a/editor/kmcomposewin.cpp b/editor/kmcomposewin.cpp index 2c2d32739..9cabcfe63 100644 --- a/editor/kmcomposewin.cpp +++ b/editor/kmcomposewin.cpp @@ -562,7 +562,7 @@ void KMComposeWin::addAttachmentsAndSend( const KUrl::List &urls, const QString kDebug() << "addAttachment and sending!"; const int nbUrl = urls.count(); for ( int i =0; i < nbUrl; ++i ) { - mComposerBase->addAttachment( urls[i], comment, true ); + mComposerBase->addAttachment( urls.at(i), comment, true ); } send( how ); @@ -1966,7 +1966,7 @@ void KMComposeWin::autoSaveMessage(bool force) } } -bool KMComposeWin::encryptToSelf() +bool KMComposeWin::encryptToSelf() const { return MessageComposer::MessageComposerSettings::self()->cryptoEncryptToSelf(); } @@ -2136,11 +2136,20 @@ void KMComposeWin::slotInsertRecentFile( const KUrl &u ) MessageComposer::InsertTextFileJob *job = new MessageComposer::InsertTextFileJob( mComposerBase->editor(), u ); job->setEncoding( encoding ); + connect(job, SIGNAL(result(KJob*)), SLOT(slotInsertTextFile(KJob*))); job->start(); - // Don't care about the result for now - // TODO: we should probably show an error message if it fails... } +void KMComposeWin::slotInsertTextFile(KJob*job) +{ + if ( job->error() ) { + if ( static_cast(job)->ui() ) + static_cast(job)->ui()->showErrorMessage(); + else + kDebug()<<" job->errorString() :"<errorString(); + return; + } +} void KMComposeWin::slotSelectCryptoModule( bool init ) { diff --git a/editor/kmcomposewin.h b/editor/kmcomposewin.h index 3988fc95d..778283255 100644 --- a/editor/kmcomposewin.h +++ b/editor/kmcomposewin.h @@ -439,6 +439,7 @@ private slots: void slotExpandGroupResult(KJob *job); void slotCheckSendNowStep2(); void slotPotentialPhishingEmailsFound(const QStringList &list); + void slotInsertTextFile(KJob *job); public: // kmcommand // FIXME we need to remove these, but they're pure virtual in Composer. void addAttach( KMime::Content *msgPart ); @@ -589,7 +590,7 @@ private: of setAutomaticFields(), see below, is still required. */ void initHeader( KMime::Message *message, uint identity=0 ); - inline bool encryptToSelf(); + inline bool encryptToSelf() const; private: int validateLineWrapWidth();