diff options
Diffstat (limited to 'examples/qtmail')
-rw-r--r-- | examples/qtmail/accountsettings.cpp | 2 | ||||
-rw-r--r-- | examples/qtmail/attachmentlistwidget.cpp | 48 | ||||
-rw-r--r-- | examples/qtmail/attachmentoptions.cpp | 6 | ||||
-rw-r--r-- | examples/qtmail/detailspage.cpp | 40 | ||||
-rw-r--r-- | examples/qtmail/emailclient.cpp | 60 | ||||
-rw-r--r-- | examples/qtmail/emailcomposer.cpp | 42 | ||||
-rw-r--r-- | examples/qtmail/main.cpp | 2 | ||||
-rw-r--r-- | examples/qtmail/messagelistview.cpp | 14 | ||||
-rw-r--r-- | examples/qtmail/readmail.cpp | 2 | ||||
-rw-r--r-- | examples/qtmail/searchview.cpp | 90 | ||||
-rw-r--r-- | examples/qtmail/statusbar.cpp | 6 | ||||
-rw-r--r-- | examples/qtmail/statusmonitor.cpp | 6 | ||||
-rw-r--r-- | examples/qtmail/statusmonitorwidget.cpp | 8 | ||||
-rw-r--r-- | examples/qtmail/writemail.cpp | 4 |
14 files changed, 165 insertions, 165 deletions
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); |