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

const'ify pointer

parent 1a17bfcd
Pipeline #146771 failed with stage
in 54 seconds
......@@ -33,7 +33,7 @@ class KAddressBookPlugin : public KontactInterface::Plugin
Q_OBJECT
public:
KAddressBookPlugin(KontactInterface::Core *core, const QVariantList &);
explicit KAddressBookPlugin(KontactInterface::Core *core, const QVariantList &);
~KAddressBookPlugin() override;
bool isRunningStandalone() const override;
......
......@@ -15,18 +15,18 @@
ContactSwitcher::ContactSwitcher(QWidget *parent)
: QWidget(parent)
, mNextButton(new QPushButton(i18nc("@action:button Next contact", "Next"), this))
, mPreviousButton(new QPushButton(i18nc("@action:button Previous contact", "Previous"), this))
, mStatusLabel(new QLabel(this))
{
auto layout = new QHBoxLayout(this);
mPreviousButton = new QPushButton(i18nc("@action:button Previous contact", "Previous"));
mPreviousButton->setToolTip(i18nc("@info:tooltip", "Move to the previous contact in the list"));
mPreviousButton->setWhatsThis(i18nc("@info:whatsthis", "Press this button to move to the previous contact in the list."));
mNextButton = new QPushButton(i18nc("@action:button Next contact", "Next"));
mNextButton->setToolTip(i18nc("@info:tooltip", "Move to the next contact in the list"));
mNextButton->setWhatsThis(i18nc("@info:whatsthis", "Press this button to move to the next contact in the list."));
mStatusLabel = new QLabel();
layout->addWidget(mPreviousButton);
layout->addWidget(mNextButton);
......
......@@ -55,8 +55,8 @@ private:
void updateStatus();
QAbstractItemView *mView = nullptr;
QPushButton *mNextButton = nullptr;
QPushButton *mPreviousButton = nullptr;
QLabel *mStatusLabel = nullptr;
QPushButton *const mNextButton;
QPushButton *const mPreviousButton;
QLabel *const mStatusLabel;
};
......@@ -20,14 +20,14 @@
GlobalContactModel *GlobalContactModel::mInstance = nullptr;
GlobalContactModel::GlobalContactModel()
: mSession(new Akonadi::Session("KAddressBook::GlobalContactSession"))
, mMonitor(new Akonadi::ChangeRecorder)
{
mSession = new Akonadi::Session("KAddressBook::GlobalContactSession");
Akonadi::ItemFetchScope scope;
scope.fetchFullPayload(true);
scope.fetchAttribute<Akonadi::EntityDisplayAttribute>();
mMonitor = new Akonadi::ChangeRecorder;
mMonitor->setSession(mSession);
mMonitor->fetchCollection(true);
mMonitor->setItemFetchScope(scope);
......
......@@ -45,8 +45,8 @@ private:
static GlobalContactModel *mInstance;
Akonadi::Session *mSession = nullptr;
Akonadi::ChangeRecorder *mMonitor = nullptr;
Akonadi::Session *const mSession;
Akonadi::ChangeRecorder *const mMonitor;
Akonadi::ContactsTreeModel *mModel = nullptr;
};
......@@ -19,7 +19,7 @@ class KAddressBookPart : public KParts::Part
Q_OBJECT
public:
KAddressBookPart(QWidget *parentWidget, QObject *parent, const QVariantList &);
explicit KAddressBookPart(QWidget *parentWidget, QObject *parent, const QVariantList &);
~KAddressBookPart() override;
public Q_SLOTS:
......
......@@ -131,11 +131,7 @@ public:
MainWidget::MainWidget(KXMLGUIClient *guiClient, QWidget *parent)
: QWidget(parent)
, mAllContactsModel(nullptr)
, mXmlGuiClient(guiClient)
, mGrantleeThemeManager(nullptr)
, mQuickSearchAction(nullptr)
, mServerSideSubscription(nullptr)
{
(void)new KaddressbookAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/KAddressBook"), this);
......
......@@ -29,8 +29,8 @@
MainWindow::MainWindow()
: KXmlGuiWindow(nullptr)
, mMainWidget(new MainWidget(this, this))
{
mMainWidget = new MainWidget(this, this);
setCentralWidget(mMainWidget);
......
......@@ -33,7 +33,7 @@ private:
void initActions();
void updateHamburgerMenu();
MainWidget *mMainWidget = nullptr;
MainWidget *const mMainWidget;
KToggleAction *mShowMenuBarAction = nullptr;
KHamburgerMenu *mHamburgerMenu = nullptr;
};
......
......@@ -138,7 +138,7 @@ QString contactsToHtml(const KContacts::Addressee::List &contacts, const ColorSe
}
block.header += QLatin1Char(':');
block.entries = address.formattedAddress().split(QLatin1Char('\n'), Qt::KeepEmptyParts);
block.entries = address.formatted(KContacts::AddressFormatStyle::Postal).split(QLatin1Char('\n'), Qt::KeepEmptyParts);
blocks.append(block);
}
}
......
......@@ -78,8 +78,9 @@ static QString contactsToHtml(const KContacts::Addressee::List &contacts, int fi
if (fields & Addresses) {
const KContacts::Address::List addresses = contact.addresses();
for (const KContacts::Address &address : addresses) {
const QString data =
address.formattedAddress().replace(QLatin1String("\n\n"), QStringLiteral("\n")).replace(QLatin1Char('\n'), QStringLiteral("<br/>"));
const QString data = address.formatted(KContacts::AddressFormatStyle::Postal)
.replace(QLatin1String("\n\n"), QStringLiteral("\n"))
.replace(QLatin1Char('\n'), QStringLiteral("<br/>"));
const QString subBlock = QLatin1String("<p style=\"margin-top: 0px; margin-left: 20px\">") + data + QLatin1String("</p>");
leftBlock.append(subBlock);
......
......@@ -20,11 +20,12 @@ using namespace std::chrono_literals;
QuickSearchWidget::QuickSearchWidget(QWidget *parent)
: QWidget(parent)
, mEdit(new QLineEdit(this))
, mTimer(new QTimer(this))
{
auto layout = new QVBoxLayout(this);
layout->setContentsMargins({});
mEdit = new QLineEdit(this);
// If change shortcut changes it in mainwidget
mEdit->setClearButtonEnabled(true);
mEdit->setToolTip(i18nc("@info:tooltip", "Search contacts in list"));
......@@ -36,7 +37,6 @@ QuickSearchWidget::QuickSearchWidget(QWidget *parent)
layout->addWidget(mEdit);
mTimer = new QTimer(this);
connect(mEdit, &QLineEdit::textChanged, this, &QuickSearchWidget::resetTimer);
connect(mTimer, &QTimer::timeout, this, &QuickSearchWidget::delayedTextChanged);
......
......@@ -72,7 +72,7 @@ protected:
private:
void resetTimer();
void delayedTextChanged();
QLineEdit *mEdit = nullptr;
QTimer *mTimer = nullptr;
QLineEdit *const mEdit;
QTimer *const mTimer;
};
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