From c4e94b885e3d64a5d547e575ff88d163a36c03f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C5=91k=C3=A9s=20Attila?= Date: Thu, 9 Aug 2012 20:27:32 +0300 Subject: [PATCH] Destructor for mimefile. Getter for maximum length in MimeContentFormatter Added getter to MimeContentFormatter in the MimePart class. --- src/mimecontentformatter.cpp | 8 ++++++-- src/mimecontentformatter.h | 3 ++- src/mimefile.cpp | 1 + src/mimepart.cpp | 5 +++++ src/mimepart.h | 2 ++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mimecontentformatter.cpp b/src/mimecontentformatter.cpp index 1a43bd1..7f5a6e4 100644 --- a/src/mimecontentformatter.cpp +++ b/src/mimecontentformatter.cpp @@ -22,7 +22,7 @@ MimeContentFormatter::MimeContentFormatter(int max_length) : max_length(max_length) {} -QString MimeContentFormatter::format(const QString &content, bool quotedPrintable) { +QString MimeContentFormatter::format(const QString &content, bool quotedPrintable) const { QString out; @@ -43,7 +43,7 @@ QString MimeContentFormatter::format(const QString &content, bool quotedPrintabl } if ((chars > max_length - 1) - || ((content[i] == '=') && (chars > max_length - 3) )) { + || ((content[i] == '=') && (chars > max_length - 3) )) { out.append('='); out.append("\r\n"); chars = 1; @@ -60,3 +60,7 @@ QString MimeContentFormatter::format(const QString &content, bool quotedPrintabl void MimeContentFormatter::setMaxLength(int l) { max_length = l; } + +int MimeContentFormatter::getMaxLength() const { + return max_length; +} diff --git a/src/mimecontentformatter.h b/src/mimecontentformatter.h index 3ddbcf9..8180cb6 100644 --- a/src/mimecontentformatter.h +++ b/src/mimecontentformatter.h @@ -29,8 +29,9 @@ public: MimeContentFormatter (int max_length = 76); void setMaxLength(int l); + int getMaxLength() const; - QString format(const QString &content, bool quotedPrintable = false); + QString format(const QString &content, bool quotedPrintable = false) const; protected: int max_length; diff --git a/src/mimefile.cpp b/src/mimefile.cpp index 6a4e4c3..59fb5bf 100644 --- a/src/mimefile.cpp +++ b/src/mimefile.cpp @@ -31,6 +31,7 @@ MimeFile::MimeFile(QFile *file) MimeFile::~MimeFile() { + delete file; } /* [1] --- */ diff --git a/src/mimepart.cpp b/src/mimepart.cpp index 4a498d2..07ff662 100644 --- a/src/mimepart.cpp +++ b/src/mimepart.cpp @@ -113,6 +113,11 @@ MimePart::Encoding MimePart::getEncoding() const return this->cEncoding; } +MimeContentFormatter& MimePart::getContentFormatter() +{ + return this->formatter; +} + /* [2] --- */ diff --git a/src/mimepart.h b/src/mimepart.h index 8c5539f..3eda975 100644 --- a/src/mimepart.h +++ b/src/mimepart.h @@ -72,6 +72,8 @@ public: void setEncoding(Encoding enc); Encoding getEncoding() const; + MimeContentFormatter& getContentFormatter(); + /* [2] --- */