diff options
Diffstat (limited to 'src/libraries')
24 files changed, 122 insertions, 122 deletions
diff --git a/src/libraries/qmfclient/longstring.cpp b/src/libraries/qmfclient/longstring.cpp index 5c43b0c5..a206660b 100644 --- a/src/libraries/qmfclient/longstring.cpp +++ b/src/libraries/qmfclient/longstring.cpp @@ -285,7 +285,7 @@ void LongStringFileMapping::map() const fileMapping.mapping = reinterpret_cast<char*>(fileMapping.file->map(0, fileMapping.size)); fileMapping.file->close(); - if(!fileMapping.mapping) { + if (!fileMapping.mapping) { qWarning() << "Unable to map file:" << filename; } } else { @@ -484,7 +484,7 @@ const QByteArray LongStringPrivate::toQByteArray() const if (mapping) { // Does not copy: const QByteArray input = mapping->toQByteArray(); - if(!input.isEmpty()) { + if (!input.isEmpty()) { return QByteArray::fromRawData(input.constData() + offset, len); } } diff --git a/src/libraries/qmfclient/qmailaccount.cpp b/src/libraries/qmfclient/qmailaccount.cpp index d618ba09..ed62aa28 100644 --- a/src/libraries/qmfclient/qmailaccount.cpp +++ b/src/libraries/qmfclient/qmailaccount.cpp @@ -407,7 +407,7 @@ QMailAccount::QMailAccount(const QMailAccount& other) QMailAccount& QMailAccount::operator=(const QMailAccount& other) { - if(&other != this) + if (&other != this) d = other.d; return *this; } diff --git a/src/libraries/qmfclient/qmailaccountlistmodel.cpp b/src/libraries/qmfclient/qmailaccountlistmodel.cpp index ff27e417..8efc0990 100644 --- a/src/libraries/qmfclient/qmailaccountlistmodel.cpp +++ b/src/libraries/qmfclient/qmailaccountlistmodel.cpp @@ -67,7 +67,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; @@ -249,7 +249,7 @@ QVariant QMailAccountListModel::data(const QModelIndex& index, int role) const QMailAccount account(id); - switch(role) { + switch (role) { case Qt::DisplayRole: case NameTextRole: return account.name(); @@ -469,7 +469,7 @@ void QMailAccountListModel::accountsRemoved(const QMailAccountIdList& ids) for (const QMailAccountId &id : ids) { int index = d->indexOf(id); - if(index == -1) + if (index == -1) continue; d->deletionId = id; diff --git a/src/libraries/qmfclient/qmailcodec.cpp b/src/libraries/qmfclient/qmailcodec.cpp index 2ee0d672..3811f259 100644 --- a/src/libraries/qmfclient/qmailcodec.cpp +++ b/src/libraries/qmfclient/qmailcodec.cpp @@ -241,7 +241,7 @@ QByteArray QMailCodec::bestCompatibleCharset(const QByteArray& charset, bool tra if (translateAscii && (encoding.contains("ascii") || (encoding.contains("unicode-1-1-utf-7")))) { // We'll assume the text is plain ASCII, to be extracted to Latin-1 encoding = "ISO-8859-1"; - } else if(encoding.contains("ks_c_5601")) { + } else if (encoding.contains("ks_c_5601")) { encoding = "EUC-KR"; } else if (encoding == "gb2312" || encoding == "gbk") { // gb18030 is a superset of gb2312 and gbk, prefer it diff --git a/src/libraries/qmfclient/qmailcontentmanager.cpp b/src/libraries/qmfclient/qmailcontentmanager.cpp index 055c8215..2e95e0ab 100644 --- a/src/libraries/qmfclient/qmailcontentmanager.cpp +++ b/src/libraries/qmfclient/qmailcontentmanager.cpp @@ -52,7 +52,7 @@ ContentPluginMap init(QMailPluginManager& manager) map.insert(iface->key(), iface->create()); } - if(map.isEmpty()) { + if (map.isEmpty()) { qMailLog(Messaging) << "No content manager plugins found. Message content will not be available."; } diff --git a/src/libraries/qmfclient/qmaildisconnected.cpp b/src/libraries/qmfclient/qmaildisconnected.cpp index 9ea441e9..4715b670 100644 --- a/src/libraries/qmfclient/qmaildisconnected.cpp +++ b/src/libraries/qmfclient/qmaildisconnected.cpp @@ -189,7 +189,7 @@ static void syncStatusWithFolder(QMailMessageMetaData& message) QMailAccount messageAccount(message.parentAccountId()); - for( QMap<QMailFolder::StandardFolder, QMailFolderId>::const_iterator it(messageAccount.standardFolders().begin()) + for ( QMap<QMailFolder::StandardFolder, QMailFolderId>::const_iterator it(messageAccount.standardFolders().begin()) ; it != messageAccount.standardFolders().end() ; it++) { if (message.parentFolderId() == it.value()) { @@ -279,7 +279,7 @@ void QMailDisconnected::rollBackUpdates(const QMailAccountId &mailAccountId) QMailMessageIdList movedIds = QMailStore::instance()->queryMessages(movedKey); // remove copies - if(!copiedIds.isEmpty()) { + if (!copiedIds.isEmpty()) { if (!QMailStore::instance()->removeMessages(QMailMessageKey::id(copiedIds))) { qWarning() << "Unable to rollback disconnected copies for account:" << mailAccountId; return; diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp index 1c89f1aa..ed2edbe8 100644 --- a/src/libraries/qmfclient/qmailmessage.cpp +++ b/src/libraries/qmfclient/qmailmessage.cpp @@ -265,7 +265,7 @@ static QMailMessageBody::TransferEncoding encodingForName(const QByteArray& name static const char* nameForEncoding(QMailMessageBody::TransferEncoding te) { - switch( te ) + switch ( te ) { case QMailMessageBody::SevenBit: return "7bit"; @@ -286,7 +286,7 @@ static const char* nameForEncoding(QMailMessageBody::TransferEncoding te) static QMailCodec* codecForEncoding(QMailMessageBody::TransferEncoding te, bool textualData) { - switch( te ) + switch ( te ) { case QMailMessageBody::NoEncoding: case QMailMessageBody::Binary: diff --git a/src/libraries/qmfclient/qmailmessagemodelbase.cpp b/src/libraries/qmfclient/qmailmessagemodelbase.cpp index c67a9abd..072cf20c 100644 --- a/src/libraries/qmfclient/qmailmessagemodelbase.cpp +++ b/src/libraries/qmfclient/qmailmessagemodelbase.cpp @@ -182,7 +182,7 @@ QVariant QMailMessageModelBase::data(const QModelIndex& index, int role) const return QVariant(); // Some items can be processed without loading the message data - switch(role) + switch (role) { case MessageIdRole: return id; @@ -205,7 +205,7 @@ QVariant QMailMessageModelBase::data(const QMailMessageMetaData &message, int ro //bool incoming(message.status() & QMailMessage::Incoming); bool incoming = !sent; - switch(role) + switch (role) { case Qt::DisplayRole: case MessageAddressTextRole: diff --git a/src/libraries/qmfclient/qmailmessageremovalrecord.cpp b/src/libraries/qmfclient/qmailmessageremovalrecord.cpp index cff2c995..220fc0f3 100644 --- a/src/libraries/qmfclient/qmailmessageremovalrecord.cpp +++ b/src/libraries/qmfclient/qmailmessageremovalrecord.cpp @@ -109,7 +109,7 @@ QMailMessageRemovalRecord::~QMailMessageRemovalRecord() /*! \internal */ QMailMessageRemovalRecord& QMailMessageRemovalRecord::operator=(const QMailMessageRemovalRecord& other) { - if(&other != this) + if (&other != this) d = other.d; return *this; } diff --git a/src/libraries/qmfclient/qmailstore.cpp b/src/libraries/qmfclient/qmailstore.cpp index 7ee6ec05..26716ce6 100644 --- a/src/libraries/qmfclient/qmailstore.cpp +++ b/src/libraries/qmfclient/qmailstore.cpp @@ -1480,7 +1480,7 @@ QMailMessageMetaDataList QMailStore::dataList(const QList<QMailMessage*>& messag foreach (QMailMessage* message, messages) { Q_ASSERT (message); - if(ids.contains(message->id())) { + if (ids.contains(message->id())) { data.append(dataToTransfer(message)); } } @@ -1495,7 +1495,7 @@ QMailMessageMetaDataList QMailStore::dataList(const QList<QMailMessageMetaData*> foreach (QMailMessageMetaData* message, messages) { Q_ASSERT (message); - if(ids.contains(message->id())) { + if (ids.contains(message->id())) { data.append(dataToTransfer(message)); } } diff --git a/src/libraries/qmfclient/qmailstore_p.cpp b/src/libraries/qmfclient/qmailstore_p.cpp index 34b4a4af..a8360941 100644 --- a/src/libraries/qmfclient/qmailstore_p.cpp +++ b/src/libraries/qmfclient/qmailstore_p.cpp @@ -1010,7 +1010,7 @@ void QMailStorePrivate::messagesRemotelyChanged(QMailStore::ChangeType changeTyp void QMailStorePrivate::messageMetaDataRemotelyChanged(QMailStore::ChangeType changeType, const QMailMessageMetaDataList &data) { - if(!data.isEmpty()) { + if (!data.isEmpty()) { QMailMessageIdList ids; @@ -1045,7 +1045,7 @@ void QMailStorePrivate::messagePropertiesRemotelyChanged(const QMailMessageIdLis foreach(const QMailMessageId& id, ids) { - if(messageCache.contains(id)) { + if (messageCache.contains(id)) { QMailMessageMetaData metaData = messageCache.lookup(id); if ((properties & QMailMessageKey::Custom)) { metaData.setCustomFields(data.customFields()); @@ -1152,7 +1152,7 @@ void QMailStorePrivate::messageStatusRemotelyChanged(const QMailMessageIdList& i foreach(const QMailMessageId& id, ids) { - if(messageCache.contains(id)) { + if (messageCache.contains(id)) { QMailMessageMetaData metaData = messageCache.lookup(id); metaData.setStatus(status, set); metaData.setUnmodified(); diff --git a/src/libraries/qmfclient/qmailstoresql_p.cpp b/src/libraries/qmfclient/qmailstoresql_p.cpp index 7fe84041..e7707736 100644 --- a/src/libraries/qmfclient/qmailstoresql_p.cpp +++ b/src/libraries/qmfclient/qmailstoresql_p.cpp @@ -1875,7 +1875,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>()) { @@ -1942,7 +1942,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) { @@ -1964,7 +1964,7 @@ QString whereClauseItem<QMailMessageKey>(const QMailMessageKey &key, const QMail case QMailMessageKey::ParentFolderId: case QMailMessageKey::PreviousParentFolderId: case QMailMessageKey::RestoreFolderId: - if(a.valueList.first().canConvert<QMailFolderKey>()) { + if (a.valueList.first().canConvert<QMailFolderKey>()) { QMailFolderKey parentFolderKey = a.valueList.first().value<QMailFolderKey>(); QString nestedAlias(incrementAlias(alias)); @@ -2006,7 +2006,7 @@ QString whereClauseItem<QMailMessageKey>(const QMailMessageKey &key, const QMail break; case QMailMessageKey::ParentAccountId: - if(a.valueList.first().canConvert<QMailAccountKey>()) { + if (a.valueList.first().canConvert<QMailAccountKey>()) { QMailAccountKey parentAccountKey = a.valueList.first().value<QMailAccountKey>(); if (store.hasAccountTables()) { QString nestedAlias(incrementAlias(alias)); @@ -2130,7 +2130,7 @@ QString whereClauseItem<QMailFolderKey>(const QMailFolderKey &key, const QMailFo break; case QMailFolderKey::ParentFolderId: - if(a.valueList.first().canConvert<QMailFolderKey>()) { + if (a.valueList.first().canConvert<QMailFolderKey>()) { QMailFolderKey folderSubKey = a.valueList.first().value<QMailFolderKey>(); QString nestedAlias(incrementAlias(alias)); @@ -2160,7 +2160,7 @@ QString whereClauseItem<QMailFolderKey>(const QMailFolderKey &key, const QMailFo break; case QMailFolderKey::ParentAccountId: - if(a.valueList.first().canConvert<QMailAccountKey>()) { + if (a.valueList.first().canConvert<QMailAccountKey>()) { QMailAccountKey accountSubKey = a.valueList.first().value<QMailAccountKey>(); if (store.hasAccountTables()) { QString nestedAlias(incrementAlias(alias)); @@ -2243,7 +2243,7 @@ QString whereClauseItem<QMailThreadKey>(const QMailThreadKey &, const QMailThrea break; case QMailThreadKey::Includes: - if(a.valueList.first().canConvert<QMailMessageKey>()) { + if (a.valueList.first().canConvert<QMailMessageKey>()) { QMailMessageKey messageSubKey = a.valueList.first().value<QMailMessageKey>(); QString nestedAlias(incrementAlias(alias)); @@ -3200,14 +3200,14 @@ bool QMailStoreSql::idValueExists(quint64 id, const QString& table) { QSqlQuery query(*database()); QString sql = QLatin1String("SELECT id FROM ") + table + QLatin1String(" WHERE id=?"); - if(!query.prepare(sql)) { + if (!query.prepare(sql)) { setQueryError(query.lastError(), QLatin1String("Failed to prepare idExists query"), queryText(query)); return false; } query.addBindValue(id); - if(!query.exec()) { + if (!query.exec()) { setQueryError(query.lastError(), QLatin1String("Failed to execute idExists query"), queryText(query)); return false; } @@ -3234,13 +3234,13 @@ bool QMailStoreSql::messageExists(const QString &serveruid, const QMailAccountId { QSqlQuery query(*database()); QString sql = QLatin1String("SELECT id FROM mailmessages WHERE serveruid=? AND parentaccountid=?"); - if(!query.prepare(sql)) { + if (!query.prepare(sql)) { setQueryError(query.lastError(), QLatin1String("Failed to prepare messageExists query")); } query.addBindValue(serveruid); query.addBindValue(id.toULongLong()); - if(!query.exec()) { + if (!query.exec()) { setQueryError(query.lastError(), QLatin1String("Failed to execute messageExists")); } @@ -4451,7 +4451,7 @@ bool QMailStoreSql::performMaintenance() QString QMailStoreSql::parseSql(QTextStream& ts) { QString qry; - while(!ts.atEnd()) + while (!ts.atEnd()) { QString line = ts.readLine(); // comment, remove. @@ -4598,7 +4598,7 @@ bool QMailStoreSql::addMessages(const QList<QMailMessage *> &messages, return false; } - if(!message->contentScheme().isEmpty()) + if (!message->contentScheme().isEmpty()) contentSchemes.insert(message->contentScheme()); } @@ -5884,7 +5884,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptAddMessage(QMailMessageMetaDa return Failure; } - if(!metaData->serverUid().isEmpty() && metaData->parentAccountId().isValid() + if (!metaData->serverUid().isEmpty() && metaData->parentAccountId().isValid() && messageExists(metaData->serverUid(), metaData->parentAccountId())) { qWarning() << "Message with serveruid: " << metaData->serverUid() << "and accountid:" << metaData->parentAccountId() @@ -6408,7 +6408,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::attemptUpdateFolder(QMailFolder *fol Transaction &t, bool commitOnSuccess) { //check that the parent folder actually exists - if(!checkPreconditions(*folder, true)) + if (!checkPreconditions(*folder, true)) return Failure; QMailFolderId parentFolderId; @@ -8132,7 +8132,7 @@ QMailStoreSql::AttemptResult QMailStoreSql::messagePredecessor(QMailMessageMetaD if (referencedMessages.isEmpty()) { // All the references are missing *missingReferences = references; - if(findPotentialPredecessorsBySubject(metaData, baseSubject, missingAncestor, potentialPredecessors) == DatabaseFailure) + if (findPotentialPredecessorsBySubject(metaData, baseSubject, missingAncestor, potentialPredecessors) == DatabaseFailure) return DatabaseFailure; } else { for (int i = references.count() - 1; i >= 0; --i) { @@ -8568,9 +8568,9 @@ 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 (!update) { - if(folder.id().isValid()) + if (folder.id().isValid()) { qWarning() << "Folder exists, use update instead of add."; return false; @@ -8578,20 +8578,20 @@ bool QMailStoreSql::checkPreconditions(const QMailFolder& folder, bool update) } else { - if(!folder.id().isValid()) + if (!folder.id().isValid()) { qWarning() << "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()) { qWarning() << "A folder cannot be a child to itself"; return false; } } - if(folder.parentFolderId().isValid()) + if (folder.parentFolderId().isValid()) { if (!idExists(folder.parentFolderId())) { @@ -8600,7 +8600,7 @@ bool QMailStoreSql::checkPreconditions(const QMailFolder& folder, bool update) } } - if(folder.parentAccountId().isValid()) + if (folder.parentAccountId().isValid()) { if ((withAccountTables ? !idExists(folder.parentAccountId()) diff --git a/src/libraries/qmfclient/qmailthreadlistmodel.cpp b/src/libraries/qmfclient/qmailthreadlistmodel.cpp index 9d205771..5c7993da 100644 --- a/src/libraries/qmfclient/qmailthreadlistmodel.cpp +++ b/src/libraries/qmfclient/qmailthreadlistmodel.cpp @@ -65,7 +65,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; @@ -241,7 +241,7 @@ int QMailThreadListModel::rowCount(const QModelIndex& index) const QVariant QMailThreadListModel::data(const QModelIndex& index, int role) const { - if(!index.isValid()) + if (!index.isValid()) return QVariant(); int offset = index.row(); @@ -251,7 +251,7 @@ QVariant QMailThreadListModel::data(const QModelIndex& index, int role) const QMailThread thread(id); - switch(role) + switch (role) { case Qt::DisplayRole: return thread.subject(); @@ -333,29 +333,29 @@ void QMailThreadListModel::setSortKey(const QMailThreadSortKey& sortKey) void QMailThreadListModel::threadsAdded(const QMailThreadIdList& ids) { d->needSynchronize = true; - if(!d->synchronizeEnabled) + if (!d->synchronizeEnabled) return; //TODO change this code to use our own searching and insertion routines //for more control //use id sorted indexes - if(!d->init) + if (!d->init) d->initialize(); QMailThreadKey passKey = d->key & QMailThreadKey::id(ids); QMailThreadIdList results = QMailStore::instance()->queryThreads(passKey); - if(results.isEmpty()) + if (results.isEmpty()) return; - if(!d->sortKey.isEmpty()) + 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 { @@ -385,14 +385,14 @@ void QMailThreadListModel::threadsAdded(const QMailThreadIdList& ids) void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) { d->needSynchronize = true; - if(!d->synchronizeEnabled) + if (!d->synchronizeEnabled) return; //TODO change this code to use our own searching and insertion routines //for more control //use id sorted indexes - if(!d->init) + if (!d->init) d->initialize(); QMailThreadKey idKey(QMailThreadKey::id(ids)); @@ -400,7 +400,7 @@ 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) @@ -423,9 +423,9 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) foreach(const QMailThreadId &id, validIds) { int index = d->idList.indexOf(id); - if(index == -1) //insert + if (index == -1) //insert { - if(lessThan.invalidatedList()) + if (lessThan.invalidatedList()) fullRefresh(); else { @@ -439,14 +439,14 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) } else //update { - if(lessThan.invalidatedList()) + if (lessThan.invalidatedList()) fullRefresh(); 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); @@ -478,16 +478,16 @@ void QMailThreadListModel::threadsUpdated(const QMailThreadIdList& ids) void QMailThreadListModel::threadsRemoved(const QMailThreadIdList& ids) { d->needSynchronize = true; - if(!d->synchronizeEnabled) + if (!d->synchronizeEnabled) return; - if(!d->init) + if (!d->init) d->initialize(); foreach(const QMailThreadId &id, ids) { int index = d->indexOf(id); - if(index == -1) + if (index == -1) continue; d->deletionId = id; @@ -506,7 +506,7 @@ void QMailThreadListModel::threadsRemoved(const QMailThreadIdList& ids) QMailThreadId QMailThreadListModel::idFromIndex(const QModelIndex& index) const { - if(!index.isValid()) + if (!index.isValid()) return QMailThreadId(); return d->ids().at(index.row()); @@ -521,7 +521,7 @@ QModelIndex QMailThreadListModel::indexFromId(const QMailThreadId& id) const { //if the id does not exist return null int index = d->indexOf(id); - if(index != -1) { + if (index != -1) { return createIndex(index,0); } @@ -551,7 +551,7 @@ bool QMailThreadListModel::synchronizeEnabled() const void QMailThreadListModel::setSynchronizeEnabled(bool val) { d->synchronizeEnabled = val; - if(val && d->needSynchronize) + if (val && d->needSynchronize) fullRefresh(); } diff --git a/src/libraries/qmfclient/support/qcharsetdetector.cpp b/src/libraries/qmfclient/support/qcharsetdetector.cpp index 13bc2d2e..96baaddc 100644 --- a/src/libraries/qmfclient/support/qcharsetdetector.cpp +++ b/src/libraries/qmfclient/support/qcharsetdetector.cpp @@ -113,9 +113,9 @@ QCharsetMatch &QCharsetMatch::operator=(const QCharsetMatch &other) bool QCharsetMatch::operator<(const QCharsetMatch &other) const { - if(this->confidence() < other.confidence()) + if (this->confidence() < other.confidence()) return true; - else if(this->confidence() == other.confidence() + else if (this->confidence() == other.confidence() && this->language().isEmpty() && !other.language().isEmpty()) return true; @@ -125,7 +125,7 @@ bool QCharsetMatch::operator<(const QCharsetMatch &other) const bool QCharsetMatch::operator>(const QCharsetMatch &other) const { - if(this->confidence() > other.confidence()) + if (this->confidence() > other.confidence()) return true; else if (this->confidence() == other.confidence() && !this->language().isEmpty() @@ -177,7 +177,7 @@ QCharsetDetectorPrivate::QCharsetDetectorPrivate() q_ptr(0) { _uCharsetDetector = ucsdet_open(&_status); - if(hasError()) + if (hasError()) qWarning() << __PRETTY_FUNCTION__ << errorString(); } @@ -188,7 +188,7 @@ QCharsetDetectorPrivate::~QCharsetDetectorPrivate() bool QCharsetDetectorPrivate::hasError() const { - if(U_SUCCESS(_status)) + if (U_SUCCESS(_status)) return false; else return true; @@ -276,7 +276,7 @@ void QCharsetDetector::setText(const QByteArray &ba) d->_baExtended.append(char(0)); ucsdet_setText(d->_uCharsetDetector, d->_baExtended.constData(), int32_t(-1), &(d->_status)); - if(hasError()) + if (hasError()) qWarning() << __PRETTY_FUNCTION__ << errorString(); } @@ -291,14 +291,14 @@ QCharsetMatch QCharsetDetector::detect() // differ from the single match returned by ucsdet_detect(). Q_D(QCharsetDetector); QList<QCharsetMatch> qCharsetMatchList = detectAll(); - if(hasError()) { + if (hasError()) { qWarning() << __PRETTY_FUNCTION__ << errorString(); return QCharsetMatch(); } if (qCharsetMatchList.isEmpty()) { // should never happen, because detectAll() already sets an // error if no matches are found which the previous - // if(hasError()) should detect. + // if (hasError()) should detect. d->_status = U_CE_NOT_FOUND_ERROR; qWarning() << __PRETTY_FUNCTION__ << "no matches found at all" << errorString(); @@ -315,7 +315,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() qint32 matchesFound; const UCharsetMatch **uCharsetMatch = ucsdet_detectAll(d->_uCharsetDetector, &matchesFound, &(d->_status)); - if(hasError()) { + if (hasError()) { qWarning() << __PRETTY_FUNCTION__ << errorString(); return QList<QCharsetMatch>(); } @@ -331,25 +331,25 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() QCharsetMatch qCharsetMatch; qCharsetMatch.setName( QString::fromLatin1(ucsdet_getName(uCharsetMatch[i], &(d->_status)))); - if(hasError()) { + if (hasError()) { qWarning() << __PRETTY_FUNCTION__ << errorString(); return QList<QCharsetMatch>(); } qCharsetMatch.setConfidence( static_cast<qint32>(ucsdet_getConfidence (uCharsetMatch[i], &(d->_status)))); - if(hasError()) { + if (hasError()) { qWarning() << __PRETTY_FUNCTION__ << errorString(); return QList<QCharsetMatch>(); } qCharsetMatch.setLanguage( QString::fromLatin1(ucsdet_getLanguage(uCharsetMatch[i], &(d->_status)))); - if(hasError()) { + if (hasError()) { qWarning() << __PRETTY_FUNCTION__ << errorString(); return QList<QCharsetMatch>(); } qCharsetMatchList << qCharsetMatch; } - if(d->_allDetectableCharsets.isEmpty()) + if (d->_allDetectableCharsets.isEmpty()) getAllDetectableCharsets(); // libicu sometimes does not detect single byte encodings at all // even if they can encode the input without error. This seems to @@ -368,7 +368,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() // the list of matches with the confidence value of 10. If it // cannot encode the complete input, the iteration over the list // of matches will detect that and remove it again. - if(!d->_declaredEncoding.isEmpty() + if (!d->_declaredEncoding.isEmpty() && (d->_declaredEncoding.startsWith(QLatin1String("ISO-8859-")) || d->_declaredEncoding.startsWith(QLatin1String("windows-12")) || d->_declaredEncoding.startsWith(QLatin1String("KOI8")))) @@ -383,18 +383,18 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() // encodings I could find no case where the matches returned by // libicu did omit a multibyte encoding when it should have been // included. - if(!d->_declaredLocale.isEmpty()) { + if (!d->_declaredLocale.isEmpty()) { QString language = d->_declaredLocale.left(2); - if(language == QLatin1String("ru")) { + if (language == QLatin1String("ru")) { qCharsetMatchList << QCharsetMatch(QLatin1String("KOI8-R"), language, 10); qCharsetMatchList << QCharsetMatch(QLatin1String("windows-1251"), language, 10); qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-5"), language, 10); } - else if(language == QLatin1String("tr")) + else if (language == QLatin1String("tr")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-9"), language, 10); - else if(language == QLatin1String("el")) + else if (language == QLatin1String("el")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-7"), language, 10); - else if(language == QLatin1String("en") + else if (language == QLatin1String("en") || language == QLatin1String("da") || language == QLatin1String("de") || language == QLatin1String("es") @@ -408,16 +408,16 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() || language == QLatin1String("pt") || language == QLatin1String("sv")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-1"), language, 10); - else if(language == QLatin1String("cs") + else if (language == QLatin1String("cs") || language == QLatin1String("hu") || language == QLatin1String("pl") || language == QLatin1String("ro")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-1"), language, 10); - else if(language == QLatin1String("ar") + else if (language == QLatin1String("ar") || language == QLatin1String("fa") || language == QLatin1String("ur")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-6"), language, 10); - else if(language == QLatin1String("he")) + else if (language == QLatin1String("he")) qCharsetMatchList << QCharsetMatch(QLatin1String("ISO-8859-8"), language, 10); } // iterate over the detected matches and do some fine tuning: @@ -426,19 +426,19 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() qint32 iso88595Confidence = 0; qint32 windows1251Confidence = 0; QList<QCharsetMatch>::iterator it = qCharsetMatchList.begin(); - while(it != qCharsetMatchList.end()) { - if((*it).name() == QLatin1String("KOI8-R")) + while (it != qCharsetMatchList.end()) { + if ((*it).name() == QLatin1String("KOI8-R")) koi8rConfidence += (*it).confidence(); - if((*it).name() == QLatin1String("ISO-8859-5")) + if ((*it).name() == QLatin1String("ISO-8859-5")) iso88595Confidence += (*it).confidence(); - if((*it).name() == QLatin1String("windows-1251")) + if ((*it).name() == QLatin1String("windows-1251")) windows1251Confidence += (*it).confidence(); - if((*it).name() == QLatin1String("ISO-2022-JP")) { + if ((*it).name() == QLatin1String("ISO-2022-JP")) { // non-Japanese text in ISO-2022-JP encoding is possible // but very unlikely: (*it).setLanguage(QLatin1String("ja")); } - if((*it).name() == QLatin1String("UTF-8") + if ((*it).name() == QLatin1String("UTF-8") && (*it).confidence() >= 80 && (*it).confidence() < 99) { // Actually libicu currently only returns confidence // values of 100, 80, 25, and 10 for UTF-8. A value of 80 @@ -462,7 +462,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() (*it).setConfidence(99); sortNeeded = true; } - if(!d->_declaredEncoding.isEmpty() + if (!d->_declaredEncoding.isEmpty() && (*it).name() == d->_declaredEncoding && (*it).confidence() == 10) { // A confidence value of 10 means the charset can @@ -478,7 +478,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() (*it).setConfidence(40); sortNeeded = true; } - if(!d->_declaredLocale.isEmpty() + if (!d->_declaredLocale.isEmpty() && d->_declaredLocale.startsWith((*it).language()) && (*it).confidence() == 10) { // A confidence value of 10 means the charset can @@ -527,13 +527,13 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() // ISO-8859-5 but 21 to the confidence for // windows-1251 to prefer windows-1251 a little bit // over ISO-8859-5. - if((*it).name() == QLatin1String("KOI8-R") + if ((*it).name() == QLatin1String("KOI8-R") && koi8rConfidence > 10 && koi8rConfidence < 30) (*it).setConfidence(20 + koi8rConfidence); - else if((*it).name() == QLatin1String("ISO-8859-5") + else if ((*it).name() == QLatin1String("ISO-8859-5") && iso88595Confidence > 10 && iso88595Confidence < 30) (*it).setConfidence(20 + iso88595Confidence); - else if((*it).name() == QLatin1String("windows-1251") + else if ((*it).name() == QLatin1String("windows-1251") && windows1251Confidence > 10 && windows1251Confidence < 30) (*it).setConfidence(21 + windows1251Confidence); } @@ -565,7 +565,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() } sortNeeded = true; } - if(!d->_allDetectableCharsets.contains((*it).name())) { + if (!d->_allDetectableCharsets.contains((*it).name())) { // remove matches for charsets not supported by QTextCodec // then it is probably some weird charset we cannot use anyway it = qCharsetMatchList.erase(it); @@ -575,7 +575,7 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() // using this match, if not remove the match clearError(); text(*it); - if(hasError()) { + if (hasError()) { // qMailLog(Messaging) << __PRETTY_FUNCTION__ // << "removing match" << (*it).name() // << "because it cannot encode the complete input" @@ -588,10 +588,10 @@ QList<QCharsetMatch> QCharsetDetector::detectAll() } } // sort the list of matches again if confidences have been changed: - if(sortNeeded) + if (sortNeeded) std::sort(qCharsetMatchList.begin(), qCharsetMatchList.end(), std::greater<QCharsetMatch>()); - if(qCharsetMatchList.isEmpty()) { + if (qCharsetMatchList.isEmpty()) { // is there any better status to describe this case? d->_status = U_CE_NOT_FOUND_ERROR; qWarning() << __PRETTY_FUNCTION__ @@ -644,7 +644,7 @@ void QCharsetDetector::setDeclaredEncoding(const QString &encoding) d->_declaredEncoding.toLatin1().constData(), int32_t(-1), &(d->_status)); - if(hasError()) + if (hasError()) qWarning() << __PRETTY_FUNCTION__ << errorString(); } @@ -769,7 +769,7 @@ QStringList QCharsetDetector::getAllDetectableCharsets() qint32 len; const UChar *uc; while ((uc = uenum_unext(en, &len, &(d->_status))) != NULL) { - if(uc && !hasError()) + if (uc && !hasError()) allDetectableCharsetsICU << QString::fromUtf16(uc, len); } } @@ -777,7 +777,7 @@ QStringList QCharsetDetector::getAllDetectableCharsets() // remove all charsets not supported by QTextCodec and all duplicates: foreach(const QString &cs, allDetectableCharsetsICU) { - if(availableCodecsQt.contains(cs) && !d->_allDetectableCharsets.contains(cs)) + if (availableCodecsQt.contains(cs) && !d->_allDetectableCharsets.contains(cs)) d->_allDetectableCharsets << cs; } diff --git a/src/libraries/qmfclient/support/qloggers.cpp b/src/libraries/qmfclient/support/qloggers.cpp index 42926a37..6372f7f0 100644 --- a/src/libraries/qmfclient/support/qloggers.cpp +++ b/src/libraries/qmfclient/support/qloggers.cpp @@ -45,7 +45,7 @@ void BaseLoggerFoundation::setMinLogLvl(const LogLevel _min_lvl) bool BaseLoggerFoundation::isReady(QString& _err) const { - if(!is_ready) _err = err_msg; + if (!is_ready) _err = err_msg; return is_ready; } diff --git a/src/libraries/qmfclient/support/qlogsystem.cpp b/src/libraries/qmfclient/support/qlogsystem.cpp index c7b7533e..44fdd9cf 100644 --- a/src/libraries/qmfclient/support/qlogsystem.cpp +++ b/src/libraries/qmfclient/support/qlogsystem.cpp @@ -78,7 +78,7 @@ void LogSystem::log(LogLevel lvl, const char* fmt, ...) void LogSystem::addLogger(ILogger* logger) { Q_ASSERT(logger); - if(!loggers.contains(logger)) + if (!loggers.contains(logger)) loggers.append(logger); } diff --git a/src/libraries/qmfclient/support/qmaillog.cpp b/src/libraries/qmfclient/support/qmaillog.cpp index 9d36ccb4..daca1471 100644 --- a/src/libraries/qmfclient/support/qmaillog.cpp +++ b/src/libraries/qmfclient/support/qmaillog.cpp @@ -61,7 +61,7 @@ namespace QString err; const bool isReady = logger->isReady(err); - if(!isReady) { + if (!isReady) { // Need to print to stderr in case no loggers are acting now fprintf(stderr, "%s: Can't initialize logger, error: '%s'\n", Q_FUNC_INFO, qPrintable(err)); // Printing through the log subsystem @@ -119,7 +119,7 @@ QMF_EXPORT void qMailLoggersRecreate(const QString& organization, const QString& LogSystem& loggers = LogSystem::getInstance(); loggers.clear(); - if(syslogEnabled) { + if (syslogEnabled) { #if !defined(Q_OS_WIN) SysLogger<LvlLogPrefix>* sl = new SysLogger<LvlLogPrefix>(QLatin1String(ident), LOG_PID, LOG_LOCAL7); addLoggerIfReady(sl); @@ -128,12 +128,12 @@ QMF_EXPORT void qMailLoggersRecreate(const QString& organization, const QString& #endif }; - if(fileEnabled) { + if (fileEnabled) { FileLogger<LvlTimePidLogPrefix>* fl = new FileLogger<LvlTimePidLogPrefix>(filePath); addLoggerIfReady(fl); }; - if(stderrEnabled) { + if (stderrEnabled) { FileLogger<LvlTimePidLogPrefix>* el = new FileLogger<LvlTimePidLogPrefix>(stderr); addLoggerIfReady(el); }; diff --git a/src/libraries/qmfclient/support/qmailnamespace.cpp b/src/libraries/qmfclient/support/qmailnamespace.cpp index a1c4431f..41bb534c 100644 --- a/src/libraries/qmfclient/support/qmailnamespace.cpp +++ b/src/libraries/qmfclient/support/qmailnamespace.cpp @@ -96,7 +96,7 @@ QString QMail::dataPath() { // encoding as best guess, likely just ascii static QString dataEnv(QString::fromUtf8(qgetenv(QMF_DATA_ENV))); - if(!dataEnv.isEmpty()) + if (!dataEnv.isEmpty()) return dataEnv + QChar::fromLatin1('/'); //default to ~/.qmf if not env set return QDir::homePath() + QLatin1String("/.qmf/"); @@ -158,7 +158,7 @@ QString QMail::tempPath() QString QMail::messageServerPath() { static QString serverEnv(QString::fromUtf8(qgetenv(QMF_SERVER_ENV))); - if(!serverEnv.isEmpty()) + if (!serverEnv.isEmpty()) return serverEnv + QChar::fromLatin1('/'); return QCoreApplication::applicationDirPath() + QChar::fromLatin1('/'); @@ -170,7 +170,7 @@ QString QMail::messageServerPath() QString QMail::messageSettingsPath() { static QString settingsEnv(QString::fromUtf8(qgetenv(QMF_SETTINGS_ENV))); - if(!settingsEnv.isEmpty()) + if (!settingsEnv.isEmpty()) return settingsEnv + QChar::fromLatin1('/'); return QCoreApplication::applicationDirPath() + QChar::fromLatin1('/'); } @@ -247,7 +247,7 @@ QSqlDatabase QMail::createDatabase() db.setDatabaseName(dataPath() + QLatin1String("database/qmailstore.db")); - if(!db.open()) { + if (!db.open()) { QSqlError dbError = db.lastError(); qCritical() << "Cannot open database: " << dbError.text(); } diff --git a/src/libraries/qmfclient/support/qmailpluginmanager.cpp b/src/libraries/qmfclient/support/qmailpluginmanager.cpp index 3b3e69f9..5f459ab5 100644 --- a/src/libraries/qmfclient/support/qmailpluginmanager.cpp +++ b/src/libraries/qmfclient/support/qmailpluginmanager.cpp @@ -133,12 +133,12 @@ QMailPluginManagerPrivate::QMailPluginManagerPrivate(const QString& path) foreach(QString libraryPath, libraryPaths) { QDir dir(libraryPath); //Change into the sub directory, and make sure it's readable - if(!dir.cd(path) || !dir.isReadable()) + if (!dir.cd(path) || !dir.isReadable()) continue; foreach(const QString &libname, dir.entryList(pluginFilePatterns(), QDir::Files)) { QString libfile = dir.absoluteFilePath(libname); - if(pluginMap.contains(libname)) + if (pluginMap.contains(libname)) pluginMap[libname]->setFileName(libfile); else pluginMap[libname] = new QPluginLoader(libfile); @@ -173,7 +173,7 @@ QStringList QMailPluginManager::list() const QObject* QMailPluginManager::instance(const QString& name) { if (d->pluginMap.contains(name)) { - if(d->pluginMap[name]->load()) { + if (d->pluginMap[name]->load()) { return d->pluginMap[name]->instance(); } else { qWarning() << "Error loading" << name << "with errorString()" << d->pluginMap[name]->errorString(); diff --git a/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp b/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp index 50025ab4..2a9e80ed 100644 --- a/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp +++ b/src/libraries/qmfmessageserver/qmailmessageclassifier.cpp @@ -125,7 +125,7 @@ bool QMailMessageClassifier::classifyMessage(QMailMessageMetaData& metaData) // Handle voicemail emails, from pre-configured addresses if (voiceMailAddresses.contains(metaData.from().address())) { content = QMailMessage::VoicemailContent; - } else if(videoMailAddresses.contains(metaData.from().address())) { + } else if (videoMailAddresses.contains(metaData.from().address())) { content = QMailMessage::VideomailContent; } break; diff --git a/src/libraries/qmfwidgets/emailfoldermodel.cpp b/src/libraries/qmfwidgets/emailfoldermodel.cpp index ce836b38..c86fa74e 100644 --- a/src/libraries/qmfwidgets/emailfoldermodel.cpp +++ b/src/libraries/qmfwidgets/emailfoldermodel.cpp @@ -298,7 +298,7 @@ QVariant EmailFolderModel::data(QMailMessageSet *item, int role, int column) con if (item) { if (role == FolderSynchronizationEnabledRole) { return itemSynchronizationEnabled(item); - } else if(role == FolderChildCreationPermittedRole || role == FolderDeletionPermittedRole + } else if (role == FolderChildCreationPermittedRole || role == FolderDeletionPermittedRole || role == FolderRenamePermittedRole) { return itemPermitted(item, static_cast<Roles>(role)); } @@ -467,7 +467,7 @@ bool EmailFolderModel::itemPermitted(QMailMessageSet *item, Roles role) const QMailFolder folder(folderItem->folderId()); if (folder.parentAccountId().isValid()) { quint64 folderStatus = folder.status(); - switch(role) { + switch (role) { case FolderChildCreationPermittedRole: return (folderStatus & QMailFolder::ChildCreationPermitted); case FolderDeletionPermittedRole: diff --git a/src/libraries/qmfwidgets/folderdelegate.cpp b/src/libraries/qmfwidgets/folderdelegate.cpp index a134d21d..23c53088 100644 --- a/src/libraries/qmfwidgets/folderdelegate.cpp +++ b/src/libraries/qmfwidgets/folderdelegate.cpp @@ -86,7 +86,7 @@ void FolderDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem & QRect statusRect = option.direction == Qt::RightToLeft ? QRect(0, rect.top(), tw + margin, rect.height()) : QRect(rect.left()+rect.width()-tw-margin, rect.top(), tw, rect.height()); - if(m_showStatus) + if (m_showStatus) painter->drawText(statusRect, Qt::AlignCenter, _statusText); } } diff --git a/src/libraries/qmfwidgets/folderview.cpp b/src/libraries/qmfwidgets/folderview.cpp index a4c32ff1..46c4dfe4 100644 --- a/src/libraries/qmfwidgets/folderview.cpp +++ b/src/libraries/qmfwidgets/folderview.cpp @@ -210,7 +210,7 @@ void FolderView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bott { Q_UNUSED(roles) - if(topLeft == currentIndex() || bottomRight == currentIndex()) + if (topLeft == currentIndex() || bottomRight == currentIndex()) emit selectionUpdated(); QTreeView::dataChanged(topLeft,bottomRight); } diff --git a/src/libraries/qmfwidgets/qtmailnamespace.cpp b/src/libraries/qmfwidgets/qtmailnamespace.cpp index 0cc255aa..96a790e8 100644 --- a/src/libraries/qmfwidgets/qtmailnamespace.cpp +++ b/src/libraries/qmfwidgets/qtmailnamespace.cpp @@ -86,7 +86,7 @@ QIcon Qtmail::icon(const QString& name) static IconMap icons(init()); QIcon result = icons[name]; - if(result.isNull()) + if (result.isNull()) qWarning() << name << " icon not found."; return icons[name]; |