diff options
54 files changed, 410 insertions, 410 deletions
diff --git a/benchmarks/tst_messageserver/testmalloc.cpp b/benchmarks/tst_messageserver/testmalloc.cpp index 5f5a4ac5..459bbd33 100644 --- a/benchmarks/tst_messageserver/testmalloc.cpp +++ b/benchmarks/tst_messageserver/testmalloc.cpp @@ -247,11 +247,11 @@ void TestMallocPrivate::updatePeak() do { if (D) { \ didref = true; \ D->inTestMalloc.ref(); \ - } } while(0) + } } while (0) #define DEREF if (didref) D->inTestMalloc.deref() #else -#define REF do {} while(0) -#define DEREF do {} while(0) +#define REF do {} while (0) +#define DEREF do {} while (0) #endif extern "C" void* malloc(size_t size) diff --git a/examples/messagingaccounts/main_messagingaccounts.cpp b/examples/messagingaccounts/main_messagingaccounts.cpp index cb91b905..b97547d2 100644 --- a/examples/messagingaccounts/main_messagingaccounts.cpp +++ b/examples/messagingaccounts/main_messagingaccounts.cpp @@ -38,7 +38,7 @@ int main(int argc, char** argv) { - if(QMail::fileLock("messagingsettings-instance.lock") == -1) + if (QMail::fileLock("messagingsettings-instance.lock") == -1) qFatal("MessagingSettings already running!\n"); QApplication app(argc, argv); diff --git a/examples/qtmail/accountsettings.cpp b/examples/qtmail/accountsettings.cpp index 8227280f..933723ff 100644 --- a/examples/qtmail/accountsettings.cpp +++ b/examples/qtmail/accountsettings.cpp @@ -254,7 +254,7 @@ void AccountSettings::updateActions() void AccountSettings::editCurrentAccount() { - if(!accountModel->rowCount()) + if (!accountModel->rowCount()) return; QModelIndex index = accountView->currentIndex(); diff --git a/examples/qtmail/attachmentlistwidget.cpp b/examples/qtmail/attachmentlistwidget.cpp index 729ad68f..b2702391 100644 --- a/examples/qtmail/attachmentlistwidget.cpp +++ b/examples/qtmail/attachmentlistwidget.cpp @@ -51,11 +51,11 @@ class AttachmentListWidget; static QString sizeString(uint size) { - if(size < 1024) + if (size < 1024) return QObject::tr("%n byte(s)", "", size); - else if(size < (1024 * 1024)) + else if (size < (1024 * 1024)) return QObject::tr("%1 KB").arg(((float)size)/1024.0, 0, 'f', 1); - else if(size < (1024 * 1024 * 1024)) + else if (size < (1024 * 1024 * 1024)) return QObject::tr("%1 MB").arg(((float)size)/(1024.0 * 1024.0), 0, 'f', 1); else return QObject::tr("%1 GB").arg(((float)size)/(1024.0 * 1024.0 * 1024.0), 0, 'f', 1); @@ -97,7 +97,7 @@ m_parent(parent) void AttachmentListHeader::paintSection(QPainter * painter, const QRect & rect, int logicalIndex) const { - if(logicalIndex == 3 && m_parent->attachments().count() > 1) + if (logicalIndex == 3 && m_parent->attachments().count() > 1) { painter->save(); QFont font = painter->font(); @@ -113,7 +113,7 @@ void AttachmentListHeader::paintSection(QPainter * painter, const QRect & rect, #ifndef QT_NO_CURSOR bool AttachmentListHeader::viewportEvent(QEvent* e) { - if(e->type() == QEvent::Leave) + if (e->type() == QEvent::Leave) setCursor(QCursor()); return QAbstractItemView::viewportEvent(e); } @@ -121,19 +121,19 @@ bool AttachmentListHeader::viewportEvent(QEvent* e) void AttachmentListHeader::mouseMoveEvent(QMouseEvent* e) { QHeaderView::mouseMoveEvent(e); - if(overRemoveLink(e)) + if (overRemoveLink(e)) { QCursor handCursor(Qt::PointingHandCursor); setCursor(handCursor); } - else if(cursor().shape() == Qt::PointingHandCursor) + else if (cursor().shape() == Qt::PointingHandCursor) setCursor(QCursor()); } #endif void AttachmentListHeader::mousePressEvent(QMouseEvent* e) { - if(overRemoveLink(e)) + if (overRemoveLink(e)) emit clear(); QHeaderView::mousePressEvent(e); } @@ -167,7 +167,7 @@ m_parent(parent) void AttachmentListDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - if(index.isValid() && index.column() == 3) + if (index.isValid() && index.column() == 3) { painter->save(); QFont font = painter->font(); @@ -233,19 +233,19 @@ QTreeView(parent) #ifndef QT_NO_CURSOR bool AttachmentListView::viewportEvent(QEvent* e) { - if(e->type() == QEvent::Leave) + if (e->type() == QEvent::Leave) setCursor(QCursor()); return QAbstractItemView::viewportEvent(e); } void AttachmentListView::mouseMoveEvent(QMouseEvent* e) { - if(overRemoveLink(e)) + if (overRemoveLink(e)) { QCursor handCursor(Qt::PointingHandCursor); setCursor(handCursor); } - else if(cursor().shape() == Qt::PointingHandCursor) + else if (cursor().shape() == Qt::PointingHandCursor) setCursor(QCursor()); QTreeView::mouseMoveEvent(e); } @@ -253,7 +253,7 @@ void AttachmentListView::mouseMoveEvent(QMouseEvent* e) void AttachmentListView::mousePressEvent(QMouseEvent* e) { - if(overRemoveLink(e)) + if (overRemoveLink(e)) { QModelIndex index = indexAt(e->pos()); emit removeAttachmentAtIndex(index.row()); @@ -264,7 +264,7 @@ void AttachmentListView::mousePressEvent(QMouseEvent* e) bool AttachmentListView::overRemoveLink(QMouseEvent* e) { QModelIndex index = indexAt(e->pos()); - if(index.isValid() && index.column() == 3) + if (index.isValid() && index.column() == 3) { AttachmentListDelegate* delegate = static_cast<AttachmentListDelegate*>(itemDelegate()); return delegate->isOverRemoveLink(visualRect(index),e->pos()); @@ -302,7 +302,7 @@ QVariant AttachmentListModel::headerData(int section, Qt::Orientation o, int rol { if (role == Qt::DisplayRole) { - if(section < headers.count()) + if (section < headers.count()) return headers.at(section); } @@ -328,14 +328,14 @@ int AttachmentListModel::rowCount(const QModelIndex& parent) const QVariant AttachmentListModel::data( const QModelIndex & index, int role) const { - if(index.isValid()) + if (index.isValid()) { - if(role == Qt::DisplayRole && index.isValid()) + if (role == Qt::DisplayRole && index.isValid()) { QString path = m_attachments.at(index.row()); QFileInfo fi(path); - switch(index.column()) + switch (index.column()) { case 0: return fi.fileName(); @@ -345,14 +345,14 @@ QVariant AttachmentListModel::data( const QModelIndex & index, int role) const break; case 2: QString mimeType = QMail::mimeTypeFromFileName(path); - if(mimeType.isEmpty()) mimeType = "Unknown"; + if (mimeType.isEmpty()) mimeType = "Unknown"; return mimeType; break; } } - else if((role == Qt::DecorationRole || role == Qt::CheckStateRole )&& index.column() > 0) + else if ((role == Qt::DecorationRole || role == Qt::CheckStateRole )&& index.column() > 0) return QVariant(); - else if(role == Qt::DecorationRole) + else if (role == Qt::DecorationRole) { static QIcon attachIcon( ":icon/attach" ); return attachIcon; @@ -435,7 +435,7 @@ bool AttachmentListWidget::isEmpty() const void AttachmentListWidget::addAttachment(const QString& attachment) { - if(m_attachments.contains(attachment)) + if (m_attachments.contains(attachment)) return; m_attachments.append(attachment); @@ -486,7 +486,7 @@ void AttachmentListWidget::clear() void AttachmentListWidget::clearClicked() { - if(QMessageBox::question(this, + if (QMessageBox::question(this, "Remove attachments", QString("Remove %1 attachments?").arg(m_attachments.count()), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) @@ -495,7 +495,7 @@ void AttachmentListWidget::clearClicked() void AttachmentListWidget::removeAttachmentAtIndex(int index) { - if(index >= m_attachments.count()) + if (index >= m_attachments.count()) return; QString attachment = m_attachments.at(index); diff --git a/examples/qtmail/attachmentoptions.cpp b/examples/qtmail/attachmentoptions.cpp index e6a165a6..a6c1da5c 100644 --- a/examples/qtmail/attachmentoptions.cpp +++ b/examples/qtmail/attachmentoptions.cpp @@ -363,11 +363,11 @@ QSize AttachmentOptions::sizeHint() const static QString humanReadable(int size) { - if(size < 1024) + if (size < 1024) return QObject::tr("%n byte(s)", "", size); - else if(size < (1024 * 1024)) + else if (size < (1024 * 1024)) return QObject::tr("%1 KB").arg(((float)size)/1024.0, 0, 'f', 1); - else if(size < (1024 * 1024 * 1024)) + else if (size < (1024 * 1024 * 1024)) return QObject::tr("%1 MB").arg(((float)size)/(1024.0 * 1024.0), 0, 'f', 1); else return QObject::tr("%1 GB").arg(((float)size)/(1024.0 * 1024.0 * 1024.0), 0, 'f', 1); diff --git a/examples/qtmail/detailspage.cpp b/examples/qtmail/detailspage.cpp index 74c734f5..4333c8d2 100644 --- a/examples/qtmail/detailspage.cpp +++ b/examples/qtmail/detailspage.cpp @@ -93,7 +93,7 @@ DetailsPage::DetailsPage( QWidget *parent, const char *name ) { /* QMenu *menu = QSoftMenuBar::menuFor( this ); QWidget* p = QWidget::parentWidget(); - while(p) + while (p) { addActionsFromWidget(p,menu); p = p->parentWidget(); @@ -107,7 +107,7 @@ DetailsPage::DetailsPage( QWidget *parent, const char *name ) setObjectName( name ); QIcon abicon(":icon/addressbook/AddressBook"); // QMenu *menu = QSoftMenuBar::menuFor( this ); -// if( !Qtopia::mousePreferred() ) +// if ( !Qtopia::mousePreferred() ) // { // menu->addAction( abicon, tr("From contacts", "Find recipient's phone number or email address from Contacts application"), // this, SLOT(editRecipients()) ); @@ -206,11 +206,11 @@ DetailsPage::DetailsPage( QWidget *parent, const char *name ) QList<QWidget*> tabOrderList; tabOrderList.append( m_toField ); -// if( Qtopia::mousePreferred() && m_toPicker) +// if ( Qtopia::mousePreferred() && m_toPicker) // tabOrderList.append( m_toPicker ); tabOrderList.append( m_ccField ); tabOrderList.append( m_bccField ); - // if( Qtopia::mousePreferred() && m_bccPicker) + // if ( Qtopia::mousePreferred() && m_bccPicker) // tabOrderList.append( m_bccPicker ); tabOrderList.append( m_subjectField ); tabOrderList.append( m_fromField ); @@ -283,15 +283,15 @@ void DetailsPage::editRecipients() /* RecipientEdit *edit = 0; if (Qtopia::mousePreferred()) { -// if( sender() == m_toPicker ) +// if ( sender() == m_toPicker ) // edit = m_toField; - else if( sender() == m_ccPicker ) + else if ( sender() == m_ccPicker ) edit = m_ccField; - else if( sender() == m_bccPicker ) + else if ( sender() == m_bccPicker ) edit = m_bccField; } else { QWidget *w = focusWidget(); - if( w && w->inherits("RecipientEdit") ) + if ( w && w->inherits("RecipientEdit") ) edit = static_cast<RecipientEdit *>(w); } if (edit) @@ -304,7 +304,7 @@ void DetailsPage::editRecipients() void DetailsPage::setType( int t ) { //QtopiaApplication::InputMethodHint imHint = QtopiaApplication::Normal; - if( m_type != t ) + if ( m_type != t ) { m_allowPhoneNumbers = false; m_allowEmails = false; @@ -320,7 +320,7 @@ void DetailsPage::setType( int t ) m_readReplyField->hide(); m_deliveryReportField->hide(); - if( t == QMailMessage::Mms ) + if ( t == QMailMessage::Mms ) { m_allowPhoneNumbers = true; //m_allowEmails = true; //TODO reenable when address picker supports selection of multiple types @@ -333,12 +333,12 @@ void DetailsPage::setType( int t ) m_readReplyField->show(); m_deliveryReportField->show(); } - else if( t == QMailMessage::Sms ) + else if ( t == QMailMessage::Sms ) { m_allowPhoneNumbers = true; } - else if( t == QMailMessage::Email ) + else if ( t == QMailMessage::Email ) { m_allowEmails = true; m_ccFieldLabel->show(); @@ -477,7 +477,7 @@ void DetailsPage::setBcc( const QString &a_bcc ) QString DetailsPage::bcc() const { QString text; - if( !m_bccField->isHidden() ) + if ( !m_bccField->isHidden() ) text = m_bccField->text(); return text; } @@ -491,7 +491,7 @@ void DetailsPage::setCc( const QString &a_cc ) QString DetailsPage::cc() const { QString text; - if( !m_ccField->isHidden() ) + if ( !m_ccField->isHidden() ) text = m_ccField->text(); return text; } @@ -567,11 +567,11 @@ void DetailsPage::copy() { #ifndef QT_NO_CLIPBOARD QWidget *fw = focusWidget(); - if( !fw ) + if ( !fw ) return; - if( fw->inherits( "QLineEdit" ) ) + if ( fw->inherits( "QLineEdit" ) ) static_cast<QLineEdit*>(fw)->copy(); - else if( fw->inherits( "QTextEdit" ) ) + else if ( fw->inherits( "QTextEdit" ) ) static_cast<QTextEdit*>(fw)->copy(); #endif } @@ -580,11 +580,11 @@ void DetailsPage::paste() { #ifndef QT_NO_CLIPBOARD QWidget *fw = focusWidget(); - if( !fw ) + if ( !fw ) return; - if( fw->inherits( "QLineEdit" ) ) + if ( fw->inherits( "QLineEdit" ) ) static_cast<QLineEdit*>(fw)->paste(); - else if( fw->inherits( "QTextEdit" )) + else if ( fw->inherits( "QTextEdit" )) static_cast<QTextEdit*>(fw)->paste(); #endif } diff --git a/examples/qtmail/emailclient.cpp b/examples/qtmail/emailclient.cpp index 44597cbf..32d856ef 100644 --- a/examples/qtmail/emailclient.cpp +++ b/examples/qtmail/emailclient.cpp @@ -119,16 +119,16 @@ void ActivityIcon::itemChanged(StatusItem* item) void ActivityIcon::showActivity(bool val) { - if(val) + if (val) { - if(m_activeIcon.state() == QMovie::Running) + if (m_activeIcon.state() == QMovie::Running) return; setMovie(&m_activeIcon); m_activeIcon.start(); } else { - if(m_activeIcon.state() == QMovie::NotRunning) + if (m_activeIcon.state() == QMovie::NotRunning) return; m_activeIcon.stop(); setPixmap(m_inactiveIcon); @@ -336,7 +336,7 @@ void MessageUiBase::presentMessage(const QMailMessageId &id, QMailViewerFactory: void MessageUiBase::updateWindowTitle() { QMailMessageSet* item = folderView()->currentItem(); - if(!item) return; + if (!item) return; QString folderName = item->data(Qt::DisplayRole).value<QString>(); QString folderStatus = item->data(EmailFolderModel::FolderStatusRole).value<QString>(); @@ -344,15 +344,15 @@ void MessageUiBase::updateWindowTitle() QMailFolderId folderId = item->data(EmailFolderModel::FolderIdRole).value<QMailFolderId>(); QMailAccountId accountId = item->data(EmailFolderModel::ContextualAccountIdRole).value<QMailAccountId>(); - if(!folderStatus.isEmpty()) + if (!folderStatus.isEmpty()) folderStatus = " (" + folderStatus + ")"; //don't display account prefix for account root items bool isFolderItem = accountId.isValid() && folderId.isValid(); - if(isFolderItem) + if (isFolderItem) { QMailAccount account(accountId); - if(!account.name().isEmpty()) + if (!account.name().isEmpty()) accountName = account.name() + '/'; } @@ -361,7 +361,7 @@ void MessageUiBase::updateWindowTitle() void MessageUiBase::checkUpdateWindowTitle(const QModelIndex& topLeft, const QModelIndex& bottomRight) { - if(topLeft == folderView()->currentIndex() || bottomRight == folderView()->currentIndex()) + if (topLeft == folderView()->currentIndex() || bottomRight == folderView()->currentIndex()) updateWindowTitle(); } @@ -479,7 +479,7 @@ EmailClient::EmailClient(QWidget *parent, Qt::WindowFlags f) //run account setup if we don't have any defined yet bool haveAccounts = QMailStore::instance()->countAccounts() > 0; - if(!haveAccounts) + if (!haveAccounts) QTimer::singleShot(0,this,SLOT(settings())); init(); @@ -554,7 +554,7 @@ void EmailClient::resumeInterruptedComposition() bool EmailClient::startMessageServer() { qMailLog(Messaging) << "Starting messageserver child process..."; - if(m_messageServerProcess) delete m_messageServerProcess; + if (m_messageServerProcess) delete m_messageServerProcess; m_messageServerProcess = new QProcess(this); connect(m_messageServerProcess,SIGNAL(error(QProcess::ProcessError)), this,SLOT(messageServerProcessError(QProcess::ProcessError))); @@ -571,7 +571,7 @@ bool EmailClient::startMessageServer() bool EmailClient::waitForMessageServer() { - if(m_messageServerProcess) + if (m_messageServerProcess) { qMailLog(Messaging) << "Shutting down messageserver child process.."; bool result = m_messageServerProcess->waitForFinished(); @@ -635,7 +635,7 @@ bool EmailClient::closeImmediately() void EmailClient::setVisible(bool visible) { - if(visible) + if (visible) { QPoint p(0, 0); const QScreen *scrn = QGuiApplication::primaryScreen(); @@ -1564,7 +1564,7 @@ QString EmailClient::mailType(QMailMessage::MessageType type) void EmailClient::messageActivated() { QMailMessageId currentId = messageListView()->current(); - if(!currentId.isValid()) + if (!currentId.isValid()) return; QMailMessage message(currentId); @@ -1577,7 +1577,7 @@ void EmailClient::messageActivated() void EmailClient::messageOpenRequested() { QMailMessageId currentId = messageListView()->current(); - if(!currentId.isValid()) + if (!currentId.isValid()) return; QMailMessage message(currentId); @@ -1713,14 +1713,14 @@ void EmailClient::deleteSelectedMessages() //delete LocalOnly messages clientside first QMailMessageKey localOnlyKey(QMailMessageKey::id(deleteList) & QMailMessageKey::status(QMailMessage::LocalOnly)); QMailMessageIdList localOnlyIds(QMailStore::instance()->queryMessages(localOnlyKey)); - if(!localOnlyIds.isEmpty()) + if (!localOnlyIds.isEmpty()) { QMailStore::instance()->removeMessages(QMailMessageKey::id(localOnlyIds)); for (const QMailMessageId &id : localOnlyIds) { deleteList.removeAll(id); } } - if(!deleteList.isEmpty()) + if (!deleteList.isEmpty()) storageAction("Deleting messages..")->deleteMessages(deleteList); } else @@ -1854,7 +1854,7 @@ void EmailClient::copySelectedMessages() foreach(QMailMessageId id, copyIds) { QMailMessage message(id); bool complete(message.status() & QMailMessage::ContentAvailable); - for(uint i = 0; (i < message.partCount()) && complete; ++i) { + for (uint i = 0; (i < message.partCount()) && complete; ++i) { complete &= message.partAt(i).contentAvailable(); } @@ -2078,7 +2078,7 @@ void EmailClient::deleteFolder() { QString folderName = QMailFolder(selectedFolderId).displayName(); - if(QMessageBox::question(this, tr("Delete"), tr("Are you sure you wish to delete the folder %1 and all its contents?").arg(folderName), QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok) + if (QMessageBox::question(this, tr("Delete"), tr("Are you sure you wish to delete the folder %1 and all its contents?").arg(folderName), QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok) return; storageAction("Deleting folder ")->onlineDeleteFolder(selectedFolderId); } @@ -2087,7 +2087,7 @@ void EmailClient::createFolder() { QString name = QInputDialog::getText(this, tr("New Folder Name"), tr("The name of the new folder should be: ")); - if(name.isEmpty()) + if (name.isEmpty()) return; storageAction("Creating folder ")->onlineCreateFolder(name, selectedAccountId, selectedFolderId); @@ -2096,12 +2096,12 @@ void EmailClient::createFolder() void EmailClient::renameFolder() { - if(selectedFolderId.isValid()) + if (selectedFolderId.isValid()) { QString oldName = QMailFolder(selectedFolderId).displayName(); QString newName = QInputDialog::getText(this, tr("Rename Folder"), tr("Rename folder %1 to: ").arg(oldName)); - if(newName.isEmpty()) + if (newName.isEmpty()) return; storageAction("Renaming folder")->onlineRenameFolder(selectedFolderId, newName); @@ -2111,7 +2111,7 @@ void EmailClient::renameFolder() void EmailClient::search() { static bool init = false; - if(!init) { + if (!init) { connect(searchView(), SIGNAL(searchResultSelected(QMailMessageId)), this, SLOT(showSearchResult(const QMailMessageId &))); init = true; } @@ -2155,7 +2155,7 @@ bool EmailClient::checkMailConflict(const QString& msg1, const QString& msg2) { if ( writeMailWidget()->isVisible()) { QString message = tr("<qt>You are currently editing a message:<br>%1</qt>").arg(msg1); - switch( QMessageBox::warning( 0, tr("Messages conflict"), message, + switch ( QMessageBox::warning( 0, tr("Messages conflict"), message, tr("Yes"), tr("No"), 0, 0, 1 ) ) { case 0: @@ -2177,21 +2177,21 @@ bool EmailClient::checkMailConflict(const QString& msg1, const QString& msg2) void EmailClient::replyClicked() { QMailMessageId currentId = readMailWidget()->displayedMessage(); - if(currentId.isValid()) + if (currentId.isValid()) respond(QMailMessage(currentId),QMailMessage::Reply); } void EmailClient::replyAllClicked() { QMailMessageId currentId = readMailWidget()->displayedMessage(); - if(currentId.isValid()) + if (currentId.isValid()) respond(QMailMessage(currentId),QMailMessage::ReplyToAll); } void EmailClient::forwardClicked() { QMailMessageId currentId = readMailWidget()->displayedMessage(); - if(currentId.isValid()) + if (currentId.isValid()) respond(QMailMessage(currentId),QMailMessage::Forward); } @@ -2350,7 +2350,7 @@ void EmailClient::quit() } } - if(m_messageServerProcess) + if (m_messageServerProcess) { //we started the messageserver, direct it to shut down //before we quit ourselves @@ -2706,7 +2706,7 @@ void EmailClient::messageSelectionChanged() setActionVisible(copyAction, (messagesSelected && !(trashCount > 0))); setActionVisible(restoreAction, (messagesSelected && (trashCount > 0))); - if(messageListView()->current().isValid()) + if (messageListView()->current().isValid()) { QMailMessage mail(messageListView()->current()); bool incoming(mail.status() & QMailMessage::Incoming); @@ -2791,7 +2791,7 @@ QMailStorageAction* EmailClient::storageAction(const QString& description) QMailRetrievalAction* EmailClient::retrieveAction(const QString& description) { - if(!m_retrievalAction) + if (!m_retrievalAction) { m_retrievalAction = new QMailRetrievalAction(this); connectServiceAction(m_retrievalAction); @@ -2803,7 +2803,7 @@ QMailRetrievalAction* EmailClient::retrieveAction(const QString& description) QMailTransmitAction* EmailClient::transmitAction(const QString& description) { - if(!m_transmitAction) + if (!m_transmitAction) { m_transmitAction = new QMailTransmitAction(this); connectServiceAction(m_transmitAction); diff --git a/examples/qtmail/emailcomposer.cpp b/examples/qtmail/emailcomposer.cpp index 1ba559b6..2131926d 100644 --- a/examples/qtmail/emailcomposer.cpp +++ b/examples/qtmail/emailcomposer.cpp @@ -197,10 +197,10 @@ RecipientType RecipientWidget::recipientType() const void RecipientWidget::setRecipientType(RecipientType t) { - for(int index = 0; index < m_typeCombo->count(); index++) + for (int index = 0; index < m_typeCombo->count(); index++) { RecipientType v = static_cast<RecipientType>(m_typeCombo->itemData(index).toUInt()); - if(v == t) + if (v == t) { m_typeCombo->setCurrentIndex(index); break; @@ -212,8 +212,8 @@ bool RecipientWidget::eventFilter(QObject* obj, QEvent* event) { if (obj == m_recipientEdit && event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); - if(keyEvent->key() == Qt::Key_Backspace) - if(isEmpty()) + if (keyEvent->key() == Qt::Key_Backspace) + if (isEmpty()) { emit removeClicked(); return true; @@ -267,7 +267,7 @@ QStringList RecipientListWidget::recipients(RecipientType t) const QStringList results; foreach(RecipientWidget* r,m_widgetList) - if(!r->isEmpty() && r->recipientType() == t) + if (!r->isEmpty() && r->recipientType() == t) results.append(r->recipient()); return results; @@ -278,7 +278,7 @@ QStringList RecipientListWidget::recipients() const QStringList results; foreach(RecipientWidget* r,m_widgetList) - if(!r->isEmpty()) + if (!r->isEmpty()) results.append(r->recipient()); return results; @@ -286,12 +286,12 @@ QStringList RecipientListWidget::recipients() const void RecipientListWidget::setRecipients(RecipientType t, const QStringList& addresses) { - if(addresses.isEmpty()) + if (addresses.isEmpty()) return; foreach(RecipientWidget* r, m_widgetList) { - if(r->isEmpty()) + if (r->isEmpty()) { m_widgetList.removeAll(r); delete r; @@ -300,7 +300,7 @@ void RecipientListWidget::setRecipients(RecipientType t, const QStringList& addr foreach(QString address, addresses) { - if(!containRecipient(t,address)) + if (!containRecipient(t,address)) { RecipientWidget* r = addRecipientWidget(); r->setRecipientType(t); @@ -330,7 +330,7 @@ int RecipientListWidget::emptyRecipientSlots() const int emptyCount = 0; foreach(RecipientWidget* r,m_widgetList) { - if(r->isEmpty()) + if (r->isEmpty()) emptyCount++; } return emptyCount; @@ -340,7 +340,7 @@ bool RecipientListWidget::containRecipient(RecipientType t, const QString& addre { foreach(RecipientWidget* r,m_widgetList) { - if(r->recipientType() == t && r->recipient() == address) + if (r->recipientType() == t && r->recipient() == address) return true; } return false; @@ -357,7 +357,7 @@ RecipientWidget* RecipientListWidget::addRecipientWidget() setUpdatesEnabled(false); m_layout->addWidget(r); - if(!m_widgetList.isEmpty()) + if (!m_widgetList.isEmpty()) m_widgetList.last()->setTabOrder(m_widgetList.last(),r); r->setRemoveEnabled(!m_widgetList.isEmpty()); @@ -371,9 +371,9 @@ RecipientWidget* RecipientListWidget::addRecipientWidget() void RecipientListWidget::removeRecipientWidget() { - if(RecipientWidget* r = qobject_cast<RecipientWidget*>(sender())) + if (RecipientWidget* r = qobject_cast<RecipientWidget*>(sender())) { - if(m_widgetList.count() <= 1) + if (m_widgetList.count() <= 1) return; setUpdatesEnabled(false); int index = m_widgetList.indexOf(r); @@ -382,10 +382,10 @@ void RecipientListWidget::removeRecipientWidget() m_layout->removeWidget(r); r->deleteLater(); - if(index >= m_widgetList.count()) + if (index >= m_widgetList.count()) index = m_widgetList.count()-1; - if(m_widgetList.at(index)->isEmpty() && index > 0) + if (m_widgetList.at(index)->isEmpty() && index > 0) index--; m_widgetList.at(index)->setFocus(); @@ -397,9 +397,9 @@ void RecipientListWidget::removeRecipientWidget() void RecipientListWidget::recipientChanged() { - if(qobject_cast<RecipientWidget*>(sender())) + if (qobject_cast<RecipientWidget*>(sender())) { - if(emptyRecipientSlots() == 0) + if (emptyRecipientSlots() == 0) addRecipientWidget(); } } @@ -462,7 +462,7 @@ protected: void SpellingHighlighter::highlightBlock(const QString &text) { - if(text.startsWith(EmailComposerInterface::quotePrefix())) + if (text.startsWith(EmailComposerInterface::quotePrefix())) return; //don't find errors in quoted text Dictionary *dictionary = Dictionary::instance(); @@ -546,11 +546,11 @@ void BodyTextEdit::keyPressEvent(QKeyEvent* e) } if (e->key() == Qt::Key_Back) { -// if( Qtopia::mousePreferred() ) { +// if ( Qtopia::mousePreferred() ) { // e->ignore(); // return; // } else if (isEmpty()) { - if(isEmpty()) { + if (isEmpty()) { e->accept(); emit finished(); return; diff --git a/examples/qtmail/main.cpp b/examples/qtmail/main.cpp index e3e092bf..64344be8 100644 --- a/examples/qtmail/main.cpp +++ b/examples/qtmail/main.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) // This is ~/.config/QtProject/Qtmail.conf qMailLoggersRecreate("QtProject", "Qtmail", "Qtmail"); - if(QMail::fileLock("qtmail-instance.lock") == -1) + if (QMail::fileLock("qtmail-instance.lock") == -1) qFatal("Qtmail already running!\n"); app.setWindowIcon(QIcon(":icon/qtmail")); diff --git a/examples/qtmail/messagelistview.cpp b/examples/qtmail/messagelistview.cpp index c560ba41..5852844d 100644 --- a/examples/qtmail/messagelistview.cpp +++ b/examples/qtmail/messagelistview.cpp @@ -147,7 +147,7 @@ void QuickSearchWidget::searchTermsChanged() QMailMessageKey QuickSearchWidget::buildSearchKey() const { QMailMessageKey statusKey = qvariant_cast<QMailMessageKey>(m_statusCombo->itemData(m_statusCombo->currentIndex())); - if(m_searchTerms->text().isEmpty() && m_statusCombo->currentIndex() == 0) + if (m_searchTerms->text().isEmpty() && m_statusCombo->currentIndex() == 0) return statusKey; QMailMessageKey subjectKey = QMailMessageKey::subject(m_searchTerms->text(),QMailDataComparator::Includes); @@ -220,13 +220,13 @@ static QString dateString(const QDateTime& dt) { QDateTime current = QDateTime::currentDateTime(); //today - if(dt.date() == current.date()) + if (dt.date() == current.date()) return QString("Today %1").arg(dt.toString("h:mm:ss ap")); //yesterday - else if(dt.daysTo(current) <= 1) + else if (dt.daysTo(current) <= 1) return QString("Yesterday %1").arg(dt.toString("h:mm:ss ap")); //within 7 days - else if(dt.daysTo(current) < 7) + else if (dt.daysTo(current) < 7) return dt.toString("dddd h:mm:ss ap"); else return dt.toString("dd/MM/yy h:mm:ss ap"); } @@ -236,7 +236,7 @@ QVariant MessageListModel<BaseModel>::data(const QModelIndex & index, int role) { if (index.isValid()) { if (role == Qt::DisplayRole && index.isValid()) { - switch(index.column()) + switch (index.column()) { case 0: return SuperType::data(index, QMailMessageModelBase::MessageSubjectTextRole); @@ -327,13 +327,13 @@ MessageList::~MessageList() void MessageList::keyPressEvent(QKeyEvent* e) { - switch( e->key() ) { + switch ( e->key() ) { case Qt::Key_Space: case Qt::Key_Return: case Qt::Key_Select: case Qt::Key_Enter: { - if(currentIndex().isValid()) + if (currentIndex().isValid()) emit clicked(currentIndex()); } break; diff --git a/examples/qtmail/readmail.cpp b/examples/qtmail/readmail.cpp index 5fd6c3c5..ed71aedd 100644 --- a/examples/qtmail/readmail.cpp +++ b/examples/qtmail/readmail.cpp @@ -277,7 +277,7 @@ void ReadMail::updateView(QMailViewerFactory::PresentationType type) void ReadMail::keyPressEvent(QKeyEvent *e) { - switch( e->key() ) { + switch ( e->key() ) { default: QWidget::keyPressEvent( e ); } diff --git a/examples/qtmail/searchview.cpp b/examples/qtmail/searchview.cpp index 43a66529..1d05a774 100644 --- a/examples/qtmail/searchview.cpp +++ b/examples/qtmail/searchview.cpp @@ -93,7 +93,7 @@ SearchButton::SearchButton(QWidget* parent) void SearchButton::thisClicked() { - if(m_searching) + if (m_searching) emit stopSearch(); else emit startSearch(); @@ -107,7 +107,7 @@ void SearchButton::searchActivityChanged(QMailServiceAction::Activity a) void SearchButton::updateView() { - if(m_searching) + if (m_searching) { setText("Stop"); setIcon(Qtmail::icon("cancel")); @@ -156,7 +156,7 @@ QWidget(parent) QString BodySearchWidget::term() const { - if(m_checkBox->isChecked()) + if (m_checkBox->isChecked()) return m_term->text(); else return QString(); @@ -340,7 +340,7 @@ public: static QMap<Comparator,QString> comparatorMap() { static QMap<Comparator,QString> s; - if(s.isEmpty()) + if (s.isEmpty()) { s.insert(Contains,"Contains"); s.insert(DoesNotContain,"Does not contain"); @@ -366,7 +366,7 @@ public: static QMap<Property,QString> propertyMap() { static QMap<Property,QString> s; - if(s.isEmpty()) + if (s.isEmpty()) { s.insert(AllRecipients,"All recipients"); s.insert(SizeInBytes,"Size in bytes"); @@ -422,7 +422,7 @@ QMailMessageKey() enum compartorType{Equality,Inclusion,Relation,Presence,None} ct = None; - switch(comparator) + switch (comparator) { case SearchTermWidget::Contains: { @@ -466,18 +466,18 @@ QMailMessageKey() } break; } - switch(property) + switch (property) { case SearchTermWidget::AllRecipients: { - if(ct == Equality) + if (ct == Equality) QMailMessageKey::operator=(recipients(value.value<QString>(),ec)); else QMailMessageKey::operator=(recipients(value.value<QString>(),ic)); }break; case SearchTermWidget::SizeInBytes: { - if(ct == Equality) + if (ct == Equality) QMailMessageKey::operator=(size(value.value<int>(),ec)); else QMailMessageKey::operator=(size(value.value<int>(),rc)); @@ -488,14 +488,14 @@ QMailMessageKey() }break; case SearchTermWidget::Subject: { - if(ct == Equality) + if (ct == Equality) QMailMessageKey::operator=(subject(value.value<QString>(),ec)); else QMailMessageKey::operator=(subject(value.value<QString>(),ic)); }break; case SearchTermWidget::From: { - if(ct == Equality) + if (ct == Equality) QMailMessageKey::operator=(sender(value.value<QString>(),ec)); else QMailMessageKey::operator=(sender(value.value<QString>(),ic)); @@ -505,21 +505,21 @@ QMailMessageKey() //beacuse the storage system uses the more fine grained QDateTime, we need to construct keys that //consider time range as well - if(ct == Equality) + if (ct == Equality) { QMailMessageKey startRange = receptionTimeStamp(value.value<QDate>().startOfDay(),QMailDataComparator::GreaterThanEqual); QMailMessageKey endRange = receptionTimeStamp(value.value<QDate>().addDays(1).startOfDay(),QMailDataComparator::LessThan); - if(ec == QMailDataComparator::Equal) + if (ec == QMailDataComparator::Equal) QMailMessageKey::operator=(startRange & endRange); else QMailMessageKey::operator=(~(startRange & endRange)); } else { - if(rc == QMailDataComparator::GreaterThan) + if (rc == QMailDataComparator::GreaterThan) QMailMessageKey::operator=(receptionTimeStamp(value.value<QDate>().addDays(1).startOfDay(),QMailDataComparator::GreaterThanEqual)); - else if(rc == QMailDataComparator::LessThanEqual) + else if (rc == QMailDataComparator::LessThanEqual) QMailMessageKey::operator=(receptionTimeStamp(value.value<QDate>().startOfDay().addDays(1),QMailDataComparator::LessThan)); else QMailMessageKey::operator=(receptionTimeStamp(value.value<QDate>().startOfDay(),rc)); @@ -550,7 +550,7 @@ void SearchTermWidget::reset() QMailMessageKey SearchTermWidget::searchKey() const { - if(term().isValid()) + if (term().isValid()) return SearchKey(property(),comparator(),term()); else return QMailMessageKey(); @@ -558,7 +558,7 @@ QMailMessageKey SearchTermWidget::searchKey() const void SearchTermWidget::propertyChanged() { - switch(property()) + switch (property()) { case SizeInBytes: setComparators(numericComparators()); @@ -586,7 +586,7 @@ void SearchTermWidget::setupUi() m_property = new QComboBox(this); QMap<Property,QString>::const_iterator itr = propertyMap().constBegin(); - for(;itr != propertyMap().constEnd() ; itr++) + for (;itr != propertyMap().constEnd() ; itr++) m_property->addItem(*itr,itr.key()); layout->addWidget(m_property); @@ -624,9 +624,9 @@ void SearchTermWidget::setComparators(Comparators c) { m_comparator->clear(); QMap<Comparator,QString>::const_iterator itr = comparatorMap().constBegin(); - for(;itr != comparatorMap().constEnd();itr++) + for (;itr != comparatorMap().constEnd();itr++) { - if(c & itr.key()) + if (c & itr.key()) m_comparator->addItem(*itr,itr.key()); } } @@ -638,7 +638,7 @@ void SearchTermWidget::setTerm(TermFormat t) m_messageFlagsTerm->hide(); m_dateTerm->hide(); QWidget* w = 0; - switch(t) + switch (t) { case TextTerm: w = m_textTerm; @@ -655,7 +655,7 @@ void SearchTermWidget::setTerm(TermFormat t) case NoTerm: break; } - if(w) w->show(); + if (w) w->show(); } SearchTermWidget::Property SearchTermWidget::property() const @@ -673,20 +673,20 @@ SearchTermWidget::Comparator SearchTermWidget::comparator() const QVariant SearchTermWidget::term() const { TermFormat f = NoTerm; - if(m_textTerm->isVisible()) + if (m_textTerm->isVisible()) f = TextTerm; - else if(m_numericTerm->isVisible()) + else if (m_numericTerm->isVisible()) f = NumericTerm; - else if(m_messageFlagsTerm->isVisible()) + else if (m_messageFlagsTerm->isVisible()) f = MessageFlagsTerm; - else if(m_dateTerm->isVisible()) + else if (m_dateTerm->isVisible()) f = DateTerm; QVariant keyValue; - switch(f) + switch (f) { case TextTerm: - if(!m_textTerm->text().isEmpty()) + if (!m_textTerm->text().isEmpty()) keyValue = m_textTerm->text(); break; case NumericTerm: @@ -767,7 +767,7 @@ QWidget(parent) controlButtonsLayout->addStretch(); layout->addLayout(controlButtonsLayout); - for(int i = 0; i < minSearchTerms; ++i) + for (int i = 0; i < minSearchTerms; ++i) addSearchTerm(); } @@ -778,14 +778,14 @@ QMailMessageKey SearchTermsComposer::searchKey() const QMailMessageKey key = (*itr)->searchKey(); itr++; - if(m_matchAllButton->isChecked()) + if (m_matchAllButton->isChecked()) { - for(;itr != m_terms.end(); ++itr) + for (;itr != m_terms.end(); ++itr) key &= (*itr)->searchKey(); } - else if(m_matchAnyButton->isChecked()) + else if (m_matchAnyButton->isChecked()) { - for(;itr != m_terms.end(); ++itr) + for (;itr != m_terms.end(); ++itr) key |= (*itr)->searchKey(); } return key; @@ -797,7 +797,7 @@ void SearchTermsComposer::reset() foreach(SearchTermWidget* stw, m_terms) stw->deleteLater(); m_terms = QList<SearchTermWidget*>(); - for(int i = 0 ; i < minSearchTerms; ++i) + for (int i = 0 ; i < minSearchTerms; ++i) addSearchTerm(); updateGeometry(); setUpdatesEnabled(true); @@ -805,13 +805,13 @@ void SearchTermsComposer::reset() void SearchTermsComposer::moreButtonClicked() { - if(m_terms.count() < maxSearchTerms ) + if (m_terms.count() < maxSearchTerms ) addSearchTerm(); } void SearchTermsComposer::lessButtonClicked() { - if(m_terms.count() > minSearchTerms ) + if (m_terms.count() > minSearchTerms ) removeSearchTerm(); } @@ -880,7 +880,7 @@ void SearchView::reset() void SearchView::close() { - if(m_searchAction->activity() == QMailServiceAction::InProgress) + if (m_searchAction->activity() == QMailServiceAction::InProgress) m_searchAction->cancelOperation(); QMainWindow::close(); } @@ -935,9 +935,9 @@ void SearchView::setupUi() QMailMessageKey SearchView::searchKey() const { QMailMessageKey key = m_searchTermsComposer->searchKey(); - if(!m_folderSelectorWidget->searchKey().isEmpty()) + if (!m_folderSelectorWidget->searchKey().isEmpty()) { - if(!key.isEmpty()) + if (!key.isEmpty()) key &= m_folderSelectorWidget->searchKey(); else key = m_folderSelectorWidget->searchKey(); @@ -949,16 +949,16 @@ void SearchView::startSearch() { m_searchResults->setKey(QMailMessageKey::nonMatchingKey()); - if(m_searched) { //lets "restart" the search action + if (m_searched) { //lets "restart" the search action delete m_searchAction; setupSearchAction(); } QMailMessageKey key = searchKey(); - if(key.isEmpty() && m_bodySearchWidget->term().isEmpty()) + if (key.isEmpty() && m_bodySearchWidget->term().isEmpty()) return; - if(m_searchAction->activity() != QMailServiceAction::InProgress) + if (m_searchAction->activity() != QMailServiceAction::InProgress) m_searchAction->searchMessages(key,m_bodySearchWidget->term(), m_folderSelectorWidget->searchSpecification()); m_searched = true; @@ -966,7 +966,7 @@ void SearchView::startSearch() void SearchView::stopSearch() { - if(m_searched) + if (m_searched) m_searchAction->cancelOperation(); } @@ -977,13 +977,13 @@ void SearchView::messageIdsMatched(const QMailMessageIdList& ids) void SearchView::searchActivityChanged(QMailServiceAction::Activity a) { - if(a == QMailServiceAction::Successful) + if (a == QMailServiceAction::Successful) m_statusBar->showMessage("Done."); } void SearchView::searchProgressChanged(uint value, uint total) { - if(total > 0) + if (total > 0) m_statusBar->showMessage(QString("Searching %1%").arg((value*100)/total)); } diff --git a/examples/qtmail/statusbar.cpp b/examples/qtmail/statusbar.cpp index 375198e9..7a01fc1b 100644 --- a/examples/qtmail/statusbar.cpp +++ b/examples/qtmail/statusbar.cpp @@ -83,7 +83,7 @@ bool ArrowButton::upState() const void ArrowButton::thisClicked() { - if(up) + if (up) emit upClicked(); else emit downClicked(); @@ -103,7 +103,7 @@ m_showDetailsButton(true) void StatusBar::setProgress(unsigned int min, unsigned int max) { - if(min == max) + if (min == max) { clearProgress(); return; @@ -113,7 +113,7 @@ void StatusBar::setProgress(unsigned int min, unsigned int max) m_progressBar->setRange(0,max); m_progressBar->setValue(min); - if(m_detailsButton->isVisible() && !m_detailsButton->upState()) + if (m_detailsButton->isVisible() && !m_detailsButton->upState()) emit showDetails(); } diff --git a/examples/qtmail/statusmonitor.cpp b/examples/qtmail/statusmonitor.cpp index 8ade7244..918a99ad 100644 --- a/examples/qtmail/statusmonitor.cpp +++ b/examples/qtmail/statusmonitor.cpp @@ -141,7 +141,7 @@ QString ServiceActionStatusItem::status() const void ServiceActionStatusItem::serviceActivityChanged(QMailServiceAction::Activity a) { - if(a == QMailServiceAction::Successful || a == QMailServiceAction::Failed) + if (a == QMailServiceAction::Successful || a == QMailServiceAction::Failed) emit finished(); } @@ -159,7 +159,7 @@ StatusMonitor* StatusMonitor::instance() void StatusMonitor::add(StatusItem* newItem) { - if(!newItem || m_statusItems.contains(newItem)) + if (!newItem || m_statusItems.contains(newItem)) { qWarning() << "Status item already exists."; return; @@ -218,7 +218,7 @@ void StatusMonitor::statusItemProgressChanged() void StatusMonitor::statusItemDestroyed(QObject* s) { StatusItem* ss = qobject_cast<StatusItem*>(s); - if(ss) + if (ss) { m_statusItems.removeAll(ss); disconnect(ss); diff --git a/examples/qtmail/statusmonitorwidget.cpp b/examples/qtmail/statusmonitorwidget.cpp index 71cee6dc..76907c09 100644 --- a/examples/qtmail/statusmonitorwidget.cpp +++ b/examples/qtmail/statusmonitorwidget.cpp @@ -46,7 +46,7 @@ m_bottomMargin(bottomMargin), m_rightMargin(rightMargin) { init(); - if(parent) + if (parent) parent->installEventFilter(this); connect(StatusMonitor::instance(),SIGNAL(added(StatusItem*)),this, SLOT(statusAdded(StatusItem*))); @@ -68,7 +68,7 @@ QSize StatusMonitorWidget::sizeHint() const bool StatusMonitorWidget::eventFilter(QObject* source, QEvent* event) { - if(source == parent() && isVisible() && event->type() == QEvent::Resize) + if (source == parent() && isVisible() && event->type() == QEvent::Resize) repositionToParent(); return QWidget::eventFilter(source,event); } @@ -88,7 +88,7 @@ void StatusMonitorWidget::statusAdded(StatusItem* s) void StatusMonitorWidget::statusRemoved(StatusItem* s) { - if(QWidget* w = m_statusWidgets.value(s)) + if (QWidget* w = m_statusWidgets.value(s)) { m_statusWidgets.remove(s); w->deleteLater(); @@ -109,7 +109,7 @@ void StatusMonitorWidget::init() void StatusMonitorWidget::repositionToParent() { QWidget* parentWidget = qobject_cast<QWidget*>(parent()); - if(!parentWidget) + if (!parentWidget) return; int x = parentWidget->width() - m_rightMargin - width(); int y = parentWidget->height() - m_bottomMargin - height(); diff --git a/examples/qtmail/writemail.cpp b/examples/qtmail/writemail.cpp index 81e351b1..1fb6c9c0 100644 --- a/examples/qtmail/writemail.cpp +++ b/examples/qtmail/writemail.cpp @@ -427,7 +427,7 @@ bool WriteMail::prepareComposer(QMailMessage::MessageType type, const QMailAccou } updateAccountSelection(type, accountId); - if(m_composerInterface) + if (m_composerInterface) m_composerInterface->setSendingAccountId(accountId); return success; @@ -460,7 +460,7 @@ bool WriteMail::draft() void WriteMail::statusChanged(const QString& status) { - if(status.isEmpty()) + if (status.isEmpty()) setWindowTitle(tr("(Unnamed)")); else setWindowTitle(status); diff --git a/examples/serverobserver/serverobserver.cpp b/examples/serverobserver/serverobserver.cpp index f58726ee..64a7772d 100644 --- a/examples/serverobserver/serverobserver.cpp +++ b/examples/serverobserver/serverobserver.cpp @@ -99,7 +99,7 @@ RowWidget::RowWidget(QSharedPointer<QMailActionInfo> action, QWidget *parent) QString RowWidget::requestTypeToString(QMailServerRequestType t) { - switch(t) + switch (t) { case AcknowledgeNewMessagesRequestType: return tr("Acknowledging new messages"); 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]; diff --git a/src/plugins/messageservices/imap/imapclient.cpp b/src/plugins/messageservices/imap/imapclient.cpp index 38d3c6e5..c5efc46d 100644 --- a/src/plugins/messageservices/imap/imapclient.cpp +++ b/src/plugins/messageservices/imap/imapclient.cpp @@ -301,7 +301,7 @@ void IdleProtocol::idleCommandTransition(const ImapCommand command, const Operat } QMailAccountConfiguration config(_client->account()); - switch( command ) { + switch ( command ) { case IMAP_Init: { if (receivedCapabilities()) { @@ -598,7 +598,7 @@ void ImapClient::checkCommandResponse(ImapCommand command, OperationStatus statu void ImapClient::commandTransition(ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_Init: { // We need to request the capabilities. Even in the case that an unsolicited response @@ -809,7 +809,7 @@ void ImapClient::mailboxListed(const QString &flags, const QString &path) QString mailboxPath; - if(_protocol.delimiterUnknown()) + if (_protocol.delimiterUnknown()) qWarning() << "Delimiter has not yet been discovered, which is essential to know the structure of a mailbox"; QStringList list = _protocol.flatHierarchy() ? QStringList(path) : path.split(_protocol.delimiter()); @@ -857,7 +857,7 @@ void ImapClient::mailboxListed(const QString &flags, const QString &path) folderFlags = flags; } - if(QString::compare(path, "INBOX", Qt::CaseInsensitive) == 0) { + if (QString::compare(path, "INBOX", Qt::CaseInsensitive) == 0) { //don't let inbox be deleted/renamed folder.setStatus(QMailFolder::DeletionPermitted, false); folder.setStatus(QMailFolder::RenamePermitted, false); diff --git a/src/plugins/messageservices/imap/imapprotocol.cpp b/src/plugins/messageservices/imap/imapprotocol.cpp index 868157d1..e5903493 100644 --- a/src/plugins/messageservices/imap/imapprotocol.cpp +++ b/src/plugins/messageservices/imap/imapprotocol.cpp @@ -723,7 +723,7 @@ QString CreateState::transmit(ImapContext *c) const QMailFolderId &parent = _mailboxes.last().first; const QString &name = _mailboxes.last().second; - if(parent.isValid() && c->protocol()->delimiterUnknown()) { + if (parent.isValid() && c->protocol()->delimiterUnknown()) { // We are waiting on delim to create return QString(); } @@ -764,8 +764,8 @@ QString CreateState::makePath(ImapContext *c, const QMailFolderId &parent, const { QString path; - if(parent.isValid()) { - if(!c->protocol()->delimiterUnknown()) + if (parent.isValid()) { + if (!c->protocol()->delimiterUnknown()) path = QMailFolder(parent).path() + c->protocol()->delimiter(); else qWarning() << "Cannot create a child folder, without a delimiter"; @@ -868,7 +868,7 @@ void RenameState::init() QString RenameState::transmit(ImapContext *c) { - if(c->protocol()->delimiterUnknown()) { + if (c->protocol()->delimiterUnknown()) { // We are waiting on delim to create return QString(); } @@ -911,7 +911,7 @@ QString RenameState::buildNewPath(ImapContext *c , const QMailFolder &folder, QS { QString path; QString encodedNewName = QMailCodec::encodeModifiedUtf7(newName); - if(c->protocol()->flatHierarchy() || folder.path().count(c->protocol()->delimiter()) == 0) + if (c->protocol()->flatHierarchy() || folder.path().count(c->protocol()->delimiter()) == 0) path = encodedNewName; else path = folder.path().section(c->protocol()->delimiter(), 0, -2) + c->protocol()->delimiter() + encodedNewName; @@ -1105,9 +1105,9 @@ 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") { + if (delimiter == "NIL") { c->protocol()->setFlatHierarchy(true); } else { pos = 0; @@ -1115,7 +1115,7 @@ void ListState::untaggedResponse(ImapContext *c, const QString &line) pos = 0; delimiter = token(delimiter, '"', '"', &pos); } - if(delimiter.length() != 1) + if (delimiter.length() != 1) qWarning() << "Delimiter length is" << delimiter.length() << "while should only be 1 character"; c->protocol()->setDelimiter(*delimiter.begin()); } @@ -1799,7 +1799,7 @@ QStringList SearchMessageState::convertValue(const QVariant &value, const QMailM const QMailKey::Comparator &comparer) { - switch(property) { + switch (property) { case QMailMessageKey::Id: break; case QMailMessageKey::Type: @@ -1811,7 +1811,7 @@ QStringList SearchMessageState::convertValue(const QVariant &value, const QMailM QStringList result = QStringList(QString("FROM {%1}").arg(sender.size())); result.append(QString("%1").arg(QString(sender))); return result; - } else if(comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { + } else if (comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { QStringList result = QStringList(QString("NOT (FROM {%1}").arg(sender.size())); result.append(QString("%1)").arg(QString(sender))); return result; @@ -1825,13 +1825,13 @@ QStringList SearchMessageState::convertValue(const QVariant &value, const QMailM case QMailMessageKey::Recipients: { _utf8 |= !(isPrintable(value.toString())); QString recipients = value.toString().toUtf8(); // utf8 is backwards compatible with 7 bit ascii - if(comparer == QMailKey::Equal || comparer == QMailKey::Includes) { + if (comparer == QMailKey::Equal || comparer == QMailKey::Includes) { QStringList result = QStringList(QString("OR (BCC {%1}").arg(recipients.size())); result.append(QString("%1) (OR (CC {%2}").arg(recipients).arg(recipients.size())); result.append(QString("%1) (TO {%2}").arg(recipients).arg(recipients.size())); result.append(QString("%1))").arg(recipients)); return result; - } else if(comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { + } else if (comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { QStringList result = QStringList(QString("NOT (OR (BCC {%1}").arg(recipients.size())); result.append(QString("%1) (OR (CC {%2}").arg(recipients).arg(recipients.size())); result.append(QString("%1) (TO {%2}").arg(recipients).arg(recipients.size())); @@ -1845,11 +1845,11 @@ QStringList SearchMessageState::convertValue(const QVariant &value, const QMailM case QMailMessageKey::Subject: { _utf8 |= !(isPrintable(value.toString())); QString subject = value.toString().toUtf8(); //utf8 is backwards compatible with 7 bit ascii - if(comparer == QMailKey::Equal || comparer == QMailKey::Includes) { + if (comparer == QMailKey::Equal || comparer == QMailKey::Includes) { QStringList result = QStringList(QString("SUBJECT {%1}").arg(subject.size())); result.append(QString("%1").arg(QString(subject))); return result; - } else if(comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { + } else if (comparer == QMailKey::NotEqual || comparer == QMailKey::Excludes) { QStringList result = QStringList(QString("NOT (SUBJECT {%1}").arg(subject.size())); result.append(QString("%1)").arg(QString(subject))); return result; @@ -1871,15 +1871,15 @@ QStringList SearchMessageState::convertValue(const QVariant &value, const QMailM case QMailMessageKey::Size: { int size = value.toInt(); - if(comparer == QMailKey::GreaterThan) + if (comparer == QMailKey::GreaterThan) return QStringList(QString("LARGER %1").arg(size)); - else if(comparer == QMailKey::LessThan) + else if (comparer == QMailKey::LessThan) return QStringList(QString("SMALLER %1").arg(size)); - else if(comparer == QMailKey::GreaterThanEqual) + else if (comparer == QMailKey::GreaterThanEqual) return QStringList(QString("LARGER %1").arg(size-1)); // imap has no >= search, so convert it to a > - else if(comparer == QMailKey::LessThanEqual) + else if (comparer == QMailKey::LessThanEqual) return QStringList(QString("SMALLER %1").arg(size+1)); // ..same with <= - else if(comparer == QMailKey::Equal) // ..cause real men know how many bytes they're looking for + else if (comparer == QMailKey::Equal) // ..cause real men know how many bytes they're looking for return QStringList(QString("LARGER %1 SMALLER %2").arg(size-1).arg(size+1)); else qWarning() << "Unknown comparer: " << comparer << "for size"; @@ -1939,7 +1939,7 @@ QStringList SearchMessageState::convertKey(const QMailMessageKey &key) if (!searchKey.isEmpty()) subSearchKeys.append(searchKey); } - if(!subSearchKeys.isEmpty()) { + if (!subSearchKeys.isEmpty()) { result += combine(subSearchKeys, combiner); } @@ -1951,7 +1951,7 @@ QStringList SearchMessageState::combine(const QList<QStringList> &searchKeys, co Q_ASSERT(searchKeys.size() >= 1); if (searchKeys.size() == 1) { return searchKeys.first(); - } else if(combiner == QMailKey::And) { + } else if (combiner == QMailKey::And) { // IMAP uses AND so just add a space and we're good to go! QStringList result = searchKeys.first(); for (int i = 1 ; i < searchKeys.count() ; i++) { @@ -1967,7 +1967,7 @@ QStringList SearchMessageState::combine(const QList<QStringList> &searchKeys, co } } return result; - } else if(combiner == QMailKey::Or) { + } else if (combiner == QMailKey::Or) { QStringList result; for (int i = 0 ; i < searchKeys.count() ; i++) { @@ -1989,8 +1989,8 @@ QStringList SearchMessageState::combine(const QList<QStringList> &searchKeys, co } return result; - } else if(combiner == QMailKey::None) { - if(searchKeys.count() != 1) { + } else if (combiner == QMailKey::None) { + if (searchKeys.count() != 1) { qWarning() << "Attempting to combine more than thing, without a combiner?"; return QStringList(); } else { @@ -3337,7 +3337,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 3aa81b1e..2904b23b 100644 --- a/src/plugins/messageservices/imap/imapservice.cpp +++ b/src/plugins/messageservices/imap/imapservice.cpp @@ -216,7 +216,7 @@ bool ImapService::Source::retrieveFolderList(const QMailAccountId &accountId, co _service->_client->strategyContext()->foldersOnlyStrategy.setDescending(descending); _service->_client->strategyContext()->foldersOnlyStrategy.setIgnoreSyncFlag(true); appendStrategy(&_service->_client->strategyContext()->foldersOnlyStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -308,7 +308,7 @@ bool ImapService::Source::retrieveMessageLists(const QMailAccountId &accountId, _service->_client->strategyContext()->retrieveMessageListStrategy.selectedFoldersAppend(folderIds); _service->_client->strategyContext()->retrieveMessageListStrategy.setIgnoreSyncFlag(!_folderIds.isEmpty()); appendStrategy(&_service->_client->strategyContext()->retrieveMessageListStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -330,7 +330,7 @@ bool ImapService::Source::retrieveMessages(const QMailMessageIdList &messageIds, _service->_client->strategyContext()->updateMessagesFlagsStrategy.clearSelection(); _service->_client->strategyContext()->updateMessagesFlagsStrategy.selectedMailsAppend(messageIds); appendStrategy(&_service->_client->strategyContext()->updateMessagesFlagsStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -356,7 +356,7 @@ bool ImapService::Source::retrieveMessages(const QMailMessageIdList &messageIds, appendStrategy(&_service->_client->strategyContext()->selectedStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -393,7 +393,7 @@ bool ImapService::Source::retrieveMessagePart(const QMailMessagePart::Location & _service->_client->strategyContext()->selectedStrategy.setOperation(_service->_client->strategyContext(), QMailRetrievalAction::Content); _service->_client->strategyContext()->selectedStrategy.selectedSectionsAppend(partLocation); appendStrategy(&_service->_client->strategyContext()->selectedStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -434,7 +434,7 @@ bool ImapService::Source::retrieveMessageRange(const QMailMessageId &messageId, _service->_client->strategyContext()->selectedStrategy.setOperation(_service->_client->strategyContext(), QMailRetrievalAction::Content); _service->_client->strategyContext()->selectedStrategy.selectedSectionsAppend(location, minimum); appendStrategy(&_service->_client->strategyContext()->selectedStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -476,7 +476,7 @@ bool ImapService::Source::retrieveMessagePartRange(const QMailMessagePart::Locat _service->_client->strategyContext()->selectedStrategy.selectedSectionsAppend(partLocation, minimum); appendStrategy(&_service->_client->strategyContext()->selectedStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -501,7 +501,7 @@ bool ImapService::Source::retrieveAll(const QMailAccountId &accountId) _service->_client->strategyContext()->retrieveAllStrategy.setOperation(_service->_client->strategyContext(), QMailRetrievalAction::Auto); _service->_client->strategyContext()->retrieveAllStrategy.setIgnoreSyncFlag(false); appendStrategy(&_service->_client->strategyContext()->retrieveAllStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -550,7 +550,7 @@ bool ImapService::Source::exportUpdates(const QMailAccountId &accountId) _service->_client->strategyContext()->exportUpdatesStrategy.clearSelection(); appendStrategy(&_service->_client->strategyContext()->exportUpdatesStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -577,7 +577,7 @@ bool ImapService::Source::synchronize(const QMailAccountId &accountId) _service->_client->strategyContext()->synchronizeAccountStrategy.setOperation(_service->_client->strategyContext(), QMailRetrievalAction::Auto); _service->_client->strategyContext()->synchronizeAccountStrategy.setIgnoreSyncFlag(false); appendStrategy(&_service->_client->strategyContext()->synchronizeAccountStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -657,7 +657,7 @@ bool ImapService::Source::doDelete(const QMailMessageIdList &ids) _service->_client->strategyContext()->deleteMessagesStrategy.setLocalMessageRemoval(true); _service->_client->strategyContext()->deleteMessagesStrategy.selectedMailsAppend(ids); appendStrategy(&_service->_client->strategyContext()->deleteMessagesStrategy, SIGNAL(messagesDeleted(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -688,7 +688,7 @@ bool ImapService::Source::copyMessages(const QMailMessageIdList &messageIds, con _service->_client->strategyContext()->copyMessagesStrategy.clearSelection(); _service->_client->strategyContext()->copyMessagesStrategy.appendMessageSet(messageIds, destinationId); appendStrategy(&_service->_client->strategyContext()->copyMessagesStrategy, SIGNAL(messagesCopied(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -719,7 +719,7 @@ bool ImapService::Source::moveMessages(const QMailMessageIdList &messageIds, con _service->_client->strategyContext()->moveMessagesStrategy.clearSelection(); _service->_client->strategyContext()->moveMessagesStrategy.appendMessageSet(messageIds, destinationId); appendStrategy(&_service->_client->strategyContext()->moveMessagesStrategy, SIGNAL(messagesMoved(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -738,7 +738,7 @@ bool ImapService::Source::moveMessages(const QMailMessageIdList &messageIds, con _service->_client->strategyContext()->deleteMessagesStrategy.setLocalMessageRemoval(false); _service->_client->strategyContext()->deleteMessagesStrategy.selectedMailsAppend(serverMessages); appendStrategy(&_service->_client->strategyContext()->deleteMessagesStrategy); - if(!_unavailable) + if (!_unavailable) initiateStrategy(); } } @@ -806,7 +806,7 @@ bool ImapService::Source::flagMessages(const QMailMessageIdList &messageIds, qui appendStrategy(&_service->_client->strategyContext()->moveMessagesStrategy, SIGNAL(messagesFlagged(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; @@ -823,7 +823,7 @@ bool ImapService::Source::flagMessages(const QMailMessageIdList &messageIds, qui } appendStrategy(&_service->_client->strategyContext()->moveMessagesStrategy, SIGNAL(messagesFlagged(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -862,7 +862,7 @@ bool ImapService::Source::flagMessages(const QMailMessageIdList &messageIds, qui _service->_client->strategyContext()->moveMessagesStrategy.appendMessageSet(moveIds, sentId); appendStrategy(&_service->_client->strategyContext()->moveMessagesStrategy, SIGNAL(messagesFlagged(QMailMessageIdList))); } - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); else return true; } @@ -879,7 +879,7 @@ bool ImapService::Source::flagMessages(const QMailMessageIdList &messageIds, qui _service->_client->strategyContext()->moveMessagesStrategy.clearSelection(); _service->_client->strategyContext()->moveMessagesStrategy.appendMessageSet(messageIds, draftId); appendStrategy(&_service->_client->strategyContext()->moveMessagesStrategy, SIGNAL(messagesFlagged(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -945,7 +945,7 @@ bool ImapService::Source::flagMessages(const QMailMessageIdList &messageIds, qui } _service->_client->strategyContext()->flagMessagesStrategy.selectedMailsAppend(messageIds); appendStrategy(&_service->_client->strategyContext()->flagMessagesStrategy, SIGNAL(messagesFlagged(QMailMessageIdList))); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -972,7 +972,7 @@ bool ImapService::Source::createFolder(const QString &name, const QMailAccountId } //here we'll create a QMailFolder and give it to the strategy //if it is successful, we'll let it register it as a real folder in the QMailStore - if(name.isEmpty()) { + if (name.isEmpty()) { _service->errorOccurred(QMailServiceAction::Status::ErrInvalidData, tr("Cannot create empty named folder")); return false; } @@ -980,7 +980,7 @@ bool ImapService::Source::createFolder(const QString &name, const QMailAccountId _service->_client->strategyContext()->createFolderStrategy.createFolder(parentId, name, matchFolderRequired); appendStrategy(&_service->_client->strategyContext()->createFolderStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -1040,7 +1040,7 @@ bool ImapService::Source::createStandardFolders(const QMailAccountId &accountId) appendStrategy(&_service->_client->strategyContext()->createFolderStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -1053,7 +1053,7 @@ bool ImapService::Source::deleteFolder(const QMailFolderId &folderId) return false; } - if(!folderId.isValid()) { + if (!folderId.isValid()) { _service->errorOccurred(QMailServiceAction::Status::ErrInvalidData, tr("Deleting invalid folder")); return false; } @@ -1065,7 +1065,7 @@ bool ImapService::Source::deleteFolder(const QMailFolderId &folderId) //remove remote copy _service->_client->strategyContext()->deleteFolderStrategy.deleteFolder(folderId); appendStrategy(&_service->_client->strategyContext()->deleteFolderStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -1078,11 +1078,11 @@ bool ImapService::Source::renameFolder(const QMailFolderId &folderId, const QStr return false; } - if(name.isEmpty()) { + if (name.isEmpty()) { _service->errorOccurred(QMailServiceAction::Status::ErrInvalidData, tr("Cannot rename to an empty folder")); return false; } - if(!folderId.isValid()) { + if (!folderId.isValid()) { _service->errorOccurred(QMailServiceAction::Status::ErrInvalidData, tr("Cannot rename an invalid folder")); return false; } @@ -1090,7 +1090,7 @@ bool ImapService::Source::renameFolder(const QMailFolderId &folderId, const QStr _service->_client->strategyContext()->renameFolderStrategy.renameFolder(folderId, name); appendStrategy(&_service->_client->strategyContext()->renameFolderStrategy); - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } @@ -1150,7 +1150,7 @@ bool ImapService::Source::searchMessages(const QMailMessageKey &searchCriteria, return false; } - if(searchCriteria.isEmpty() && bodyText.isEmpty()) { + if (searchCriteria.isEmpty() && bodyText.isEmpty()) { //we're not going to do an empty search (which returns all emails..) _service->errorOccurred(QMailServiceAction::Status::ErrInvalidData, tr("Empty search provided")); return false; @@ -1158,7 +1158,7 @@ bool ImapService::Source::searchMessages(const QMailMessageKey &searchCriteria, _service->_client->strategyContext()->searchMessageStrategy.searchArguments(searchCriteria, bodyText, limit, sort, count); appendStrategy(&_service->_client->strategyContext()->searchMessageStrategy); - if(!_unavailable) + if (!_unavailable) initiateStrategy(); return true; } @@ -1172,7 +1172,7 @@ bool ImapService::Source::cancelSearch() _service->_client->strategyContext()->searchMessageStrategy.cancelSearch(); appendStrategy(&_service->_client->strategyContext()->searchMessageStrategy); - if(!_unavailable) + if (!_unavailable) initiateStrategy(); return true; } @@ -1236,7 +1236,7 @@ bool ImapService::Source::prepareMessages(const QList<QPair<QMailMessagePart::Lo _service->_client->strategyContext()->externalizeMessagesStrategy.appendMessageSet(externaliseIds, sentId); appendStrategy(&_service->_client->strategyContext()->externalizeMessagesStrategy, SIGNAL(messagesPrepared(QMailMessageIdList))); } - if(!_unavailable) + if (!_unavailable) return initiateStrategy(); return true; } diff --git a/src/plugins/messageservices/imap/imapstrategy.cpp b/src/plugins/messageservices/imap/imapstrategy.cpp index 8f4cf44a..10ef5802 100644 --- a/src/plugins/messageservices/imap/imapstrategy.cpp +++ b/src/plugins/messageservices/imap/imapstrategy.cpp @@ -707,10 +707,10 @@ void ImapStrategy::selectFolder(ImapStrategyContextBase *context, const QMailFol /* A strategy to create a folder */ void ImapCreateFolderStrategy::transition(ImapStrategyContextBase* context, const ImapCommand cmd, const OperationStatus op) { - if(op != OpOk) + if (op != OpOk) qWarning() << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch(cmd) + switch (cmd) { case IMAP_Login: handleLogin(context); @@ -741,7 +741,7 @@ void ImapCreateFolderStrategy::handleCreate(ImapStrategyContextBase *context) void ImapCreateFolderStrategy::process(ImapStrategyContextBase *context) { - while(_folders.count() > 0) { + while (_folders.count() > 0) { QPair<QMailFolderId, QString> folder = _folders.takeFirst(); _inProgress++; context->protocol().sendCreate(folder.first, folder.second); @@ -772,10 +772,10 @@ void ImapCreateFolderStrategy::folderCreated(ImapStrategyContextBase *context, c /* A strategy to delete a folder */ void ImapDeleteFolderStrategy::transition(ImapStrategyContextBase* context, const ImapCommand cmd, const OperationStatus op) { - if(op != OpOk) + if (op != OpOk) qWarning() << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch(cmd) + switch (cmd) { case IMAP_Login: handleLogin(context); @@ -805,7 +805,7 @@ void ImapDeleteFolderStrategy::handleDelete(ImapStrategyContextBase *context) void ImapDeleteFolderStrategy::process(ImapStrategyContextBase *context) { - while(_folderIds.count() > 0) { + while (_folderIds.count() > 0) { deleteFolder(_folderIds.takeFirst(), context); } } @@ -845,10 +845,10 @@ void ImapDeleteFolderStrategy::folderDeleted(ImapStrategyContextBase *context, c /* A strategy to rename a folder */ void ImapRenameFolderStrategy::transition(ImapStrategyContextBase* context, const ImapCommand cmd, const OperationStatus op) { - if(op != OpOk) + if (op != OpOk) qWarning() << "IMAP Response to cmd:" << cmd << " is not ok: " << op; - switch(cmd) + switch (cmd) { case IMAP_Login: handleLogin(context); @@ -878,7 +878,7 @@ void ImapRenameFolderStrategy::handleRename(ImapStrategyContextBase *context) void ImapRenameFolderStrategy::process(ImapStrategyContextBase *context) { - while(_folderNewNames.count() > 0) { + while (_folderNewNames.count() > 0) { const QPair<QMailFolderId, QString> &folderId_name = _folderNewNames.takeFirst(); _inProgress++; context->protocol().sendRename(QMailFolder(folderId_name.first), folderId_name.second); @@ -897,10 +897,10 @@ void ImapRenameFolderStrategy::folderRenamed(ImapStrategyContextBase *context, c qWarning() << "IMAP folder rename failed"; return; // don't call context->operationCompleted in case of error } - if(!context->protocol().delimiter().isNull()) { + if (!context->protocol().delimiter().isNull()) { //only update if we're dealing with a hierarchical system QChar delimiter = context->protocol().delimiter(); - if(folder.path().count(delimiter) == 0) { + if (folder.path().count(delimiter) == 0) { name = newPath; } else { name = newPath.section(delimiter, -1, -1); @@ -925,7 +925,7 @@ void ImapRenameFolderStrategy::folderRenamed(ImapStrategyContextBase *context, c newFolder.setPath(newPath); newFolder.setDisplayName(QMailCodec::decodeModifiedUtf7(name)); - if(!QMailStore::instance()->updateFolder(&newFolder)) + if (!QMailStore::instance()->updateFolder(&newFolder)) qWarning() << "Unable to locally rename folder"; if (_inProgress == 0) context->operationCompleted(); @@ -1049,7 +1049,7 @@ void ImapPrepareMessagesStrategy::newConnection(ImapStrategyContextBase *context void ImapPrepareMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus) { - switch( command ) { + switch ( command ) { case IMAP_Login: { handleLogin(context); @@ -1258,7 +1258,7 @@ void ImapMessageListStrategy::checkUidValidity(ImapStrategyContextBase *context) void ImapMessageListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus) { - switch( command ) { + switch ( command ) { case IMAP_Login: { handleLogin(context); @@ -1794,7 +1794,7 @@ void ImapFetchSelectedMessagesStrategy::newConnection(ImapStrategyContextBase *c void ImapFetchSelectedMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_UIDFetch: { handleUidFetch(context); @@ -1945,7 +1945,7 @@ void ImapSearchMessageStrategy::cancelSearch() void ImapSearchMessageStrategy::transition(ImapStrategyContextBase *c, ImapCommand cmd, OperationStatus status) { - switch(cmd) { + switch (cmd) { case IMAP_Search_Message: handleSearchMessage(c); break; @@ -1959,7 +1959,7 @@ void ImapSearchMessageStrategy::folderListCompleted(ImapStrategyContextBase *con _mailboxList = context->client()->mailboxIds(); ImapRetrieveFolderListStrategy::folderListCompleted(context); - if(_currentMailbox.id().isValid()) { + if (_currentMailbox.id().isValid()) { _searches.removeFirst(); _limit = -1; _count = false; @@ -1979,7 +1979,7 @@ void ImapSearchMessageStrategy::folderListCompleted(ImapStrategyContextBase *con void ImapSearchMessageStrategy::folderListFolderAction(ImapStrategyContextBase *context) { - if(_canceled) + if (_canceled) return; //stop it searching SearchData search(_searches.first()); @@ -1990,7 +1990,7 @@ void ImapSearchMessageStrategy::folderListFolderAction(ImapStrategyContextBase * bool ImapSearchMessageStrategy::messageFetched(ImapStrategyContextBase *context, QMailMessage &message) { - if(_canceled) + if (_canceled) return false; message.setStatus(QMailMessage::Temporary, true); @@ -2007,7 +2007,7 @@ void ImapSearchMessageStrategy::messageFlushed(ImapStrategyContextBase *context, void ImapSearchMessageStrategy::handleUidFetch(ImapStrategyContextBase *context) { - if(_canceled) + if (_canceled) return; QMailMessageBuffer::instance()->flush(); @@ -2019,7 +2019,7 @@ void ImapSearchMessageStrategy::handleUidFetch(ImapStrategyContextBase *context) void ImapSearchMessageStrategy::handleSearchMessage(ImapStrategyContextBase *context) { - if(_canceled) + if (_canceled) return; const ImapMailboxProperties &properties(context->mailbox()); @@ -2043,7 +2043,7 @@ void ImapSearchMessageStrategy::handleSearchMessage(ImapStrategyContextBase *con context->messagesCount(properties.searchCount); - if(!searchResults.isEmpty()) + if (!searchResults.isEmpty()) context->matchingMessageIds(searchResults); int limit(_limit); @@ -2059,7 +2059,7 @@ void ImapSearchMessageStrategy::handleSearchMessage(ImapStrategyContextBase *con } } - if(uidsToFetch.isEmpty()) + if (uidsToFetch.isEmpty()) processNextFolder(context); else context->protocol().sendUidFetch(MetaDataFetchFlags, uidsToFetch.toString()); @@ -2067,7 +2067,7 @@ void ImapSearchMessageStrategy::handleSearchMessage(ImapStrategyContextBase *con void ImapSearchMessageStrategy::messageListCompleted(ImapStrategyContextBase *context) { - if(_currentMailbox.id().isValid()) { + if (_currentMailbox.id().isValid()) { context->operationCompleted(); } } @@ -2095,7 +2095,7 @@ void ImapFolderListStrategy::newConnection(ImapStrategyContextBase *context) void ImapFolderListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_List: { handleList(context); @@ -2233,7 +2233,7 @@ bool ImapFolderListStrategy::nextFolder() void ImapFolderListStrategy::processFolder(ImapStrategyContextBase *context) { QMailFolderId folderId = _currentMailbox.id(); - if(_folderStatus.contains(folderId) && _folderStatus[folderId] & NoSelect) + if (_folderStatus.contains(folderId) && _folderStatus[folderId] & NoSelect) context->protocol().sendList(_currentMailbox, QString('%')); else selectFolder(context, _currentMailbox); @@ -2684,7 +2684,7 @@ void ImapSynchronizeAllStrategy::setOptions(Options options) void ImapSynchronizeAllStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_UIDSearch: { handleUidSearch(context); @@ -2715,7 +2715,7 @@ void ImapSynchronizeAllStrategy::handleUidSearch(ImapStrategyContextBase *contex { const ImapMailboxProperties &properties(context->mailbox()); - switch(_searchState) + switch (_searchState) { case Seen: { @@ -3319,7 +3319,7 @@ QMailMessageIdList ImapUpdateMessagesFlagsStrategy::selectedMails() void ImapUpdateMessagesFlagsStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_UIDSearch: { handleUidSearch(context); @@ -3359,7 +3359,7 @@ void ImapUpdateMessagesFlagsStrategy::handleUidSearch(ImapStrategyContextBase *c { const ImapMailboxProperties &properties(context->mailbox()); - switch(_searchState) + switch (_searchState) { case Unseen: { @@ -3443,7 +3443,7 @@ void ImapUpdateMessagesFlagsStrategy::processFolder(ImapStrategyContextBase *con QMailFolderId folderId(_currentMailbox.id()); //not not try select an unselectable mailbox - if(!_folderStatus.contains(folderId) || !(_folderStatus.value(folderId) & NoSelect)) + if (!_folderStatus.contains(folderId) || !(_folderStatus.value(folderId) & NoSelect)) selectFolder(context, _currentMailbox); } @@ -3498,7 +3498,7 @@ void ImapRetrieveMessageListStrategy::setAccountCheck(bool check) void ImapRetrieveMessageListStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_FetchFlags: { handleFetchFlags(context); @@ -4063,7 +4063,7 @@ void ImapCopyMessagesStrategy::newConnection(ImapStrategyContextBase *context) void ImapCopyMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_UIDCopy: { handleUidCopy(context); @@ -4372,7 +4372,7 @@ void ImapCopyMessagesStrategy::selectMessageSet(ImapStrategyContextBase *context void ImapMoveMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_Examine: { handleExamine(context); @@ -4513,7 +4513,7 @@ void ImapExternalizeMessagesStrategy::newConnection(ImapStrategyContextBase *con void ImapExternalizeMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_GenUrlAuth: { handleGenUrlAuth(context); @@ -4639,7 +4639,7 @@ void ImapFlagMessagesStrategy::setMessageFlags(MessageFlags flags, bool set) void ImapFlagMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_UIDStore: { handleUidStore(context); @@ -4699,7 +4699,7 @@ void ImapDeleteMessagesStrategy::clearSelection() void ImapDeleteMessagesStrategy::transition(ImapStrategyContextBase *context, ImapCommand command, OperationStatus status) { - switch( command ) { + switch ( command ) { case IMAP_Close: { handleClose(context); diff --git a/src/plugins/messageservices/imap/imaptransport.cpp b/src/plugins/messageservices/imap/imaptransport.cpp index c02cc389..f49ce537 100644 --- a/src/plugins/messageservices/imap/imaptransport.cpp +++ b/src/plugins/messageservices/imap/imaptransport.cpp @@ -325,8 +325,8 @@ void ImapTransport::test() // Mainly aiming to test for bounday conditions // So make the compression/decompression buffers about the same size as the input/output QByteArray data("This\n is some test data.\r\n The quick brown fox jumps over the lazy dog. 0123456789.\r\n"); - for(int i = 10; i <= 100; ++ i) { - for(int j = 10; i <= 100; ++ i) { + for (int i = 10; i <= 100; ++ i) { + for (int j = 10; i <= 100; ++ i) { for (int k = 10; k <= 100; ++k) { Rfc1951Compressor compressor(i); Rfc1951Decompressor decompressor(j); diff --git a/src/plugins/messageservices/imap/integerregion.cpp b/src/plugins/messageservices/imap/integerregion.cpp index b3edc3fb..de3c978c 100644 --- a/src/plugins/messageservices/imap/integerregion.cpp +++ b/src/plugins/messageservices/imap/integerregion.cpp @@ -103,7 +103,7 @@ IntegerRegion::IntegerRegion(const QString &uidString) int b = s.mid(index+1).toInt(&ok); if (!ok) continue; - for(int i = a; i <= b; ++i) { + for (int i = a; i <= b; ++i) { // could be optimized if union is implemented add(i); } diff --git a/src/plugins/messageservices/imap/serviceactionqueue.cpp b/src/plugins/messageservices/imap/serviceactionqueue.cpp index d835e24f..654badd6 100644 --- a/src/plugins/messageservices/imap/serviceactionqueue.cpp +++ b/src/plugins/messageservices/imap/serviceactionqueue.cpp @@ -78,7 +78,7 @@ void ServiceActionQueue::activityChanged(QMailServiceAction::Activity activity) void ServiceActionQueue::clear() { - for(int i = 0; i < _commands.size(); ++i) { + for (int i = 0; i < _commands.size(); ++i) { delete _commands.takeFirst(); ++i; } diff --git a/src/plugins/messageservices/pop/popclient.cpp b/src/plugins/messageservices/pop/popclient.cpp index 42f9ce1a..fa257087 100644 --- a/src/plugins/messageservices/pop/popclient.cpp +++ b/src/plugins/messageservices/pop/popclient.cpp @@ -321,7 +321,7 @@ bool PopClient::findInbox() childFolder.setStatus(QMailFolder::Incoming, true); childFolder.setStatus(QMailFolder::MessagesPermitted, true); - if(!QMailStore::instance()->addFolder(&childFolder)) + if (!QMailStore::instance()->addFolder(&childFolder)) qWarning() << "Unable to add child folder to pop account"; folderId = childFolder.id(); account.setStandardFolder(QMailFolder::InboxFolder, folderId); @@ -1267,7 +1267,7 @@ void PopClient::retrieveOperationCompleted() // Only update PartialContent flag when retrieving message list QMailFolder folder(folderId); folder.setStatus(QMailFolder::PartialContent, partialContent); - if(!QMailStore::instance()->updateFolder(&folder)) + if (!QMailStore::instance()->updateFolder(&folder)) qWarning() << "Unable to update folder" << folder.id() << "to set PartialContent"; } diff --git a/src/tools/messageserver/messageserver.cpp b/src/tools/messageserver/messageserver.cpp index 9eefa1ac..28164f96 100644 --- a/src/tools/messageserver/messageserver.cpp +++ b/src/tools/messageserver/messageserver.cpp @@ -268,7 +268,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/servicehandler.cpp b/src/tools/messageserver/servicehandler.cpp index 89349520..a8314d76 100644 --- a/src/tools/messageserver/servicehandler.cpp +++ b/src/tools/messageserver/servicehandler.cpp @@ -1120,7 +1120,7 @@ const char* requestTypeNames[] = void ServiceHandler::dispatchRequest() { QList<Request>::iterator request(mRequests.begin()); - while(request != mRequests.end()) + while (request != mRequests.end()) { if (!servicesAvailable(*request)) { ++request; @@ -2411,7 +2411,7 @@ void ServiceHandler::restoreToPreviousFolder(quint64 action, const QMailMessageK void ServiceHandler::onlineCreateFolder(quint64 action, const QString &name, const QMailAccountId &accountId, const QMailFolderId &parentId) { - if(accountId.isValid()) { + if (accountId.isValid()) { QSet<QMailAccountId> accounts; if (parentId.isValid()) { @@ -2436,7 +2436,7 @@ bool ServiceHandler::dispatchOnlineCreateFolder(quint64 action, const QByteArray deserialize(data, name, accountId, parentId); - if(QMailMessageSource *source = accountSource(accountId)) { + if (QMailMessageSource *source = accountSource(accountId)) { bool success(sourceService.value(source)->usesConcurrentActions() ? source->createFolder(name, accountId, parentId, action) : source->createFolder(name, accountId, parentId)); @@ -2455,7 +2455,7 @@ bool ServiceHandler::dispatchOnlineCreateFolder(quint64 action, const QByteArray void ServiceHandler::onlineRenameFolder(quint64 action, const QMailFolderId &folderId, const QString &name) { - if(folderId.isValid()) { + if (folderId.isValid()) { QSet<QMailAccountId> accounts = folderAccount(folderId); QSet<QMailMessageService *> sources(sourceServiceSet(accounts)); @@ -2472,7 +2472,7 @@ bool ServiceHandler::dispatchOnlineRenameFolder(quint64 action, const QByteArray deserialize(data, folderId, newFolderName); - if(QMailMessageSource *source = accountSource(QMailFolder(folderId).parentAccountId())) { + if (QMailMessageSource *source = accountSource(QMailFolder(folderId).parentAccountId())) { bool success(sourceService.value(source)->usesConcurrentActions() ? source->renameFolder(folderId, newFolderName, action) : source->renameFolder(folderId, newFolderName)); @@ -2491,7 +2491,7 @@ bool ServiceHandler::dispatchOnlineRenameFolder(quint64 action, const QByteArray void ServiceHandler::onlineDeleteFolder(quint64 action, const QMailFolderId &folderId) { - if(folderId.isValid()) { + if (folderId.isValid()) { QSet<QMailAccountId> accounts = folderAccount(folderId); QSet<QMailMessageService *> sources(sourceServiceSet(accounts)); @@ -2507,8 +2507,8 @@ bool ServiceHandler::dispatchOnlineDeleteFolder(quint64 action, const QByteArray deserialize(data, folderId); - if(QMailMessageSource *source = accountSource(QMailFolder(folderId).parentAccountId())) { - if(source->deleteFolder(folderId)) { + if (QMailMessageSource *source = accountSource(QMailFolder(folderId).parentAccountId())) { + if (source->deleteFolder(folderId)) { return true; } else { qWarning() << "Unable to service request to delete folder id:" << folderId; @@ -2679,7 +2679,7 @@ void ServiceHandler::listActions() { QMailActionDataList list; - for(QMap<quint64, ActionData>::iterator i(mActiveActions.begin()) ; i != mActiveActions.end(); ++i) + for (QMap<quint64, ActionData>::iterator i(mActiveActions.begin()) ; i != mActiveActions.end(); ++i) { QMailActionData t(i.key(), i->description, i->progressTotal, i->progressCurrent, i->status.errorCode, i->status.text, diff --git a/tests/tst_qlogsystem/tst_qlogsystem.cpp b/tests/tst_qlogsystem/tst_qlogsystem.cpp index ac639168..e30a539a 100644 --- a/tests/tst_qlogsystem/tst_qlogsystem.cpp +++ b/tests/tst_qlogsystem/tst_qlogsystem.cpp @@ -87,7 +87,7 @@ tst_QLogSystem::~tst_QLogSystem() void tst_QLogSystem::initTestCase() { // this file will be regenerated in each test - if(QFile::exists("./LoggersTest.log")) + if (QFile::exists("./LoggersTest.log")) QVERIFY2(QFile::remove("./LoggersTest.log"), "could not delete log file"); } @@ -102,7 +102,7 @@ void tst_QLogSystem::init() void tst_QLogSystem::cleanup() { - if(QFile::exists("./LoggersTest.log")) + if (QFile::exists("./LoggersTest.log")) QVERIFY2(QFile::remove("./LoggersTest.log"), "could not delete log file"); } Q_DECLARE_METATYPE(LogLevel) diff --git a/tests/tst_qmaillog/tst_qmaillog.cpp b/tests/tst_qmaillog/tst_qmaillog.cpp index 44775b0c..1714f344 100644 --- a/tests/tst_qmaillog/tst_qmaillog.cpp +++ b/tests/tst_qmaillog/tst_qmaillog.cpp @@ -91,7 +91,7 @@ public: void set_ready(bool ready) { - if(ready) + if (ready) setReady(); else setUnReady("TestBaseLoggerFoundation"); diff --git a/tests/tst_qmailstore/tst_qmailstore.cpp b/tests/tst_qmailstore/tst_qmailstore.cpp index 3bfb57d5..279fc1bd 100644 --- a/tests/tst_qmailstore/tst_qmailstore.cpp +++ b/tests/tst_qmailstore/tst_qmailstore.cpp @@ -1568,7 +1568,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)); @@ -1593,7 +1593,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)); |