diff options
| author | Pekka Vuorela <pvuorela@iki.fi> | 2025-11-04 09:32:10 +0200 |
|---|---|---|
| committer | Pekka Vuorela <pvuorela@iki.fi> | 2025-11-06 17:36:43 +0200 |
| commit | ced6584c65498661db5012602b0465e293476da0 (patch) | |
| tree | b10b8599bbfbeefa41f8ba84590b8b4aca531c76 /examples | |
| parent | 7e135a5c9305e889003b8c2cebb41633aaba012c (diff) | |
Avoid some more compiler warnings
- Missed earlier one QMessageBox deprecation from separate file
- LongStream now doing consistent open() check in all code paths.
Also removed unused member variable 'c' and moved internal constants
to .cpp.
- imapstrategy.h / ImapMessageListStrategy::selectedSectionsAppend()
was dead code due to derived class ImapFetchSelectedMessagesStrategy
having similar named method with extra parameter and default value.
- ImapService was triggering a couple of -Woverloaded-virtual
warnings due to having extra methods with same name as base class.
These were really used internally so simpler as different named private.
- ImapProtocol / QString::lastIndexOf() was complaining about unused
return value. Using that should be even simpler than accessing regexp
match.
- Some small random warnings on unused parameters, missed switch case etc.
Change-Id: I243c09ab2d551fe2f8be18f1b3a4df2e3d84b55c
Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Reviewed-by: Damien Caliste <dcaliste@free.fr>
Reviewed-by: <matti.viljanen@kapsi.fi>
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/qtmail/attachmentoptions.cpp | 7 | ||||
| -rw-r--r-- | examples/qtmail/emailclient.cpp | 2 | ||||
| -rw-r--r-- | examples/qtmail/qmailcomposer.cpp | 7 | ||||
| -rw-r--r-- | examples/qtmail/qmailviewer.cpp | 2 | ||||
| -rw-r--r-- | examples/serverobserver/serverobserver.cpp | 11 |
5 files changed, 13 insertions, 16 deletions
diff --git a/examples/qtmail/attachmentoptions.cpp b/examples/qtmail/attachmentoptions.cpp index a6c1da5c..c8f55af3 100644 --- a/examples/qtmail/attachmentoptions.cpp +++ b/examples/qtmail/attachmentoptions.cpp @@ -607,11 +607,8 @@ void AttachmentOptions::saveAttachment() _document->setVisible(true); _save->setVisible(false); } else { - QMessageBox mb(tr("Unable to save attachment"), - tr("Please ensure that there is space available for Documents"), - QMessageBox::Warning, - QMessageBox::Ok | QMessageBox::Default, QMessageBox::NoButton, QMessageBox::NoButton); - mb.exec(); + QMessageBox::warning(nullptr, tr("Unable to save attachment"), + tr("Please ensure that there is space available for Documents")); } } diff --git a/examples/qtmail/emailclient.cpp b/examples/qtmail/emailclient.cpp index a6c92b9f..8307c1c6 100644 --- a/examples/qtmail/emailclient.cpp +++ b/examples/qtmail/emailclient.cpp @@ -468,7 +468,7 @@ EmailClient::EmailClient(QWidget *parent, Qt::WindowFlags f) setObjectName( "EmailClient" ); //start messageserver if it's not running - if (!QMail::isMessageServerRunning && !startMessageServer()) + if (!QMail::isMessageServerRunning() && !startMessageServer()) qFatal("Unable to start messageserver!"); //run account setup if we don't have any defined yet diff --git a/examples/qtmail/qmailcomposer.cpp b/examples/qtmail/qmailcomposer.cpp index 35a58c5e..e9eaf97a 100644 --- a/examples/qtmail/qmailcomposer.cpp +++ b/examples/qtmail/qmailcomposer.cpp @@ -319,6 +319,7 @@ QString QMailComposerFactory::defaultKey( QMailMessage::MessageType type ) */ QList<QMailMessage::MessageType> QMailComposerFactory::messageTypes( const QString& key ) { + Q_UNUSED(key) return composerInterface()->messageTypes(); } @@ -329,6 +330,7 @@ QList<QMailMessage::MessageType> QMailComposerFactory::messageTypes( const QStri */ QString QMailComposerFactory::name(const QString &key, QMailMessage::MessageType type) { + Q_UNUSED(key) return composerInterface()->name(type); } @@ -339,6 +341,7 @@ QString QMailComposerFactory::name(const QString &key, QMailMessage::MessageType */ QString QMailComposerFactory::displayName(const QString &key, QMailMessage::MessageType type) { + Q_UNUSED(key) return composerInterface()->displayName(type); } @@ -349,6 +352,7 @@ QString QMailComposerFactory::displayName(const QString &key, QMailMessage::Mess */ QIcon QMailComposerFactory::displayIcon(const QString &key, QMailMessage::MessageType type) { + Q_UNUSED(key) return composerInterface()->displayIcon(type); } @@ -358,7 +362,6 @@ QIcon QMailComposerFactory::displayIcon(const QString &key, QMailMessage::Messag */ QMailComposerInterface *QMailComposerFactory::create( const QString& key, QWidget *parent ) { - Q_UNUSED(parent); + Q_UNUSED(key) return new EmailComposerInterface(parent); } - diff --git a/examples/qtmail/qmailviewer.cpp b/examples/qtmail/qmailviewer.cpp index 180312e1..7ef32988 100644 --- a/examples/qtmail/qmailviewer.cpp +++ b/examples/qtmail/qmailviewer.cpp @@ -332,7 +332,7 @@ QString QMailViewerFactory::defaultKey(QMailMessage::ContentType type, Presentat */ QMailViewerInterface *QMailViewerFactory::create(const QString &key, QWidget *parent) { - Q_UNUSED(parent); + Q_UNUSED(key); return new GenericViewer(parent); } diff --git a/examples/serverobserver/serverobserver.cpp b/examples/serverobserver/serverobserver.cpp index 64a7772d..56051b47 100644 --- a/examples/serverobserver/serverobserver.cpp +++ b/examples/serverobserver/serverobserver.cpp @@ -99,8 +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"); case TransmitMessagesRequestType: @@ -147,12 +146,10 @@ QString RowWidget::requestTypeToString(QMailServerRequestType t) return tr("Listing actions"); case ProtocolRequestRequestType: return tr("Direct protocol request"); - // No default, to get warning when requests added + default: + qWarning() << "Did not handle:" << t; + return tr("Unknown/handled request."); } - - qWarning() << "Did not handle:" << t; - Q_ASSERT(false); - return tr("Unknown/handled request."); } void RowWidget::sendCancel() |
