diff options
| author | Pekka Vuorela <pvuorela@iki.fi> | 2025-09-17 11:03:49 +0300 |
|---|---|---|
| committer | Pekka Vuorela <pvuorela@iki.fi> | 2025-09-19 13:59:24 +0300 |
| commit | f53ed1dd6116353d5fb6051f7739784e73208ca3 (patch) | |
| tree | 570f3dd91402867b659bb35f8c8155df2252ed2a | |
| parent | 41caf5b0db008520a64be005a0d7eab9548e43ec (diff) | |
Clean up some cosmetic details
Mostly coding conventions here.
- Method opening braces to their own lines
- Adjusted some inconsistent init list styles
- Removed some redundant static declarations inside anon namespace
- Replaced one delete loop with qDeleteAll()
- Remove some trailing extra new lines
- Added some missing spaces after commas
- for (), if (), switch as common qt style
- Removed some unnecessary scopes within switch cases
Etc.
Change-Id: Ide9ad7fea6f5fce3b854af2bf05874623c474028
Reviewed-by: <matti.viljanen@kapsi.fi>
Reviewed-by: Damien Caliste <dcaliste@free.fr>
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
132 files changed, 722 insertions, 1309 deletions
diff --git a/src/libraries/qmfclient/locks.cpp b/src/libraries/qmfclient/locks.cpp index 3f0ac906..8d1b6df0 100644 --- a/src/libraries/qmfclient/locks.cpp +++ b/src/libraries/qmfclient/locks.cpp @@ -65,4 +65,3 @@ void ProcessMutex::unlock() { d->unlock(); } - diff --git a/src/libraries/qmfclient/longstring.cpp b/src/libraries/qmfclient/longstring.cpp index 5bf98333..8b423c1b 100644 --- a/src/libraries/qmfclient/longstring.cpp +++ b/src/libraries/qmfclient/longstring.cpp @@ -96,18 +96,15 @@ static int insensitiveIndexOf(const QByteArray& target, const QByteArray &source it = begin + len + from; } - while (it < end) - { - if (toupper(*it++) == toupper(*matchBegin)) - { + while (it < end) { + if (toupper(*it++) == toupper(*matchBegin)) { const char* restart = it; // See if the remainder matches const char* searchIt = it; const char* matchIt = matchBegin + 1; - do - { + do { if (matchIt == matchEnd) return ((it - 1) - begin); @@ -147,8 +144,7 @@ static int insensitiveIndexOf(const QByteArray& target, const QByteArray &source while (haystack <= end) { hashHaystack += *(haystack + ol_minus_1); if (hashHaystack == hashNeedle && *needle == *haystack - && strncasecmp(needle, haystack, ol) == 0) - { + && strncasecmp(needle, haystack, ol) == 0) { return haystack - source.data(); } REHASH(*haystack); @@ -237,7 +233,8 @@ LongStringFileMapping::~LongStringFileMapping() } } -bool LongStringFileMapping::mapped() const { +bool LongStringFileMapping::mapped() const +{ if (!buffer || !fileMap.contains(filename)) return false; @@ -655,4 +652,3 @@ template void LongString::serialize<QDataStream>(QDataStream&) const; template void LongString::deserialize<QDataStream>(QDataStream&); template void LongString::serialize(QDBusArgument&) const; template void LongString::deserialize(const QDBusArgument&); - diff --git a/src/libraries/qmfclient/mailkeyimpl_p.h b/src/libraries/qmfclient/mailkeyimpl_p.h index 45f4427c..16b6b338 100644 --- a/src/libraries/qmfclient/mailkeyimpl_p.h +++ b/src/libraries/qmfclient/mailkeyimpl_p.h @@ -327,4 +327,3 @@ void MailKeyImpl<Key>::deserialize(const QDBusArgument& stream) } #endif - diff --git a/src/libraries/qmfclient/mailsortkeyimpl_p.h b/src/libraries/qmfclient/mailsortkeyimpl_p.h index 4530eaee..773d4f96 100644 --- a/src/libraries/qmfclient/mailsortkeyimpl_p.h +++ b/src/libraries/qmfclient/mailsortkeyimpl_p.h @@ -144,4 +144,3 @@ void MailSortKeyImpl<Key>::deserialize(Stream &stream) } #endif - diff --git a/src/libraries/qmfclient/qmailaccount.cpp b/src/libraries/qmfclient/qmailaccount.cpp index 74117b8e..492af585 100644 --- a/src/libraries/qmfclient/qmailaccount.cpp +++ b/src/libraries/qmfclient/qmailaccount.cpp @@ -731,4 +731,3 @@ void QMailAccount::addMessageSink(const QString &sink) { d->_sinks.append(sink); } - diff --git a/src/libraries/qmfclient/qmailaccountconfiguration.cpp b/src/libraries/qmfclient/qmailaccountconfiguration.cpp index f4a2656a..16fa6b80 100644 --- a/src/libraries/qmfclient/qmailaccountconfiguration.cpp +++ b/src/libraries/qmfclient/qmailaccountconfiguration.cpp @@ -460,4 +460,3 @@ void QMailAccountConfiguration::setModified(bool set) { d->_modified = set; } - diff --git a/src/libraries/qmfclient/qmailaccountkey_p.h b/src/libraries/qmfclient/qmailaccountkey_p.h index ede55536..d77a64e5 100644 --- a/src/libraries/qmfclient/qmailaccountkey_p.h +++ b/src/libraries/qmfclient/qmailaccountkey_p.h @@ -48,7 +48,6 @@ #include "qmailaccountkey.h" #include "mailkeyimpl_p.h" - class QMailAccountKeyPrivate : public MailKeyImpl<QMailAccountKey> { public: @@ -61,6 +60,4 @@ public: QMailAccountKeyPrivate(const ListType &ids, QMailAccountKey::Property p, QMailKey::Comparator c) : Impl(ids, p, c) {} }; - #endif - diff --git a/src/libraries/qmfclient/qmailaccountlistmodel.cpp b/src/libraries/qmfclient/qmailaccountlistmodel.cpp index 8efc0990..c8a4b10e 100644 --- a/src/libraries/qmfclient/qmailaccountlistmodel.cpp +++ b/src/libraries/qmfclient/qmailaccountlistmodel.cpp @@ -53,9 +53,8 @@ private: }; LessThanFunctorA::LessThanFunctorA(const QMailAccountSortKey& sortKey) -: - mSortKey(sortKey), - mInvalidatedList(false) + : mSortKey(sortKey) + , mInvalidatedList(false) { } @@ -67,8 +66,7 @@ bool LessThanFunctorA::operator()(const QMailAccountId& first, const QMailAccoun QMailAccountKey secondKey(QMailAccountKey::id(second)); QMailAccountIdList results = QMailStore::instance()->queryAccounts(firstKey | secondKey, mSortKey); - if (results.count() != 2) - { + if (results.count() != 2) { mInvalidatedList = true; return false; } @@ -110,12 +108,11 @@ public: QMailAccountListModelPrivate::QMailAccountListModelPrivate(const QMailAccountKey& key, const QMailAccountSortKey& sortKey, bool synchronizeEnabled) -: - key(key), - sortKey(sortKey), - synchronizeEnabled(synchronizeEnabled), - populated(false), - needSynchronize(true) + : key(key) + , sortKey(sortKey) + , synchronizeEnabled(synchronizeEnabled) + , populated(false) + , needSynchronize(true) { } @@ -196,9 +193,8 @@ QMailAccountIdList::iterator QMailAccountListModelPrivate::lowerBound(const QMai */ QMailAccountListModel::QMailAccountListModel(QObject* parent) -: - QAbstractListModel(parent), - d(new QMailAccountListModelPrivate(QMailAccountKey(),QMailAccountSortKey(),true)) + : QAbstractListModel(parent) + , d(new QMailAccountListModelPrivate(QMailAccountKey(), QMailAccountSortKey(), true)) { connect(QMailStore::instance(), SIGNAL(accountsAdded(QMailAccountIdList)), @@ -399,7 +395,7 @@ void QMailAccountListModel::accountsUpdated(const QMailAccountIdList& ids) continue; d->deletionId = id; - beginRemoveRows(QModelIndex(),index,index); + beginRemoveRows(QModelIndex(), index, index); d->idList.removeAt(index); endRemoveRows(); d->deletionId = QMailAccountId(); @@ -540,4 +536,3 @@ void QMailAccountListModel::fullRefresh() d->populated = false; endResetModel(); } - diff --git a/src/libraries/qmfclient/qmailaccountsortkey.cpp b/src/libraries/qmfclient/qmailaccountsortkey.cpp index 4f5d09a6..113cb966 100644 --- a/src/libraries/qmfclient/qmailaccountsortkey.cpp +++ b/src/libraries/qmfclient/qmailaccountsortkey.cpp @@ -261,4 +261,3 @@ QMailAccountSortKey QMailAccountSortKey::iconPath(Qt::SortOrder order) } Q_IMPLEMENT_USER_METATYPE(QMailAccountSortKey) - diff --git a/src/libraries/qmfclient/qmailaccountsortkey.h b/src/libraries/qmfclient/qmailaccountsortkey.h index 8296d66e..c35eb2c6 100644 --- a/src/libraries/qmfclient/qmailaccountsortkey.h +++ b/src/libraries/qmfclient/qmailaccountsortkey.h @@ -99,4 +99,3 @@ private: Q_DECLARE_USER_METATYPE(QMailAccountSortKey) #endif - diff --git a/src/libraries/qmfclient/qmailaction.cpp b/src/libraries/qmfclient/qmailaction.cpp index 77b011f4..c8e2b706 100644 --- a/src/libraries/qmfclient/qmailaction.cpp +++ b/src/libraries/qmfclient/qmailaction.cpp @@ -278,4 +278,3 @@ void QMailActionData::deserialize(Stream &stream) Q_IMPLEMENT_USER_METATYPE_ENUM(QMailServerRequestType) Q_IMPLEMENT_USER_METATYPE(QMailActionData) Q_IMPLEMENT_USER_METATYPE_TYPEDEF(QMailActionDataList, QMailActionDataList) - diff --git a/src/libraries/qmfclient/qmailaddress.cpp b/src/libraries/qmfclient/qmailaddress.cpp index 2846a8bd..63ac2022 100644 --- a/src/libraries/qmfclient/qmailaddress.cpp +++ b/src/libraries/qmfclient/qmailaddress.cpp @@ -40,7 +40,7 @@ namespace { -static bool needsQuotes(const QString& src) +bool needsQuotes(const QString& src) { QRegularExpression specials(QLatin1String("[<>\\[\\]:;@\\\\,.]")); @@ -154,7 +154,7 @@ void Decommentor::process(QChar character, bool quoted, bool escaped, int commen Q_UNUSED(escaped) } -static QString removeComments(const QString& input, bool (QChar::*classifier)() const, bool acceptedResult = true) +QString removeComments(const QString& input, bool (QChar::*classifier)() const, bool acceptedResult = true) { Decommentor decommentor(classifier, acceptedResult); decommentor.processCharacters(input); @@ -409,14 +409,14 @@ QStringList AddressListGenerator::result() return _result; } -static QStringList generateAddressList(const QString& list) +QStringList generateAddressList(const QString& list) { AddressListGenerator generator; generator.processCharacters(list); return generator.result(); } -static bool containsMultipleFields(const QString& input) +bool containsMultipleFields(const QString& input) { // There is no shortcut; we have to parse the addresses AddressListGenerator generator; @@ -457,7 +457,7 @@ bool GroupDetector::result() const return _listTerminator; } -static bool containsGroupSpecifier(const QString& input) +bool containsGroupSpecifier(const QString& input) { GroupDetector detector; detector.processCharacters(input); @@ -478,7 +478,7 @@ void WhitespaceRemover::process(QChar character, bool quoted, bool escaped, int _result.append(character); } -static QString removeWhitespace(const QString& input) +QString removeWhitespace(const QString& input) { WhitespaceRemover remover; remover.processCharacters(input); @@ -566,7 +566,7 @@ void QuoteDisplayName::finished() } } -static QString quoteIfNecessary(const QString& input) +QString quoteIfNecessary(const QString& input) { QuoteDisplayName quoteDisplayName; quoteDisplayName.processCharacters(input); @@ -616,8 +616,7 @@ void parseMailbox(QString& input, QString& name, QString& address, QString& suff { // See if there is a trailing suffix int pos = input.indexOf(QLatin1String("/TYPE=")); - if (pos != -1) - { + if (pos != -1) { suffix = input.mid(pos + 6); input = input.left(pos); } @@ -625,19 +624,13 @@ void parseMailbox(QString& input, QString& name, QString& address, QString& suff // Separate the email address from the name QPair<int, int> delimiters = findDelimiters(input); - if (delimiters.first == -1 && delimiters.second == -1) - { + if (delimiters.first == -1 && delimiters.second == -1) { name = address = input.trimmed(); - } - else - { - if (delimiters.first == -1) - { + } else { + if (delimiters.first == -1) { // Unmatched '>' address = input.left( delimiters.second ); - } - else - { + } else { name = input.left( delimiters.first ); if (delimiters.second == -1) @@ -707,23 +700,18 @@ QMailAddressPrivate::QMailAddressPrivate(const QString& addressText) : _group(false), _searchCompleted(false) { - if (!addressText.isEmpty()) - { + if (!addressText.isEmpty()) { QString input = addressText.trimmed(); // See whether this address is a group - if (containsGroupSpecifier(input)) - { + if (containsGroupSpecifier(input)) { QRegularExpressionMatch match = QRegularExpression(QLatin1String("(.*):(.*);")).match(input); - if (match.hasMatch()) - { + if (match.hasMatch()) { _name = match.captured(1).trimmed(); _address = match.captured(2).trimmed(); _group = true; } - } - else - { + } else { parseMailbox(input, _name, _address, _suffix); setComponents(_name, _address); } @@ -735,14 +723,11 @@ QMailAddressPrivate::QMailAddressPrivate(const QString& name, const QString& add _searchCompleted(false) { // See whether the address part contains a group - if (containsMultipleFields(address)) - { + if (containsMultipleFields(address)) { _name = name; _address = address; _group = true; - } - else - { + } else { setComponents(name, address); } } @@ -841,22 +826,22 @@ QString QMailAddressPrivate::toString(bool forceDelimited) const { QString result; - if ( _name == _address ) + if (_name == _address) return _name; if ( _group ) { result.append( _name ).append( QLatin1String(": ") ).append( _address ).append( QChar::fromLatin1(';') ); } else { // If there are any 'special' characters in the name it needs to be quoted - if ( !_name.isEmpty() ) { + if (!_name.isEmpty()) { result = ::quoteIfNecessary(_name); } - if ( !_address.isEmpty() ) { - if ( !forceDelimited && result.isEmpty() ) { + if (!_address.isEmpty()) { + if (!forceDelimited && result.isEmpty()) { result = _address; } else { - if ( !result.isEmpty() ) - result.append( QChar::fromLatin1(' ') ); + if (!result.isEmpty()) + result.append(QChar::fromLatin1(' ')); result.append( QChar::fromLatin1('<') ).append( _address ).append( QChar::fromLatin1('>') ); } } @@ -1170,6 +1155,4 @@ Q_IMPLEMENT_USER_METATYPE(QMailAddress) Q_IMPLEMENT_USER_METATYPE_TYPEDEF(QMailAddressList, QMailAddressList) - //Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(QList<QMailAddress>) - diff --git a/src/libraries/qmfclient/qmailcodec.cpp b/src/libraries/qmfclient/qmailcodec.cpp index e724d966..74688edc 100644 --- a/src/libraries/qmfclient/qmailcodec.cpp +++ b/src/libraries/qmfclient/qmailcodec.cpp @@ -118,8 +118,7 @@ static void enumerateCodecs() { static bool enumerated = false; - if (!enumerated) - { + if (!enumerated) { qCDebug(lcMessaging) << "Available codecs:"; foreach (const QByteArray& codec, QTextCodec::availableCodecs()) qCDebug(lcMessaging) << " " << codec; @@ -137,11 +136,9 @@ static void enumerateCodecs() */ void QMailCodec::encode(QDataStream& out, QTextStream& in, const QByteArray& charset) { - if (QTextCodec* codec = codecForName(charset)) - { + if (QTextCodec* codec = codecForName(charset)) { QTextEncoder *encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); - while (!in.atEnd()) - { + while (!in.atEnd()) { QString chunk = in.read(MaxCharacters); QByteArray charsetEncoded = encoder->fromUnicode(chunk); @@ -168,8 +165,7 @@ void QMailCodec::decode(QTextStream& out, QDataStream& in, const QByteArray& ich QDataStream decodedStream(&decoded, QIODevice::WriteOnly); char* buffer = new char[MaxCharacters]; - while (!in.atEnd()) - { + while (!in.atEnd()) { int length = in.readRawData(buffer, MaxCharacters); // Allow for decoded data to be twice the size without reallocation @@ -198,8 +194,7 @@ void QMailCodec::decode(QTextStream& out, QDataStream& in, const QByteArray& ich void QMailCodec::encode(QDataStream& out, QDataStream& in) { char* buffer = new char[MaxCharacters]; - while (!in.atEnd()) - { + while (!in.atEnd()) { int length = in.readRawData(buffer, MaxCharacters); encodeChunk(out, reinterpret_cast<unsigned char*>(buffer), length, in.atEnd()); @@ -214,8 +209,7 @@ void QMailCodec::encode(QDataStream& out, QDataStream& in) void QMailCodec::decode(QDataStream& out, QDataStream& in) { char* buffer = new char[MaxCharacters]; - while (!in.atEnd()) - { + while (!in.atEnd()) { int length = in.readRawData(buffer, MaxCharacters); if (length > 0 && in.status() == QDataStream::ReadPastEnd) { // work around QTBUG-69474 @@ -272,8 +266,7 @@ QTextCodec* QMailCodec::codecForName(const QByteArray& charset, bool translateAs if (!encoding.isEmpty()) { QTextCodec* codec = QTextCodec::codecForName(encoding); - if (!codec) - { + if (!codec) { qCWarning(lcMessaging) << "QMailCodec::codecForName - Unable to find codec for charset" << encoding; enumerateCodecs(); } @@ -290,8 +283,7 @@ QTextCodec* QMailCodec::codecForName(const QByteArray& charset, bool translateAs void QMailCodec::copy(QDataStream& out, QDataStream& in) { char* buffer = new char[MaxCharacters]; - while (!in.atEnd()) - { + while (!in.atEnd()) { int length = in.readRawData(buffer, MaxCharacters); out.writeRawData(buffer, length); } @@ -310,8 +302,7 @@ void QMailCodec::copy(QTextStream& out, QDataStream& in, const QByteArray& chars QTextDecoder *decoder = codec->makeDecoder(); char* buffer = new char[MaxCharacters]; - while (!in.atEnd()) - { + while (!in.atEnd()) { int length = in.readRawData(buffer, MaxCharacters); out << decoder->toUnicode(buffer, length); } @@ -539,30 +530,22 @@ void QMailBase64Codec::encodeChunk(QDataStream& out, const unsigned char* it, in const unsigned char* lineEnd = it + _encodeLineCharsRemaining; const unsigned char* const end = it + length; - while (it != end) - { + while (it != end) { bool trailingLF = false; const unsigned char input = *it++; - if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) - { - if (_lastChar == CarriageReturn && input == LineFeed) - { + if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) { + if (_lastChar == CarriageReturn && input == LineFeed) { // We have already encoded this character-sequence // We can accept one more input character than accounted for lineEnd += 1; - } - else - { + } else { // We must replace this character with ASCII CRLF *_encodeBufferOut++ = CarriageReturn; - if (_encodeBufferOut != bufferEnd) - { + if (_encodeBufferOut != bufferEnd) { *_encodeBufferOut++ = LineFeed; - } - else - { + } else { trailingLF = true; } @@ -571,12 +554,11 @@ void QMailBase64Codec::encodeChunk(QDataStream& out, const unsigned char* it, in } _lastChar = input; - } - else + } else { *_encodeBufferOut++ = input; + } - if (_encodeBufferOut == bufferEnd) - { + if (_encodeBufferOut == bufferEnd) { // We have buffered 3 input bytes - write them out as four output bytes out << Base64Values[(_encodeBuffer[0] >> 2) & 0x3f]; out << Base64Values[(((_encodeBuffer[0] & 0x03) << 4) | (_encodeBuffer[1] >> 4)) & 0x3f]; @@ -584,25 +566,21 @@ void QMailBase64Codec::encodeChunk(QDataStream& out, const unsigned char* it, in out << Base64Values[_encodeBuffer[2] & 0x3f]; _encodeBufferOut = _encodeBuffer; - if ((it >= lineEnd) && ((it != end) || !finalChunk)) - { + if ((it >= lineEnd) && ((it != end) || !finalChunk)) { // Insert an ASCII CRLF sequence out << static_cast<unsigned char>(CarriageReturn) << static_cast<unsigned char>(LineFeed); lineEnd += (_maximumLineLength / 4 * 3); } } - if (trailingLF) - { + if (trailingLF) { *_encodeBufferOut++ = LineFeed; } } - if (finalChunk) - { + if (finalChunk) { int bufferedBytesRemaining = _encodeBufferOut - _encodeBuffer; - if (bufferedBytesRemaining > 0) - { + if (bufferedBytesRemaining > 0) { // We have some data still buffered - pad buffer with zero bits *_encodeBufferOut = 0; @@ -610,20 +588,15 @@ void QMailBase64Codec::encodeChunk(QDataStream& out, const unsigned char* it, in out << Base64Values[(((_encodeBuffer[0] & 0x03) << 4) | (_encodeBuffer[1] >> 4)) & 0x3f]; // Indicate unused bytes with the padding character - if (bufferedBytesRemaining == 1) - { + if (bufferedBytesRemaining == 1) { out << Base64PaddingByte; out << Base64PaddingByte; - } - else // must be two - { + } else { // must be two out << Base64Values[(((_encodeBuffer[1] & 0x0f) << 2) | (_encodeBuffer[2] >> 6)) & 0x3f]; out << Base64PaddingByte; } } - } - else - { + } else { // Leave the buffer intact, and adjust the line char count _encodeLineCharsRemaining = (lineEnd - it); } @@ -635,8 +608,7 @@ void QMailBase64Codec::decodeChunk(QDataStream& out, const char* it, int length, unsigned char* bufferEnd = _decodeBuffer + 4; const char* const end = it + length; - while (it != end) - { + while (it != end) { // Convert each character to the index value *_decodeBufferOut = base64Index(*it++); if (*_decodeBufferOut == 64) @@ -644,8 +616,7 @@ void QMailBase64Codec::decodeChunk(QDataStream& out, const char* it, int length, if (*_decodeBufferOut <= 64) ++_decodeBufferOut; - if (_decodeBufferOut == bufferEnd) - { + if (_decodeBufferOut == bufferEnd) { // We have buffered 4 input characters - write them out as three output bytes // unless some of them are padding @@ -655,16 +626,11 @@ void QMailBase64Codec::decodeChunk(QDataStream& out, const char* it, int length, decoded[2] = static_cast<unsigned char>(((_decodeBuffer[2] & 0x03) << 6) | (_decodeBuffer[3] & 0x3f)); int remainingChars = (3 - _decodePaddingCount); - for (int i = 0; i < remainingChars; ++i) - { - if ((decoded[i] == CarriageReturn || decoded[i] == LineFeed) && (_content == Text)) - { - if (_lastChar == CarriageReturn && decoded[i] == LineFeed) - { + for (int i = 0; i < remainingChars; ++i) { + if ((decoded[i] == CarriageReturn || decoded[i] == LineFeed) && (_content == Text)) { + if (_lastChar == CarriageReturn && decoded[i] == LineFeed) { // We have already processed this sequence - } - else - { + } else { // We should output the local newline sequence, but we can't // because we don't know what it is, and C++ translation-from-\n will // only work if the stream is a file... @@ -672,21 +638,19 @@ void QMailBase64Codec::decodeChunk(QDataStream& out, const char* it, int length, } _lastChar = decoded[i]; - } - else + } else { out << decoded[i]; + } } _decodeBufferOut = _decodeBuffer; } } - if (finalChunk) - { + if (finalChunk) { // There should always be an even multiple of 4 input bytes int bufferedBytesRemaining = _decodeBufferOut - _decodeBuffer; - if (bufferedBytesRemaining > 0) - { + if (bufferedBytesRemaining > 0) { qCWarning(lcMessaging) << "Huh? bytes remaining:" << bufferedBytesRemaining; } } @@ -708,18 +672,15 @@ static bool requiresEscape(unsigned char input, QMailQuotedPrintableCodec::Confo // For RFC 2047, we need to escape '?', '_', ' ' & '\t' // In fact, since the output may be used in a header field 'word', then the only characters // that can be used un-escaped are: alphanumerics, '!', '*', '+' '-', '/' and '_' - if (!escape && (conformance == QMailQuotedPrintableCodec::Rfc2047)) - { + if (!escape && (conformance == QMailQuotedPrintableCodec::Rfc2047)) { // We can also ignore space, since it will become an underscore - if ((input != ExclamationMark) && (input != Asterisk) && (input != Plus) && - (input != Minus) && (input != Slash) && (input != Underscore) && (input != Space)) - { + if ((input != ExclamationMark) && (input != Asterisk) && (input != Plus) + && (input != Minus) && (input != Slash) && (input != Underscore) && (input != Space)) { escape = !isalnum(input); } } - if (!escape && (input == HorizontalTab || input == Space)) - { + if (!escape && (input == HorizontalTab || input == Space)) { // The (potentially) last whitespace character on a line must be escaped if (charsRemaining <= 3) escape = true; @@ -860,18 +821,13 @@ void QMailQuotedPrintableCodec::encodeChunk(QDataStream& out, const unsigned cha // Set the input pointers relative to this input const unsigned char* const end = it + length; - while (it != end) - { + while (it != end) { unsigned char input = *it++; - if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) - { - if (_encodeLastChar == CarriageReturn && input == LineFeed) - { + if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) { + if (_encodeLastChar == CarriageReturn && input == LineFeed) { // We have already encoded this character-sequence - } - else - { + } else { // We must replace this character with ascii CRLF out << CarriageReturn << LineFeed; } @@ -889,8 +845,7 @@ void QMailQuotedPrintableCodec::encodeChunk(QDataStream& out, const unsigned cha int charsRequired = (escape ? 3 : 1); // If we can't fit this character on the line, insert a line break - if (charsRequired > _encodeLineCharsRemaining) - { + if (charsRequired > _encodeLineCharsRemaining) { lineBreak(out, &_encodeLineCharsRemaining, _maximumLineLength); // We may no longer need the encoding after the line break @@ -898,15 +853,14 @@ void QMailQuotedPrintableCodec::encodeChunk(QDataStream& out, const unsigned cha charsRequired = 1; } - if (charsRequired == 1) - { + if (charsRequired == 1) { if (input == Space && _conformance == Rfc2047) // output space as '_' out << static_cast<unsigned char>(Underscore); else out << input; - } - else + } else { encodeCharacter(out, input); + } _encodeLineCharsRemaining -= charsRequired; @@ -926,98 +880,72 @@ void QMailQuotedPrintableCodec::decodeChunk(QDataStream& out, const char* it, in // The variable _decodePrecedingInput holds any unprocessed input from a previous call: // If '=', we've parsed only that char, otherwise, it is the hex value of the first parsed character - if ((_decodePrecedingInput != NilPreceding) && (it != end)) - { + if ((_decodePrecedingInput != NilPreceding) && (it != end)) { unsigned char value = 0; - if (_decodePrecedingInput == Equals) - { + if (_decodePrecedingInput == Equals) { // Get the first escaped char unsigned char input = *it++; - if (input == LineFeed || input == CarriageReturn) - { + if (input == LineFeed || input == CarriageReturn) { // This is only a soft-line break _decodePrecedingInput = NilPreceding; - } - else - { + } else { value = decodeCharacter(input); _decodePrecedingInput = value; } _decodeLastChar = input; - } - else - { + } else { // We already have partial escaped input value = _decodePrecedingInput; } - if (it != end && _decodePrecedingInput != NilPreceding) - { + if (it != end && _decodePrecedingInput != NilPreceding) { out << static_cast<unsigned char>((value << 4) | decodeCharacter(*it++)); _decodePrecedingInput = NilPreceding; } } - while (it != end) - { + while (it != end) { unsigned char input = *it++; - if (input == Equals) - { + if (input == Equals) { // We are in an escape sequence - if (it == end) - { + if (it == end) { _decodePrecedingInput = Equals; - } - else - { + } else { input = *it++; - if (input == LineFeed || input == CarriageReturn) - { + if (input == LineFeed || input == CarriageReturn) { // This is a soft-line break - move on - } - else - { + } else { // This is an encoded character unsigned char value = decodeCharacter(input); - if (it == end) - { + if (it == end) { _decodePrecedingInput = value; - } - else - { + } else { out << static_cast<unsigned char>((value << 4) | decodeCharacter(*it++)); } } } - } - else - { - if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) - { - if (_decodeLastChar == CarriageReturn && input == LineFeed) - { + } else { + if ((input == CarriageReturn || input == LineFeed) && (_content == Text)) { + if (_decodeLastChar == CarriageReturn && input == LineFeed) { // We have already processed this sequence - } - else - { + } else { // We should output the local newline sequence, but we can't // because we don't know what it is, and C++ translation-from-\n will // only work if the stream is a file... out << static_cast<unsigned char>('\n'); } - } - else if (input == Underscore && _conformance == Rfc2047) + } else if (input == Underscore && _conformance == Rfc2047) { out << static_cast<unsigned char>(Space); - else + } else { out << input; + } } _decodeLastChar = input; } - if (finalChunk && _decodePrecedingInput != NilPreceding) - { + if (finalChunk && _decodePrecedingInput != NilPreceding) { qCWarning(lcMessaging) << "Huh? unfinished escape sequence..."; } } @@ -1025,8 +953,7 @@ void QMailQuotedPrintableCodec::decodeChunk(QDataStream& out, const char* it, in static void writeStream(QDataStream& out, const char* it, int length) { int totalWritten = 0; - while (totalWritten < length) - { + while (totalWritten < length) { int bytesWritten = out.writeRawData(it + totalWritten, length - totalWritten); if (bytesWritten == -1) return; @@ -1130,18 +1057,13 @@ void QMailLineEndingCodec::encodeChunk(QDataStream& out, const unsigned char* it const unsigned char* const end = it + length; const unsigned char* begin = it; - while (it != end) - { + while (it != end) { const unsigned char input = *it; - if (input == CarriageReturn || input == LineFeed) - { - if (_lastChar == CarriageReturn && input == LineFeed) - { + if (input == CarriageReturn || input == LineFeed) { + if (_lastChar == CarriageReturn && input == LineFeed) { // We have already encoded this character-sequence; skip the input begin = (it + 1); - } - else - { + } else { // Write the preceding characters if (it > begin) writeStream(out, reinterpret_cast<const char*>(begin), (it - begin)); @@ -1156,8 +1078,7 @@ void QMailLineEndingCodec::encodeChunk(QDataStream& out, const unsigned char* it ++it; } - if (it > begin) - { + if (it > begin) { // Write the remaining characters writeStream(out, reinterpret_cast<const char*>(begin), (it - begin)); } @@ -1171,18 +1092,13 @@ void QMailLineEndingCodec::decodeChunk(QDataStream& out, const char* it, int len const char* const end = it + length; const char* begin = it; - while (it != end) - { + while (it != end) { const char input = *it; - if (input == CarriageReturn || input == LineFeed) - { - if (_lastChar == CarriageReturn && input == LineFeed) - { + if (input == CarriageReturn || input == LineFeed) { + if (_lastChar == CarriageReturn && input == LineFeed) { // We have already processed this sequence begin = (it + 1); - } - else - { + } else { // Write the preceding characters if (it > begin) writeStream(out, begin, (it - begin)); @@ -1199,8 +1115,7 @@ void QMailLineEndingCodec::decodeChunk(QDataStream& out, const char* it, int len ++it; } - if (it > begin) - { + if (it > begin) { // Write the remaining characters writeStream(out, begin, (it - begin)); } @@ -1271,28 +1186,28 @@ static QString encodeModifiedBase64(const QString &in) static QString decodeModifiedBase64(QString in) { //remove & - - in.remove(0,1); - in.remove(in.length()-1,1); + in.remove(0, 1); + in.remove(in.length()-1, 1); if (in.isEmpty()) return QLatin1String("&"); - QByteArray buf(in.length(),static_cast<char>(0)); - QByteArray out(in.length() * 3 / 4 + 2,static_cast<char>(0)); + QByteArray buf(in.length(), static_cast<char>(0)); + QByteArray out(in.length() * 3 / 4 + 2, static_cast<char>(0)); //chars to numeric QByteArray latinChars = in.toLatin1(); for (int x = 0; x < in.length(); x++) { int c = latinChars[x]; - if ( c >= 'A' && c <= 'Z') + if (c >= 'A' && c <= 'Z') buf[x] = c - 'A'; - if ( c >= 'a' && c <= 'z') + if (c >= 'a' && c <= 'z') buf[x] = c - 'a' + 26; - if ( c >= '0' && c <= '9') + if (c >= '0' && c <= '9') buf[x] = c - '0' + 52; - if ( c == '+') + if (c == '+') buf[x] = 62; - if ( c == ',') + if (c == ',') buf[x] = 63; } @@ -1379,11 +1294,11 @@ QString QMailCodec::encodeModifiedUtf7(const QString &text) endIndex++; // encode non-US-ASCII part - QString unicodeString = in.mid(startIndex,(endIndex - startIndex)); + QString unicodeString = in.mid(startIndex, (endIndex - startIndex)); QString mbase64 = encodeModifiedBase64(unicodeString); // insert the encoded string - in.remove(startIndex,(endIndex-startIndex)); + in.remove(startIndex, (endIndex - startIndex)); in.insert(startIndex, mbase64); // set start index to the end of the encoded part @@ -1422,4 +1337,3 @@ QString QMailCodec::decodeModifiedUtf7(const QString &text) return out; } - diff --git a/src/libraries/qmfclient/qmailcontentmanager.cpp b/src/libraries/qmfclient/qmailcontentmanager.cpp index 0772535e..cfc62653 100644 --- a/src/libraries/qmfclient/qmailcontentmanager.cpp +++ b/src/libraries/qmfclient/qmailcontentmanager.cpp @@ -438,7 +438,7 @@ QMailContentManager::~QMailContentManager() QMailStore::ErrorCode QMailContentManager::remove(const QList<QString> &identifiers) { QMailStore::ErrorCode returnError(QMailStore::NoError); - foreach(QString const &identifier, identifiers) { + foreach (QString const &identifier, identifiers) { QMailStore::ErrorCode err(remove(identifier)); if (returnError == QMailStore::NoError) // report the first failure, but continue. returnError = err; @@ -447,7 +447,6 @@ QMailStore::ErrorCode QMailContentManager::remove(const QList<QString> &identifi return returnError; } - /*! Directs the content manager to perform any initialization tasks required. The content manager should return false if unable to perform initialization tasks; otherwise return true. @@ -475,4 +474,3 @@ QMailContentManager::ManagerRole QMailContentManager::role() const { return StorageRole; } - diff --git a/src/libraries/qmfclient/qmailcontentmanager.h b/src/libraries/qmfclient/qmailcontentmanager.h index 42b28ccd..653e46a2 100644 --- a/src/libraries/qmfclient/qmailcontentmanager.h +++ b/src/libraries/qmfclient/qmailcontentmanager.h @@ -124,4 +124,3 @@ public: }; #endif - diff --git a/src/libraries/qmfclient/qmaildatacomparator.cpp b/src/libraries/qmfclient/qmaildatacomparator.cpp index 9407d36d..eb92dc8c 100644 --- a/src/libraries/qmfclient/qmaildatacomparator.cpp +++ b/src/libraries/qmfclient/qmaildatacomparator.cpp @@ -86,4 +86,3 @@ \value Present Tests whether the specified property is present in the QMailStore object. \value Absent Tests whether the specified property is absent in the QMailStore object. */ - diff --git a/src/libraries/qmfclient/qmaildisconnected.cpp b/src/libraries/qmfclient/qmaildisconnected.cpp index 4a4e54de..7efced7e 100644 --- a/src/libraries/qmfclient/qmaildisconnected.cpp +++ b/src/libraries/qmfclient/qmaildisconnected.cpp @@ -287,7 +287,7 @@ void QMailDisconnected::rollBackUpdates(const QMailAccountId &mailAccountId) } // undo moves - foreach(const QMailMessageId& id, movedIds) { + foreach (const QMailMessageId& id, movedIds) { QMailMessageMetaData mail(id); mail.setParentFolderId(mail.previousParentFolderId()); mail.setPreviousParentFolderId(QMailFolderId()); @@ -360,7 +360,7 @@ void QMailDisconnected::moveToStandardFolder(const QMailMessageIdList& ids, QMai { QList<QMailMessageMetaData *> messages; // Using this for efficient update - foreach(const QMailMessageId &id, ids) { + foreach (const QMailMessageId &id, ids) { QMailMessageMetaData *msg = new QMailMessageMetaData(id); QMailFolderId folderId(QMailAccount(msg->parentAccountId()).standardFolder(standardFolder)); // will be cached QMailFolder folder; @@ -455,11 +455,11 @@ void QMailDisconnected::copyToStandardFolder(const QMailMessageIdList& ids, QMai { QMailAccountIdList allAccounts = QMailStore::instance()->queryAccounts(); - foreach(const QMailAccountId& id, allAccounts) { + foreach (const QMailAccountId& id, allAccounts) { QMailAccount account(id); QMailFolderId standardFolderId = account.standardFolder(standardFolder); if (standardFolderId.isValid()) - copyToFolder(ids,standardFolderId); + copyToFolder(ids, standardFolderId); } } @@ -492,8 +492,8 @@ void QMailDisconnected::copyToFolder(const QMailMessageIdList& ids, const QMailF copy.setParentAccountId(mail.parentAccountId()); copy.setSize(mail.size()); copy.setStatus(mail.status()); - copy.setStatus(QMailMessage::LocalOnly,true); - copy.setStatus(QMailMessage::Removed,false); + copy.setStatus(QMailMessage::LocalOnly, true); + copy.setStatus(QMailMessage::Removed, false); syncStatusWithFolder(copy); QMailStore::instance()->addMessage(©); } @@ -582,9 +582,6 @@ void QMailDisconnected::restoreToPreviousFolder(const QMailMessageKey& key) if (!messages.empty()) { QMailStore::instance()->updateMessages(messages); - foreach (QMailMessageMetaData *messagePointer, messages) { - delete messagePointer; - } + qDeleteAll(messages); } } - diff --git a/src/libraries/qmfclient/qmailfolderfwd.h b/src/libraries/qmfclient/qmailfolderfwd.h index e7302859..a58539b0 100644 --- a/src/libraries/qmfclient/qmailfolderfwd.h +++ b/src/libraries/qmfclient/qmailfolderfwd.h @@ -43,4 +43,3 @@ public: }; #endif - diff --git a/src/libraries/qmfclient/qmailfolderkey.cpp b/src/libraries/qmfclient/qmailfolderkey.cpp index c639cc4a..6b6ea8b8 100644 --- a/src/libraries/qmfclient/qmailfolderkey.cpp +++ b/src/libraries/qmfclient/qmailfolderkey.cpp @@ -625,5 +625,3 @@ QMailFolderKey QMailFolderKey::customField(const QString &name, const QString &v { return QMailFolderKey(Custom, QStringList() << QMailKey::stringValue(name) << QMailKey::stringValue(value), QMailKey::comparator(cmp)); } - - diff --git a/src/libraries/qmfclient/qmailfoldersortkey.cpp b/src/libraries/qmfclient/qmailfoldersortkey.cpp index 7fc6d471..f14ece5a 100644 --- a/src/libraries/qmfclient/qmailfoldersortkey.cpp +++ b/src/libraries/qmfclient/qmailfoldersortkey.cpp @@ -293,6 +293,4 @@ QMailFolderSortKey QMailFolderSortKey::status(quint64 mask, Qt::SortOrder order) return QMailFolderSortKey(Status, order, mask); } - Q_IMPLEMENT_USER_METATYPE(QMailFolderSortKey) - diff --git a/src/libraries/qmfclient/qmailid.cpp b/src/libraries/qmfclient/qmailid.cpp index 872ec9c6..0d2b7df6 100644 --- a/src/libraries/qmfclient/qmailid.cpp +++ b/src/libraries/qmfclient/qmailid.cpp @@ -710,5 +710,3 @@ uint qHash(const QMailThreadId &id) { return qHash(id.toULongLong()); } - - diff --git a/src/libraries/qmfclient/qmailinstantiations.cpp b/src/libraries/qmfclient/qmailinstantiations.cpp index 88e85337..e7dc60bb 100644 --- a/src/libraries/qmfclient/qmailinstantiations.cpp +++ b/src/libraries/qmfclient/qmailinstantiations.cpp @@ -79,4 +79,3 @@ Q_IMPLEMENT_USER_METATYPE_ENUM(QMailServiceAction::Status::ErrorCode) Q_IMPLEMENT_USER_METATYPE_ENUM(QMailRetrievalAction::RetrievalSpecification) Q_IMPLEMENT_USER_METATYPE_ENUM(QMailSearchAction::SearchSpecification) - diff --git a/src/libraries/qmfclient/qmailkeyargument.cpp b/src/libraries/qmfclient/qmailkeyargument.cpp index 16891ca0..783f85ff 100644 --- a/src/libraries/qmfclient/qmailkeyargument.cpp +++ b/src/libraries/qmfclient/qmailkeyargument.cpp @@ -140,4 +140,3 @@ Reads the contents of a QMailKeyArgument from \a stream. */ - diff --git a/src/libraries/qmfclient/qmailkeyargument.h b/src/libraries/qmfclient/qmailkeyargument.h index 16945e36..e2af5563 100644 --- a/src/libraries/qmfclient/qmailkeyargument.h +++ b/src/libraries/qmfclient/qmailkeyargument.h @@ -231,4 +231,3 @@ public: }; #endif - diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp index 29d1ac1c..a8191669 100644 --- a/src/libraries/qmfclient/qmailmessage.cpp +++ b/src/libraries/qmfclient/qmailmessage.cpp @@ -135,26 +135,22 @@ static int insensitiveIndexOf(const QByteArray& content, const QByteArray& conta const char* const end = begin + container.length() - (content.length() - 1); const char* it = begin + from; - while (it < end) - { - if (toupper(*it++) == toupper(*matchBegin)) - { + while (it < end) { + if (toupper(*it++) == toupper(*matchBegin)) { const char* restart = it; // See if the remainder matches const char* searchIt = it; const char* matchIt = matchBegin + 1; - do - { + do { if (matchIt == matchEnd) return ((it - 1) - begin); // We may find the next place to search in our scan if ((restart == it) && (*searchIt == *(it - 1))) restart = searchIt; - } - while (toupper(*searchIt++) == toupper(*matchIt++)); + } while (toupper(*searchIt++) == toupper(*matchIt++)); // No match it = restart; @@ -182,15 +178,11 @@ static QByteArray charsetForInput(const QString& input) const QChar* it = input.constData(); const QChar* const end = it + input.length(); - for ( ; it != end; ++it) - { - if ((*it).unicode() > 0xff) - { + for ( ; it != end; ++it) { + if ((*it).unicode() > 0xff) { // Multi-byte characters included - we need to use UTF-8 return QByteArray("UTF-8"); - } - else if (!latin1 && ((*it).unicode() > 0x7f)) - { + } else if (!latin1 && ((*it).unicode() > 0x7f)) { // We need encoding from latin-1 latin1 = true; } @@ -201,8 +193,7 @@ static QByteArray charsetForInput(const QString& input) static QByteArray fromUnicode(const QString& input, const QByteArray& charset) { - if (!charset.isEmpty() && (insensitiveIndexOf("ascii", charset) == -1)) - { + if (!charset.isEmpty() && (insensitiveIndexOf("ascii", charset) == -1)) { // See if we can convert using the nominated charset if (QTextCodec* textCodec = QMailCodec::codecForName(charset)) return textCodec->fromUnicode(input); @@ -265,61 +256,59 @@ static QMailMessageBody::TransferEncoding encodingForName(const QByteArray& name static const char* nameForEncoding(QMailMessageBody::TransferEncoding te) { - switch ( te ) - { - case QMailMessageBody::SevenBit: - return "7bit"; - case QMailMessageBody::EightBit: - return "8bit"; - case QMailMessageBody::QuotedPrintable: - return "quoted-printable"; - case QMailMessageBody::Base64: - return "base64"; - case QMailMessageBody::Binary: - return "binary"; - case QMailMessageBody::NoEncoding: - break; + switch (te) { + case QMailMessageBody::SevenBit: + return "7bit"; + case QMailMessageBody::EightBit: + return "8bit"; + case QMailMessageBody::QuotedPrintable: + return "quoted-printable"; + case QMailMessageBody::Base64: + return "base64"; + case QMailMessageBody::Binary: + return "binary"; + case QMailMessageBody::NoEncoding: + break; } - return 0; + return nullptr; } static QMailCodec* codecForEncoding(QMailMessageBody::TransferEncoding te, bool textualData) { - switch ( te ) - { - case QMailMessageBody::NoEncoding: - case QMailMessageBody::Binary: - return new QMailPassThroughCodec(); + switch (te) { + case QMailMessageBody::NoEncoding: + case QMailMessageBody::Binary: + return new QMailPassThroughCodec(); - case QMailMessageBody::SevenBit: - case QMailMessageBody::EightBit: - if (textualData) { - return static_cast<QMailCodec*>(new QMailLineEndingCodec()); - } else { - return new QMailPassThroughCodec(); - } + case QMailMessageBody::SevenBit: + case QMailMessageBody::EightBit: + if (textualData) { + return static_cast<QMailCodec*>(new QMailLineEndingCodec()); + } else { + return new QMailPassThroughCodec(); + } - case QMailMessageBody::QuotedPrintable: - if (textualData) { - return new QMailQuotedPrintableCodec( - QMailQuotedPrintableCodec::Text, - QMailQuotedPrintableCodec::Rfc2045); - } else { - return new QMailQuotedPrintableCodec( - QMailQuotedPrintableCodec::Binary, - QMailQuotedPrintableCodec::Rfc2045); - } + case QMailMessageBody::QuotedPrintable: + if (textualData) { + return new QMailQuotedPrintableCodec( + QMailQuotedPrintableCodec::Text, + QMailQuotedPrintableCodec::Rfc2045); + } else { + return new QMailQuotedPrintableCodec( + QMailQuotedPrintableCodec::Binary, + QMailQuotedPrintableCodec::Rfc2045); + } - case QMailMessageBody::Base64: - if (textualData) { - return new QMailBase64Codec(QMailBase64Codec::Text); - } else { - return new QMailBase64Codec(QMailBase64Codec::Binary); - } + case QMailMessageBody::Base64: + if (textualData) { + return new QMailBase64Codec(QMailBase64Codec::Text); + } else { + return new QMailBase64Codec(QMailBase64Codec::Binary); + } } - return 0; + return nullptr; } static QMailCodec* codecForEncoding(QMailMessageBody::TransferEncoding te, const QMailMessageContentType& content) @@ -336,26 +325,20 @@ static QPair<QByteArray, QByteArray> encodedText(const QByteArray& encodedWord) // Find the parts of the input index[0] = encodedWord.indexOf("=?"); - if (index[0] != -1) - { + if (index[0] != -1) { index[1] = encodedWord.indexOf('?', index[0] + 2); - if (index[1] != -1) - { + if (index[1] != -1) { index[2] = encodedWord.indexOf('?', index[1] + 1); index[3] = encodedWord.lastIndexOf("?="); - if ((index[2] != -1) && (index[3] > index[2])) - { + if ((index[2] != -1) && (index[3] > index[2])) { QByteArray charset = QMail::unquoteString(encodedWord.mid(index[0] + 2, (index[1] - index[0] - 2))); QByteArray encoding = encodedWord.mid(index[1] + 1, (index[2] - index[1] - 1)).toUpper(); QByteArray encoded = encodedWord.mid(index[2] + 1, (index[3] - index[2] - 1)); - if (encoding == "Q") - { + if (encoding == "Q") { QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047); result = qMakePair(codec.decode(encoded), charset); - } - else if (encoding == "B") - { + } else if (encoding == "B") { QMailBase64Codec codec(QMailBase64Codec::Binary); result = qMakePair(codec.decode(encoded), charset); } @@ -382,8 +365,7 @@ static QByteArray generateEncodedWord(const QByteArray& codec, char encoding, co { QByteArray result; - foreach (const QByteArray& item, list) - { + foreach (const QByteArray& item, list) { if (!result.isEmpty()) result.append(' '); @@ -449,8 +431,7 @@ static QList<QByteArray> split(const QByteArray& input, const QByteArray& separa int index = -1; int lastIndex = -1; - do - { + do { lastIndex = index; index = input.indexOf(separator, lastIndex + 1); @@ -476,8 +457,7 @@ static QByteArray encodeWord(const QString &text, const QByteArray& cs, bool* en int maximumEncoded = 75 - 7 - charset.length(); // If this is an encodedWord, we need to include any whitespace that we don't want to lose - if (insensitiveIndexOf("utf-8", charset) == 0) - { + if (insensitiveIndexOf("utf-8", charset) == 0) { QList<QByteArray> listEnc; QList<QByteArray> list = splitUtf8(text.toUtf8(), maximumEncoded); foreach (const QByteArray &item, list) { @@ -487,9 +467,7 @@ static QByteArray encodeWord(const QString &text, const QByteArray& cs, bool* en } return generateEncodedWord(charset, 'B', listEnc); - } - else if (insensitiveIndexOf("iso-8859-", charset) == 0) - { + } else if (insensitiveIndexOf("iso-8859-", charset) == 0) { QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047, maximumEncoded); QByteArray encoded = codec.encode(text, charset); return generateEncodedWord(charset, 'Q', split(encoded, "=\r\n")); @@ -583,42 +561,32 @@ static QList<Token> tokenSequence(const QString& input) const QChar* it = input.constData(); const QChar* const end = it + input.length(); - if (it != end) - { + if (it != end) { const QChar* token = it; EncodingTokenType state = ((*it) == QChar::fromLatin1('"') ? Quote : ((*it).isSpace() ? Whitespace : Word)); - for (++it; it != end; ++it) - { - if (!escaped && (*it == QChar::fromLatin1('\\'))) - { + for (++it; it != end; ++it) { + if (!escaped && (*it == QChar::fromLatin1('\\'))) { escaped = true; continue; } - if (state == Quote) - { + if (state == Quote) { // This quotation mark is a token by itself result.append(makeToken(state, token, it, escaped)); state = ((*it) == QChar::fromLatin1('"') && !escaped ? Quote : ((*it).isSpace() ? Whitespace : Word)); token = it; - } - else if (state == Whitespace) - { - if (!(*it).isSpace()) - { + } else if (state == Whitespace) { + if (!(*it).isSpace()) { // We have passed the end of this whitespace-sequence result.append(makeToken(state, token, it, escaped)); state = ((*it) == QChar::fromLatin1('"') && !escaped ? Quote : Word); token = it; } - } - else - { - if ((*it).isSpace() || ((*it) == QChar::fromLatin1('"') && !escaped)) - { + } else { + if ((*it).isSpace() || ((*it) == QChar::fromLatin1('"') && !escaped)) { // We have passed the end of this word result.append(makeToken(state, token, it, escaped)); @@ -645,15 +613,12 @@ static QByteArray encodeWordSequence(const QString& str, const QByteArray& chars QString quotedText; QString heldWhitespace; - foreach (const Token& token, tokenSequence(str)) - { + foreach (const Token& token, tokenSequence(str)) { QString chars = QString::fromRawData(token.second.first, token.second.second); // See if we're processing some quoted words - if (quoted) - { - if (token.first == Quote) - { + if (quoted) { + if (token.first == Quote) { // We have reached the end of a quote sequence quotedText.append(chars); @@ -668,24 +633,16 @@ static QByteArray encodeWordSequence(const QString& str, const QByteArray& chars if (lastEncoded && tokenEncoded) result.append(' '); result.append(output); - } - else - { + } else { quotedText.append(chars); } - } - else - { - if (token.first == Quote) - { + } else { + if (token.first == Quote) { // This token begins a quoted sequence quotedText = chars; quoted = true; - } - else - { - if (token.first == Word) - { + } else { + if (token.first == Word) { bool lastEncoded = tokenEncoded; // See if this token needs encoding @@ -695,9 +652,7 @@ static QByteArray encodeWordSequence(const QString& str, const QByteArray& chars if (lastEncoded && tokenEncoded) result.append(' '); result.append(output); - } - else // whitespace - { + } else { // whitespace // If the last token was an encoded-word, we may need to include this // whitespace into the next token if (tokenEncoded) @@ -710,8 +665,7 @@ static QByteArray encodeWordSequence(const QString& str, const QByteArray& chars } // Process trailing text after unmatched double quote character - if (quoted) - { + if (quoted) { bool lastEncoded = tokenEncoded; QByteArray output = encodeWord(heldWhitespace + quotedText, charset, &tokenEncoded); @@ -747,17 +701,15 @@ static QString decodeParameterText(const QByteArray& text, const QByteArray& cha // Decode any encoded bytes in the data const char* it = text.constData(); - for (const char* const end = it + text.length(); it != end; ++it) - { - if (*it == '%') - { + for (const char* const end = it + text.length(); it != end; ++it) { + if (*it == '%') { if ((end - it) > 2) decoded.append(hexValue(it + 1)); it += 2; - } - else + } else { decoded.append(*it); + } } // Decoded contains a bytestream - decode to unicode text if possible @@ -795,8 +747,7 @@ static QByteArray generateEncodedParameter(const QByteArray& charset, const QByt // If the charset contains a language part, extract it int index = result.indexOf('*'); - if (index != -1) - { + if (index != -1) { // If no language is specified, use the extracted part if (lang.isEmpty()) lang = result.mid(index + 1); @@ -1604,7 +1555,7 @@ namespace attachments disposition.setParameter("filename*", QMailMessageContentDisposition::encodeParameter(input, "UTF-8")); } - container->appendPart(QMailMessagePart::fromFile(filePath, disposition,attach_type, QMailMessageBody::Base64, + container->appendPart(QMailMessagePart::fromFile(filePath, disposition, attach_type, QMailMessageBody::Base64, QMailMessageBody::RequiresEncoding)); addedSome = true; } @@ -1662,8 +1613,7 @@ static bool validExtension(const QByteArray& trailer, int* number = Q_NULLPTR, b // Extensions according to RFC 2231: QRegularExpressionMatch extensionFormat = QRegularExpression(QLatin1String("^(?:\\*(\\d+))?(\\*?)$")).match(QLatin1String(trailer)); - if (extensionFormat.hasMatch()) - { + if (extensionFormat.hasMatch()) { if (number) *number = extensionFormat.captured(1).toInt(); if (encoded) @@ -1683,8 +1633,7 @@ static bool matchingParameter(const QByteArray& name, const QByteArray& other, b if (index == -1) return false; - if (index > 0) - { + if (index > 0) { // Ensure that every preceding character is whitespace QByteArray leader(other.left(index).trimmed()); if (!leader.isEmpty()) @@ -1697,8 +1646,7 @@ static bool matchingParameter(const QByteArray& name, const QByteArray& other, b index = other.length(); // Ensure that there is only whitespace between the matched name and the end of the name - if ((index - lastIndex) > 1) - { + if ((index - lastIndex) > 1) { QByteArray trailer(other.mid(lastIndex + 1, (index - lastIndex)).trimmed()); if (!trailer.isEmpty()) return validExtension(trailer, 0, encoded); @@ -1725,8 +1673,7 @@ void QMailMessageHeaderFieldPrivate::parse(const QByteArray& text, bool structur const char* token = begin; const char* it = begin; const char* separator = 0; - for (bool quoted = false; it != end; ++it) - { + for (bool quoted = false; it != end; ++it) { if (*it == '"') { quoted = !quoted; } @@ -1745,26 +1692,22 @@ void QMailMessageHeaderFieldPrivate::parse(const QByteArray& text, bool structur if (separator == 0) { // This is a parameter separator separator = it; - } - else { + } else { // It would be nice to identify extra '=' chars, but it's too hard // to separate them from encoded-word formations... //malformed = true; } - } - else if (*it == ';' && !quoted && structured) { + } else if (*it == ';' && !quoted && structured) { // This is the end of a token if (_content.isEmpty()) { _content = QByteArray(token, (it - token)).trimmed(); - } - else if ((separator > token) && ((separator + 1) < it)) { + } else if ((separator > token) && ((separator + 1) < it)) { QByteArray name = QByteArray(token, (separator - token)).trimmed(); QByteArray value = QByteArray(separator + 1, (it - separator - 1)).trimmed(); if (!name.isEmpty() && !value.isEmpty()) addParameter(name, value); - } - else { + } else { malformed = true; } @@ -1776,18 +1719,15 @@ void QMailMessageHeaderFieldPrivate::parse(const QByteArray& text, bool structur if (token != end) { if (_id.isEmpty()) { _id = QByteArray(token, (end - token)).trimmed(); - } - else if (_content.isEmpty()) { + } else if (_content.isEmpty()) { _content = QByteArray(token, (end - token)).trimmed(); - } - else if ((separator > token) && ((separator + 1) < end) && !malformed) { + } else if ((separator > token) && ((separator + 1) < end) && !malformed) { QByteArray name = QByteArray(token, (separator - token)).trimmed(); QByteArray value = QByteArray(separator + 1, (end - separator - 1)).trimmed(); if (!name.isEmpty() && !value.isEmpty()) addParameter(name, value); - } - else if (_structured) { + } else if (_structured) { malformed = true; } } @@ -1886,8 +1826,7 @@ void QMailMessageHeaderFieldPrivate::setParameter(const QByteArray& name, const // We have multiple pieces to insert QList<QByteArray> pieces; QByteArray input(value); - do - { + do { int splitPoint = maxInputLength; if (encoded && input.length() > maxInputLength) { int percentPosition = input.indexOf("%", maxInputLength - 2); @@ -2042,8 +1981,7 @@ QByteArray QMailMessageHeaderFieldPrivate::toString(bool includeName, bool prese result += _content; } - if (_structured) - { + if (_structured) { foreach (const QMailMessageContentType::ParameterType& parameter, (presentable ? parameters() : _parameters)) result.append("; ").append(parameter.first).append('=').append(protectedParameter(parameter.second)); } @@ -2175,8 +2113,7 @@ QString QMailMessageHeaderFieldPrivate::decodedContent() const { QString result(QMailMessageHeaderField::decodeContent(_content)); - if (_structured) - { + if (_structured) { foreach (const QMailMessageContentType::ParameterType& parameter, _parameters) { QString decoded; if (parameterEncoded(parameter.first)) @@ -2557,12 +2494,9 @@ QMailMessageContentType::QMailMessageContentType(const QByteArray& type) // Although a conforming CT must be: <type> "/" <subtype> without whitespace, // we'll be a bit more accepting int index = type.indexOf('/'); - if (index == -1) - { + if (index == -1) { content = type.trimmed(); - } - else - { + } else { QByteArray primaryType = type.left(index).trimmed(); QByteArray secondaryType = type.mid(index + 1).trimmed(); @@ -2647,8 +2581,7 @@ QByteArray QMailMessageContentType::subType() const void QMailMessageContentType::setSubType(const QByteArray& subType) { QByteArray primaryType(type()); - if (!primaryType.isEmpty()) - { + if (!primaryType.isEmpty()) { if (!subType.isEmpty()) primaryType.append('/').append(subType); @@ -3022,8 +2955,7 @@ static bool matchingId(const QByteArray& id, const QByteArray& other, bool allow if (index == -1) return false; - if (index > 0) - { + if (index > 0) { // Ensure that every preceding character is whitespace QByteArray leader(other.left(index).trimmed()); if (!leader.isEmpty()) @@ -3039,8 +2971,7 @@ static bool matchingId(const QByteArray& id, const QByteArray& other, bool allow index = other.length() - 1; // Ensure that there is only whitespace between the matched ID and the end of the ID - if ((index - lastIndex) > 1) - { + if ((index - lastIndex) > 1) { QByteArray trailer(other.mid(lastIndex + 1, (index - lastIndex)).trimmed()); if (!trailer.isEmpty()) return false; @@ -3265,6 +3196,7 @@ void QMailMessageBodyPrivate::ensureCharsetExist() } else { autoCharset = QMailCodec::autoDetectEncoding(data).toLatin1(); } + if (!autoCharset.isEmpty() && (insensitiveIndexOf("ISO-8859-", autoCharset) == -1)) { QByteArray best(QMailCodec::bestCompatibleCharset(autoCharset, true)); if (!best.isEmpty()) { @@ -3314,8 +3246,7 @@ void QMailMessageBodyPrivate::fromStream(QDataStream& in, const QMailMessageCont te = QMailMessageBody::SevenBit; QMailCodec* codec = codecForEncoding(te, content); - if (codec) - { + if (codec) { // Stream to the buffer, encoding as required QByteArray encoded; { @@ -3338,8 +3269,7 @@ void QMailMessageBodyPrivate::fromStream(QTextStream& in, const QMailMessageCont _bodyData = LongString(); QMailCodec* codec = codecForEncoding(te, content); - if (codec) - { + if (codec) { QByteArray encoded; { QDataStream out(&encoded, QIODevice::WriteOnly); @@ -3364,13 +3294,10 @@ void QMailMessageBodyPrivate::fromStream(QTextStream& in, const QMailMessageCont static bool unicodeConvertingCharset(const QByteArray& charset) { // See if this is a unicode-capable codec - if (QTextCodec* textCodec = QMailCodec::codecForName(charset, true)) - { + if (QTextCodec* textCodec = QMailCodec::codecForName(charset, true)) { const QChar multiByteChar = static_cast<char16_t>(0x1234); return textCodec->canEncode(multiByteChar); - } - else - { + } else { qCWarning(lcMessaging) << "unicodeConvertingCharset: unable to find codec for charset:" << charset; } @@ -3382,11 +3309,9 @@ static QByteArray extractionCharset(const QMailMessageContentType& type) QByteArray charset; // Find the charset for this data, if it is text data - if (insensitiveEqual(type.type(), "text")) - { + if (insensitiveEqual(type.type(), "text")) { charset = type.charset(); - if (!charset.isEmpty()) - { + if (!charset.isEmpty()) { // If the codec can't handle multi-byte characters, don't extract to/from unicode if (!unicodeConvertingCharset(charset)) charset = QByteArray(); @@ -3399,8 +3324,7 @@ static QByteArray extractionCharset(const QMailMessageContentType& type) bool QMailMessageBodyPrivate::toFile(const QString& file, QMailMessageBody::EncodingFormat format) const { QFile outFile(file); - if (!outFile.open(QIODevice::WriteOnly)) - { + if (!outFile.open(QIODevice::WriteOnly)) { qCWarning(lcMessaging) << "Unable to open for write:" << file; return false; } @@ -3414,8 +3338,7 @@ bool QMailMessageBodyPrivate::toFile(const QString& file, QMailMessageBody::Enco te = QMailMessageBody::Binary; QMailCodec* codec = codecForEncoding(te, _type); - if (codec) - { + if (codec) { bool result = false; // Find the charset for this data, if it is text data @@ -3423,17 +3346,14 @@ bool QMailMessageBodyPrivate::toFile(const QString& file, QMailMessageBody::Enco QDataStream* in = _bodyData.dataStream(); // Empty charset indicates no unicode encoding; encoded return data means binary streams - if (charset.isEmpty() || encodeOutput) - { + if (charset.isEmpty() || encodeOutput) { // We are dealing with binary data QDataStream out(&outFile); if (encodeOutput) codec->encode(out, *in); else codec->decode(out, *in); - } - else // we should probably check that charset matches this->charset - { + } else { // we should probably check that charset matches this->charset // We are dealing with unicode text data, which we want in unencoded form QTextStream out(&outFile); @@ -3463,21 +3383,17 @@ bool QMailMessageBodyPrivate::toStream(QDataStream& out, QMailMessageBody::Encod te = QMailMessageBody::Binary; QMailCodec* codec = codecForEncoding(te, _type); - if (codec) - { + if (codec) { bool result = false; QByteArray charset(extractionCharset(_type)); - if (!charset.isEmpty() && !_filename.isEmpty() && encodeOutput) - { + if (!charset.isEmpty() && !_filename.isEmpty() && encodeOutput) { // This data must be unicode in the file QTextStream* in = _bodyData.textStream(); codec->encode(out, *in, charset); result = (in->status() == QTextStream::Ok); delete in; - } - else - { + } else { QDataStream* in = _bodyData.dataStream(); if (encodeOutput) codec->encode(out, *in); @@ -3509,8 +3425,7 @@ bool QMailMessageBodyPrivate::toStream(QTextStream& out) const te = QMailMessageBody::Binary; QMailCodec* codec = codecForEncoding(te, _type); - if (codec) - { + if (codec) { bool result = false; QDataStream* in = _bodyData.dataStream(); @@ -4023,8 +3938,7 @@ void QMailMessagePartContainerPrivate::setHeader(const QMailMessageHeader& partH defaultContentType(parent); QByteArray contentType = headerField("Content-Type"); - if (!contentType.isEmpty()) - { + if (!contentType.isEmpty()) { // Extract the stored parts from the supplied field QMailMessageContentType type(contentType); _multipartType = QMailMessagePartContainer::multipartTypeForName(type.content()); @@ -4040,20 +3954,15 @@ void QMailMessagePartContainerPrivate::defaultContentType(const QMailMessagePart QByteArray contentType = headerField("Content-Type"); bool useDefault = contentType.isEmpty(); - if (!useDefault) - { + if (!useDefault) { type = QMailMessageContentType(contentType); - if (type.type().isEmpty() || type.subType().isEmpty()) - { + if (type.type().isEmpty() || type.subType().isEmpty()) { useDefault = true; - } - else if (insensitiveEqual(type.content(), "application/octet-stream")) - { + } else if (insensitiveEqual(type.content(), "application/octet-stream")) { // Sender's client might not know what type, but maybe we do. Try... QByteArray contentDisposition = headerField("Content-Disposition"); - if (!contentDisposition.isEmpty()) - { + if (!contentDisposition.isEmpty()) { QMailMessageContentDisposition disposition(contentDisposition); QList<QMimeType> mimeTypes = QMimeDatabase().mimeTypesForFileName(QString::fromUtf8(disposition.filename())); @@ -4065,12 +3974,10 @@ void QMailMessagePartContainerPrivate::defaultContentType(const QMailMessagePart } } - if (useDefault && parent) - { + if (useDefault && parent) { // Note that the default is 'message/rfc822' when the parent is 'multipart/digest' QMailMessageContentType parentType = parent->contentType(); - if (parentType.matches("multipart", "digest")) - { + if (parentType.matches("multipart", "digest")) { type.setType("message"); type.setSubType("rfc822"); updateHeaderField(type.id(), type.toString(false, false)); @@ -4078,8 +3985,7 @@ void QMailMessagePartContainerPrivate::defaultContentType(const QMailMessagePart } } - if (useDefault) - { + if (useDefault) { type.setType("text"); type.setSubType("plain"); type.setCharset("us-ascii"); @@ -4196,7 +4102,7 @@ void QMailMessagePartContainerPrivate::setMultipartType(QMailMessagePartContaine if (_multipartType == QMailMessagePartContainer::MultipartNone) { removeHeaderField("Content-Type"); - } else { + } else { QMailMessageContentType contentType = updateContentType(headerField("Content-Type"), _multipartType, _boundary); foreach (const QMailMessageHeaderField::ParameterType& param, parameters) contentType.setParameter(param.first, param.second); @@ -4345,8 +4251,7 @@ void QMailMessagePartContainerPrivate::updateHeaderField(const QByteArray &id, c _header.update(id, content); setDirty(); - if (insensitiveEqual(plainId(id), "Content-Type")) - { + if (insensitiveEqual(plainId(id), "Content-Type")) { // Extract the stored parts from the supplied field QMailMessageContentType type(content); _multipartType = QMailMessagePartContainer::multipartTypeForName(type.content()); @@ -4373,8 +4278,7 @@ void QMailMessagePartContainerPrivate::appendHeaderField(const QByteArray &id, c _header.append( id, content ); setDirty(); - if (insensitiveEqual(plainId(id), "Content-Type")) - { + if (insensitiveEqual(plainId(id), "Content-Type")) { // Extract the stored parts from the supplied field QMailMessageContentType type(content); _multipartType = QMailMessagePartContainer::multipartTypeForName(type.content()); @@ -4392,8 +4296,7 @@ void QMailMessagePartContainerPrivate::removeHeaderField(const QByteArray &id) _header.remove(id); setDirty(); - if (insensitiveEqual(plainId(id), "Content-Type")) - { + if (insensitiveEqual(plainId(id), "Content-Type")) { // Extract the stored parts from the supplied field _multipartType = QMailMessagePartContainer::MultipartNone; _boundary = QByteArray(); @@ -4536,16 +4439,14 @@ void QMailMessagePartContainerPrivate::parseMimeMultipart(const QMailMessageHead if (endPos == -1) endPos = body.length() - 1; - while ((startPos != -1) && (startPos < endPos)) - { + while ((startPos != -1) && (startPos < endPos)) { // Skip the boundary line startPos = body.indexOf(lineFeed, startPos); if (startPos > 0 && body.mid(startPos - 1, 1).indexOf(QByteArray(1, QMailMessage::CarriageReturn)) != -1) startPos--; - if ((startPos != -1) && (startPos < endPos)) - { + if ((startPos != -1) && (startPos < endPos)) { // Parse the section up to the next boundary marker int nextPos = body.indexOf(partDelimiter, startPos); @@ -5140,46 +5041,27 @@ QMailMessagePartContainer::MultipartType QMailMessagePartContainer::multipartTyp */ QByteArray QMailMessagePartContainer::nameForMultipartType(QMailMessagePartContainer::MultipartType type) { - switch (type) - { - case QMailMessagePartContainer::MultipartSigned: - { + switch (type) { + case QMailMessagePartContainer::MultipartSigned: return "multipart/signed"; - } - case QMailMessagePartContainer::MultipartEncrypted: - { - return "multipart/encrypted"; - } - case QMailMessagePartContainer::MultipartMixed: - { - return "multipart/mixed"; - } - case QMailMessagePartContainer::MultipartAlternative: - { - return "multipart/alternative"; - } - case QMailMessagePartContainer::MultipartDigest: - { - return "multipart/digest"; - } - case QMailMessagePartContainer::MultipartParallel: - { - return "multipart/parallel"; - } - case QMailMessagePartContainer::MultipartRelated: - { - return "multipart/related"; - } - case QMailMessagePartContainer::MultipartFormData: - { - return "multipart/form-data"; - } - case QMailMessagePartContainer::MultipartReport: - { - return "multipart/report"; - } - case QMailMessagePartContainer::MultipartNone: - break; + case QMailMessagePartContainer::MultipartEncrypted: + return "multipart/encrypted"; + case QMailMessagePartContainer::MultipartMixed: + return "multipart/mixed"; + case QMailMessagePartContainer::MultipartAlternative: + return "multipart/alternative"; + case QMailMessagePartContainer::MultipartDigest: + return "multipart/digest"; + case QMailMessagePartContainer::MultipartParallel: + return "multipart/parallel"; + case QMailMessagePartContainer::MultipartRelated: + return "multipart/related"; + case QMailMessagePartContainer::MultipartFormData: + return "multipart/form-data"; + case QMailMessagePartContainer::MultipartReport: + return "multipart/report"; + case QMailMessagePartContainer::MultipartNone: + break; } return QByteArray(); @@ -8678,8 +8560,7 @@ bool QMailMessage::partialContentAvailable() const /*! \reimp */ QString QMailMessage::preview() const { - if (partContainerImpl()->previewDirty()) - { + if (partContainerImpl()->previewDirty()) { const_cast<QMailMessage*>(this)->refreshPreview(); } diff --git a/src/libraries/qmfclient/qmailmessage_p.h b/src/libraries/qmfclient/qmailmessage_p.h index 1609ee70..7ebbfd83 100644 --- a/src/libraries/qmfclient/qmailmessage_p.h +++ b/src/libraries/qmfclient/qmailmessage_p.h @@ -507,4 +507,3 @@ private: }; #endif - diff --git a/src/libraries/qmfclient/qmailmessagefwd.cpp b/src/libraries/qmfclient/qmailmessagefwd.cpp index 6c3abded..37ad6c31 100644 --- a/src/libraries/qmfclient/qmailmessagefwd.cpp +++ b/src/libraries/qmfclient/qmailmessagefwd.cpp @@ -269,4 +269,3 @@ This type defines a single chunk in a sequence of partitioned output data. */ - diff --git a/src/libraries/qmfclient/qmailmessagekey_p.h b/src/libraries/qmfclient/qmailmessagekey_p.h index 1ab2e6fe..8e6e4464 100644 --- a/src/libraries/qmfclient/qmailmessagekey_p.h +++ b/src/libraries/qmfclient/qmailmessagekey_p.h @@ -60,5 +60,4 @@ public: QMailMessageKeyPrivate(const ListType &valueList, QMailMessageKey::Property p, QMailKey::Comparator c) : Impl(valueList, p, c) {} }; - #endif diff --git a/src/libraries/qmfclient/qmailmessagelistmodel.cpp b/src/libraries/qmfclient/qmailmessagelistmodel.cpp index 4d212a71..e49bc71e 100644 --- a/src/libraries/qmfclient/qmailmessagelistmodel.cpp +++ b/src/libraries/qmfclient/qmailmessagelistmodel.cpp @@ -676,4 +676,3 @@ const QMailMessageModelImplementation *QMailMessageListModel::impl() const { return d; } - diff --git a/src/libraries/qmfclient/qmailmessagemodelbase.cpp b/src/libraries/qmfclient/qmailmessagemodelbase.cpp index 072cf20c..3bd5477d 100644 --- a/src/libraries/qmfclient/qmailmessagemodelbase.cpp +++ b/src/libraries/qmfclient/qmailmessagemodelbase.cpp @@ -55,7 +55,7 @@ QString messageAddressText(const QMailMessageMetaData& m, bool incoming) text += QLatin1String(", ..."); return text; - } else { + } else { return qApp->translate("QMailMessageModelBase", "Draft message"); } } @@ -209,7 +209,7 @@ QVariant QMailMessageModelBase::data(const QMailMessageMetaData &message, int ro { case Qt::DisplayRole: case MessageAddressTextRole: - return messageAddressText(message,incoming); + return messageAddressText(message, incoming); case MessageSizeTextRole: return messageSizeText(message); @@ -238,7 +238,7 @@ QVariant QMailMessageModelBase::data(const QMailMessageMetaData &message, int ro return message.subject(); case MessageFilterTextRole: - return QString(messageAddressText(message,incoming) + QChar::Space + message.subject()); + return QString(messageAddressText(message, incoming) + QChar::Space + message.subject()); case MessageBodyTextRole: { diff --git a/src/libraries/qmfclient/qmailmessagemodelbase.h b/src/libraries/qmfclient/qmailmessagemodelbase.h index 2d519316..8c97cb4b 100644 --- a/src/libraries/qmfclient/qmailmessagemodelbase.h +++ b/src/libraries/qmfclient/qmailmessagemodelbase.h @@ -39,7 +39,6 @@ #include "qmailmessagekey.h" #include "qmailmessagesortkey.h" - class QMailMessageModelImplementation { public: diff --git a/src/libraries/qmfclient/qmailmessageremovalrecord.cpp b/src/libraries/qmfclient/qmailmessageremovalrecord.cpp index 220fc0f3..f6878a5a 100644 --- a/src/libraries/qmfclient/qmailmessageremovalrecord.cpp +++ b/src/libraries/qmfclient/qmailmessageremovalrecord.cpp @@ -161,4 +161,3 @@ void QMailMessageRemovalRecord::setParentFolderId(const QMailFolderId& parentFol { d->parentFolderId = parentFolderId; } - diff --git a/src/libraries/qmfclient/qmailmessageserver.cpp b/src/libraries/qmfclient/qmailmessageserver.cpp index 57938b2a..74b7dc7b 100644 --- a/src/libraries/qmfclient/qmailmessageserver.cpp +++ b/src/libraries/qmfclient/qmailmessageserver.cpp @@ -1122,4 +1122,3 @@ Q_IMPLEMENT_USER_METATYPE_TYPEDEF(QMailMessageCountMap, QMailMessageCountMap) */ #include "qmailmessageserver.moc" - diff --git a/src/libraries/qmfclient/qmailmessageset.cpp b/src/libraries/qmfclient/qmailmessageset.cpp index 05b366fa..d5dcb7d5 100644 --- a/src/libraries/qmfclient/qmailmessageset.cpp +++ b/src/libraries/qmfclient/qmailmessageset.cpp @@ -499,8 +499,7 @@ void QMailFolderMessageSet::foldersUpdated(const QMailFolderIdList &ids) synchronizeChildren(); - if (ids.contains(i->_id)) - { + if (ids.contains(i->_id)) { //update our folder name i->_name.clear(); @@ -741,8 +740,7 @@ void QMailAccountMessageSet::accountsUpdated(const QMailAccountIdList &ids) { const ImplementationType *i = impl(this); - if (ids.contains(i->_id)) - { + if (ids.contains(i->_id)) { //update our account name i->_name.clear(); update(this); @@ -1158,7 +1156,7 @@ QMailMessageSetModel::QMailMessageSetModel(QObject *parent) : QAbstractItemModel(parent), QMailMessageSetContainer(new QMailMessageSetModelPrivate) { - QTimer::singleShot(0,this,SLOT(delayedInit())); + QTimer::singleShot(0, this, SLOT(delayedInit())); } /*! \internal */ @@ -1743,4 +1741,3 @@ QModelIndex QMailMessageSetModel::parentIndex(QMailMessageSet *item, int column) \sa messagesAdded(), messagesRemoved() */ - diff --git a/src/libraries/qmfclient/qmailmessageset.h b/src/libraries/qmfclient/qmailmessageset.h index 00d2e70c..9c88770c 100644 --- a/src/libraries/qmfclient/qmailmessageset.h +++ b/src/libraries/qmfclient/qmailmessageset.h @@ -339,6 +339,4 @@ private: QModelIndex parentIndex(QMailMessageSet *item, int column) const; }; - #endif - diff --git a/src/libraries/qmfclient/qmailmessageset_p.h b/src/libraries/qmfclient/qmailmessageset_p.h index 8074ee89..4963a69b 100644 --- a/src/libraries/qmfclient/qmailmessageset_p.h +++ b/src/libraries/qmfclient/qmailmessageset_p.h @@ -64,4 +64,3 @@ public: }; #endif - diff --git a/src/libraries/qmfclient/qmailmessagesortkey.cpp b/src/libraries/qmfclient/qmailmessagesortkey.cpp index 07003488..8e0ea7dd 100644 --- a/src/libraries/qmfclient/qmailmessagesortkey.cpp +++ b/src/libraries/qmfclient/qmailmessagesortkey.cpp @@ -392,6 +392,4 @@ QMailMessageSortKey QMailMessageSortKey::status(quint64 mask, Qt::SortOrder orde return QMailMessageSortKey(Status, order, mask); } - Q_IMPLEMENT_USER_METATYPE(QMailMessageSortKey) - diff --git a/src/libraries/qmfclient/qmailmessagethreadedmodel.cpp b/src/libraries/qmfclient/qmailmessagethreadedmodel.cpp index 352fced7..56d66079 100644 --- a/src/libraries/qmfclient/qmailmessagethreadedmodel.cpp +++ b/src/libraries/qmfclient/qmailmessagethreadedmodel.cpp @@ -1021,4 +1021,3 @@ const QMailMessageModelImplementation *QMailMessageThreadedModel::impl() const { return d; } - diff --git a/src/libraries/qmfclient/qmailserviceaction.cpp b/src/libraries/qmfclient/qmailserviceaction.cpp index b57acbfb..bee172fd 100644 --- a/src/libraries/qmfclient/qmailserviceaction.cpp +++ b/src/libraries/qmfclient/qmailserviceaction.cpp @@ -212,7 +212,7 @@ void QMailServiceActionPrivate::clearSubActions() { if (_pendingActions.count()) disconnectSubAction(_pendingActions.first().action); - foreach(ActionCommand a, _pendingActions) { + foreach (ActionCommand a, _pendingActions) { // Don't delete QObject while it's emitting a signal a.action->deleteLater(); } diff --git a/src/libraries/qmfclient/qmailsortkeyargument.h b/src/libraries/qmfclient/qmailsortkeyargument.h index 6a7b69f7..f5777f51 100644 --- a/src/libraries/qmfclient/qmailsortkeyargument.h +++ b/src/libraries/qmfclient/qmailsortkeyargument.h @@ -47,7 +47,6 @@ #include <QDataStream> - template<typename PropertyType> class QMailSortKeyArgument { @@ -95,4 +94,3 @@ public: }; #endif - diff --git a/src/libraries/qmfclient/qmailstore.cpp b/src/libraries/qmfclient/qmailstore.cpp index 26716ce6..6c217fc2 100644 --- a/src/libraries/qmfclient/qmailstore.cpp +++ b/src/libraries/qmfclient/qmailstore.cpp @@ -1790,4 +1790,3 @@ QMailStore* QMailStore::instance() Q_IMPLEMENT_USER_METATYPE_ENUM(QMailStore::MessageRemovalOption) Q_IMPLEMENT_USER_METATYPE_ENUM(QMailStore::ChangeType) - diff --git a/src/libraries/qmfclient/qmailstore_p.cpp b/src/libraries/qmfclient/qmailstore_p.cpp index 9c0e21bc..c27a059a 100644 --- a/src/libraries/qmfclient/qmailstore_p.cpp +++ b/src/libraries/qmfclient/qmailstore_p.cpp @@ -301,8 +301,7 @@ void QMailStorePrivate::updateMessageValues(const QMailMessageKey::Properties& p QPair<QString, QString> uriElements; foreach (QMailMessageKey::Property p, messagePropertyList()) { - switch (properties & p) - { + switch (properties & p) { case QMailMessageKey::Id: metaData->setId(values.id()); break; @@ -754,7 +753,7 @@ void QMailStorePrivate::preloadHeaderCache(const QMailMessageId& id) const ++highIt; if (highIt == end) { ascend = false; - } else { + } else { if (!messageCache.contains(*highIt)) { idBatch.append(*highIt); ++count; @@ -829,7 +828,7 @@ void QMailStorePrivate::preloadThreadCache(const QMailThreadId& id) const ++highIt; if (highIt == end) { ascend = false; - } else { + } else { if (!threadCache.contains(*highIt)) { idBatch.append(*highIt); ++count; @@ -1014,8 +1013,7 @@ void QMailStorePrivate::messageMetaDataRemotelyChanged(QMailStore::ChangeType ch QMailMessageIdList ids; - for (const QMailMessageMetaData& metaData : data) - { + for (const QMailMessageMetaData& metaData : data) { messageCache.insert(metaData); uidCache.insert(qMakePair(metaData.parentAccountId(), metaData.serverUid()), metaData.id()); @@ -1043,7 +1041,7 @@ void QMailStorePrivate::messagePropertiesRemotelyChanged(const QMailMessageIdLis { Q_ASSERT(!ids.contains(QMailMessageId())); - foreach(const QMailMessageId& id, ids) { + foreach (const QMailMessageId& id, ids) { if (messageCache.contains(id)) { QMailMessageMetaData metaData = messageCache.lookup(id); @@ -1051,8 +1049,7 @@ void QMailStorePrivate::messagePropertiesRemotelyChanged(const QMailMessageIdLis metaData.setCustomFields(data.customFields()); } foreach (QMailMessageKey::Property p, messagePropertyList()) { - switch (properties & p) - { + switch (properties & p) { case QMailMessageKey::Id: metaData.setId(data.id()); break; @@ -1150,7 +1147,7 @@ void QMailStorePrivate::messageStatusRemotelyChanged(const QMailMessageIdList& i { Q_ASSERT(!ids.contains(QMailMessageId())); - foreach(const QMailMessageId& id, ids) { + foreach (const QMailMessageId& id, ids) { if (messageCache.contains(id)) { QMailMessageMetaData metaData = messageCache.lookup(id); diff --git a/src/libraries/qmfclient/qmailstore_p.h b/src/libraries/qmfclient/qmailstore_p.h index 0e6491e0..4c9e65b3 100644 --- a/src/libraries/qmfclient/qmailstore_p.h +++ b/src/libraries/qmfclient/qmailstore_p.h @@ -272,7 +272,7 @@ private: void clear(); private: - QCache<KeyType,T> mCache; + QCache<KeyType, T> mCache; }; template <typename ID, typename T> @@ -324,7 +324,7 @@ T QMailStorePrivate::Cache<KeyType, T>::lookup(const KeyType& key) const template <typename KeyType, typename T> void QMailStorePrivate::Cache<KeyType, T>::insert(const KeyType& key, const T& item) { - mCache.insert(key,new T(item)); + mCache.insert(key, new T(item)); } template <typename KeyType, typename T> diff --git a/src/libraries/qmfclient/qmailstoreimplementation_p.cpp b/src/libraries/qmfclient/qmailstoreimplementation_p.cpp index 07c79776..d5c1671e 100644 --- a/src/libraries/qmfclient/qmailstoreimplementation_p.cpp +++ b/src/libraries/qmfclient/qmailstoreimplementation_p.cpp @@ -313,4 +313,3 @@ bool QMailStoreNullImplementation::initStore() { return false; } - diff --git a/src/libraries/qmfclient/qmailstoresql_p.cpp b/src/libraries/qmfclient/qmailstoresql_p.cpp index 9e0c2291..d32b7bab 100644 --- a/src/libraries/qmfclient/qmailstoresql_p.cpp +++ b/src/libraries/qmfclient/qmailstoresql_p.cpp @@ -1207,8 +1207,7 @@ void appendWhereValues<QMailMessageKey::ArgumentType>(const QMailMessageKey::Arg { const MessageKeyArgumentExtractor extractor(a); - switch (a.property) - { + switch (a.property) { case QMailMessageKey::Id: if (a.valueList.count() < IdLookupThreshold) { values += extractor.id(); @@ -1403,8 +1402,7 @@ void appendWhereValues<QMailAccountKey::ArgumentType>(const QMailAccountKey::Arg { const AccountKeyArgumentExtractor extractor(a); - switch (a.property) - { + switch (a.property) { case QMailAccountKey::Id: values += extractor.id(); break; @@ -1511,8 +1509,7 @@ void appendWhereValues<QMailFolderKey::ArgumentType>(const QMailFolderKey::Argum { const FolderKeyArgumentExtractor extractor(a); - switch (a.property) - { + switch (a.property) { case QMailFolderKey::Id: values += extractor.id(); break; @@ -1649,8 +1646,7 @@ void appendWhereValues<QMailThreadKey::ArgumentType>(const QMailThreadKey::Argum { const ThreadKeyArgumentExtractor extractor(a); - switch (a.property) - { + switch (a.property) { case QMailThreadKey::Id: values += extractor.id(); break; @@ -1763,8 +1759,7 @@ QString buildOrderClause(const ArgumentListType &list, const QString &alias) QString operatorString(QMailKey::Comparator op, bool multipleArgs = false, bool patternMatch = false, bool bitwiseMultiples = false) { - switch (op) - { + switch (op) { case Equal: return QLatin1String(multipleArgs ? " IN " : (patternMatch ? " LIKE " : " = ")); @@ -1798,8 +1793,7 @@ QString operatorString(QMailKey::Comparator op, bool multipleArgs = false, bool QString combineOperatorString(QMailKey::Combiner op) { - switch (op) - { + switch (op) { case And: return QLatin1String(" AND "); @@ -1875,8 +1869,7 @@ QString whereClauseItem<QMailAccountKey>(const QMailAccountKey &, const QMailAcc QString expression = columnExpression(columnName, a.op, a.valueList, patternMatching, bitwise, noCase); - switch (a.property) - { + switch (a.property) { case QMailAccountKey::Id: if (a.valueList.first().canConvert<QMailAccountKey>()) { QMailAccountKey subKey = a.valueList.first().value<QMailAccountKey>(); @@ -1942,8 +1935,7 @@ QString whereClauseItem<QMailMessageKey>(const QMailMessageKey &key, const QMail QString expression = columnExpression(columnName, a.op, a.valueList, patternMatching, bitwise, noCase); - switch (a.property) - { + switch (a.property) { case QMailMessageKey::Id: if (a.valueList.count() >= IdLookupThreshold) { q << baseExpression(columnName, a.op, true) << "( SELECT id FROM " << QMailStoreSql::temporaryTableName(a) << ")"; @@ -2114,8 +2106,7 @@ QString whereClauseItem<QMailFolderKey>(const QMailFolderKey &key, const QMailFo QString expression = columnExpression(columnName, a.op, a.valueList, false, bitwise, noCase); - switch (a.property) - { + switch (a.property) { case QMailFolderKey::Id: if (a.valueList.first().canConvert<QMailFolderKey>()) { QMailFolderKey subKey = a.valueList.first().value<QMailFolderKey>(); @@ -2227,8 +2218,7 @@ QString whereClauseItem<QMailThreadKey>(const QMailThreadKey &, const QMailThrea QString expression = columnExpression(columnName, a.op, a.valueList, false, false, noCase); - switch (a.property) - { + switch (a.property) { case QMailThreadKey::Id: if (a.valueList.first().canConvert<QMailThreadKey>()) { QMailThreadKey subKey = a.valueList.first().value<QMailThreadKey>(); @@ -3316,8 +3306,7 @@ void QMailStoreSql::extractMessageMetaData(const QSqlRecord& r, const MessageRecord messageRecord(r, recordProperties); foreach (QMailMessageKey::Property p, messagePropertyList()) { - switch (properties & p) - { + switch (properties & p) { case QMailMessageKey::Id: metaData->setId(messageRecord.id()); break; @@ -3574,8 +3563,7 @@ QVariantList QMailStoreSql::messageValues(const QMailMessageKey::Properties& pro properties &= ~QMailMessageKey::ContentIdentifier; foreach (QMailMessageKey::Property p, messagePropertyList()) { - switch (properties & p) - { + switch (properties & p) { case QMailMessageKey::Id: values.append(extractor.id()); break; @@ -3680,8 +3668,7 @@ QVariantList QMailStoreSql::threadValues(const QMailThreadKey::Properties &prop, QMailThreadKey::Properties properties(prop); foreach (QMailThreadKey::Property p, threadPropertyList()) { - switch (properties & p) - { + switch (properties & p) { case QMailThreadKey::Id: values.append(thread.id().toULongLong()); break; @@ -3977,8 +3964,8 @@ bool QMailStoreSql::upgradeTimeStampToUtc() qCDebug(lcMailStore) << Q_FUNC_INFO << "Time stamp for " << allMessageIds.count() << " will be updated "; QMailMessageKey::Properties updateDateProperties = QMailMessageKey::TimeStamp | QMailMessageKey::ReceptionTimeStamp; - foreach(const QMailMessageId &updateId, allMessageIds) - { + + foreach (const QMailMessageId &updateId, allMessageIds) { const QMailMessageMetaData m(updateId); const MessageValueExtractor<QMailMessageMetaData> extractor(m); QVariantList bindValues; @@ -4350,14 +4337,12 @@ bool QMailStoreSql::purgeObsoleteFiles() uriElements[extractUriElements(contentUri).first].append(extractUriElements(contentUri).second); } - for ( QMap<QString, QStringList>::iterator it(uriElements.begin()) ; it != uriElements.end() ; ++it) - { + for (QMap<QString, QStringList>::iterator it(uriElements.begin()) ; it != uriElements.end() ; ++it) { QStringList schemes(QStringList() << QMailContentManagerFactory::defaultFilterScheme() << it.key() << QMailContentManagerFactory::defaultIndexerScheme()); - foreach(QString const& scheme, schemes) - { + foreach (QString const& scheme, schemes) { if (!scheme.isEmpty()) { QMailContentManager *manager(QMailContentManagerFactory::create(scheme)); if (!manager) @@ -5261,14 +5246,12 @@ void QMailStoreSql::removeExpiredData(const QStringList& contentUris) foreach (const QString& contentUri, contentUris) { uriElements[extractUriElements(contentUri).first].append(extractUriElements(contentUri).second); - for ( QMap<QString, QStringList>::iterator it(uriElements.begin()) ; it != uriElements.end() ; ++it) - { + for (QMap<QString, QStringList>::iterator it(uriElements.begin()) ; it != uriElements.end() ; ++it) { QStringList schemes(QStringList() << QMailContentManagerFactory::defaultFilterScheme() << it.key() << QMailContentManagerFactory::defaultIndexerScheme()); - foreach(QString const& scheme, schemes) - { + foreach (QString const& scheme, schemes) { if (!scheme.isEmpty()) { QMailContentManager *manager(QMailContentManagerFactory::create(scheme)); if (!manager) @@ -5821,7 +5804,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptAddMessage(QMailMessage *mess QList<QMailContentManager*> contentManagers; - foreach(QString scheme, QStringList() + foreach (QString scheme, QStringList() << QMailContentManagerFactory::defaultFilterScheme() << message->contentScheme() << QMailContentManagerFactory::defaultIndexerScheme()) @@ -5838,7 +5821,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptAddMessage(QMailMessage *mess } - foreach(QMailContentManager *manager, contentManagers) { + foreach (QMailContentManager *manager, contentManagers) { QMailStore::ErrorCode code = manager->add(message, durability(commitOnSuccess)); if (code != QMailStore::NoError) { setLastError(code); @@ -5850,7 +5833,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptAddMessage(QMailMessage *mess AttemptResult result = attemptAddMessage(static_cast<QMailMessageMetaData*>(message), identifier, references, out, t, commitOnSuccess); if (result != Success) { bool obsoleted(false); - foreach(QMailContentManager *manager, contentManagers) { + foreach (QMailContentManager *manager, contentManagers) { // Try to remove the content file we added QMailStore::ErrorCode code = manager->remove(message->contentIdentifier()); if (code != QMailStore::NoError && !obsoleted) { @@ -6666,8 +6649,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptUpdateMessage(QMailMessageMet << metaData->contentScheme() << QMailContentManagerFactory::defaultIndexerScheme()); - foreach(QString const& scheme, schemes) - { + foreach (QString const& scheme, schemes) { if (!scheme.isEmpty()) { if (QMailContentManager *contentManager = QMailContentManagerFactory::create(scheme)) { QString contentUri(::contentUri(*metaData)); @@ -6846,8 +6828,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptUpdateMessage(QMailMessageMet // Check NB#294937. Sometimes metaData contains 0 as a parentThreadId // and that is really bad for a thread mode. - if (!metaData->parentThreadId().isValid()) - { + if (!metaData->parentThreadId().isValid()) { //Dirty hack to fix NB#297007, but at least it is better then nothing QMailMessageMetaData data(metaData->id()); if (data.parentThreadId().isValid()) @@ -7216,7 +7197,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptUpdateMessagesStatus(const QM while (!bindMessagesIds.isEmpty()) { bindMessagesIdsBatch.clear(); - bindMessagesIdsBatch = bindMessagesIds.mid(0,500); + bindMessagesIdsBatch = bindMessagesIds.mid(0, 500); if (bindMessagesIds.count() > 500) { bindMessagesIds = bindMessagesIds.mid(500); } else { @@ -8195,11 +8176,10 @@ QMailStoreSql::AttemptResult QMailStoreSql::messagePredecessor(QMailMessageMetaD QMap<quint64, quint64> predecessor; { - // Find the predecessor message for every message in the same thread as us or the thread of any potential predecessor of us QVariantList vl; vl << messageId; - foreach(quint64 p, potentialPredecessors) { + foreach (quint64 p, potentialPredecessors) { vl << p; } QSqlQuery query(simpleQuery(QString::fromLatin1("SELECT id,responseid FROM mailmessages WHERE parentaccountid = %1 AND parentthreadid IN (SELECT parentthreadid FROM mailmessages WHERE id IN %2)") @@ -8568,44 +8548,34 @@ bool QMailStoreSql::checkPreconditions(const QMailFolder& folder, bool update) //if the parent is valid, check that it exists //if the account is valid, check that is exists - if (!update) - { - if (folder.id().isValid()) - { + if (!update) { + if (folder.id().isValid()) { qCWarning(lcMailStore) << "Folder exists, use update instead of add."; return false; } - } - else - { - if (!folder.id().isValid()) - { + } else { + if (!folder.id().isValid()) { qCWarning(lcMailStore) << "Folder does not exist, use add instead of update."; return false; } - if (folder.parentFolderId().isValid() && folder.parentFolderId() == folder.id()) - { + if (folder.parentFolderId().isValid() && folder.parentFolderId() == folder.id()) { qCWarning(lcMailStore) << "A folder cannot be a child to itself"; return false; } } - if (folder.parentFolderId().isValid()) - { - if (!idExists(folder.parentFolderId())) - { + if (folder.parentFolderId().isValid()) { + if (!idExists(folder.parentFolderId())) { qCWarning(lcMailStore) << "Parent folder does not exist!"; return false; } } - if (folder.parentAccountId().isValid()) - { + if (folder.parentAccountId().isValid()) { if ((withAccountTables ? !idExists(folder.parentAccountId()) - : !externalAccountIdExists(folder.parentAccountId()))) - { + : !externalAccountIdExists(folder.parentAccountId()))) { qCWarning(lcMailStore) << "Parent account does not exist!"; return false; } @@ -8620,8 +8590,7 @@ bool QMailStoreSql::recalculateThreadsColumns(const QMailThreadIdList& modifiedT { QVariantList bindValues; QVariantList bindValuesBatch; - foreach (const QMailThreadId& threadId, modifiedThreads) - { + foreach (const QMailThreadId& threadId, modifiedThreads) { bindValues << threadId.toULongLong(); } @@ -8652,8 +8621,7 @@ bool QMailStoreSql::recalculateThreadsColumns(const QMailThreadIdList& modifiedT } } - foreach (const QMailThreadId& threadId, modifiedThreads) - { + foreach (const QMailThreadId& threadId, modifiedThreads) { // if all thread's messages were deleted we should delete thread as well. if (!existedMessagesMap.keys().contains(threadId)) { deletedThreads.append(threadId); @@ -8671,8 +8639,7 @@ bool QMailStoreSql::recalculateThreadsColumns(const QMailThreadIdList& modifiedT quint64 status = 0; QStringList senders; const QMailMessageMetaDataList &threadsMessagesList = existedMessagesMap.value(threadId); - for (const QMailMessageMetaData& data : threadsMessagesList) - { + for (const QMailMessageMetaData& data : threadsMessagesList) { // Messages moved to Draft or Trash folder should not being counted. QMailAccount account(data.parentAccountId()); QMailFolderId trashFolderId = account.standardFolder(QMailFolder::TrashFolder); @@ -8916,8 +8883,7 @@ bool QMailStoreSql::deleteMessages(const QMailMessageKey& key, } Q_ASSERT(messageIdList.size() == newResponseIdList.size()); - if (messageIdList.size()) - { + if (messageIdList.size()) { // Link any descendants of the messages to the deleted messages' predecessor QSqlQuery query(batchQuery(QLatin1String("UPDATE mailmessages SET responseid=? WHERE id=?"), QVariantList() << QVariant(newResponseIdList) << QVariant(messageIdList), diff --git a/src/libraries/qmfclient/qmailthread.cpp b/src/libraries/qmfclient/qmailthread.cpp index 815fb536..df425b9d 100644 --- a/src/libraries/qmfclient/qmailthread.cpp +++ b/src/libraries/qmfclient/qmailthread.cpp @@ -202,7 +202,6 @@ void QMailThread::setLastDate(const QMailTimeStamp &value) d->lastDate = value; } - QMailTimeStamp QMailThread::startedDate() const { return d->startedDate; @@ -213,7 +212,6 @@ void QMailThread::setStartedDate(const QMailTimeStamp &value) d->startedDate = value; } - quint64 QMailThread::status() const { return d->status; diff --git a/src/libraries/qmfclient/qmailthread_p.h b/src/libraries/qmfclient/qmailthread_p.h index 3f9c5fb6..1155a5bf 100644 --- a/src/libraries/qmfclient/qmailthread_p.h +++ b/src/libraries/qmfclient/qmailthread_p.h @@ -61,5 +61,4 @@ public: quint64 status; }; - #endif // QMAILTHREAD_P_H diff --git a/src/libraries/qmfclient/qmailthreadkey.cpp b/src/libraries/qmfclient/qmailthreadkey.cpp index 9e89855e..6a2db94a 100644 --- a/src/libraries/qmfclient/qmailthreadkey.cpp +++ b/src/libraries/qmfclient/qmailthreadkey.cpp @@ -41,10 +41,8 @@ using namespace QMailKey; - Q_IMPLEMENT_USER_METATYPE(QMailThreadKey) - /*! \class QMailThreadKey diff --git a/src/libraries/qmfclient/qmailthreadkey_p.h b/src/libraries/qmfclient/qmailthreadkey_p.h index 8cc014fe..627d9de2 100644 --- a/src/libraries/qmfclient/qmailthreadkey_p.h +++ b/src/libraries/qmfclient/qmailthreadkey_p.h @@ -60,5 +60,4 @@ public: QMailThreadKeyPrivate(const ListType &valueList, QMailThreadKey::Property p, QMailKey::Comparator c) : Impl(valueList, p, c) {} }; - #endif diff --git a/src/libraries/qmfclient/qmailthreadlistmodel.cpp b/src/libraries/qmfclient/qmailthreadlistmodel.cpp index 5c7993da..ae1ec262 100644 --- a/src/libraries/qmfclient/qmailthreadlistmodel.cpp +++ b/src/libraries/qmfclient/qmailthreadlistmodel.cpp @@ -51,9 +51,8 @@ private: }; LessThanFunctorT::LessThanFunctorT(const QMailThreadSortKey& sortKey) -: - mSortKey(sortKey), - mInvalidatedList(false) + : mSortKey(sortKey) + , mInvalidatedList(false) { } @@ -65,8 +64,7 @@ bool LessThanFunctorT::operator()(const QMailThreadId& first, const QMailThreadI QMailThreadKey secondKey(QMailThreadKey::id(second)); QMailThreadIdList results = QMailStore::instance()->queryThreads(firstKey | secondKey, mSortKey); - if (results.count() != 2) - { + if (results.count() != 2) { mInvalidatedList = true; return false; } @@ -123,7 +121,7 @@ QMailThreadListModelPrivate::~QMailThreadListModelPrivate() void QMailThreadListModelPrivate::initialize() const { - idList = QMailStore::instance()->queryThreads(key,sortKey); + idList = QMailStore::instance()->queryThreads(key, sortKey); init = true; needSynchronize = false; } @@ -200,7 +198,7 @@ QMailThreadIdList::iterator QMailThreadListModelPrivate::lowerBound(const QMailT QMailThreadListModel::QMailThreadListModel(QObject* parent) : QAbstractListModel(parent), - d(new QMailThreadListModelPrivate(QMailThreadKey(),QMailThreadSortKey(),true)) + d(new QMailThreadListModelPrivate(QMailThreadKey(), QMailThreadSortKey(), true)) { connect(QMailStore::instance(), SIGNAL(threadsAdded(QMailThreadIdList)), @@ -251,8 +249,7 @@ QVariant QMailThreadListModel::data(const QModelIndex& index, int role) const QMailThread thread(id); - switch (role) - { + switch (role) { case Qt::DisplayRole: return thread.subject(); case ThreadIdRole: @@ -348,32 +345,27 @@ void QMailThreadListModel::threadsAdded(const QMailThreadIdList& ids) if (results.isEmpty()) return; - if (!d->sortKey.isEmpty()) - { - foreach(const QMailThreadId &id,results) - { + if (!d->sortKey.isEmpty()) { + foreach (const QMailThreadId &id, results) { LessThanFunctorT lessThan(d->sortKey); //if sorting the list fails, then resort to a complete refresh - if (lessThan.invalidatedList()) + if (lessThan.invalidatedList()) { fullRefresh(); - else - { + } else { QMailThreadIdList::iterator itr = d->lowerBound(id, lessThan); int newIndex = (itr - d->idList.begin()); - beginInsertRows(QModelIndex(),newIndex,newIndex); + beginInsertRows(QModelIndex(), newIndex, newIndex); d->idList.insert(itr, id); endInsertRows(); } } - } - else - { + } else { int index = d->idList.count(); - beginInsertRows(QModelIndex(),index,(index + results.count() - 1)); - foreach(const QMailThreadId &id,results) + beginInsertRows(QModelIndex(), index, (index + results.count() - 1)); + foreach (const QMailThreadId &id, results) d->idList.append(id); endInsertRows(); } @@ -400,18 +392,16 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) QMailThreadIdList validIds = QMailStore::instance()->queryThreads(idKey & d->key); //if the key is empty the id's will be returned valid and invalid - if (!d->key.isEmpty()) - { + if (!d->key.isEmpty()) { QMailThreadIdList invalidIds = QMailStore::instance()->queryThreads(idKey & ~d->key); - foreach(const QMailThreadId &id,invalidIds) - { + foreach (const QMailThreadId &id, invalidIds) { //get the index int index = d->idList.indexOf(id); if (index == -1) continue; d->deletionId = id; - beginRemoveRows(QModelIndex(),index,index); + beginRemoveRows(QModelIndex(), index, index); d->idList.removeAt(index); endRemoveRows(); d->deletionId = QMailThreadId(); @@ -420,42 +410,33 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) LessThanFunctorT lessThan(d->sortKey); - foreach(const QMailThreadId &id, validIds) - { + foreach (const QMailThreadId &id, validIds) { int index = d->idList.indexOf(id); - if (index == -1) //insert - { - if (lessThan.invalidatedList()) + if (index == -1) { //insert + if (lessThan.invalidatedList()) { fullRefresh(); - else - { + } else { QMailThreadIdList::iterator itr = d->lowerBound(id, lessThan); int newIndex = (itr - d->idList.begin()); - beginInsertRows(QModelIndex(),newIndex,newIndex); + beginInsertRows(QModelIndex(), newIndex, newIndex); d->idList.insert(itr, id); endInsertRows(); } - } - else //update - { - if (lessThan.invalidatedList()) + } else { //update + if (lessThan.invalidatedList()) { fullRefresh(); - else - { + } else { QMailThreadIdList::iterator itr = d->lowerBound(id, lessThan); int newIndex = (itr - d->idList.begin()); - if ((newIndex == index) || (newIndex == index + 1)) - { + if ((newIndex == index) || (newIndex == index + 1)) { // This item would be inserted either immediately before or after itself - QModelIndex modelIndex = createIndex(index,0); - emit dataChanged(modelIndex,modelIndex); - } - else - { + QModelIndex modelIndex = createIndex(index, 0); + emit dataChanged(modelIndex, modelIndex); + } else { d->deletionId = id; - beginRemoveRows(QModelIndex(),index,index); + beginRemoveRows(QModelIndex(), index, index); d->idList.removeAt(index); endRemoveRows(); d->deletionId = QMailThreadId(); @@ -463,7 +444,7 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) if (newIndex > index) --newIndex; - beginInsertRows(QModelIndex(),newIndex,newIndex); + beginInsertRows(QModelIndex(), newIndex, newIndex); d->idList.insert(newIndex, id); endInsertRows(); } @@ -484,14 +465,13 @@ void QMailThreadListModel::threadsRemoved(const QMailThreadIdList& ids) if (!d->init) d->initialize(); - foreach(const QMailThreadId &id, ids) - { + foreach (const QMailThreadId &id, ids) { int index = d->indexOf(id); if (index == -1) continue; d->deletionId = id; - beginRemoveRows(QModelIndex(),index,index); + beginRemoveRows(QModelIndex(), index, index); d->idList.removeAt(index); endRemoveRows(); d->deletionId = QMailThreadId(); @@ -522,7 +502,7 @@ QModelIndex QMailThreadListModel::indexFromId(const QMailThreadId& id) const //if the id does not exist return null int index = d->indexOf(id); if (index != -1) { - return createIndex(index,0); + return createIndex(index, 0); } return QModelIndex(); @@ -564,4 +544,3 @@ void QMailThreadListModel::fullRefresh() endResetModel(); emit modelChanged(); } - diff --git a/src/libraries/qmfclient/qmailthreadsortkey.cpp b/src/libraries/qmfclient/qmailthreadsortkey.cpp index f8c7b1f4..538da4dc 100644 --- a/src/libraries/qmfclient/qmailthreadsortkey.cpp +++ b/src/libraries/qmfclient/qmailthreadsortkey.cpp @@ -305,7 +305,4 @@ QMailThreadSortKey QMailThreadSortKey::status(quint64 mask, Qt::SortOrder order) return QMailThreadSortKey(Status, order, mask); } - - Q_IMPLEMENT_USER_METATYPE(QMailThreadSortKey) - diff --git a/src/libraries/qmfclient/qmailtimestamp.cpp b/src/libraries/qmfclient/qmailtimestamp.cpp index 214834f7..2390cc8c 100644 --- a/src/libraries/qmfclient/qmailtimestamp.cpp +++ b/src/libraries/qmfclient/qmailtimestamp.cpp @@ -502,4 +502,3 @@ bool QMailTimeStamp::operator>= (const QMailTimeStamp& other) const { return d->operator>=(*other.d); } - diff --git a/src/libraries/qmfclient/qmflist.h b/src/libraries/qmfclient/qmflist.h index e35b983e..17b5b7d9 100644 --- a/src/libraries/qmfclient/qmflist.h +++ b/src/libraries/qmfclient/qmflist.h @@ -126,4 +126,3 @@ const QDBusArgument &operator>>(const QDBusArgument &in, QmfList<T> &list) } #endif // QMF_QMFLIST_H - diff --git a/src/libraries/qmfclient/qprivateimplementation.h b/src/libraries/qmfclient/qprivateimplementation.h index 3f5e1daf..076db456 100644 --- a/src/libraries/qmfclient/qprivateimplementation.h +++ b/src/libraries/qmfclient/qprivateimplementation.h @@ -112,7 +112,7 @@ public: if (ref_count.deref() == 0 && delete_function && self) { (*delete_function)(self); return true; - } else { + } else { return false; } } diff --git a/src/libraries/qmfclient/support/qcharsetdetector.cpp b/src/libraries/qmfclient/support/qcharsetdetector.cpp index f5db89a3..18c6a131 100644 --- a/src/libraries/qmfclient/support/qcharsetdetector.cpp +++ b/src/libraries/qmfclient/support/qcharsetdetector.cpp @@ -682,7 +682,7 @@ QStringList QCharsetDetector::getAllDetectableCharsets() // ksc5601.1987-0 cp949 Big5-HKSCS big5-0 big5hkscs-0 QStringList availableCodecsQt; - foreach(const QByteArray &ba, QTextCodec::availableCodecs()) + foreach (const QByteArray &ba, QTextCodec::availableCodecs()) availableCodecsQt << QString::fromLatin1(ba); // Charsets detectable by libicu 4.4.2: @@ -776,7 +776,7 @@ QStringList QCharsetDetector::getAllDetectableCharsets() uenum_close(en); // remove all charsets not supported by QTextCodec and all duplicates: - foreach(const QString &cs, allDetectableCharsetsICU) { + foreach (const QString &cs, allDetectableCharsetsICU) { if (availableCodecsQt.contains(cs) && !d->_allDetectableCharsets.contains(cs)) d->_allDetectableCharsets << cs; } diff --git a/src/libraries/qmfclient/support/qmailipc.h b/src/libraries/qmfclient/support/qmailipc.h index 3445263a..58c5ccc4 100644 --- a/src/libraries/qmfclient/support/qmailipc.h +++ b/src/libraries/qmfclient/support/qmailipc.h @@ -159,4 +159,3 @@ struct QMetaTypeRegister Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(TYPE) #endif //QMAILIPC_H - diff --git a/src/libraries/qmfclient/support/qmailnamespace.cpp b/src/libraries/qmfclient/support/qmailnamespace.cpp index 4b392a2f..5f0129c8 100644 --- a/src/libraries/qmfclient/support/qmailnamespace.cpp +++ b/src/libraries/qmfclient/support/qmailnamespace.cpp @@ -452,7 +452,7 @@ QList<StandardFolderInfo> standardFolders() { QList<StandardFolderInfo> standardFoldersList; - QMap<QByteArray,QStringList> folderTranslations = standardFolderTranslations(); + QMap<QByteArray, QStringList> folderTranslations = standardFolderTranslations(); if (!folderTranslations.empty()) { standardFoldersList << StandardFolderInfo(QLatin1String("\\Inbox"), QMailFolder::Incoming, QMailFolder::InboxFolder, QMailMessage::Incoming, folderTranslations.value("inbox")) @@ -495,7 +495,7 @@ bool detectStandardFolder(const QMailAccountId &accountId, StandardFolderInfo st if (folderId.isValid()) { qCDebug(lcMailStore) << "Setting folder: " << QMailFolder(folderId).displayName(); QMailFolder folder(folderId); - folder.setStatus(flag,true); + folder.setStatus(flag, true); account.setStandardFolder(standardFolder, folderId); if (!QMailStore::instance()->updateAccount(&account)) { qCWarning(lcMailStore) << "Unable to update account" << account.id() << "to set standard folder" << QMailFolder(folderId).displayName(); diff --git a/src/libraries/qmfclient/support/qmailnamespace.h b/src/libraries/qmfclient/support/qmailnamespace.h index e95ce3e6..978145fe 100644 --- a/src/libraries/qmfclient/support/qmailnamespace.h +++ b/src/libraries/qmfclient/support/qmailnamespace.h @@ -80,8 +80,7 @@ namespace QMail // If a string has double-quote as the first and last characters, return the string // between those characters int length = src.length(); - if (length) - { + if (length) { typename StringType::const_iterator const begin = src.constData(); typename StringType::const_iterator const last = begin + length - 1; @@ -101,8 +100,7 @@ namespace QMail // Return the input string surrounded by double-quotes, which are added if not present int length = src.length(); - if (length) - { + if (length) { result.reserve(length + 2); typename StringType::const_iterator begin = src.constData(); diff --git a/src/libraries/qmfclient/support/qmailpluginmanager.cpp b/src/libraries/qmfclient/support/qmailpluginmanager.cpp index ed12f8c8..fd5a0f97 100644 --- a/src/libraries/qmfclient/support/qmailpluginmanager.cpp +++ b/src/libraries/qmfclient/support/qmailpluginmanager.cpp @@ -121,7 +121,7 @@ public: ~QMailPluginManagerPrivate(); public: - QMap<QString,QPluginLoader*> pluginMap; + QMap<QString, QPluginLoader*> pluginMap; }; QMailPluginManagerPrivate::QMailPluginManagerPrivate(const QString& path) @@ -130,13 +130,13 @@ QMailPluginManagerPrivate::QMailPluginManagerPrivate(const QString& path) QStringList coreLibraryPaths = QCoreApplication::libraryPaths(); libraryPaths.append(coreLibraryPaths); - foreach(QString libraryPath, libraryPaths) { + foreach (QString libraryPath, libraryPaths) { QDir dir(libraryPath); //Change into the sub directory, and make sure it's readable if (!dir.cd(path) || !dir.isReadable()) continue; - foreach(const QString &libname, dir.entryList(pluginFilePatterns(), QDir::Files)) { + foreach (const QString &libname, dir.entryList(pluginFilePatterns(), QDir::Files)) { QString libfile = dir.absoluteFilePath(libname); if (pluginMap.contains(libname)) pluginMap[libname]->setFileName(libfile); diff --git a/src/libraries/qmfmessageserver/longstream_p.h b/src/libraries/qmfmessageserver/longstream_p.h index ec2ef305..7c236057 100644 --- a/src/libraries/qmfmessageserver/longstream_p.h +++ b/src/libraries/qmfmessageserver/longstream_p.h @@ -59,7 +59,8 @@ class MESSAGESERVER_EXPORT LongStream { public: LongStream(); - virtual ~LongStream() ; + virtual ~LongStream(); + void reset(); QString detach(); void append(QString str); @@ -72,7 +73,8 @@ public: void resetStatus(); void setStatus( Status ); void updateStatus(); - static bool freeSpace( const QString &path = QString(), int min = -1); + + static bool freeSpace(const QString &path = QString(), int min = -1); static QString outOfSpaceMessage(); static void cleanupTempFiles(); diff --git a/src/libraries/qmfmessageserver/qmailauthenticator.h b/src/libraries/qmfmessageserver/qmailauthenticator.h index 5d614c39..d54e5cea 100644 --- a/src/libraries/qmfmessageserver/qmailauthenticator.h +++ b/src/libraries/qmfmessageserver/qmailauthenticator.h @@ -55,4 +55,3 @@ public: }; #endif - diff --git a/src/libraries/qmfmessageserver/qmailmessagebuffer.cpp b/src/libraries/qmfmessageserver/qmailmessagebuffer.cpp index 4dd916d5..b6f08db6 100644 --- a/src/libraries/qmfmessageserver/qmailmessagebuffer.cpp +++ b/src/libraries/qmfmessageserver/qmailmessagebuffer.cpp @@ -212,7 +212,8 @@ void QMailMessageBuffer::flush() messageFlush(); } -int QMailMessageBuffer::messagePending() { +int QMailMessageBuffer::messagePending() +{ return d->waitingForFlush.size(); } @@ -222,7 +223,8 @@ int QMailMessageBuffer::maximumBufferSize() const return 1024*900; } -bool QMailMessageBuffer::isFull() { +bool QMailMessageBuffer::isFull() +{ if (messagePending() >= d->maxPending) { return true; } @@ -259,4 +261,3 @@ void QMailMessageBuffer::removeCallback(QMailMessageBufferFlushCallback *callbac } } } - diff --git a/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp b/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp index 2a9e80ed..4680ec88 100644 --- a/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp +++ b/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp @@ -224,4 +224,3 @@ bool QMailMessageClassifier::classifyMessage(QMailMessage& message) return false; } - diff --git a/src/libraries/qmfmessageserver/qmailmessageservice.cpp b/src/libraries/qmfmessageserver/qmailmessageservice.cpp index b1681b84..f6d3ddce 100644 --- a/src/libraries/qmfmessageserver/qmailmessageservice.cpp +++ b/src/libraries/qmfmessageserver/qmailmessageservice.cpp @@ -2346,5 +2346,3 @@ void QMailMessageService::releasePushConnections(int connections) reservedPushConnections -= connections; } } - - diff --git a/src/libraries/qmfmessageserver/qmailserviceconfiguration.cpp b/src/libraries/qmfmessageserver/qmailserviceconfiguration.cpp index 9667c4aa..ea19d72a 100644 --- a/src/libraries/qmfmessageserver/qmailserviceconfiguration.cpp +++ b/src/libraries/qmfmessageserver/qmailserviceconfiguration.cpp @@ -233,4 +233,3 @@ void QMailServiceConfiguration::setValue(const QString &name, const QString &val _config->setValue(name, value); } } - diff --git a/src/libraries/qmfmessageserver/qmailserviceconfiguration.h b/src/libraries/qmfmessageserver/qmailserviceconfiguration.h index 4ca1e0ed..7693d5e0 100644 --- a/src/libraries/qmfmessageserver/qmailserviceconfiguration.h +++ b/src/libraries/qmfmessageserver/qmailserviceconfiguration.h @@ -72,5 +72,4 @@ private: QMailAccountConfiguration::ServiceConfiguration *_config; }; - #endif diff --git a/src/libraries/qmfmessageserver/qmailstoreaccountfilter.cpp b/src/libraries/qmfmessageserver/qmailstoreaccountfilter.cpp index 737ef81e..0d4005ae 100644 --- a/src/libraries/qmfmessageserver/qmailstoreaccountfilter.cpp +++ b/src/libraries/qmfmessageserver/qmailstoreaccountfilter.cpp @@ -539,4 +539,3 @@ void QMailStoreAccountFilter::disconnectNotify(const QMetaMethod &signal) */ #include <qmailstoreaccountfilter.moc> - diff --git a/src/libraries/qmfmessageserver/qmailstoreaccountfilter.h b/src/libraries/qmfmessageserver/qmailstoreaccountfilter.h index 9332dd40..e7882d08 100644 --- a/src/libraries/qmfmessageserver/qmailstoreaccountfilter.h +++ b/src/libraries/qmfmessageserver/qmailstoreaccountfilter.h @@ -37,7 +37,6 @@ #include <qmailglobal.h> #include <qmailstore.h> - class QMailStoreAccountFilterPrivate; class QMailStoreEvents; diff --git a/src/libraries/qmfmessageserver/qmailtransport.cpp b/src/libraries/qmfmessageserver/qmailtransport.cpp index 97633183..746fe48d 100644 --- a/src/libraries/qmfmessageserver/qmailtransport.cpp +++ b/src/libraries/qmfmessageserver/qmailtransport.cpp @@ -207,8 +207,7 @@ void QMailTransport::createSocket(EncryptType encryptType) */ void QMailTransport::open(const QString& url, int port, EncryptType encryptionType) { - if (mSocket && mSocket->isOpen()) - { + if (mSocket && mSocket->isOpen()) { qCWarning(lcMessaging) << "Failed to open connection - already open!"; return; } @@ -491,6 +490,4 @@ QMailTransport::EncryptType QMailTransport::mailEncryption() const This signal is emitted when a change in status is reported. The new status is described by \a status. */ - #include "qmailtransport.moc" - diff --git a/src/libraries/qmfwidgets/folderdelegate.cpp b/src/libraries/qmfwidgets/folderdelegate.cpp index 23c53088..ad14c56f 100644 --- a/src/libraries/qmfwidgets/folderdelegate.cpp +++ b/src/libraries/qmfwidgets/folderdelegate.cpp @@ -94,7 +94,7 @@ void FolderDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem & QSize FolderDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { // Ensure that we use the full width for our item - QSize base(QItemDelegate::sizeHint(option,index)); + QSize base(QItemDelegate::sizeHint(option, index)); return QSize(qMax(base.width(), option.rect.width()), base.height()); } diff --git a/src/libraries/qmfwidgets/folderview.cpp b/src/libraries/qmfwidgets/folderview.cpp index 46c4dfe4..fac87efd 100644 --- a/src/libraries/qmfwidgets/folderview.cpp +++ b/src/libraries/qmfwidgets/folderview.cpp @@ -212,7 +212,7 @@ void FolderView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bott if (topLeft == currentIndex() || bottomRight == currentIndex()) emit selectionUpdated(); - QTreeView::dataChanged(topLeft,bottomRight); + QTreeView::dataChanged(topLeft, bottomRight); } namespace { diff --git a/src/libraries/qmfwidgets/qtmailnamespace.cpp b/src/libraries/qmfwidgets/qtmailnamespace.cpp index 96a790e8..ce4b1fcf 100644 --- a/src/libraries/qmfwidgets/qtmailnamespace.cpp +++ b/src/libraries/qmfwidgets/qtmailnamespace.cpp @@ -35,7 +35,7 @@ #include <qmaillog.h> #include <QMap> -typedef QMap<QString,QIcon> IconMap; +typedef QMap<QString, QIcon> IconMap; static QIcon loadIcon(const char *themeIdentifier, const char *resourceFallback) { diff --git a/src/libraries/qmfwidgets/selectfolder.cpp b/src/libraries/qmfwidgets/selectfolder.cpp index 072c528d..d47334de 100644 --- a/src/libraries/qmfwidgets/selectfolder.cpp +++ b/src/libraries/qmfwidgets/selectfolder.cpp @@ -71,11 +71,11 @@ SelectFolderDialog::SelectFolderDialog(FolderModel *model, QWidget *parent) m_okButton = new QPushButton(QLatin1String("Ok"), this); buttonsLayout->addWidget(m_okButton); - connect(m_okButton,SIGNAL(clicked(bool)),this,SLOT(accept())); + connect(m_okButton, SIGNAL(clicked(bool)), this, SLOT(accept())); QPushButton* cancelButton = new QPushButton(QLatin1String("Cancel"), this); buttonsLayout->addWidget(cancelButton); - connect(cancelButton,SIGNAL(clicked(bool)),this,SLOT(reject())); + connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(reject())); top->addLayout(buttonsLayout,1,0); } diff --git a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp index 055c55bd..ab03d41b 100644 --- a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp +++ b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.cpp @@ -694,7 +694,7 @@ bool QmfStorageManager::addOrRenameParts(QMailMessage *message, const QString &f if (durability == QMailContentManager::NoDurability) return true; // Don't sync parts, they should be sync'd later - foreach(QSharedPointer<QFile> part, openParts) { + foreach (QSharedPointer<QFile> part, openParts) { syncLater(part); } diff --git a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.h b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.h index cf6ca674..2e07db02 100644 --- a/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.h +++ b/src/plugins/contentmanagers/qmfstoragemanager/qmfstoragemanager.h @@ -104,4 +104,3 @@ public: }; #endif - diff --git a/src/plugins/messageservices/imap/idlenetworksession.cpp b/src/plugins/messageservices/imap/idlenetworksession.cpp index a228d3c1..77553921 100644 --- a/src/plugins/messageservices/imap/idlenetworksession.cpp +++ b/src/plugins/messageservices/imap/idlenetworksession.cpp @@ -158,4 +158,3 @@ IdleNetworkSession::Error IdleNetworkSession::error() const Q_D(const IdleNetworkSession); return d->error(); } - diff --git a/src/plugins/messageservices/imap/imapauthenticator.cpp b/src/plugins/messageservices/imap/imapauthenticator.cpp index 1fdaa5e5..eeb89ec3 100644 --- a/src/plugins/messageservices/imap/imapauthenticator.cpp +++ b/src/plugins/messageservices/imap/imapauthenticator.cpp @@ -89,4 +89,3 @@ QByteArray ImapAuthenticator::getResponse(const ImapConfiguration &svcCfg, { return QMailAuthenticator::getResponse(svcCfg, challenge, credentials); } - diff --git a/src/plugins/messageservices/imap/imapauthenticator.h b/src/plugins/messageservices/imap/imapauthenticator.h index b4316355..d8fe9367 100644 --- a/src/plugins/messageservices/imap/imapauthenticator.h +++ b/src/plugins/messageservices/imap/imapauthenticator.h @@ -53,4 +53,3 @@ public: }; #endif - diff --git a/src/plugins/messageservices/imap/imapclient.cpp b/src/plugins/messageservices/imap/imapclient.cpp index ea7876c2..f8f00d04 100644 --- a/src/plugins/messageservices/imap/imapclient.cpp +++ b/src/plugins/messageservices/imap/imapclient.cpp @@ -1247,7 +1247,7 @@ void ImapClient::dataFetched(const QString &uid, const QString §ion, const Q mail = new QMailMessage(uid, _accountId); } - detachedTempFiles.insert(mail->id(),fileName); // multi + detachedTempFiles.insert(mail->id(), fileName); // multi if (mail->id().isValid()) { if (section.isEmpty()) { @@ -1402,7 +1402,7 @@ void ImapClient::partHeaderFetched(const QString &uid, const QString §ion, c mail = new QMailMessage(uid, _accountId); } - detachedTempFiles.insert(mail->id(),fileName); // multi + detachedTempFiles.insert(mail->id(), fileName); // multi if (mail->id().isValid() && !section.isEmpty()) { // This is data for a sub-part of the message @@ -1691,7 +1691,7 @@ QMailFolderIdList ImapClient::configurationIdleFolderIds() QMailFolderIdList folderIds; if (!imapCfg.pushEnabled()) return folderIds; - foreach(QString folderName, imapCfg.pushFolders()) { + foreach (QString folderName, imapCfg.pushFolders()) { QMailFolderId idleFolderId(mailboxId(folderName)); if (idleFolderId.isValid()) { folderIds.append(idleFolderId); @@ -1708,7 +1708,7 @@ void ImapClient::monitor(const QMailFolderIdList &mailboxIds) _idleTimer.stop(); } - foreach(const QMailFolderId &id, _monitored.keys()) { + foreach (const QMailFolderId &id, _monitored.keys()) { if (!mailboxIds.contains(id)) { qCDebug(lcIMAP) << "stop monitoring folder" << id; IdleProtocol *protocol = _monitored.take(id); @@ -1725,7 +1725,7 @@ void ImapClient::monitor(const QMailFolderIdList &mailboxIds) return; } - foreach(QMailFolderId id, mailboxIds) { + foreach (QMailFolderId id, mailboxIds) { if (!_monitored.contains(id)) { qCDebug(lcIMAP) << "start monitoring folder" << id; ++count; diff --git a/src/plugins/messageservices/imap/imapclient.h b/src/plugins/messageservices/imap/imapclient.h index ab4a1cba..82b92b37 100644 --- a/src/plugins/messageservices/imap/imapclient.h +++ b/src/plugins/messageservices/imap/imapclient.h @@ -178,7 +178,7 @@ private: QVector<QMailMessage*> _bufferedMessages; int _pushConnectionsReserved; - QMultiMap<QMailMessageId,QString> detachedTempFiles; + QMultiMap<QMailMessageId, QString> detachedTempFiles; QMailCredentialsInterface *_credentials; }; diff --git a/src/plugins/messageservices/imap/imapprotocol.cpp b/src/plugins/messageservices/imap/imapprotocol.cpp index 04a6f4a2..d9cc74cd 100644 --- a/src/plugins/messageservices/imap/imapprotocol.cpp +++ b/src/plugins/messageservices/imap/imapprotocol.cpp @@ -1097,8 +1097,7 @@ void ListState::untaggedResponse(ImapContext *c, const QString &line) flags = token(str, '(', ')', &index); delimiter = token(str, ' ', ' ', &index); - if (c->protocol()->delimiterUnknown()) //only figure it out precisely if needed - { + if (c->protocol()->delimiterUnknown()) { //only figure it out precisely if needed if (delimiter == "NIL") { c->protocol()->setFlatHierarchy(true); } else { @@ -2456,7 +2455,7 @@ void UidFetchState::taggedResponse(ImapContext *c, const QString &line) FetchParameters &fp(mParameters[mCurrentIndex]); IntegerRegion missingUids = fp.mExpectedMessages.subtract(fp.mReceivedMessages); - foreach(const QString &uid, missingUids.toStringList()) { + foreach (const QString &uid, missingUids.toStringList()) { qCWarning(lcIMAP) << "Message not found " << uid; emit nonexistentUid(messageUid(c->mailbox().id, uid)); } @@ -3327,8 +3326,7 @@ void ImapProtocol::sendExamine(const QMailFolder &mailbox) void ImapProtocol::sendCreate(const QMailFolderId &parentFolderId, const QString &name) { QString mailboxPath; - if (parentFolderId.isValid()) - { + if (parentFolderId.isValid()) { if (delimiterUnknown()) { sendDiscoverDelimiter(); } diff --git a/src/plugins/messageservices/imap/imapservice.cpp b/src/plugins/messageservices/imap/imapservice.cpp index d7b7d1dd..d626e60e 100644 --- a/src/plugins/messageservices/imap/imapservice.cpp +++ b/src/plugins/messageservices/imap/imapservice.cpp @@ -515,7 +515,7 @@ void ImapService::Source::queueDisconnectedOperations(const QMailAccountId &acco bool pendingDisconnectedOperations = false; _service->_client->strategyContext()->moveMessagesStrategy.clearSelection(); - foreach(const QMailFolderId& folderId, folderList) { + foreach (const QMailFolderId& folderId, folderList) { if (!folderId.isValid()) continue; @@ -1374,7 +1374,7 @@ void ImapService::Source::pushIntervalCheck() _actionQueue.append(new ExportUpdatesCommand(_service->accountId())); // Convenient for user to export pending changes also QMailFolderIdList ids(_service->_client->configurationIdleFolderIds()); if (ids.count()) { - foreach(QMailFolderId id, ids) { + foreach (QMailFolderId id, ids) { // Check for flag changes and new mail _service->_source->queueFlagsChangedCheck(id); } @@ -1636,7 +1636,7 @@ void ImapService::initiatePushEmail() _establishingPushEmail = true; setPersistentConnectionStatus(true); - foreach(QMailFolderId id, ids) { + foreach (QMailFolderId id, ids) { // Check for flag changes and new mail _source->queueFlagsChangedCheck(id); } @@ -1691,8 +1691,8 @@ void ImapService::createIdleSession() // Fail after 10 sec if no network reply is received _networkSessionTimer->setSingleShot(true); _networkSessionTimer->setInterval(10000); - connect(_networkSessionTimer,SIGNAL(timeout()), - this,SLOT(onSessionConnectionTimeout())); + connect(_networkSessionTimer, SIGNAL(timeout()), + this, SLOT(onSessionConnectionTimeout())); openIdleSession(); } diff --git a/src/plugins/messageservices/imap/imapservice.h b/src/plugins/messageservices/imap/imapservice.h index 7b24794a..5adb68a5 100644 --- a/src/plugins/messageservices/imap/imapservice.h +++ b/src/plugins/messageservices/imap/imapservice.h @@ -122,5 +122,4 @@ public: QMailMessageServiceConfigurator *createServiceConfigurator() override; }; - #endif diff --git a/src/plugins/messageservices/imap/imapsettings.cpp b/src/plugins/messageservices/imap/imapsettings.cpp index 6e8eb698..caa9c4da 100644 --- a/src/plugins/messageservices/imap/imapsettings.cpp +++ b/src/plugins/messageservices/imap/imapsettings.cpp @@ -129,14 +129,14 @@ void PushFolderList::setAccountId(const QMailAccountId &id) void PushFolderList::setHasFolders(bool hasFolders) { _hasFolders = hasFolders; - foreach(QWidget *widget, _widgets) + foreach (QWidget *widget, _widgets) widget->setEnabled(_hasFolders && _pushEnabled); } void PushFolderList::setPushEnabled(int pushEnabled) { _pushEnabled = (pushEnabled != Qt::Unchecked); - foreach(QWidget *widget, _widgets) + foreach (QWidget *widget, _widgets) widget->setEnabled(_hasFolders && _pushEnabled); } @@ -179,11 +179,11 @@ void PushFolderList::addRow(const QString &s) void PushFolderList::populate(const QStringList &pushFolderNames) { _items = 0; - foreach(QWidget *widget, _widgets) { + foreach (QWidget *widget, _widgets) { _parentLayout->removeWidget(widget); delete widget; } - foreach(QHBoxLayout *layout, _layouts) { + foreach (QHBoxLayout *layout, _layouts) { _parentLayout->removeItem(layout); delete layout; } @@ -194,7 +194,7 @@ void PushFolderList::populate(const QStringList &pushFolderNames) _dirButtons.clear(); QStringList folderNames(pushFolderNames); folderNames.append(""); - foreach(const QString &s, folderNames) { + foreach (const QString &s, folderNames) { addRow(s); } } @@ -231,7 +231,7 @@ void PushFolderList::selectFolder() QStringList PushFolderList::folderNames() { QStringList result; - foreach(QLineEdit* edit, _dirTexts) { + foreach (QLineEdit* edit, _dirTexts) { if (!edit->text().isEmpty()) result.append(edit->text()); } @@ -508,4 +508,3 @@ void ImapSettings::setStandardFolder(QMailAccount *account, QMailFolder::Standar } #include "imapsettings.moc" - diff --git a/src/plugins/messageservices/imap/imapsettings.h b/src/plugins/messageservices/imap/imapsettings.h index fbb37fc7..574edcd5 100644 --- a/src/plugins/messageservices/imap/imapsettings.h +++ b/src/plugins/messageservices/imap/imapsettings.h @@ -61,4 +61,3 @@ private: }; #endif - diff --git a/src/plugins/messageservices/imap/imapstrategy.cpp b/src/plugins/messageservices/imap/imapstrategy.cpp index af8a8018..66318e73 100644 --- a/src/plugins/messageservices/imap/imapstrategy.cpp +++ b/src/plugins/messageservices/imap/imapstrategy.cpp @@ -67,7 +67,7 @@ QString stripFolderPrefix(const QString &str) QStringList stripFolderPrefix(const QStringList &list) { QStringList result; - foreach(const QString &uid, list) { + foreach (const QString &uid, list) { result.append(stripFolderPrefix(uid)); } return result; @@ -135,7 +135,7 @@ bool purge(ImapStrategyContextBase *context, const QMailMessageKey &removedKey) { bool result(true); QStringList vanishedIds; - for (const QMailMessageMetaData& r : QMailStore::instance()->messagesMetaData(removedKey, QMailMessageKey::ServerUid)) { + for (const QMailMessageMetaData& r : QMailStore::instance()->messagesMetaData(removedKey, QMailMessageKey::ServerUid)) { const QString &uid(r.serverUid()); // We might have a deletion record for this UID vanishedIds << uid; @@ -182,7 +182,7 @@ bool updateMessagesMetaData(ImapStrategyContextBase *context, qCWarning(lcMailStore) << "Unable to update un-removed message metadata for account:" << context->accountId(); } - for (const QMailMessageMetaData& r : QMailStore::instance()->messagesMetaData(nonexistentKey, QMailMessageKey::ServerUid)) { + for (const QMailMessageMetaData& r : QMailStore::instance()->messagesMetaData(nonexistentKey, QMailMessageKey::ServerUid)) { const QString &uid(r.serverUid()); // We might have a deletion record for this UID if (!QMailStore::instance()->purgeMessageRemovalRecords(context->accountId(), QStringList() << uid)) { @@ -328,10 +328,8 @@ QSet<QMailFolderId> foldersApplicableTo(QMailMessageKey const& messagekey, QSet< QSet<QMailFolderId> & included = isNegated ? r.second : r.first; QSet<QMailFolderId> & excluded = isNegated ? r.first : r.second; - for (QMailMessageKey::ArgumentType const& arg : key.arguments()) - { - switch (arg.property) - { + for (QMailMessageKey::ArgumentType const& arg : key.arguments()) { + switch (arg.property) { case QMailMessageKey::ParentFolderId: if (arg.op == QMailKey::Equal || arg.op == QMailKey::Includes) { Q_ASSERT(arg.valueList.count() == 1); @@ -489,8 +487,7 @@ void ImapStrategyContextBase::operationCompleted() QMailMessageBuffer::instance()->flush(); // Update the status on any folders we modified - for (QSet<QMailFolderId>::iterator it(_modifiedFolders.begin()) ; it != _modifiedFolders.end(); it = _modifiedFolders.erase(it)) - { + for (QSet<QMailFolderId>::iterator it(_modifiedFolders.begin()) ; it != _modifiedFolders.end(); it = _modifiedFolders.erase(it)) { QMailFolder folder(*it); _client->updateFolderCountStatus(&folder); @@ -710,8 +707,7 @@ void ImapCreateFolderStrategy::transition(ImapStrategyContextBase* context, cons if (op != OpOk) qCWarning(lcIMAP) << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch (cmd) - { + switch (cmd) { case IMAP_Login: handleLogin(context); break; @@ -775,8 +771,7 @@ void ImapDeleteFolderStrategy::transition(ImapStrategyContextBase* context, cons if (op != OpOk) qCWarning(lcIMAP) << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch (cmd) - { + switch (cmd) { case IMAP_Login: handleLogin(context); break; @@ -816,7 +811,7 @@ void ImapDeleteFolderStrategy::deleteFolder(const QMailFolderId &folderId, ImapS QMailFolderKey childKey(QMailFolderKey::parentFolderId(folderId)); QMailFolderIdList childrenList = QMailStore::instance()->queryFolders(childKey); - foreach(QMailFolderId fid, childrenList) { + foreach (QMailFolderId fid, childrenList) { deleteFolder(fid, context); } @@ -848,8 +843,7 @@ void ImapRenameFolderStrategy::transition(ImapStrategyContextBase* context, cons if (op != OpOk) qCWarning(lcIMAP) << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch (cmd) - { + switch (cmd) { case IMAP_Login: handleLogin(context); break; @@ -937,8 +931,7 @@ void ImapMoveFolderStrategy::transition(ImapStrategyContextBase* context, const if (op != OpOk) qCWarning(lcIMAP) << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch (cmd) - { + switch (cmd) { case IMAP_Login: handleLogin(context); break; @@ -1049,30 +1042,19 @@ void ImapPrepareMessagesStrategy::newConnection(ImapStrategyContextBase *context void ImapPrepareMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus) { - switch ( command ) { - case IMAP_Login: - { - handleLogin(context); - break; - } - - case IMAP_GenUrlAuth: - { - handleGenUrlAuth(context); - break; - } - - case IMAP_Logout: - { - break; - } - - default: - { - _error = true; - qCWarning(lcIMAP) << "Unhandled IMAP response:" << command; - break; - } + switch (command) { + case IMAP_Login: + handleLogin(context); + break; + case IMAP_GenUrlAuth: + handleGenUrlAuth(context); + break; + case IMAP_Logout: + break; + default: + _error = true; + qCWarning(lcIMAP) << "Unhandled IMAP response:" << command; + break; } } @@ -1258,62 +1240,37 @@ void ImapMessageListStrategy::checkUidValidity(ImapStrategyContextBase *context) void ImapMessageListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus) { - switch ( command ) { - case IMAP_Login: - { - handleLogin(context); - break; - } - - case IMAP_QResync: // fall through - case IMAP_Select: - { - checkUidValidity(context); - handleSelect(context); - break; - } - - case IMAP_Create: - { - handleCreate(context); - break; - } - - case IMAP_Delete: - { - handleDelete(context); - break; - } - - case IMAP_Rename: - { - handleRename(context); - break; - } - - case IMAP_Move: - { - handleMove(context); - break; - } - - case IMAP_Close: - { - handleClose(context); - break; - } - - case IMAP_Logout: - { - break; - } + switch (command) { + case IMAP_Login: + handleLogin(context); + break; - default: - { - _error = true; - qCWarning(lcIMAP) << "Unhandled IMAP response:" << command; - break; - } + case IMAP_QResync: // fall through + case IMAP_Select: + checkUidValidity(context); + handleSelect(context); + break; + case IMAP_Create: + handleCreate(context); + break; + case IMAP_Delete: + handleDelete(context); + break; + case IMAP_Rename: + handleRename(context); + break; + case IMAP_Move: + handleMove(context); + break; + case IMAP_Close: + handleClose(context); + break; + case IMAP_Logout: + break; + default: + _error = true; + qCWarning(lcIMAP) << "Unhandled IMAP response:" << command; + break; } } @@ -1690,15 +1647,14 @@ void ImapFetchSelectedMessagesStrategy::setOperation( { QMailAccountConfiguration accountCfg(context->accountId()); ImapConfiguration imapCfg(accountCfg); + switch (spec) { case QMailRetrievalAction::Auto: - { - if (imapCfg.isAutoDownload()) { - // Just download everything - _headerLimit = UINT_MAX; - } else { - _headerLimit = imapCfg.maxMailSize() * 1024; - } + if (imapCfg.isAutoDownload()) { + // Just download everything + _headerLimit = UINT_MAX; + } else { + _headerLimit = imapCfg.maxMailSize() * 1024; } break; case QMailRetrievalAction::Content: @@ -1794,18 +1750,13 @@ void ImapFetchSelectedMessagesStrategy::newConnection(ImapStrategyContextBase *c void ImapFetchSelectedMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_UIDFetch: - { - handleUidFetch(context); - break; - } - - default: - { - ImapMessageListStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_UIDFetch: + handleUidFetch(context); + break; + default: + ImapMessageListStrategy::transition(context, command, status); + break; } } @@ -2032,7 +1983,7 @@ void ImapSearchMessageStrategy::handleSearchMessage(ImapStrategyContextBase *con return; } - foreach(const QString &uidString, properties.uidList) { + foreach (const QString &uidString, properties.uidList) { QMailMessageIdList ids(QMailStore::instance()->queryMessages(QMailMessageKey::serverUid(uidString) & QMailMessageKey::parentAccountId(context->accountId()))); Q_ASSERT(ids.size() == 1 || ids.size() == 0); if (ids.size()) @@ -2095,24 +2046,16 @@ void ImapFolderListStrategy::newConnection(ImapStrategyContextBase *context) void ImapFolderListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_List: - { - handleList(context); - break; - } - - case IMAP_Search: - { - handleSearch(context); - break; - } - - default: - { - ImapFetchSelectedMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_List: + handleList(context); + break; + case IMAP_Search: + handleSearch(context); + break; + default: + ImapFetchSelectedMessagesStrategy::transition(context, command, status); + break; } } @@ -2434,7 +2377,7 @@ void ImapSynchronizeBaseStrategy::fetchNextMailPreview(ImapStrategyContextBase * if (!_newUids.isEmpty() || _outstandingPreviews) { while (!_newUids.isEmpty()) { QStringList uidList; - foreach(const QString &s, _newUids.mid(0, DefaultBatchSize)) { + foreach (const QString &s, _newUids.mid(0, DefaultBatchSize)) { uidList << ImapProtocol::uid(s); } @@ -2684,30 +2627,19 @@ void ImapSynchronizeAllStrategy::setOptions(Options options) void ImapSynchronizeAllStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_UIDSearch: - { - handleUidSearch(context); - break; - } - - case IMAP_UIDStore: - { - handleUidStore(context); - break; - } - - case IMAP_Expunge: - { - handleExpunge(context); - break; - } - - default: - { - ImapRetrieveFolderListStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_UIDSearch: + handleUidSearch(context); + break; + case IMAP_UIDStore: + handleUidStore(context); + break; + case IMAP_Expunge: + handleExpunge(context); + break; + default: + ImapRetrieveFolderListStrategy::transition(context, command, status); + break; } } @@ -2715,28 +2647,22 @@ void ImapSynchronizeAllStrategy::handleUidSearch(ImapStrategyContextBase *contex { const ImapMailboxProperties &properties(context->mailbox()); - switch (_searchState) - { + switch (_searchState) { case Seen: - { _seenUids = properties.uidList; // The Unseen search command was pipelined _searchState = Unseen; context->protocol().sendUidSearch(MFlag_Unseen); break; - } case Unseen: - { _unseenUids = properties.uidList; // The Flagged search command was pipelined _searchState = Flagged; context->protocol().sendUidSearch(MFlag_Flagged); break; - } case Flagged: - { _flaggedUids = properties.uidList; if (static_cast<quint32>((_unseenUids.count() + _seenUids.count())) == properties.exists) { // We have a consistent set of search results @@ -2752,9 +2678,7 @@ void ImapSynchronizeAllStrategy::handleUidSearch(ImapStrategyContextBase *contex context->protocol().sendUidSearch(MFlag_All); } break; - } case All: - { _unseenUids = properties.uidList; if (static_cast<quint32>(_unseenUids.count()) != properties.exists) { qCWarning(lcIMAP) << "Inconsistent UID SEARCH result"; @@ -2765,7 +2689,6 @@ void ImapSynchronizeAllStrategy::handleUidSearch(ImapStrategyContextBase *contex processUidSearchResults(context); break; - } default: qCWarning(lcIMAP) << "Unknown search status in transition"; } @@ -2990,7 +2913,7 @@ bool ImapSynchronizeAllStrategy::setNextSeen(ImapStrategyContextBase *context) if (!_readUids.isEmpty()) { QStringList msgUidl = _readUids.mid(0, batchSize); QString msg = QObject::tr("Marking message as read"); - foreach(QString uid, msgUidl) { + foreach (QString uid, msgUidl) { _readUids.removeAll(uid); _storedReadUids.append(uid); } @@ -3009,7 +2932,7 @@ bool ImapSynchronizeAllStrategy::setNextNotSeen(ImapStrategyContextBase *context if (!_unreadUids.isEmpty()) { QStringList msgUidl = _unreadUids.mid(0, batchSize); QString msg = QObject::tr("Marking message as unread"); - foreach(QString uid, msgUidl) { + foreach (QString uid, msgUidl) { _unreadUids.removeAll(uid); _storedUnreadUids.append(uid); } @@ -3028,7 +2951,7 @@ bool ImapSynchronizeAllStrategy::setNextImportant(ImapStrategyContextBase *conte if (!_importantUids.isEmpty()) { QStringList msgUidl = _importantUids.mid(0, batchSize); QString msg = QObject::tr("Marking message as important"); - foreach(QString uid, msgUidl) { + foreach (QString uid, msgUidl) { _importantUids.removeAll(uid); _storedImportantUids.append(uid); } @@ -3047,7 +2970,7 @@ bool ImapSynchronizeAllStrategy::setNextNotImportant(ImapStrategyContextBase *co if (!_unimportantUids.isEmpty()) { QStringList msgUidl = _unimportantUids.mid(0, batchSize); QString msg = QObject::tr("Marking message as unimportant"); - foreach(QString uid, msgUidl) { + foreach (QString uid, msgUidl) { _unimportantUids.removeAll(uid); _storedUnimportantUids.append(uid); } @@ -3069,7 +2992,7 @@ bool ImapSynchronizeAllStrategy::setNextDeleted(ImapStrategyContextBase *context if (!_removedUids.isEmpty()) { QStringList msgUidl = _removedUids.mid(0, batchSize); QString msg = QObject::tr("Deleting message"); - foreach(QString uid, msgUidl) { + foreach (QString uid, msgUidl) { _removedUids.removeAll(uid); _storedRemovedUids.append(uid); } @@ -3319,18 +3242,13 @@ QMailMessageIdList ImapUpdateMessagesFlagsStrategy::selectedMails() void ImapUpdateMessagesFlagsStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_UIDSearch: - { - handleUidSearch(context); - break; - } - - default: - { - ImapFolderListStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_UIDSearch: + handleUidSearch(context); + break; + default: + ImapFolderListStrategy::transition(context, command, status); + break; } } @@ -3359,30 +3277,23 @@ void ImapUpdateMessagesFlagsStrategy::handleUidSearch(ImapStrategyContextBase *c { const ImapMailboxProperties &properties(context->mailbox()); - switch (_searchState) - { + switch (_searchState) { case Unseen: - { _unseenUids = properties.uidList; _searchState = Seen; context->protocol().sendUidSearch(MFlag_Seen, "UID " + _filter); break; - } case Seen: - { _seenUids = properties.uidList; _searchState = Flagged; context->protocol().sendUidSearch(MFlag_Flagged, "UID " + _filter); break; - } case Flagged: - { _flaggedUids = properties.uidList; processUidSearchResults(context); break; - } default: qCWarning(lcIMAP) << "Unknown search status in transition"; Q_ASSERT(0); @@ -3498,24 +3409,16 @@ void ImapRetrieveMessageListStrategy::setAccountCheck(bool check) void ImapRetrieveMessageListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_FetchFlags: - { - handleFetchFlags(context); - break; - } - - case IMAP_UIDSearch: - { - handleUidSearch(context); - break; - } - - default: - { - ImapSynchronizeBaseStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_FetchFlags: + handleFetchFlags(context); + break; + case IMAP_UIDSearch: + handleUidSearch(context); + break; + default: + ImapSynchronizeBaseStrategy::transition(context, command, status); + break; } } @@ -3594,7 +3497,7 @@ static void markMessages(IntegerRegion region, quint64 flag, bool set, const QMa return; QStringList uidList; - foreach(QString uid, region.toStringList()) { + foreach (QString uid, region.toStringList()) { uidList.append(QString::number(folderId.toULongLong()) + UID_SEPARATOR + uid); } QMailMessageKey uidKey(QMailMessageKey::serverUid(uidList) & QMailMessageKey::status(flag, set ? QMailDataComparator::Excludes : QMailDataComparator::Includes)); @@ -3614,7 +3517,7 @@ static void processFlagChanges(const QList<FlagChange> &changes, const QMailFold IntegerRegion undeleted; IntegerRegion replied; IntegerRegion forwarded; - foreach(FlagChange change, changes) { + foreach (FlagChange change, changes) { bool ok; QString uidStr(stripFolderPrefix(change.first)); MessageFlags flags(change.second); @@ -3676,7 +3579,7 @@ void ImapRetrieveMessageListStrategy::handleFetchFlags(ImapStrategyContextBase * // The set of messages to fetch needs to be adjusted based on the number of such messages IntegerRegion rawServerRegion; processFlagChanges(properties.flagChanges, properties.id, &_error); - foreach(const QString &uid, properties.uidList) { + foreach (const QString &uid, properties.uidList) { bool ok; uint number = stripFolderPrefix(uid).toUInt(&ok); if (ok) @@ -3732,7 +3635,7 @@ void ImapRetrieveMessageListStrategy::handleFetchFlags(ImapStrategyContextBase * } QStringList removedList; - foreach(QString uid, beginningClientRegion.toStringList()) { + foreach (QString uid, beginningClientRegion.toStringList()) { removedList.append(QString::number(folder.id().toULongLong()) + UID_SEPARATOR + uid); } @@ -3747,7 +3650,7 @@ void ImapRetrieveMessageListStrategy::handleFetchFlags(ImapStrategyContextBase * IntegerRegion clientRegionWithinServerRange(serverRange.intersect(trueClientRegion)); IntegerRegion clientRemovedRegion(clientRegionWithinServerRange.subtract(rawServerRegion).toStringList()); QStringList removed; - foreach(QString uid, clientRemovedRegion.toStringList()) { + foreach (QString uid, clientRemovedRegion.toStringList()) { removed.append(QString::number(folder.id().toULongLong()) + UID_SEPARATOR + uid); } @@ -3884,7 +3787,7 @@ void ImapRetrieveMessageListStrategy::qresyncHandleUidSearch(ImapStrategyContext { // Add the listed uids to the retrieve list const ImapMailboxProperties &properties(context->mailbox()); - foreach(const QString &uid, properties.uidList) { + foreach (const QString &uid, properties.uidList) { bool ok; uint number = stripFolderPrefix(uid).toUInt(&ok); if (ok) { @@ -3963,7 +3866,7 @@ void ImapRetrieveMessageListStrategy::qresyncFolderListFolderAction(ImapStrategy IntegerRegion vanishedOnClient(vanished.intersect(IntegerRegion(clientMin, INT_MAX))); _qresyncVanished = vanishedOnClient.cardinality(); QStringList removedList; - foreach(QString uid, vanishedOnClient.toStringList()) { + foreach (QString uid, vanishedOnClient.toStringList()) { removedList.append(QString::number(folder.id().toULongLong()) + UID_SEPARATOR + uid); } if (!removedList.isEmpty()) { @@ -4063,36 +3966,22 @@ void ImapCopyMessagesStrategy::newConnection(ImapStrategyContextBase *context) void ImapCopyMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_UIDCopy: - { - handleUidCopy(context); - break; - } - - case IMAP_Append: - { - handleAppend(context); - break; - } - - case IMAP_UIDSearch: - { - handleUidSearch(context); - break; - } - - case IMAP_UIDStore: - { - handleUidStore(context); - break; - } - - default: - { - ImapFetchSelectedMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_UIDCopy: + handleUidCopy(context); + break; + case IMAP_Append: + handleAppend(context); + break; + case IMAP_UIDSearch: + handleUidSearch(context); + break; + case IMAP_UIDStore: + handleUidStore(context); + break; + default: + ImapFetchSelectedMessagesStrategy::transition(context, command, status); + break; } } @@ -4372,18 +4261,13 @@ void ImapCopyMessagesStrategy::selectMessageSet(ImapStrategyContextBase *context void ImapMoveMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_Examine: - { - handleExamine(context); - break; - } - - default: - { - ImapCopyMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_Examine: + handleExamine(context); + break; + default: + ImapCopyMessagesStrategy::transition(context, command, status); + break; } } @@ -4513,18 +4397,13 @@ void ImapExternalizeMessagesStrategy::newConnection(ImapStrategyContextBase *con void ImapExternalizeMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_GenUrlAuth: - { - handleGenUrlAuth(context); - break; - } - - default: - { - ImapCopyMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_GenUrlAuth: + handleGenUrlAuth(context); + break; + default: + ImapCopyMessagesStrategy::transition(context, command, status); + break; } } @@ -4639,18 +4518,13 @@ void ImapFlagMessagesStrategy::setMessageFlags(MessageFlags flags, bool set) void ImapFlagMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_UIDStore: - { - handleUidStore(context); - break; - } - - default: - { - ImapFetchSelectedMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_UIDStore: + handleUidStore(context); + break; + default: + ImapFetchSelectedMessagesStrategy::transition(context, command, status); + break; } } @@ -4699,24 +4573,16 @@ void ImapDeleteMessagesStrategy::clearSelection() void ImapDeleteMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch ( command ) { - case IMAP_Close: - { - handleClose(context); - break; - } - - case IMAP_Examine: - { - handleExamine(context); - break; - } - - default: - { - ImapFlagMessagesStrategy::transition(context, command, status); - break; - } + switch (command) { + case IMAP_Close: + handleClose(context); + break; + case IMAP_Examine: + handleExamine(context); + break; + default: + ImapFlagMessagesStrategy::transition(context, command, status); + break; } } @@ -4783,4 +4649,3 @@ ImapStrategyContext::ImapStrategyContext(ImapClient *client) _strategy(0) { } - diff --git a/src/plugins/messageservices/imap/imapstrategy.h b/src/plugins/messageservices/imap/imapstrategy.h index 832a6883..b425d8db 100644 --- a/src/plugins/messageservices/imap/imapstrategy.h +++ b/src/plugins/messageservices/imap/imapstrategy.h @@ -162,7 +162,7 @@ protected: TransferState _transferState; QString _baseFolder; bool _error; - QMap<QString,bool> _folder; + QMap<QString, bool> _folder; }; class ImapCreateFolderStrategy : public ImapStrategy @@ -742,7 +742,7 @@ protected: QStringList _createdUids; int _messagesAdded; QStringList _obsoleteDestinationUids; - QMap<QString,QString> _remember; + QMap<QString, QString> _remember; }; class ImapMoveMessagesStrategy : public ImapCopyMessagesStrategy diff --git a/src/plugins/messageservices/imap/imapstructure.cpp b/src/plugins/messageservices/imap/imapstructure.cpp index 08e57221..fef38512 100644 --- a/src/plugins/messageservices/imap/imapstructure.cpp +++ b/src/plugins/messageservices/imap/imapstructure.cpp @@ -561,4 +561,3 @@ QStringList getMessageStructure(const QString &field) return QStringList(); } - diff --git a/src/plugins/messageservices/imap/integerregion.cpp b/src/plugins/messageservices/imap/integerregion.cpp index 763150b9..3daa98a4 100644 --- a/src/plugins/messageservices/imap/integerregion.cpp +++ b/src/plugins/messageservices/imap/integerregion.cpp @@ -70,7 +70,7 @@ IntegerRegion::IntegerRegion(const QStringList &uids) { // Performance note currently O(n^2), n = uids.count() // TODO: sort uids if they are not already sorted - foreach(const QString &uid, uids) { + foreach (const QString &uid, uids) { bool ok(false); uint number = uid.toUInt(&ok); if (ok) @@ -88,7 +88,7 @@ IntegerRegion::IntegerRegion(const QString &uidString) // Performance note currently O(n^2), n = uids.count() // TODO: sort uids in uidString if they are not already sorted QStringList rangeList = uidString.split(",", Qt::SkipEmptyParts); - foreach(const QString &s, rangeList) { + foreach (const QString &s, rangeList) { bool ok = false; int index = s.indexOf(":"); if (index == -1) { @@ -144,7 +144,7 @@ uint IntegerRegion::cardinality() const { uint result(0); - foreach( const IntegerRange &range, mRangeList) + foreach ( const IntegerRange &range, mRangeList) result += range.second - range.first + 1; return result; @@ -174,7 +174,7 @@ int IntegerRegion::minimum() const QStringList IntegerRegion::toStringList() const { QStringList result; - foreach(const IntegerRange &range, mRangeList) { + foreach (const IntegerRange &range, mRangeList) { result += QString::number(range.first); for (int i = range.first + 1; i <= range.second; ++i) result += QString::number(i); @@ -189,7 +189,7 @@ QString IntegerRegion::toString() const { QString result; bool first(true); - foreach(const IntegerRange &range, mRangeList) { + foreach (const IntegerRange &range, mRangeList) { if (!first) result += ","; result += QString::number(range.first); @@ -340,7 +340,7 @@ IntegerRegion IntegerRegion::intersect(IntegerRegion other) const */ bool IntegerRegion::isIntegerRegion(QStringList uids) { - foreach(const QString &uid, uids) { + foreach (const QString &uid, uids) { bool ok(false); uid.toUInt(&ok); if (!ok) @@ -411,7 +411,7 @@ QString IntegerRegion::toBinaryString(const IntegerRegion &ir) { QString result; int last(0); - foreach(const QString &s, ir.toStringList()) { + foreach (const QString &s, ir.toStringList()) { bool ok; int value = s.toInt(&ok); for (int i = last; i < value; ++i) diff --git a/src/plugins/messageservices/pop/popauthenticator.cpp b/src/plugins/messageservices/pop/popauthenticator.cpp index 76bfe182..aba8aaf5 100644 --- a/src/plugins/messageservices/pop/popauthenticator.cpp +++ b/src/plugins/messageservices/pop/popauthenticator.cpp @@ -85,4 +85,3 @@ QByteArray PopAuthenticator::getResponse(const PopConfiguration &svcCfg, { return QMailAuthenticator::getResponse(svcCfg, challenge, credentials); } - diff --git a/src/plugins/messageservices/pop/popauthenticator.h b/src/plugins/messageservices/pop/popauthenticator.h index 765fc9aa..a82ea3ff 100644 --- a/src/plugins/messageservices/pop/popauthenticator.h +++ b/src/plugins/messageservices/pop/popauthenticator.h @@ -53,4 +53,3 @@ public: }; #endif - diff --git a/src/plugins/messageservices/pop/popclient.cpp b/src/plugins/messageservices/pop/popclient.cpp index f258c1a2..444965bd 100644 --- a/src/plugins/messageservices/pop/popclient.cpp +++ b/src/plugins/messageservices/pop/popclient.cpp @@ -818,7 +818,7 @@ void PopClient::nextAction() if (msgNum != -1) { if (!selected) { if (messageCount == 1) { - emit updateStatus(tr("Previewing","Previewing <no of messages>") +QChar(' ') + QString::number(newUids.count())); + emit updateStatus(tr("Previewing", "Previewing <no of messages>") + QChar(' ') + QString::number(newUids.count())); } if (lastStatusTimer.elapsed() > 1000) { lastStatusTimer.start(); diff --git a/src/plugins/messageservices/pop/popconfiguration.cpp b/src/plugins/messageservices/pop/popconfiguration.cpp index d7504417..5c1b6f90 100644 --- a/src/plugins/messageservices/pop/popconfiguration.cpp +++ b/src/plugins/messageservices/pop/popconfiguration.cpp @@ -163,4 +163,3 @@ void PopConfigurationEditor::setIntervalCheckRoamingEnabled(bool b) { setValue("intervalCheckRoamingEnabled", QString::number(b ? 1 : 0)); } - diff --git a/src/plugins/messageservices/pop/popservice.h b/src/plugins/messageservices/pop/popservice.h index 676fc372..896d564c 100644 --- a/src/plugins/messageservices/pop/popservice.h +++ b/src/plugins/messageservices/pop/popservice.h @@ -73,7 +73,6 @@ private: Source *_source; }; - class PopServicePlugin : public QMailMessageServicePlugin { Q_OBJECT @@ -90,5 +89,4 @@ public: QMailMessageServiceConfigurator *createServiceConfigurator() override; }; - #endif diff --git a/src/plugins/messageservices/pop/popsettings.cpp b/src/plugins/messageservices/pop/popsettings.cpp index 7616f9ac..ed9a3cec 100644 --- a/src/plugins/messageservices/pop/popsettings.cpp +++ b/src/plugins/messageservices/pop/popsettings.cpp @@ -166,4 +166,3 @@ bool PopSettings::updateAccount(QMailAccount *account, QMailAccountConfiguration return true; } - diff --git a/src/plugins/messageservices/pop/popsettings.h b/src/plugins/messageservices/pop/popsettings.h index 4e5edf34..38c15dbc 100644 --- a/src/plugins/messageservices/pop/popsettings.h +++ b/src/plugins/messageservices/pop/popsettings.h @@ -55,4 +55,3 @@ private: }; #endif - diff --git a/src/plugins/messageservices/smtp/smtpauthenticator.h b/src/plugins/messageservices/smtp/smtpauthenticator.h index c9a000ce..2f886d83 100644 --- a/src/plugins/messageservices/smtp/smtpauthenticator.h +++ b/src/plugins/messageservices/smtp/smtpauthenticator.h @@ -51,4 +51,3 @@ public: }; #endif - diff --git a/src/plugins/messageservices/smtp/smtpclient.cpp b/src/plugins/messageservices/smtp/smtpclient.cpp index 5e846ce7..545ba6a1 100644 --- a/src/plugins/messageservices/smtp/smtpclient.cpp +++ b/src/plugins/messageservices/smtp/smtpclient.cpp @@ -569,7 +569,7 @@ void SmtpClient::nextAction(const QString &response) if (responseCode == 220) { // Switch into encrypted mode transport->switchToEncrypted(); - } else { + } else { operationFailed(QMailServiceAction::Status::ErrUnknownResponse, response); } break; @@ -742,7 +742,7 @@ void SmtpClient::nextAction(const QString &response) sendCommand("RCPT TO:<" + *it + ">"); status = MRcv; } - } else { + } else { operationFailed(QMailServiceAction::Status::ErrUnknownResponse, response); } break; @@ -1079,8 +1079,7 @@ void SmtpClient::authExpired() void SmtpClient::stopTransferring() { - if (temporaryFile) - { + if (temporaryFile) { if (transport->isEncrypted()) disconnect(&(transport->socket()), SIGNAL(encryptedBytesWritten(qint64)), this, SLOT(sendMoreData(qint64))); else diff --git a/src/plugins/messageservices/smtp/smtpconfiguration.cpp b/src/plugins/messageservices/smtp/smtpconfiguration.cpp index c526e56f..fb2893c3 100644 --- a/src/plugins/messageservices/smtp/smtpconfiguration.cpp +++ b/src/plugins/messageservices/smtp/smtpconfiguration.cpp @@ -102,7 +102,7 @@ SmtpConfigurationEditor::SmtpConfigurationEditor(QMailAccountConfiguration *conf void SmtpConfigurationEditor::setUserName(const QString& str) { - setValue("username",str); + setValue("username", str); } void SmtpConfigurationEditor::setEmailAddress(const QString &str) diff --git a/src/plugins/messageservices/smtp/smtpservice.cpp b/src/plugins/messageservices/smtp/smtpservice.cpp index 22accd92..529f7d48 100644 --- a/src/plugins/messageservices/smtp/smtpservice.cpp +++ b/src/plugins/messageservices/smtp/smtpservice.cpp @@ -296,4 +296,3 @@ QMailMessageServiceConfigurator *SmtpServicePlugin::createServiceConfigurator() } #include "smtpservice.moc" - diff --git a/src/plugins/messageservices/smtp/smtpservice.h b/src/plugins/messageservices/smtp/smtpservice.h index 265fdb81..8f73cd05 100644 --- a/src/plugins/messageservices/smtp/smtpservice.h +++ b/src/plugins/messageservices/smtp/smtpservice.h @@ -96,5 +96,4 @@ public: QMailMessageServiceConfigurator *createServiceConfigurator() override; }; - #endif diff --git a/src/plugins/messageservices/smtp/smtpsettings.cpp b/src/plugins/messageservices/smtp/smtpsettings.cpp index 3b8878b6..6220fbbf 100644 --- a/src/plugins/messageservices/smtp/smtpsettings.cpp +++ b/src/plugins/messageservices/smtp/smtpsettings.cpp @@ -154,7 +154,7 @@ SmtpSettings::SmtpSettings() connect(setSignatureButton, SIGNAL(clicked()), this, SLOT(sigPressed())); connect(authentication, SIGNAL(currentIndexChanged(int)), this, SLOT(authChanged(int))); connect(emailInput, SIGNAL(textChanged(QString)), this, SLOT(emailModified())); - connect(sigCheckBox,SIGNAL(clicked(bool)),setSignatureButton,SLOT(setEnabled(bool))); + connect(sigCheckBox, SIGNAL(clicked(bool)), setSignatureButton, SLOT(setEnabled(bool))); const QString uncapitalised("email noautocapitalization"); @@ -310,6 +310,4 @@ bool SmtpSettings::updateAccount(QMailAccount *account, QMailAccountConfiguratio return true; } - #include "smtpsettings.moc" - diff --git a/src/plugins/messageservices/smtp/smtpsettings.h b/src/plugins/messageservices/smtp/smtpsettings.h index 8d55dce3..6fd20e3f 100644 --- a/src/plugins/messageservices/smtp/smtpsettings.h +++ b/src/plugins/messageservices/smtp/smtpsettings.h @@ -62,4 +62,3 @@ private: }; #endif - diff --git a/src/tools/messageserver/main.cpp b/src/tools/messageserver/main.cpp index 77d26e1a..68426c6e 100644 --- a/src/tools/messageserver/main.cpp +++ b/src/tools/messageserver/main.cpp @@ -60,4 +60,3 @@ int main(int argc, char** argv) return exitCode; } - diff --git a/src/tools/messageserver/messageserver.cpp b/src/tools/messageserver/messageserver.cpp index 06a335ae..75ed8a13 100644 --- a/src/tools/messageserver/messageserver.cpp +++ b/src/tools/messageserver/messageserver.cpp @@ -276,7 +276,7 @@ void MessageServer::reportNewCounts() if (it.value() != messageCounts[type]) { // This type's count has changed since last reported - if ( NewCountNotifier* action = new NewCountNotifier(type,it.value())) { + if ( NewCountNotifier* action = new NewCountNotifier(type, it.value())) { actionType[action] = type; connect(action, SIGNAL(response(bool)), this, SLOT(response(bool))); diff --git a/src/tools/messageserver/newcountnotifier.cpp b/src/tools/messageserver/newcountnotifier.cpp index 2c65327a..f89f7270 100644 --- a/src/tools/messageserver/newcountnotifier.cpp +++ b/src/tools/messageserver/newcountnotifier.cpp @@ -36,8 +36,7 @@ //stub for alternate handling, currently does nothing NewCountNotifier::NewCountNotifier(QMailMessage::MessageType, int) -: - QObject() + : QObject() { } @@ -55,4 +54,3 @@ bool NewCountNotifier::notify() void NewCountNotifier::notify(QMailMessage::MessageType, int) { } - diff --git a/src/tools/messageserver/prepareaccounts.cpp b/src/tools/messageserver/prepareaccounts.cpp index 78f5f9a8..d4d5d7aa 100644 --- a/src/tools/messageserver/prepareaccounts.cpp +++ b/src/tools/messageserver/prepareaccounts.cpp @@ -41,4 +41,3 @@ void prepareAccounts() { } - diff --git a/tests/tst_imap/tst_imap.cpp b/tests/tst_imap/tst_imap.cpp index a64c5630..04855e86 100644 --- a/tests/tst_imap/tst_imap.cpp +++ b/tests/tst_imap/tst_imap.cpp @@ -57,10 +57,6 @@ private: ImapClient *mClient = nullptr; }; -QTEST_MAIN(tst_ImapClient) - -#include "tst_imap.moc" - void tst_ImapClient::initTestCase() { QMailAccount account; @@ -102,14 +98,13 @@ public: if (op != OpOk) qWarning() << "Test response to cmd:" << cmd << " is not ok: " << op; - switch (cmd) - { - case IMAP_Login: - context->operationCompleted(); - break; - default: - qWarning() << "Unhandled test response:" << cmd; - } + switch (cmd) { + case IMAP_Login: + context->operationCompleted(); + break; + default: + qWarning() << "Unhandled test response:" << cmd; + } } }; @@ -129,3 +124,7 @@ void tst_ImapClient::test_connection() QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Checking capabilities")); QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Logging in")); } + +QTEST_MAIN(tst_ImapClient) + +#include "tst_imap.moc" diff --git a/tests/tst_locks/tst_locks.cpp b/tests/tst_locks/tst_locks.cpp index 76430bfa..423b4657 100644 --- a/tests/tst_locks/tst_locks.cpp +++ b/tests/tst_locks/tst_locks.cpp @@ -54,13 +54,8 @@ private slots: virtual void cleanup(); void testQMailAccountKey(); - }; -QTEST_MAIN(tst_locks) -#include "tst_locks.moc" - - tst_locks::tst_locks() { } @@ -79,7 +74,6 @@ void tst_locks::cleanupTestCase() void tst_locks::init() { - } void tst_locks::cleanup() @@ -97,6 +91,7 @@ void tst_locks::testQMailAccountKey() QCOMPARE(firstKey, testKey); testKey |= secondKey; QVERIFY((testKey | firstKey) == secondKey); - - } + +QTEST_MAIN(tst_locks) +#include "tst_locks.moc" diff --git a/tests/tst_longstring/tst_longstring.cpp b/tests/tst_longstring/tst_longstring.cpp index ba05242e..76be3b77 100644 --- a/tests/tst_longstring/tst_longstring.cpp +++ b/tests/tst_longstring/tst_longstring.cpp @@ -69,13 +69,9 @@ private slots: void mid(); }; -QTEST_MAIN(tst_LongString) -#include "tst_longstring.moc" - static void verifyIndexOf( const LongString& container, const QByteArray& content ) { - if (content.length() > 1) - { + if (content.length() > 1) { QByteArray target = content.mid(1, -1); // Invert the case of the first character @@ -302,12 +298,9 @@ void tst_LongString::left() LongString ls( source ); LongString comparator; - if ( nested_size == -1 ) - { + if (nested_size == -1) { comparator = ls.left( size ); - } - else - { + } else { LongString nested = ls.left( nested_size ); comparator = nested.left( size ); } @@ -400,12 +393,9 @@ void tst_LongString::right() LongString ls( source ); LongString comparator; - if ( nested_size == -1 ) - { + if (nested_size == -1) { comparator = ls.right( size ); - } - else - { + } else { LongString nested = ls.right( nested_size ); comparator = nested.right( size ); } @@ -876,12 +866,9 @@ void tst_LongString::mid() LongString ls( source ); LongString comparator; - if ( nested_size == -1 ) - { + if (nested_size == -1) { comparator = ls.mid( from, size ); - } - else - { + } else { LongString nested = ls.mid( nested_from, nested_size ); comparator = nested.mid( from, size ); } @@ -901,3 +888,6 @@ void tst_LongString::mid() // Ensure that indexOf works correctly on result of mid verifyIndexOf( comparator, streamOutput ); } + +QTEST_MAIN(tst_LongString) +#include "tst_longstring.moc" diff --git a/tests/tst_python_email/tst_python_email.cpp b/tests/tst_python_email/tst_python_email.cpp index 619fd7d6..b539983f 100644 --- a/tests/tst_python_email/tst_python_email.cpp +++ b/tests/tst_python_email/tst_python_email.cpp @@ -1961,4 +1961,3 @@ CRLF; QVERIFY( msg.contentType().isParameterEncoded("name") == false ); QCOMPARE( QMailMessageHeaderField::decodeParameter(msg.contentType().name()), QString("My Document For You") ); } - diff --git a/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp b/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp index 2ef9fb1c..aaa4e1d0 100644 --- a/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp +++ b/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp @@ -70,11 +70,6 @@ private: QMailMessage msg2; }; -QTEST_MAIN(tst_QMail_ListModels) - -#include "tst_qmail_listmodels.moc" - - QMailAccountConfiguration tst_QMail_ListModels::makeConfig(const QString &accountName) { QMailAccountConfiguration config; @@ -267,7 +262,6 @@ void tst_QMail_ListModels::test_qmailmessagelistmodel() idx = model.indexFromId(msg1.id()); QString data = model.data(idx).toString(); QString stop; - } void tst_QMail_ListModels::test_messagethreadedmodel() @@ -275,3 +269,7 @@ void tst_QMail_ListModels::test_messagethreadedmodel() QMailMessageThreadedModel model; model.generateIndex(0, 0, 0); } + +QTEST_MAIN(tst_QMail_ListModels) + +#include "tst_qmail_listmodels.moc" diff --git a/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp b/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp index 1266d68f..7dd59785 100644 --- a/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp +++ b/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp @@ -63,10 +63,6 @@ private: QSet<QMailMessageId> noMessages, allMessages, allEmailMessages; }; -QTEST_MAIN(tst_QMail_SortKeys) - -#include "tst_qmail_sortkeys.moc" - void tst_QMail_SortKeys::initTestCase() { // Instantiate the store to initialise the values of the status flags and create the standard folders @@ -500,3 +496,7 @@ void tst_QMail_SortKeys::test_messagesortkey() ids = QMailStore::instance()->queryMessages(key, QMailMessageSortKey::rfcId()); QCOMPARE(ids.count(), allMessages.count()); } + +QTEST_MAIN(tst_QMail_SortKeys) + +#include "tst_qmail_sortkeys.moc" diff --git a/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp b/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp index 17443850..2478b7ce 100644 --- a/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp +++ b/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp @@ -127,6 +127,5 @@ void tst_QMailAccountConfiguration::test_service() QCOMPARE(service.listValue(QStringLiteral("some element list")), list2); } - #include "tst_qmailaccountconfiguration.moc" QTEST_MAIN(tst_QMailAccountConfiguration) diff --git a/tests/tst_qmailaddress/tst_qmailaddress.cpp b/tests/tst_qmailaddress/tst_qmailaddress.cpp index 85d4c287..91ae102c 100644 --- a/tests/tst_qmailaddress/tst_qmailaddress.cpp +++ b/tests/tst_qmailaddress/tst_qmailaddress.cpp @@ -84,11 +84,6 @@ private slots: void removeWhitespace(); }; -QTEST_MAIN(tst_QMailAddress) - -#include "tst_qmailaddress.moc" - - tst_QMailAddress::tst_QMailAddress() { } @@ -1274,3 +1269,6 @@ void tst_QMailAddress::removeWhitespace() QTEST( QMailAddress::removeWhitespace(input), "output" ); } +QTEST_MAIN(tst_QMailAddress) + +#include "tst_qmailaddress.moc" diff --git a/tests/tst_qmailcodec/tst_qmailcodec.cpp b/tests/tst_qmailcodec/tst_qmailcodec.cpp index e7adb1f7..a30723bf 100644 --- a/tests/tst_qmailcodec/tst_qmailcodec.cpp +++ b/tests/tst_qmailcodec/tst_qmailcodec.cpp @@ -69,11 +69,6 @@ private slots: void encodeDecodeModifiedUtf7(); }; -QTEST_MAIN(tst_QMailCodec) - -#include "tst_qmailcodec.moc" - - tst_QMailCodec::tst_QMailCodec() { } @@ -171,8 +166,7 @@ void tst_QMailCodec::encode() QCOMPARE(reversed, plaintext); // Ensure that the byte-array-to-byte-array conversion matches the QString-to-byte-array conversion - if (codec) - { + if (codec) { QByteArray octet_data = codec->fromUnicode(plaintext); QByteArray base64_data; { @@ -208,8 +202,7 @@ void tst_QMailCodec::encode() } QCOMPARE(reversed, plaintext); - if (codec) - { + if (codec) { // Ensure that the byte-array-to-byte-array conversion matches QByteArray octet_data = codec->fromUnicode(plaintext); QByteArray qp_data; @@ -233,8 +226,7 @@ void tst_QMailCodec::encode() QCOMPARE(reversed, octet_data); } - if (!qp2047_encoded.isEmpty()) - { + if (!qp2047_encoded.isEmpty()) { // Test the the quoted-printable encoding works, conforming to RFC 2047 { QMailQuotedPrintableCodec qpCodec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047); @@ -255,8 +247,7 @@ void tst_QMailCodec::encode() encoded = ptCodec.encode(plaintext, charset); } - if (codec) - { + if (codec) { QByteArray octet_data = codec->fromUnicode(plaintext); QCOMPARE(encoded, octet_data); } @@ -457,8 +448,7 @@ void tst_QMailCodec::line_lengths() QCOMPARE(reversed, plaintext); } - if (!qp2047_encoded.isEmpty()) - { + if (!qp2047_encoded.isEmpty()) { { QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047); encoded = codec.encode(plaintext, charset); @@ -725,3 +715,6 @@ void tst_QMailCodec::encodeDecodeModifiedUtf7() QCOMPARE(QMailCodec::encodeModifiedUtf7(QString()), QString()); } +QTEST_MAIN(tst_QMailCodec) + +#include "tst_qmailcodec.moc" diff --git a/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp b/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp index a2641bc5..bb08d638 100644 --- a/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp +++ b/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp @@ -62,11 +62,6 @@ private: }; -QTEST_MAIN(tst_QMailDisconnected) - -#include "tst_qmaildisconnected.moc" - - void tst_QMailDisconnected::initTestCase() { // Instantiate the store to initialise the values of the status flags and create the standard folders @@ -424,4 +419,6 @@ void tst_QMailDisconnected::test_qmaildisconnected() //QMailDisconnected::clearPreviousFolder(dstKey); } +QTEST_MAIN(tst_QMailDisconnected) +#include "tst_qmaildisconnected.moc" diff --git a/tests/tst_qmailmessage/tst_qmailmessage.cpp b/tests/tst_qmailmessage/tst_qmailmessage.cpp index ed21106c..c2308c84 100644 --- a/tests/tst_qmailmessage/tst_qmailmessage.cpp +++ b/tests/tst_qmailmessage/tst_qmailmessage.cpp @@ -141,10 +141,6 @@ private slots: void readReceipt(); }; -QTEST_MAIN(tst_QMailMessage) - -#include "tst_qmailmessage.moc" - static void testHeader(const QString& name, void (QMailMessage::*setter)(const QString&), QString (QMailMessage::*getter)() const, bool expandEncodedWords = false) { QString value1("This is a string value"); @@ -1754,3 +1750,7 @@ void tst_QMailMessage::readReceipt() QMailMessageHeaderField::UnstructuredField).content(), QByteArray("manual-action/MDN-sent-manually; displayed")); } + +QTEST_MAIN(tst_QMailMessage) + +#include "tst_qmailmessage.moc" diff --git a/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp b/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp index 2a61ce19..05823728 100644 --- a/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp +++ b/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp @@ -89,19 +89,12 @@ private slots: void toFile(); }; -QTEST_MAIN(tst_QMailMessageBody) - -#include "tst_qmailmessagebody.moc" - static QByteArray encode(const QByteArray& input, QMailMessageBody::TransferEncoding encoding) { - if (encoding == QMailMessageBody::Base64) - { + if (encoding == QMailMessageBody::Base64) { QMailBase64Codec codec(QMailBase64Codec::Text); return codec.encode(input); - } - else if (encoding == QMailMessageBody::QuotedPrintable) - { + } else if (encoding == QMailMessageBody::QuotedPrintable) { QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2045); return codec.encode(input); } @@ -111,18 +104,13 @@ static QByteArray encode(const QByteArray& input, QMailMessageBody::TransferEnco static QByteArray encode(const QString& input, const QByteArray& charset, QMailMessageBody::TransferEncoding encoding) { - if (encoding == QMailMessageBody::Base64) - { + if (encoding == QMailMessageBody::Base64) { QMailBase64Codec codec(QMailBase64Codec::Text); return codec.encode(input, charset); - } - else if (encoding == QMailMessageBody::QuotedPrintable) - { + } else if (encoding == QMailMessageBody::QuotedPrintable) { QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2045); return codec.encode(input, charset); - } - else - { + } else { QMailPassThroughCodec codec; return codec.encode(input, charset); } @@ -537,8 +525,8 @@ void tst_QMailMessageBody::fromFile() QTemporaryFile file(QString("%1/%2").arg(QDir::tempPath()).arg(metaObject()->className())); QVERIFY( file.open() ); QString name = file.fileName(); - if ( !string_input.isEmpty() ) - { + + if (!string_input.isEmpty()) { { QTextStream out( &file ); out << string_input; @@ -553,9 +541,7 @@ void tst_QMailMessageBody::fromFile() QCOMPARE( body.contentType().type().toLower(), content_properties[0].toLatin1().toLower() ); QCOMPARE( body.contentType().subType().toLower(), content_properties[1].toLatin1().toLower() ); QCOMPARE( body.contentType().charset().toLower(), content_properties[2].toLatin1().toLower() ); - } - else - { + } else { { QDataStream out( &file ); out.writeRawData( bytearray_input.constData(), bytearray_input.length() ); @@ -682,27 +668,21 @@ void tst_QMailMessageBody::toFile() QMailMessageContentType contentType( type ); // Create a body from whatever data was supplied - if ( !string_input.isEmpty() ) - { + if (!string_input.isEmpty()) { QMailMessageBody body = QMailMessageBody::fromData( string_input, contentType, QMailMessageBody::Base64 ); body.toFile( name, format ); - } - else - { + } else { QMailMessageBody body = QMailMessageBody::fromData( bytearray_input, contentType, QMailMessageBody::Base64, QMailMessageBody::RequiresEncoding ); body.toFile( name, format ); } QVERIFY( file.open() ); - if ( !string_input.isEmpty() && format == QMailMessageBody::Decoded ) - { + if (!string_input.isEmpty() && format == QMailMessageBody::Decoded) { // Read the string from the file and compare QTextStream in( &file ); QString data = in.readAll(); QCOMPARE( data, string_input ); - } - else - { + } else { // Find the size of the file data QFileInfo fi( name ); QByteArray data( fi.size(), '\0' ); @@ -711,14 +691,14 @@ void tst_QMailMessageBody::toFile() QDataStream in( &file ); in.readRawData( data.data(), data.length() ); - if ( !bytearray_output.isEmpty() ) - { + if (!bytearray_output.isEmpty()) { QCOMPARE( data, bytearray_output ); - } - else - { + } else { QCOMPARE( data, bytearray_input ); } } } +QTEST_MAIN(tst_QMailMessageBody) + +#include "tst_qmailmessagebody.moc" diff --git a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp index cf1a0fca..18c29242 100644 --- a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp +++ b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp @@ -203,8 +203,6 @@ int main(int argc, char *argv[]) return 0; } -#include "tst_qmailmessageheader.moc" - Q_DECLARE_METATYPE(QMailMessageHeaderField::ParameterType) Q_DECLARE_METATYPE(QList<QMailMessageHeaderField::ParameterType>) Q_DECLARE_METATYPE(QMailMessageHeaderField::FieldType) @@ -1666,3 +1664,4 @@ void tst_QMailMessageContentDisposition::setSize() QCOMPARE( disposition2.toString(), QByteArray("Content-Disposition: attachment; filename=sample.txt; size=54321") ); } +#include "tst_qmailmessageheader.moc" diff --git a/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp b/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp index d76efd7e..74442f08 100644 --- a/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp +++ b/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp @@ -92,10 +92,6 @@ private slots: void testSerialization(); }; -QTEST_MAIN(tst_QMailMessagePart) -#include "tst_qmailmessagepart.moc" - - tst_QMailMessagePart::tst_QMailMessagePart() { setQMailMessageBoundaryString(BOUNDARY); @@ -491,3 +487,6 @@ void tst_QMailMessagePart::testBody() QCOMPARE(part.multipartType(), QMailMessagePart::MultipartNone); QCOMPARE(part.partCount(), static_cast<uint>(0)); } + +QTEST_MAIN(tst_QMailMessagePart) +#include "tst_qmailmessagepart.moc" diff --git a/tests/tst_qmailmessageset/tst_qmailmessageset.cpp b/tests/tst_qmailmessageset/tst_qmailmessageset.cpp index fe040695..ff0e029d 100644 --- a/tests/tst_qmailmessageset/tst_qmailmessageset.cpp +++ b/tests/tst_qmailmessageset/tst_qmailmessageset.cpp @@ -69,10 +69,6 @@ private: }; -QTEST_MAIN(tst_QMailMessageSet) - -#include "tst_qmailmessageset.moc" - void tst_QMailMessageSet::initTestCase() { // Instantiate the store to initialise the values of the status flags and create the standard folders @@ -512,3 +508,7 @@ void tst_QMailMessageSet::test_messagesetcontainer() model.removeDescendants(); QCOMPARE(model.count(), 0); } + +QTEST_MAIN(tst_QMailMessageSet) + +#include "tst_qmailmessageset.moc" diff --git a/tests/tst_qmailnamespace/tst_qmailnamespace.cpp b/tests/tst_qmailnamespace/tst_qmailnamespace.cpp index c3062f6b..a43a12fa 100644 --- a/tests/tst_qmailnamespace/tst_qmailnamespace.cpp +++ b/tests/tst_qmailnamespace/tst_qmailnamespace.cpp @@ -49,12 +49,12 @@ private slots: void test_qmailnamespace(); }; -QTEST_MAIN(tst_QMailnamespace) - -#include "tst_qmailnamespace.moc" - void tst_QMailnamespace::test_qmailnamespace() { messageServerPath(); messageSettingsPath(); } + +QTEST_MAIN(tst_QMailnamespace) + +#include "tst_qmailnamespace.moc" diff --git a/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp b/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp index a0ae627b..bed5dafc 100644 --- a/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp +++ b/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp @@ -67,10 +67,6 @@ private: QSet<QMailMessageId> noMessages, allMessages, allEmailMessages; }; -QTEST_MAIN(tst_QMailServiceAction) - -#include "tst_qmailserviceaction.moc" - void tst_QMailServiceAction::initTestCase() { // Instantiate the store to initialise the values of the status flags and create the standard folders @@ -459,3 +455,7 @@ void tst_QMailServiceAction::test_searchaction() // action.searchMessages(QMailMessageKey::customField("present"), QString(), QMailSearchAction::Local); // QCOMPARE(match.count(), 1); } + +QTEST_MAIN(tst_QMailServiceAction) + +#include "tst_qmailserviceaction.moc" diff --git a/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp b/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp index 513eddce..e90402e2 100644 --- a/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp +++ b/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp @@ -73,10 +73,6 @@ private: QSet<QMailMessageId> noMessages, allMessages, allEmailMessages; }; -QTEST_MAIN(tst_QMailStorageAction) - -#include "tst_qmailstorageaction.moc" - void tst_QMailStorageAction::initTestCase() { QVERIFY2(QMail::isMessageServerRunning(), "tst_QMailStorageAction requires messageserver to be running"); @@ -873,3 +869,7 @@ void tst_QMailStorageAction::test_storageaction_discardMessages() QVERIFY(QMailStore::instance()->countMessages(savedMessage4Key) == 0); } + +QTEST_MAIN(tst_QMailStorageAction) + +#include "tst_qmailstorageaction.moc" diff --git a/tests/tst_qmailstore/tst_qmailstore.cpp b/tests/tst_qmailstore/tst_qmailstore.cpp index 279fc1bd..8d552ba7 100644 --- a/tests/tst_qmailstore/tst_qmailstore.cpp +++ b/tests/tst_qmailstore/tst_qmailstore.cpp @@ -80,10 +80,6 @@ private slots: void implementationbase(); }; -QTEST_MAIN(tst_QMailStore) - -#include "tst_qmailstore.moc" - #define CRLF "\015\012" tst_QMailStore::tst_QMailStore() @@ -1568,8 +1564,7 @@ void tst_QMailStore::remove1000Messages() static const int largeMessageCount = 10; - for (int i = 0; i < largeMessageCount; ++i) - { + for (int i = 0; i < largeMessageCount; ++i) { QMailMessage message1; message1.setServerUid(QString("%1|Just some message").arg(i)); message1.setParentAccountId(account.id()); @@ -1593,8 +1588,7 @@ void tst_QMailStore::remove1000Messages() //with message removal record - for (int i = 0; i < largeMessageCount; ++i) - { + for (int i = 0; i < largeMessageCount; ++i) { QMailMessage message1; message1.setServerUid(QString("Just some message$%1").arg(i)); message1.setParentAccountId(account.id()); @@ -1827,5 +1821,8 @@ void tst_QMailStore::implementationbase() impl.setRetrievalInProgress(QMailAccountIdList()<<account1.id()); impl.notifyRetrievalInProgress(QMailAccountIdList()<<account1.id()); - } + +QTEST_MAIN(tst_QMailStore) + +#include "tst_qmailstore.moc" diff --git a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp index af11b9f8..68eeae44 100644 --- a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp +++ b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp @@ -137,10 +137,6 @@ private: QSet<QMailMessageId> noMessages, allMessages, allEmailMessages; }; -QTEST_MAIN(tst_QMailStoreKeys) - -#include "tst_qmailstorekeys.moc" - tst_QMailStoreKeys::tst_QMailStoreKeys() { } @@ -2473,3 +2469,7 @@ void tst_QMailStoreKeys::threadedModel() QCOMPARE(model.idFromIndex(model.index(1, 0)), inboxMessage1); QCOMPARE(model.idFromIndex(model.index(0, 0, model.indexFromId(inboxMessage1))), inboxMessage2); } + +QTEST_MAIN(tst_QMailStoreKeys) + +#include "tst_qmailstorekeys.moc" diff --git a/tests/tst_qmailthread/tst_qmailthread.cpp b/tests/tst_qmailthread/tst_qmailthread.cpp index 936f9c85..504257e0 100644 --- a/tests/tst_qmailthread/tst_qmailthread.cpp +++ b/tests/tst_qmailthread/tst_qmailthread.cpp @@ -75,19 +75,14 @@ private: QSet<QMailMessageId> noMessages, allMessages, allEmailMessages; }; -QTEST_MAIN(tst_qmailthread) -#include "tst_qmailthread.moc" - #define CRLF "\015\012" tst_qmailthread::tst_qmailthread() { - } tst_qmailthread::~tst_qmailthread() { - } void tst_qmailthread::initTestCase() @@ -691,3 +686,5 @@ void tst_qmailthread::test_threadKeys() QCOMPARE(skey1, skey4); } +QTEST_MAIN(tst_qmailthread) +#include "tst_qmailthread.moc" diff --git a/tests/tst_qmflist/tst_qmflist.cpp b/tests/tst_qmflist/tst_qmflist.cpp index 85401c7f..30f37c4f 100644 --- a/tests/tst_qmflist/tst_qmflist.cpp +++ b/tests/tst_qmflist/tst_qmflist.cpp @@ -73,9 +73,6 @@ private slots: void fromQList(); }; -QTEST_MAIN(tst_QmfList) -#include "tst_qmflist.moc" - tst_QmfList::tst_QmfList() { } @@ -295,3 +292,5 @@ void tst_QmfList::fromQList() QCOMPARE(QmfList<int>::fromQList(qlist), qmflist); } +QTEST_MAIN(tst_QmfList) +#include "tst_qmflist.moc" diff --git a/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp b/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp index 4a96d78f..5d48cd22 100644 --- a/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp +++ b/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp @@ -221,11 +221,6 @@ private slots: void basicTest(); }; -QTEST_MAIN(tst_QPrivateImplementation) - -#include "tst_qprivateimplementation.moc" - - tst_QPrivateImplementation::tst_QPrivateImplementation() { } @@ -289,3 +284,6 @@ void tst_QPrivateImplementation::basicTest() QCOMPARE(b1.toString(), marge + ':' + evergreen); } +QTEST_MAIN(tst_QPrivateImplementation) + +#include "tst_qprivateimplementation.moc" diff --git a/tests/tst_smtp/tst_smtp.cpp b/tests/tst_smtp/tst_smtp.cpp index 8dcfbe3a..99d534af 100644 --- a/tests/tst_smtp/tst_smtp.cpp +++ b/tests/tst_smtp/tst_smtp.cpp @@ -57,10 +57,6 @@ private: SmtpClient *mClient = nullptr; }; -QTEST_MAIN(tst_SmtpClient) - -#include "tst_smtp.moc" - void tst_SmtpClient::initTestCase() { QMailAccount account; @@ -134,3 +130,7 @@ void tst_SmtpClient::test_auth() QCOMPARE(updateStatus.takeFirst().first(), QString::fromLatin1("Connected")); QCOMPARE(updateStatus.takeFirst().first(), QString::fromLatin1("Connected")); } + +QTEST_MAIN(tst_SmtpClient) + +#include "tst_smtp.moc" diff --git a/tests/tst_storagemanager/tst_storagemanager.cpp b/tests/tst_storagemanager/tst_storagemanager.cpp index 6247f02a..8724db84 100644 --- a/tests/tst_storagemanager/tst_storagemanager.cpp +++ b/tests/tst_storagemanager/tst_storagemanager.cpp @@ -64,9 +64,6 @@ private: }; -QTEST_MAIN(tst_StorageManager) -#include "tst_storagemanager.moc" - #define CRLF "\015\012" QMailAccountConfiguration tst_StorageManager::makeConfig(const QString &accountName) @@ -259,6 +256,7 @@ void tst_StorageManager::test_remove() void tst_StorageManager::test_update() { - } +QTEST_MAIN(tst_StorageManager) +#include "tst_storagemanager.moc" |
