[Kde-pim] Review Request: Enable direct attaching of folders in kmail
Laurent Montel
montel at kde.org
Thu Sep 8 18:09:47 BST 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102501/#review6340
-----------------------------------------------------------
For It's good but we can reduce code here:
void AttachmentControllerBase::addAttachment( const KUrl &url )
{
+ if( KMimeType::findByUrl( url )->name() == QLatin1String( "inode/directory" ) ) {
+ kDebug() << "Creating attachment from folder";
+ AttachmentFromFolderJob *ajob = new AttachmentFromFolderJob ( url, this );
+ if( MessageComposer::MessageComposerSettings::maximumAttachmentSize() > 0 ) {
+ ajob->setMaximumAllowedSize( MessageComposer::MessageComposerSettings::maximumAttachmentSize() * 1024 * 1024 );
+ }
+ connect( ajob, SIGNAL(result(KJob*)), this, SLOT(loadJobResult(KJob*)) );
+ ajob->start();
+ }
+ else{
AttachmentFromUrlJob *ajob = new AttachmentFromUrlJob( url, this );
- if( MessageComposer::MessageComposerSettings::maximumAttachmentSize() > 0 ) {
+ kDebug() << "Creating attachment from file";
+ if( MessageComposer::MessageComposerSettings::maximumAttachmentSize() > 0 ) {
ajob->setMaximumAllowedSize( MessageComposer::MessageComposerSettings::maximumAttachmentSize() * 1024 * 1024 );
}
connect( ajob, SIGNAL(result(KJob*)), this, SLOT(loadJobResult(KJob*)) );
ajob->start();
+ }
+
to
void AttachmentControllerBase::addAttachment( const KUrl &url )
{
AttachmentFromUrlBaseJob *ajob = 0;
if( KMimeType::findByUrl( url )->name() == QLatin1String( "inode/directory" ) ) {
kDebug() << "Creating attachment from folder";
ajob = new AttachmentFromFolderJob ( url, this );
} else {
ajob = new AttachmentFromUrlJob( url, this );
}
if( MessageComposer::MessageComposerSettings::maximumAttachmentSize() > 0 ) {
ajob->setMaximumAllowedSize( MessageComposer::MessageComposerSettings::maximumAttachmentSize() * 1024 * 1024 );
}
connect( ajob, SIGNAL(result(KJob*)), this, SLOT(loadJobResult(KJob*)) );
ajob->start();
}
After that it's good (Didn't test it but I think that ut will work
And duplicate code is reduce :)
- Laurent
On Sept. 8, 2011, 4:57 p.m., Martin Bednar wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102501/
> -----------------------------------------------------------
>
> (Updated Sept. 8, 2011, 4:57 p.m.)
>
>
> Review request for KDEPIM.
>
>
> Summary
> -------
>
> Creates a new class attachmentfromfolder that enables automatic compression (zip) and attachment of folders dropped on the messagecomposer window.
>
>
> This addresses bug 42767.
> http://bugs.kde.org/show_bug.cgi?id=42767
>
>
> Diffs
> -----
>
> messagecomposer/attachmentcontrollerbase.cpp f8aea5c
> messagecore/CMakeLists.txt 821625f
> messagecore/attachmentfromfolderjob.h PRE-CREATION
> messagecore/attachmentfromfolderjob.cpp PRE-CREATION
> messagecore/attachmentfromurlbasejob.h PRE-CREATION
> messagecore/attachmentfromurlbasejob.cpp PRE-CREATION
> messagecore/attachmentfromurljob.h c509114
> messagecore/attachmentfromurljob.cpp 615218a
>
> Diff: http://git.reviewboard.kde.org/r/102501/diff
>
>
> Testing
> -------
>
> Sent myself an email with a dropped folder attached. The folder contained a .ogg and a text file. The .ogg played correctly, the text file was readable with correct contents.
>
>
> Thanks,
>
> Martin
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list