Commit 75ff069a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Const'ify pointer + initialize variable in headers

parent 87b3136f
......@@ -26,7 +26,6 @@ KAboutApplicationPersonModel::KAboutApplicationPersonModel(const QList< KAboutPe
QObject *parent)
: QAbstractListModel(parent)
, m_personList(personList)
, m_hasAvatarPixmaps(false)
, m_providerUrl(providerUrl)
{
if (m_providerUrl.isEmpty()) {
......
......@@ -71,13 +71,13 @@ private Q_SLOTS:
private:
void fetchOcsLinkIcons(int personProfileListIndex);
QList< KAboutPerson > m_personList;
const QList< KAboutPerson > m_personList;
QList< KAboutApplicationPersonProfile > m_profileList;
QMap< int, QString > m_ocsLinkIconUrls;
QMap< int, QPixmap > m_ocsLinkIcons;
bool m_hasAvatarPixmaps;
bool m_hasAvatarPixmaps = false;
#if HAVE_ATTICA
Attica::ProviderManager m_providerManager;
......
......@@ -56,17 +56,17 @@ public:
void _k_slotSetFrom();
void _k_updateUrl();
KBugReport *q;
QProcess *m_process;
KBugReport *const q;
QProcess *m_process = nullptr;
KAboutData m_aboutData;
QTextEdit *m_lineedit;
QLineEdit *m_subject;
QLabel *m_from;
QLabel *m_version;
QTextEdit *m_lineedit = nullptr;
QLineEdit *m_subject = nullptr;
QLabel *m_from = nullptr;
QLabel *m_version = nullptr;
QString m_strVersion;
QGroupBox *m_bgSeverity;
QPushButton *m_configureEmail;
QGroupBox *m_bgSeverity = nullptr;
QPushButton *m_configureEmail = nullptr;
QString lastError;
QString kde_version;
......@@ -74,7 +74,7 @@ public:
QString os;
QUrl url;
QList<QRadioButton *> severityButtons;
int currentSeverity()
int currentSeverity() const
{
for (int i = 0; i < severityButtons.count(); i++)
if (severityButtons[i]->isChecked()) {
......
......@@ -135,7 +135,7 @@ public:
*/
QString toolBarText(const QDomElement &it) const;
bool m_isModified;
bool m_isModified = false;
ToolBarList &barList()
{
return m_barList;
......@@ -548,9 +548,7 @@ using namespace KDEPrivate;
class KEditToolBarPrivate
{
public:
KEditToolBarPrivate(KEditToolBar *q): q(q),
m_accept(false), m_global(false),
m_collection(nullptr), m_factory(nullptr), m_widget(nullptr) {}
KEditToolBarPrivate(KEditToolBar *q): q(q) {}
void init();
......@@ -561,17 +559,17 @@ public:
void applyClicked();
void defaultClicked();
KEditToolBar *q;
bool m_accept;
KEditToolBar *const q;
bool m_accept = false;
// Save parameters for recreating widget after resetting toolbar
bool m_global;
KActionCollection *m_collection;
bool m_global = false;
KActionCollection *m_collection = nullptr;
QString m_file;
QString m_defaultToolBar;
KXMLGUIFactory *m_factory;
KEditToolBarWidget *m_widget;
QVBoxLayout *m_layout;
QDialogButtonBox *m_buttonBox;
KXMLGUIFactory *m_factory = nullptr;
KEditToolBarWidget *m_widget = nullptr;
QVBoxLayout *m_layout = nullptr;
QDialogButtonBox *m_buttonBox = nullptr;
};
Q_GLOBAL_STATIC(QString, s_defaultToolBarName)
......
......@@ -39,21 +39,8 @@ class KHelpMenuPrivate
{
public:
KHelpMenuPrivate()
: mSwitchApplicationLanguage(nullptr),
mActionsCreated(false),
mSwitchApplicationLanguageAction(nullptr),
mAboutData(KAboutData::applicationData())
: mAboutData(KAboutData::applicationData())
{
mMenu = nullptr;
mAboutApp = nullptr;
mAboutKDE = nullptr;
mBugReport = nullptr;
mDonateAction = nullptr;
mHandBookAction = nullptr;
mWhatsThisAction = nullptr;
mReportBugAction = nullptr;
mAboutAppAction = nullptr;
mAboutKDEAction = nullptr;
}
~KHelpMenuPrivate()
{
......@@ -66,22 +53,26 @@ public:
void createActions(KHelpMenu *q);
QMenu *mMenu;
QDialog *mAboutApp;
KAboutKdeDialog *mAboutKDE;
KBugReport *mBugReport;
QAction *mDonateAction;
KSwitchLanguageDialog *mSwitchApplicationLanguage;
QMenu *mMenu = nullptr;
QDialog *mAboutApp = nullptr;
KAboutKdeDialog *mAboutKDE = nullptr;
KBugReport *mBugReport = nullptr;
QAction *mDonateAction = nullptr;
KSwitchLanguageDialog *mSwitchApplicationLanguage = nullptr;
// TODO evaluate if we use static_cast<QWidget*>(parent()) instead of mParent to win that bit of memory
QWidget *mParent;
QWidget *mParent = nullptr;
QString mAboutAppText;
bool mShowWhatsThis;
bool mActionsCreated;
bool mShowWhatsThis = false;
bool mActionsCreated = false;
QAction *mHandBookAction, *mWhatsThisAction;
QAction *mReportBugAction, *mSwitchApplicationLanguageAction, *mAboutAppAction, *mAboutKDEAction;
QAction *mHandBookAction = nullptr;
QAction *mWhatsThisAction = nullptr;
QAction *mReportBugAction = nullptr;
QAction *mSwitchApplicationLanguageAction = nullptr;
QAction *mAboutAppAction = nullptr;
QAction *mAboutKDEAction = nullptr;
KAboutData mAboutData;
};
......
......@@ -78,7 +78,7 @@ public:
bool eventFilter(QObject *watched, QEvent *event) override;
private:
KMainWindow *m_win;
KMainWindow *const m_win;
};
DockResizeListener::DockResizeListener(KMainWindow *win) :
......
......@@ -17,8 +17,8 @@
KMainWindowInterface::KMainWindowInterface(KXmlGuiWindow *mainWindow)
: QDBusAbstractAdaptor(mainWindow)
, m_MainWindow(mainWindow)
{
m_MainWindow = mainWindow;
}
KMainWindowInterface::~KMainWindowInterface()
......
......@@ -32,7 +32,7 @@ namespace KDEPrivate
{
KMenuMenuHandler::KMenuMenuHandler(KXMLGUIBuilder *builder)
: QObject(), m_builder(builder), m_popupMenu(nullptr), m_popupAction(nullptr), m_contextMenu(nullptr)
: QObject(), m_builder(builder)
{
m_toolbarAction = new KSelectAction(i18n("Add to Toolbar"), this);
connect(m_toolbarAction, &QAction::triggered,
......
......@@ -42,11 +42,11 @@ private Q_SLOTS:
private:
void showContextMenu(QMenu *menu, const QPoint &pos);
KXMLGUIBuilder *m_builder;
KSelectAction *m_toolbarAction;
QMenu *m_popupMenu;
QAction *m_popupAction;
QMenu *m_contextMenu;
KXMLGUIBuilder *m_builder = nullptr;
KSelectAction *m_toolbarAction = nullptr;
QMenu *m_popupMenu = nullptr;
QAction *m_popupAction = nullptr;
QMenu *m_contextMenu = nullptr;
};
......
......@@ -58,11 +58,7 @@ class Q_DECL_HIDDEN KShortcutsDialog::KShortcutsDialogPrivate
public:
KShortcutsDialogPrivate(KShortcutsDialog *q)
: q(q),
m_keyChooser(nullptr),
m_schemeEditor(nullptr),
m_detailsButton(nullptr),
m_saveSettings(false)
: q(q)
{
}
......@@ -130,11 +126,11 @@ public:
emit q->saved();
}
KShortcutsDialog *q;
KShortcutsEditor *m_keyChooser; // ### move
KShortcutSchemesEditor *m_schemeEditor;
QPushButton *m_detailsButton;
bool m_saveSettings;
KShortcutsDialog *const q;
KShortcutsEditor *m_keyChooser = nullptr; // ### move
KShortcutSchemesEditor *m_schemeEditor = nullptr;
QPushButton *m_detailsButton = nullptr;
bool m_saveSettings = false;
};
KShortcutsDialog::KShortcutsDialog(KShortcutsEditor::ActionTypes types, KShortcutsEditor::LetterShortcuts allowLetterShortcuts, QWidget *parent)
......
......@@ -102,8 +102,8 @@ protected:
bool eventFilter(QObject *, QEvent *) override;
private:
mutable QPersistentModelIndex m_editingIndex;
bool m_allowLetterShortcuts;
QWidget *m_editor;
const bool m_allowLetterShortcuts;
QWidget *m_editor = nullptr;
//! List of actionCollections to check for conflicts.
QList<KActionCollection *> m_checkActionCollections;
......@@ -309,8 +309,8 @@ private:
//@{
//! The original shortcuts before user changes. 0 means no change.
QList<QKeySequence> *m_oldLocalShortcut;
QList<QKeySequence> *m_oldGlobalShortcut;
QList<QKeySequence> *m_oldLocalShortcut = nullptr;
QList<QKeySequence> *m_oldGlobalShortcut = nullptr;
#if 0
KShapeGesture *m_oldShapeGesture;
KRockerGesture *m_oldRockerGesture;
......
......@@ -23,8 +23,7 @@
KShortcutsEditorDelegate::KShortcutsEditorDelegate(QTreeWidget *parent, bool allowLetterShortcuts)
: KExtendableItemDelegate(parent),
m_allowLetterShortcuts(allowLetterShortcuts),
m_editor(nullptr)
m_allowLetterShortcuts(allowLetterShortcuts)
{
Q_ASSERT(qobject_cast<QAbstractItemView *>(parent));
......
......@@ -138,7 +138,7 @@ public:
static Qt::ToolBarArea positionFromString(const QString &position);
static Qt::ToolButtonStyle toolButtonStyleSetting();
KToolBar *q;
KToolBar *const q;
bool isMainToolBar : 1;
#if KXMLGUI_BUILD_DEPRECATED_SINCE(5, 0)
bool enableContext : 1;
......
......@@ -31,10 +31,10 @@ using namespace KDEPrivate;
class KXMLGUIBuilderPrivate
{
public:
KXMLGUIBuilderPrivate() : m_client(nullptr) {}
KXMLGUIBuilderPrivate() {}
~KXMLGUIBuilderPrivate() { }
QWidget *m_widget;
QWidget *m_widget = nullptr;
QString tagMainWindow;
QString tagMenuBar;
......@@ -57,9 +57,9 @@ public:
QString attrIcon;
KXMLGUIClient *m_client;
KXMLGUIClient *m_client = nullptr;
KMenuMenuHandler *m_menumenuhandler;
KMenuMenuHandler *m_menumenuhandler = nullptr;
};
KXMLGUIBuilder::KXMLGUIBuilder(QWidget *widget)
......
......@@ -32,9 +32,6 @@ class KXMLGUIClientPrivate
public:
KXMLGUIClientPrivate()
: m_componentName(QCoreApplication::applicationName()),
m_actionCollection(nullptr),
m_parent(nullptr),
m_builder(nullptr),
m_textTagNames({ QStringLiteral("text"), QStringLiteral("Text"), QStringLiteral("title") })
{
}
......@@ -53,13 +50,13 @@ public:
QString m_componentName;
QDomDocument m_doc;
KActionCollection *m_actionCollection;
KActionCollection *m_actionCollection = nullptr;
QDomDocument m_buildDocument;
QPointer<KXMLGUIFactory> m_factory;
KXMLGUIClient *m_parent;
KXMLGUIClient *m_parent = nullptr;
//QPtrList<KXMLGUIClient> m_supers;
QList<KXMLGUIClient *> m_children;
KXMLGUIBuilder *m_builder;
KXMLGUIBuilder *m_builder = nullptr;
QString m_xmlFile;
QString m_localXMLFile;
const QStringList m_textTagNames;
......
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