Git commit 0504f430c98101435cb066fb390a00f5ce2c7fdc by Kevin Krammer. Committed on 27/12/2012 at 20:14. Pushed by krake into branch 'master'. Several EBN Krazy fixes Fixing various issues found by the EnglishBreakfastNetwork's code checker Krazy. Submitted by Kyle Morris , completing a Google Code-in task. CCMAIL: codeinkyle@gmail.com REVIEW: 107953 DIGEST: Google Code-in contribution M +12 -7 korganizer/akonadicollectionview.cpp M +5 -4 korganizer/kocheckableproxymodel.cpp M +0 -3 korganizer/korgac/koalarmclient.cpp M +20 -15 korganizer/views/todoview/incidencetreemodel.cpp M +2 -1 korganizer/views/todoview/kotodoview.cpp M +1 -1 pimcommon/aclentrydialog_p.h M +1 -1 pimcommon/aclmanager.h M +1 -1 pimsettingexporter/backupmailkernel.h M +1 -1 plugins/messageviewer/bodypartformatter/attendeeselector.h M +1 -1 plugins/messageviewer/bodypartformatter/delegateselector.h M +1 -1 strigi-analyzer/ctg/ctgendanalyzer.h M +1 -1 strigi-analyzer/ctg/kmpsearcher.h M +1 -1 strigi-analyzer/ics/icsendanalyzer.h M +1 -1 strigi-analyzer/mail/mailendanalyzer.h M +1 -1 strigi-analyzer/vcf/vcfendanalyzer.h http://commits.kde.org/kdepim/0504f430c98101435cb066fb390a00f5ce2c7fdc diff --git a/korganizer/akonadicollectionview.cpp b/korganizer/akonadicolle= ctionview.cpp index d40b09e..2d957d4 100644 --- a/korganizer/akonadicollectionview.cpp +++ b/korganizer/akonadicollectionview.cpp @@ -367,9 +367,9 @@ AkonadiCollectionView::~AkonadiCollectionView() void AkonadiCollectionView::restoreTreeState() { static QPointer treeStateRestorer; - if ( treeStateRestorer ) // We don't need more than one to be running at= the same time + if ( treeStateRestorer ) {// We don't need more than one to be running a= t the same time delete treeStateRestorer; - + } treeStateRestorer =3D new Akonadi::ETMViewStateSaver(); // not a leak KConfigGroup group( KOGlobals::self()->config(), "CollectionTreeView" ); treeStateRestorer->setView( mCollectionview ); @@ -607,8 +607,9 @@ Akonadi::Collection AkonadiCollectionView::selectedColl= ection() const { Akonadi::Collection collection; QItemSelectionModel *selectionModel =3D mCollectionview->selectionModel(= ); - if ( !selectionModel ) + if ( !selectionModel ) { return collection; + } QModelIndexList indexes =3D selectionModel->selectedIndexes(); if ( !indexes.isEmpty() ) { collection =3D indexes.first().data( Akonadi::EntityTreeModel::Collect= ionRole ).value(); @@ -619,11 +620,13 @@ Akonadi::Collection AkonadiCollectionView::selectedCo= llection() const Akonadi::Collection::List AkonadiCollectionView::checkedCollections() const { Akonadi::Collection::List collections; - if ( !mSelectionProxyModel ) + if ( !mSelectionProxyModel ) { return collections; + } QItemSelectionModel *selectionModel =3D mSelectionProxyModel->selectionM= odel(); - if ( !selectionModel ) + if ( !selectionModel ) { return collections; + } QModelIndexList indexes =3D selectionModel->selectedIndexes(); foreach( const QModelIndex &index, indexes ) { if ( index.isValid() ) { @@ -640,8 +643,9 @@ Akonadi::EntityTreeModel *AkonadiCollectionView::entity= TreeModel() const QAbstractProxyModel *proxy =3D qobject_cast( mColl= ectionview->model() ); while( proxy ) { Akonadi::EntityTreeModel *etm =3D qobject_cast( proxy->sourceModel() ); - if ( etm ) + if ( etm ) { return etm; + } proxy =3D qobject_cast( proxy->sourceModel() ); } = @@ -662,8 +666,9 @@ void AkonadiCollectionView::checkNewCalendar( const QMo= delIndex &parent, int beg } } = - if ( parent.isValid() ) + if ( parent.isValid() ) { mCollectionview->setExpanded( parent, true ); + } } = #include "akonadicollectionview.moc" // for EntityModelStateSaver Q_PRIVAT= E_SLOT diff --git a/korganizer/kocheckableproxymodel.cpp b/korganizer/kocheckablep= roxymodel.cpp index b8b1071..27316e9 100644 --- a/korganizer/kocheckableproxymodel.cpp +++ b/korganizer/kocheckableproxymodel.cpp @@ -32,15 +32,16 @@ KOCheckableProxyModel::KOCheckableProxyModel( QObject *= parent ) : KCheckableProx bool KOCheckableProxyModel::setData( const QModelIndex &index, const QVariant &value, int role ) { - Qt::CheckState newState =3D static_cast (value.toInt() ); - if ( role =3D=3D Qt::CheckStateRole && index.column() =3D=3D 0 ) + Qt::CheckState newState =3D static_cast ( value.toInt() = ); + if ( role =3D=3D Qt::CheckStateRole && index.column() =3D=3D 0 ) { emit aboutToToggle( newState ); + } = const bool result =3D KCheckableProxyModel::setData( index, value, role = ); = - if ( result ) + if ( result ) { emit toggled( newState ); - + } return result; } = diff --git a/korganizer/korgac/koalarmclient.cpp b/korganizer/korgac/koalar= mclient.cpp index 7c54ef7..a5f69f9 100644 --- a/korganizer/korgac/koalarmclient.cpp +++ b/korganizer/korgac/koalarmclient.cpp @@ -167,7 +167,6 @@ void KOAlarmClient::deferredInit() checkAlarms(); } = - bool KOAlarmClient::dockerEnabled() { KConfig korgConfig( KStandardDirs::locate( "config", "korganizerrc" ) ); @@ -175,7 +174,6 @@ bool KOAlarmClient::dockerEnabled() return generalGroup.readEntry( "ShowReminderDaemon", true ); } = - bool KOAlarmClient::collectionsAvailable() { // The list of collections must be available. @@ -198,7 +196,6 @@ bool KOAlarmClient::collectionsAvailable() return true; } = - void KOAlarmClient::checkAlarms() { KConfigGroup cfg( KGlobal::config(), "General" ); diff --git a/korganizer/views/todoview/incidencetreemodel.cpp b/korganizer/= views/todoview/incidencetreemodel.cpp index 46bcf43..adbadba 100644 --- a/korganizer/views/todoview/incidencetreemodel.cpp +++ b/korganizer/views/todoview/incidencetreemodel.cpp @@ -74,8 +74,9 @@ static PreNode::List sortedPrenodes( const PreNode::List = &nodes ) } } = - if ( !foundAtLeastOne ) + if ( !foundAtLeastOne ) { break; + } } = PreNode::List sorted =3D nodes; @@ -117,9 +118,9 @@ void IncidenceTreeModel::Private::dumpTree() = QModelIndex IncidenceTreeModel::Private::indexForNode( const Node::Ptr &no= de ) const { - if ( !node ) + if ( !node ) { return QModelIndex(); - + } const int row =3D node->parentNode ? node->parentNode->directChilds.inde= xOf( node ) : m_toplevelNodeList.indexOf( node ); = @@ -129,8 +130,9 @@ QModelIndex IncidenceTreeModel::Private::indexForNode( = const Node::Ptr &node ) c = void IncidenceTreeModel::Private::reset( bool silent ) { - if ( !silent ) + if ( !silent ) { q->beginResetModel(); + } m_toplevelNodeList.clear(); m_nodeMap.clear(); m_itemByUid.clear(); @@ -140,12 +142,14 @@ void IncidenceTreeModel::Private::reset( bool silent ) const int sourceCount =3D q->sourceModel()->rowCount(); for ( int i=3D0; iinciden= ce->mimeType() ) ) + if ( m_mimeTypes.isEmpty() || m_mimeTypes.contains( prenode->inciden= ce->mimeType() ) ) { insertNode( prenode, /**silent=3D*/true ); + } } } - if ( !silent ) + if ( !silent ) { q->endResetModel(); + } } = void IncidenceTreeModel::Private::onHeaderDataChanged( Qt::Orientation ori= entation, int first, int last ) @@ -290,8 +294,9 @@ void IncidenceTreeModel::Private::onRowsInserted( const= QModelIndex &parent, int for ( int i=3Dbegin; i<=3Dend; ++i ) { PreNode::Ptr node =3D prenodeFromSourceRow( i ); // if m_mimeTypes is empty, we ignore this feature - if ( !m_mimeTypes.isEmpty() && !m_mimeTypes.contains( node->incidence-= >mimeType() ) ) + if ( !m_mimeTypes.isEmpty() && !m_mimeTypes.contains( node->incidence-= >mimeType() ) ) { continue; + } nodes << node; } = @@ -399,13 +404,12 @@ void IncidenceTreeModel::Private::insertNode( const P= reNode::Ptr &prenode, bool } } = - - // Sorts childs first parents last Node::List IncidenceTreeModel::Private::sorted( const Node::List &nodes ) = const { - if ( nodes.isEmpty() ) + if ( nodes.isEmpty() ) { return nodes; + } = // Initialize depths foreach( const Node::Ptr &topLevelNode, m_toplevelNodeList ) @@ -601,16 +605,17 @@ int IncidenceTreeModel::rowCount( const QModelIndex &= parent ) const = int IncidenceTreeModel::columnCount( const QModelIndex &parent ) const { - if ( parent.isValid() ) + if ( parent.isValid() ) { Q_ASSERT( parent.model() =3D=3D this ); - + } return sourceModel() ? sourceModel()->columnCount() : 1; } = void IncidenceTreeModel::setSourceModel( QAbstractItemModel *model ) { - if ( model =3D=3D sourceModel() ) + if ( model =3D=3D sourceModel() ) { return; + } = beginResetModel(); = @@ -698,9 +703,9 @@ QModelIndex IncidenceTreeModel::mapFromSource( const QM= odelIndex &sourceIndex ) return QModelIndex(); } = - if ( !sourceModel() ) + if ( !sourceModel() ) { return QModelIndex(); - + } Q_ASSERT( sourceIndex.column() < sourceModel()->columnCount() ); Q_ASSERT( sourceModel() =3D=3D sourceIndex.model() ); const Akonadi::Item::Id id =3D sourceIndex.data( Akonadi::EntityTreeMode= l::ItemIdRole ).toLongLong(); diff --git a/korganizer/views/todoview/kotodoview.cpp b/korganizer/views/to= doview/kotodoview.cpp index 65cdaae..4307a44 100644 --- a/korganizer/views/todoview/kotodoview.cpp +++ b/korganizer/views/todoview/kotodoview.cpp @@ -1154,8 +1154,9 @@ void KOTodoView::restoreViewState() return; } = - if ( sModels->todoTreeModel && !sModels->todoTreeModel->sourceModel() ) + if ( sModels->todoTreeModel && !sModels->todoTreeModel->sourceModel() ) { return; + } = //QElapsedTimer timer; //timer.start(); diff --git a/pimcommon/aclentrydialog_p.h b/pimcommon/aclentrydialog_p.h index f85147b..4e8b372 100644 --- a/pimcommon/aclentrydialog_p.h +++ b/pimcommon/aclentrydialog_p.h @@ -39,7 +39,7 @@ class AclEntryDialog : public KDialog * * @param parent The parent widget. */ - AclEntryDialog( QWidget *parent =3D 0 ); + explicit AclEntryDialog( QWidget *parent =3D 0 ); = /** * Destroys the ACL entry dialog. diff --git a/pimcommon/aclmanager.h b/pimcommon/aclmanager.h index 788306f..aa10eaf 100644 --- a/pimcommon/aclmanager.h +++ b/pimcommon/aclmanager.h @@ -49,7 +49,7 @@ class PIMCOMMON_EXPORT AclManager : public QObject * * @param parent The parent object. */ - AclManager( QObject *parent =3D 0 ); + explicit AclManager( QObject *parent =3D 0 ); = /** * Destroys the ACL manager. diff --git a/pimsettingexporter/backupmailkernel.h b/pimsettingexporter/bac= kupmailkernel.h index 999c2e6..1fb141e 100644 --- a/pimsettingexporter/backupmailkernel.h +++ b/pimsettingexporter/backupmailkernel.h @@ -31,7 +31,7 @@ class FolderCollectionMonitor; class BackupMailKernel : public QObject, public MailCommon::IKernel, publi= c MailCommon::ISettings { public: - BackupMailKernel( QObject *parent =3D 0 ); + explicit BackupMailKernel( QObject *parent =3D 0 ); = virtual KPIMIdentities::IdentityManager *identityManager(); virtual MessageSender *msgSender(); diff --git a/plugins/messageviewer/bodypartformatter/attendeeselector.h b/p= lugins/messageviewer/bodypartformatter/attendeeselector.h index 92b4eb9..a7cb989 100644 --- a/plugins/messageviewer/bodypartformatter/attendeeselector.h +++ b/plugins/messageviewer/bodypartformatter/attendeeselector.h @@ -30,7 +30,7 @@ class AttendeeSelector : public KDialog { Q_OBJECT public: - AttendeeSelector( QWidget *parent =3D 0 ); + explicit AttendeeSelector( QWidget *parent =3D 0 ); = QStringList attendees() const; = diff --git a/plugins/messageviewer/bodypartformatter/delegateselector.h b/p= lugins/messageviewer/bodypartformatter/delegateselector.h index eed2d5e..59fc386 100644 --- a/plugins/messageviewer/bodypartformatter/delegateselector.h +++ b/plugins/messageviewer/bodypartformatter/delegateselector.h @@ -37,7 +37,7 @@ class DelegateSelector : public KDialog Q_OBJECT = public: - DelegateSelector( QWidget *parent =3D 0 ); + explicit DelegateSelector( QWidget *parent =3D 0 ); = QString delegate() const; bool rsvp() const; diff --git a/strigi-analyzer/ctg/ctgendanalyzer.h b/strigi-analyzer/ctg/ctg= endanalyzer.h index 50764d9..40f8549 100644 --- a/strigi-analyzer/ctg/ctgendanalyzer.h +++ b/strigi-analyzer/ctg/ctgendanalyzer.h @@ -37,7 +37,7 @@ class CtgEndAnalyzerFactory; class PIMSTRIGI_ANALYZER_EXPORT CtgEndAnalyzer : public Strigi::StreamEndA= nalyzer { public: - CtgEndAnalyzer( const CtgEndAnalyzerFactory *factory ); + explicit CtgEndAnalyzer( const CtgEndAnalyzerFactory *factory ); = const char* name() const; bool checkHeader( const char* header, qint32 headersize ) const; diff --git a/strigi-analyzer/ctg/kmpsearcher.h b/strigi-analyzer/ctg/kmpsea= rcher.h index 8effab4..20235fe 100644 --- a/strigi-analyzer/ctg/kmpsearcher.h +++ b/strigi-analyzer/ctg/kmpsearcher.h @@ -39,7 +39,7 @@ private: qint32 maxlen; public: KmpSearcher() :table(0) { } - KmpSearcher(const std::string& query); + explicit KmpSearcher(const std::string& query); ~KmpSearcher() { if (table) { free(table); diff --git a/strigi-analyzer/ics/icsendanalyzer.h b/strigi-analyzer/ics/ics= endanalyzer.h index 9c6db11..709f1ba 100644 --- a/strigi-analyzer/ics/icsendanalyzer.h +++ b/strigi-analyzer/ics/icsendanalyzer.h @@ -35,7 +35,7 @@ class IcsEndAnalyzerFactory; class PIMSTRIGI_ANALYZER_EXPORT IcsEndAnalyzer : public Strigi::StreamEndA= nalyzer { public: - IcsEndAnalyzer( const IcsEndAnalyzerFactory *factory ); + explicit IcsEndAnalyzer( const IcsEndAnalyzerFactory *factory ); = const char* name() const; bool checkHeader( const char* header, qint32 headersize ) const; diff --git a/strigi-analyzer/mail/mailendanalyzer.h b/strigi-analyzer/mail/= mailendanalyzer.h index 000cfd6..b94fba3 100644 --- a/strigi-analyzer/mail/mailendanalyzer.h +++ b/strigi-analyzer/mail/mailendanalyzer.h @@ -60,7 +60,7 @@ class PIMSTRIGI_ANALYZER_EXPORT MailEndAnalyzer : public = Strigi::StreamEndAnalyz TypeField }; = - MailEndAnalyzer( const MailEndAnalyzerFactory *factory ); + explicit MailEndAnalyzer( const MailEndAnalyzerFactory *factory ); ~MailEndAnalyzer(); = const char* name() const; diff --git a/strigi-analyzer/vcf/vcfendanalyzer.h b/strigi-analyzer/vcf/vcf= endanalyzer.h index 426d6d9..aa066c4 100644 --- a/strigi-analyzer/vcf/vcfendanalyzer.h +++ b/strigi-analyzer/vcf/vcfendanalyzer.h @@ -36,7 +36,7 @@ class VcfEndAnalyzerFactory; class PIMSTRIGI_ANALYZER_EXPORT VcfEndAnalyzer : public Strigi::StreamEndA= nalyzer { public: - VcfEndAnalyzer( const VcfEndAnalyzerFactory *factory ); + explicit VcfEndAnalyzer( const VcfEndAnalyzerFactory *factory ); = const char* name() const; bool checkHeader( const char* header, qint32 headersize ) const;