Commit d24a917f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent 2efa4d16
Pipeline #32692 passed with stage
in 37 minutes and 11 seconds
......@@ -53,7 +53,6 @@ static QDBusInterface *searchEkigaDBusInterface()
QEkigaDialer::QEkigaDialer(const QString &applicationName)
: QDialer(applicationName)
, mInterface(nullptr)
{
}
......
......@@ -54,7 +54,6 @@ static QDBusInterface *searchSkypeDBusInterface()
QSkypeDialer::QSkypeDialer(const QString &applicationName)
: QDialer(applicationName)
, mInterface(nullptr)
{
}
......
......@@ -36,8 +36,6 @@ public:
Private(AkonadiContactEditor::Mode mode, AkonadiContactEditor::DisplayMode displayMode, ContactEditor::AbstractContactEditorWidget *editorWidget, AkonadiContactEditor *parent)
: mParent(parent)
, mMode(mode)
, mMonitor(nullptr)
, mReadOnly(false)
{
if (editorWidget) {
mEditorWidget = editorWidget;
......
......@@ -33,7 +33,6 @@ class Q_DECL_HIDDEN ContactEditorDialog::Private
public:
Private(ContactEditorDialog::Mode mode, ContactEditorDialog::DisplayMode displaymode, ContactEditor::AbstractContactEditorWidget *editorWidget, ContactEditorDialog *parent)
: q(parent)
, mAddressBookBox(nullptr)
, mMode(mode)
{
QWidget *mainWidget = new QWidget(q);
......@@ -124,7 +123,7 @@ public:
group.sync();
}
ContactEditorDialog *q;
ContactEditorDialog *const q;
CollectionComboBox *mAddressBookBox = nullptr;
ContactEditorDialog::Mode mMode;
AkonadiContactEditor *mEditor = nullptr;
......
......@@ -33,10 +33,7 @@ class Q_DECL_HIDDEN ContactGroupEditorDialog::Private
public:
Private(ContactGroupEditorDialog *qq, ContactGroupEditorDialog::Mode mode)
: q(qq)
, mAddressBookBox(nullptr)
, mEditor(nullptr)
, mMode(mode)
, okButton(nullptr)
{
}
......@@ -65,7 +62,7 @@ public:
group.sync();
}
ContactGroupEditorDialog *q;
ContactGroupEditorDialog *const q;
CollectionComboBox *mAddressBookBox = nullptr;
ContactGroupEditor *mEditor = nullptr;
ContactGroupEditorDialog::Mode mMode;
......
......@@ -20,17 +20,11 @@
using namespace Akonadi;
struct GroupMember {
GroupMember()
: isReference(false)
, loadingError(false)
{
}
KContacts::ContactGroup::ContactReference reference;
KContacts::ContactGroup::Data data;
KContacts::Addressee referencedContact;
bool isReference;
bool loadingError;
bool isReference = false;
bool loadingError = false;
};
class Q_DECL_HIDDEN ContactGroupModel::Private
......
......@@ -34,8 +34,6 @@ class Q_DECL_HIDDEN ContactGroupViewer::Private
public:
Private(ContactGroupViewer *parent)
: mParent(parent)
, mExpandJob(nullptr)
, mParentCollectionFetchJob(nullptr)
{
mBrowser = new TextBrowser;
......
......@@ -25,15 +25,13 @@ class Q_DECL_HIDDEN ContactsFilterProxyModel::Private
public:
Private()
: flags({})
, matchFilterFlag(ContactsFilterProxyModel::MatchFilterContactFlag::All)
, mExcludeVirtualCollections(false)
{
}
QString mFilter;
ContactsFilterProxyModel::FilterFlags flags;
ContactsFilterProxyModel::MatchFilterContactFlag matchFilterFlag;
bool mExcludeVirtualCollections;
ContactsFilterProxyModel::MatchFilterContactFlag matchFilterFlag = ContactsFilterProxyModel::MatchFilterContactFlag::All;
bool mExcludeVirtualCollections = false;
};
ContactsFilterProxyModel::ContactsFilterProxyModel(QObject *parent)
......
......@@ -229,7 +229,7 @@ public:
QMetaObject::Connection mCollectionFetchJobConnection;
KContacts::Addressee mCurrentContact;
Item mCurrentItem;
ContactViewer *mParent = nullptr;
ContactViewer *const mParent;
TextBrowser *mBrowser = nullptr;
AbstractContactFormatter *mContactFormatter = nullptr;
AbstractContactFormatter *mStandardContactFormatter = nullptr;
......
......@@ -26,7 +26,6 @@ class Q_DECL_HIDDEN ContactViewerDialog::Private
public:
Private(ContactViewerDialog *parent)
: q(parent)
, mViewer(nullptr)
{
}
......@@ -48,7 +47,7 @@ public:
group.sync();
}
ContactViewerDialog *q = nullptr;
ContactViewerDialog *const q;
ContactViewer *mViewer = nullptr;
};
......
......@@ -22,13 +22,12 @@ class Q_DECL_HIDDEN Akonadi::EmailAddressRequester::Private
public:
Private(EmailAddressRequester *qq)
: q(qq)
, mLineEdit(nullptr)
{
}
void slotAddressBook();
EmailAddressRequester *q = nullptr;
EmailAddressRequester *const q;
KLineEdit *mLineEdit = nullptr;
};
......
......@@ -64,7 +64,7 @@ public:
group.writeEntry("Size", q->size());
}
EmailAddressSelectionDialog *q = nullptr;
EmailAddressSelectionDialog *const q;
RecipientsPickerWidget *mView = nullptr;
};
......
......@@ -59,7 +59,7 @@ protected:
}
private:
QWidget *mReceiver = nullptr;
QWidget *const mReceiver;
};
/**
......
......@@ -122,7 +122,7 @@ public:
q->emitResult();
}
AddContactJob *q = nullptr;
AddContactJob *const q;
KContacts::Addressee mContact;
QWidget *mParentWidget = nullptr;
Akonadi::Collection mCollection;
......
......@@ -264,7 +264,7 @@ public:
}
}
AddEmailAddressJob *q = nullptr;
AddEmailAddressJob *const q;
QString mCompleteAddress;
QString mEmail;
QString mName;
......
......@@ -36,8 +36,6 @@ public:
: q(qq)
, mCompleteAddress(emailString)
, mParentWidget(parentWidget)
, mShowAsHTML(false)
, mRemoteContent(false)
{
KContacts::Addressee::parseEmailAddress(emailString, mName, mEmail);
}
......@@ -251,13 +249,13 @@ public:
q->emitResult();
}
AddEmailDisplayJob *q = nullptr;
AddEmailDisplayJob *const q;
Akonadi::Item contact;
Akonadi::Item::Id messageId;
QString mCompleteAddress;
QString mEmail;
QString mName;
QWidget *mParentWidget = nullptr;
QWidget *const mParentWidget;
bool mShowAsHTML = false;
bool mRemoteContent = false;
};
......
......@@ -80,11 +80,11 @@ public:
q->emitResult();
}
OpenEmailAddressJob *q = nullptr;
OpenEmailAddressJob *const q;
QString mCompleteAddress;
QString mEmail;
QString mName;
QWidget *mParentWidget = nullptr;
QWidget *const mParentWidget;
};
OpenEmailAddressJob::OpenEmailAddressJob(const QString &email, QWidget *parentWidget, QObject *parent)
......
......@@ -18,17 +18,16 @@ class Q_DECL_HIDDEN LeafExtensionProxyModel::Private
public:
Private(LeafExtensionProxyModel *qq)
: q(qq)
, mUniqueKeyCounter(0)
{
}
void sourceRowsInserted(const QModelIndex &parentIndex, int start, int end);
void sourceRowsRemoved(const QModelIndex &parentIndex, int start, int end);
LeafExtensionProxyModel *q = nullptr;
LeafExtensionProxyModel *const q;
QMap<qint64, QModelIndex> mParentIndexes;
QSet<QModelIndex> mOwnIndexes;
qint64 mUniqueKeyCounter;
qint64 mUniqueKeyCounter = 0;
};
void LeafExtensionProxyModel::Private::sourceRowsInserted(const QModelIndex &parentIndex, int start, int end)
......
......@@ -34,7 +34,7 @@ public:
writeConfig();
}
SelectAddressBookDialog *q = nullptr;
SelectAddressBookDialog *const q;
void readConfig();
void writeConfig();
};
......
......@@ -32,8 +32,6 @@ public:
Private(KActionCollection *actionCollection, QWidget *parentWidget, StandardContactActionManager *parent)
: mActionCollection(actionCollection)
, mParentWidget(parentWidget)
, mCollectionSelectionModel(nullptr)
, mItemSelectionModel(nullptr)
, mParent(parent)
{
mGenericManager = new StandardActionManager(actionCollection, parentWidget);
......@@ -515,14 +513,14 @@ public:
KMessageBox::error(mParentWidget, i18n("Contact cannot be stored: %1", error), i18n("Failed to store contact"));
}
KActionCollection *mActionCollection = nullptr;
QWidget *mParentWidget = nullptr;
KActionCollection *const mActionCollection;
QWidget *const mParentWidget;
StandardActionManager *mGenericManager = nullptr;
QItemSelectionModel *mCollectionSelectionModel = nullptr;
QItemSelectionModel *mItemSelectionModel = nullptr;
QHash<StandardContactActionManager::Type, QAction *> mActions;
QSet<StandardContactActionManager::Type> mInterceptedActions;
StandardContactActionManager *mParent = nullptr;
StandardContactActionManager *const mParent;
};
StandardContactActionManager::StandardContactActionManager(KActionCollection *actionCollection, QWidget *parent)
......
......@@ -78,7 +78,7 @@ public:
* connected to its default implementation provided by this class.
* @param type the type of action to create
*/
Q_REQUIRED_RESULT QAction *createAction(Type type);
QAction *createAction(Type type);
/**
* Creates the action of the given type and adds it to the action collection
......
......@@ -13,12 +13,7 @@ using namespace ContactEditor;
class Q_DECL_HIDDEN ContactMetaDataBase::Private
{
public:
Private()
: mDisplayNameMode(-1)
{
}
int mDisplayNameMode;
int mDisplayNameMode = -1;
QVariantList mCustomFieldDescriptions;
};
......
......@@ -32,7 +32,7 @@ public:
private:
AddressLocationWidget *mAddressLocationWidget = nullptr;
QTreeView *mAddressesLocationView = nullptr;
AddressModel *mAddressModel = nullptr;
AddressModel *const mAddressModel;
bool mReadOnly = false;
};
}
......
......@@ -31,7 +31,6 @@ struct LocaleAwareLessThan : std::binary_function<QString, QString, bool> {
AddressLocationWidget::AddressLocationWidget(QWidget *parent)
: QWidget(parent)
, mCurrentAddress(-1)
, mCurrentMode(CreateAddress)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
......
......@@ -69,7 +69,7 @@ private:
QPushButton *mCancelAddress = nullptr;
QStackedWidget *mButtonStack = nullptr;
SelectAddressTypeComboBox *mTypeCombo = nullptr;
int mCurrentAddress;
int mCurrentAddress = -1;
Mode mCurrentMode;
};
......
......@@ -17,8 +17,6 @@ using namespace ContactEditor;
SelectAddressTypeComboBox::SelectAddressTypeComboBox(QWidget *parent)
: QComboBox(parent)
, mType(KContacts::Address::Home)
, mLastSelected(0)
{
const int count = KContacts::Address::typeList().count();
mTypeList.reserve(count + 2);
......
......@@ -53,8 +53,8 @@ private Q_SLOTS:
private:
void update();
KContacts::Address::Type mType;
int mLastSelected;
KContacts::Address::Type mType = KContacts::Address::Home;
int mLastSelected = 0;
QList<int> mTypeList;
};
......
......@@ -19,7 +19,6 @@
FreeBusyEditWidget::FreeBusyEditWidget(QWidget *parent)
: QWidget(parent)
, mReadOnly(false)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
......
......@@ -32,7 +32,7 @@ public:
private:
KUrlRequester *mURL = nullptr;
bool mReadOnly;
bool mReadOnly = false;
};
#endif
......@@ -33,7 +33,6 @@ public:
Private(ContactEditorWidget::DisplayMode displayMode, ContactEditorWidget *parent)
: mDisplayMode(displayMode)
, mParent(parent)
, mCustomFieldsWidget(nullptr)
{
}
......@@ -51,7 +50,7 @@ public:
void storeCustom(KContacts::Addressee &contact, const QString &key, const QString &value) const;
ContactEditorWidget::DisplayMode mDisplayMode;
ContactEditorWidget *mParent = nullptr;
ContactEditorWidget *const mParent;
QTabWidget *mTabWidget = nullptr;
ContactEditor::GeneralInfoWidget *mGeneralInfoWidget = nullptr;
......
......@@ -33,7 +33,7 @@ private:
void removeField(int row, QAbstractItemModel *model);
const QIcon mIcon;
QSize mButtonSize;
QAbstractItemView *mItemView = nullptr;
QAbstractItemView *const mItemView;
};
}
#endif
......@@ -16,8 +16,6 @@ using namespace ContactEditor;
PhoneComboBoxType::PhoneComboBoxType(QWidget *parent)
: ContactEditor::ContactEditorComboBox(parent)
, mType(KContacts::PhoneNumber::Home)
, mLastSelected(0)
{
const int nbMax = KContacts::PhoneNumber::typeList().count();
mTypeList.reserve(nbMax + 1);
......
......@@ -49,8 +49,8 @@ private:
void selected(int);
void otherSelected();
void update();
KContacts::PhoneNumber::Type mType;
int mLastSelected;
KContacts::PhoneNumber::Type mType = KContacts::PhoneNumber::Home;
int mLastSelected = 0;
QList<int> mTypeList;
};
}
......
......@@ -42,8 +42,8 @@ protected:
}
private:
KDatePicker *mDatePicker = nullptr;
QWidget *mOriginalParent = nullptr;
KDatePicker *const mDatePicker;
QWidget *const mOriginalParent;
};
KDatePickerPopup::KDatePickerPopup(Items items, const QDate &date, QWidget *parent)
......
......@@ -34,10 +34,10 @@ class ImageLoader
public:
ImageLoader(QWidget *parent = nullptr);
QImage loadImage(const QUrl &url, bool *ok, bool selectPictureSize = true);
Q_REQUIRED_RESULT QImage loadImage(const QUrl &url, bool *ok, bool selectPictureSize = true);
private:
QWidget *mParent = nullptr;
QWidget *const mParent;
};
ImageLoader::ImageLoader(QWidget *parent)
......
......@@ -22,10 +22,6 @@ class Q_DECL_HIDDEN KWidgetLister::Private
public:
Private(KWidgetLister *qq)
: q(qq)
, mLayout(nullptr)
, mButtonBox(nullptr)
, mMinWidgets(0)
, mMaxWidgets(0)
{
}
......@@ -35,7 +31,7 @@ public:
mWidgetList.clear();
}
KWidgetLister *q = nullptr;
KWidgetLister *const q;
QVBoxLayout *mLayout = nullptr;
QWidget *mButtonBox = nullptr;
QList<QWidget *> mWidgetList;
......
......@@ -14,7 +14,6 @@ using namespace ContactEditor;
PreferredLineEditWidget::PreferredLineEditWidget(QWidget *parent)
: KLineEdit(parent)
, mPreferred(false)
{
mIconEnabled = QIcon::fromTheme(QStringLiteral("rating"));
mIconDisabled = QIcon::fromTheme(QStringLiteral("rating-unrated"));
......
......@@ -30,7 +30,7 @@ Q_SIGNALS:
private:
void slotPreferredStatusChanged();
void updatePreferredIcon();
bool mPreferred;
bool mPreferred = false;
QIcon mIconEnabled;
QIcon mIconDisabled;
QAction *mPreferredAction = nullptr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment