[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdepim] /: Several EBN Krazy fixes
From: Kevin Krammer <krammer () kde ! org>
Date: 2012-12-28 9:43:28
Message-ID: 20121228094328.29C7EA6091 () git ! kde ! org
[Download RAW message or body]
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 <codeinkyle@gmail.com>, 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/akonadicollectionview.cpp index d40b09e..2d957d4 100644
--- a/korganizer/akonadicollectionview.cpp
+++ b/korganizer/akonadicollectionview.cpp
@@ -367,9 +367,9 @@ AkonadiCollectionView::~AkonadiCollectionView()
void AkonadiCollectionView::restoreTreeState()
{
static QPointer<Akonadi::ETMViewStateSaver> 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 at the \
same time delete treeStateRestorer;
-
+ }
treeStateRestorer = new Akonadi::ETMViewStateSaver(); // not a leak
KConfigGroup group( KOGlobals::self()->config(), "CollectionTreeView" );
treeStateRestorer->setView( mCollectionview );
@@ -607,8 +607,9 @@ Akonadi::Collection AkonadiCollectionView::selectedCollection() \
const {
Akonadi::Collection collection;
QItemSelectionModel *selectionModel = mCollectionview->selectionModel();
- if ( !selectionModel )
+ if ( !selectionModel ) {
return collection;
+ }
QModelIndexList indexes = selectionModel->selectedIndexes();
if ( !indexes.isEmpty() ) {
collection = indexes.first().data( Akonadi::EntityTreeModel::CollectionRole \
).value<Akonadi::Collection>(); @@ -619,11 +620,13 @@ Akonadi::Collection \
AkonadiCollectionView::selectedCollection() const Akonadi::Collection::List \
AkonadiCollectionView::checkedCollections() const {
Akonadi::Collection::List collections;
- if ( !mSelectionProxyModel )
+ if ( !mSelectionProxyModel ) {
return collections;
+ }
QItemSelectionModel *selectionModel = mSelectionProxyModel->selectionModel();
- if ( !selectionModel )
+ if ( !selectionModel ) {
return collections;
+ }
QModelIndexList indexes = selectionModel->selectedIndexes();
foreach( const QModelIndex &index, indexes ) {
if ( index.isValid() ) {
@@ -640,8 +643,9 @@ Akonadi::EntityTreeModel \
*AkonadiCollectionView::entityTreeModel() const QAbstractProxyModel *proxy = \
qobject_cast<QAbstractProxyModel*>( mCollectionview->model() ); while( proxy ) {
Akonadi::EntityTreeModel *etm = qobject_cast<Akonadi::EntityTreeModel*>( \
proxy->sourceModel() );
- if ( etm )
+ if ( etm ) {
return etm;
+ }
proxy = qobject_cast<QAbstractProxyModel*>( proxy->sourceModel() );
}
@@ -662,8 +666,9 @@ void AkonadiCollectionView::checkNewCalendar( const QModelIndex \
&parent, int beg }
}
- if ( parent.isValid() )
+ if ( parent.isValid() ) {
mCollectionview->setExpanded( parent, true );
+ }
}
#include "akonadicollectionview.moc" // for EntityModelStateSaver Q_PRIVATE_SLOT
diff --git a/korganizer/kocheckableproxymodel.cpp \
b/korganizer/kocheckableproxymodel.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 = static_cast<Qt::CheckState> (value.toInt() );
- if ( role == Qt::CheckStateRole && index.column() == 0 )
+ Qt::CheckState newState = static_cast<Qt::CheckState> ( value.toInt() );
+ if ( role == Qt::CheckStateRole && index.column() == 0 ) {
emit aboutToToggle( newState );
+ }
const bool result = KCheckableProxyModel::setData( index, value, role );
- if ( result )
+ if ( result ) {
emit toggled( newState );
-
+ }
return result;
}
diff --git a/korganizer/korgac/koalarmclient.cpp \
b/korganizer/korgac/koalarmclient.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 = nodes;
@@ -117,9 +118,9 @@ void IncidenceTreeModel::Private::dumpTree()
QModelIndex IncidenceTreeModel::Private::indexForNode( const Node::Ptr &node ) const
{
- if ( !node )
+ if ( !node ) {
return QModelIndex();
-
+ }
const int row = node->parentNode ? node->parentNode->directChilds.indexOf( 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 = q->sourceModel()->rowCount();
for ( int i=0; i<sourceCount; ++i ) {
PreNode::Ptr prenode = prenodeFromSourceRow( i );
- if ( m_mimeTypes.isEmpty() || m_mimeTypes.contains( \
prenode->incidence->mimeType() ) ) + if ( m_mimeTypes.isEmpty() || \
m_mimeTypes.contains( prenode->incidence->mimeType() ) ) { insertNode( prenode, \
/**silent=*/true ); + }
}
}
- if ( !silent )
+ if ( !silent ) {
q->endResetModel();
+ }
}
void IncidenceTreeModel::Private::onHeaderDataChanged( Qt::Orientation orientation, \
int first, int last ) @@ -290,8 +294,9 @@ void \
IncidenceTreeModel::Private::onRowsInserted( const QModelIndex &parent, int for ( \
int i=begin; i<=end; ++i ) { PreNode::Ptr node = 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 \
PreNode::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() == this );
-
+ }
return sourceModel() ? sourceModel()->columnCount() : 1;
}
void IncidenceTreeModel::setSourceModel( QAbstractItemModel *model )
{
- if ( model == sourceModel() )
+ if ( model == sourceModel() ) {
return;
+ }
beginResetModel();
@@ -698,9 +703,9 @@ QModelIndex IncidenceTreeModel::mapFromSource( const QModelIndex \
&sourceIndex ) return QModelIndex();
}
- if ( !sourceModel() )
+ if ( !sourceModel() ) {
return QModelIndex();
-
+ }
Q_ASSERT( sourceIndex.column() < sourceModel()->columnCount() );
Q_ASSERT( sourceModel() == sourceIndex.model() );
const Akonadi::Item::Id id = sourceIndex.data( \
Akonadi::EntityTreeModel::ItemIdRole ).toLongLong();
diff --git a/korganizer/views/todoview/kotodoview.cpp \
b/korganizer/views/todoview/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 = 0 );
+ explicit AclEntryDialog( QWidget *parent = 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 = 0 );
+ explicit AclManager( QObject *parent = 0 );
/**
* Destroys the ACL manager.
diff --git a/pimsettingexporter/backupmailkernel.h \
b/pimsettingexporter/backupmailkernel.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, public \
MailCommon::ISettings {
public:
- BackupMailKernel( QObject *parent = 0 );
+ explicit BackupMailKernel( QObject *parent = 0 );
virtual KPIMIdentities::IdentityManager *identityManager();
virtual MessageSender *msgSender();
diff --git a/plugins/messageviewer/bodypartformatter/attendeeselector.h \
b/plugins/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 = 0 );
+ explicit AttendeeSelector( QWidget *parent = 0 );
QStringList attendees() const;
diff --git a/plugins/messageviewer/bodypartformatter/delegateselector.h \
b/plugins/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 = 0 );
+ explicit DelegateSelector( QWidget *parent = 0 );
QString delegate() const;
bool rsvp() const;
diff --git a/strigi-analyzer/ctg/ctgendanalyzer.h \
b/strigi-analyzer/ctg/ctgendanalyzer.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::StreamEndAnalyzer
{
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/kmpsearcher.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/icsendanalyzer.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::StreamEndAnalyzer
{
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/vcfendanalyzer.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::StreamEndAnalyzer
{
public:
- VcfEndAnalyzer( const VcfEndAnalyzerFactory *factory );
+ explicit VcfEndAnalyzer( const VcfEndAnalyzerFactory *factory );
const char* name() const;
bool checkHeader( const char* header, qint32 headersize ) const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic