Commit 3029da1c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Modernize code

parent b8ca5638
Pipeline #193579 passed with stage
in 2 minutes and 29 seconds
......@@ -36,10 +36,10 @@ public:
explicit KAddressBookPlugin(KontactInterface::Core *core, const KPluginMetaData &data, const QVariantList &);
~KAddressBookPlugin() override;
bool isRunningStandalone() const override;
int weight() const override;
Q_REQUIRED_RESULT bool isRunningStandalone() const override;
Q_REQUIRED_RESULT int weight() const override;
QStringList invisibleToolbarActions() const override;
Q_REQUIRED_RESULT QStringList invisibleToolbarActions() const override;
void shortcutChanged() override;
protected:
......
......@@ -18,6 +18,12 @@ using namespace KAddressBookImportExport;
ExportSelectionWidget::ExportSelectionWidget(QWidget *parent)
: QWidget(parent)
, mPrivateBox(new QCheckBox(i18nc("@option:check", "Private fields"), this))
, mBusinessBox(new QCheckBox(i18nc("@option:check", "Business fields"), this))
, mOtherBox(new QCheckBox(i18nc("@option:check", "Other fields"), this))
, mEncryptionKeys(new QCheckBox(i18nc("@option:check", "Encryption keys"), this))
, mPictureBox(new QCheckBox(i18nc("@option:check", "Pictures"), this))
, mDisplayNameBox(new QCheckBox(i18nc("@option:check", "Display name as full name"), this))
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setContentsMargins({});
......@@ -27,35 +33,30 @@ ExportSelectionWidget::ExportSelectionWidget(QWidget *parent)
gbox->setLayout(layout);
gbox->setFlat(true);
mPrivateBox = new QCheckBox(i18nc("@option:check", "Private fields"), this);
mPrivateBox->setToolTip(i18nc("@info:tooltip", "Export private fields"));
mPrivateBox->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"private fields to the vCard output file."));
layout->addWidget(mPrivateBox, 1, 0);
mBusinessBox = new QCheckBox(i18nc("@option:check", "Business fields"), this);
mBusinessBox->setToolTip(i18nc("@info:tooltip", "Export business fields"));
mBusinessBox->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"business fields to the vCard output file."));
layout->addWidget(mBusinessBox, 2, 0);
mOtherBox = new QCheckBox(i18nc("@option:check", "Other fields"), this);
mOtherBox->setToolTip(i18nc("@info:tooltip", "Export other fields"));
mOtherBox->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"other fields to the vCard output file."));
layout->addWidget(mOtherBox, 3, 0);
mEncryptionKeys = new QCheckBox(i18nc("@option:check", "Encryption keys"), this);
mEncryptionKeys->setToolTip(i18nc("@info:tooltip", "Export encryption keys"));
mEncryptionKeys->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"encryption keys to the vCard output file."));
layout->addWidget(mEncryptionKeys, 1, 1);
mPictureBox = new QCheckBox(i18nc("@option:check", "Pictures"), this);
mPictureBox->setToolTip(i18nc("@info:tooltip", "Export pictures"));
mPictureBox->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
......@@ -68,7 +69,6 @@ ExportSelectionWidget::ExportSelectionWidget(QWidget *parent)
auto gbLayout = new QHBoxLayout;
gbox->setLayout(gbLayout);
mDisplayNameBox = new QCheckBox(i18nc("@option:check", "Display name as full name"), this);
mDisplayNameBox->setToolTip(i18nc("@info:tooltip", "Export display name as full name"));
mDisplayNameBox->setWhatsThis(i18nc("@info:whatsthis",
"Check this box if you want to export the contact's display name "
......
......@@ -20,7 +20,15 @@ public:
explicit ExportSelectionWidget(QWidget *parent = nullptr);
~ExportSelectionWidget() override;
enum ExportField { None = 0, Private = 1, Business = 2, Other = 4, Encryption = 8, Picture = 16, DiplayName = 32 };
enum ExportField {
None = 0,
Private = 1,
Business = 2,
Other = 4,
Encryption = 8,
Picture = 16,
DiplayName = 32,
};
Q_ENUM(ExportField)
Q_DECLARE_FLAGS(ExportFields, ExportField)
......@@ -29,11 +37,11 @@ public:
private:
void readSettings();
void writeSettings();
QCheckBox *mPrivateBox = nullptr;
QCheckBox *mBusinessBox = nullptr;
QCheckBox *mOtherBox = nullptr;
QCheckBox *mEncryptionKeys = nullptr;
QCheckBox *mPictureBox = nullptr;
QCheckBox *mDisplayNameBox = nullptr;
QCheckBox *const mPrivateBox;
QCheckBox *const mBusinessBox;
QCheckBox *const mOtherBox;
QCheckBox *const mEncryptionKeys;
QCheckBox *const mPictureBox;
QCheckBox *const mDisplayNameBox;
};
}
......@@ -38,7 +38,6 @@ using namespace KABPrinting;
PrintingWizard::PrintingWizard(QPrinter *printer, QItemSelectionModel *selectionModel, QWidget *parent)
: KAssistantDialog(parent)
, mPrinter(printer)
, mStyle(nullptr)
{
setWindowTitle(i18nc("@title:window", "Print Contacts"));
......
......@@ -18,15 +18,15 @@ using namespace KABPrinting;
PrintProgress::PrintProgress(QWidget *parent)
: QWidget(parent)
, mLogBrowser(new QTextBrowser(this))
, mProgressBar(new QProgressBar(this))
{
setWindowTitle(i18nc("@title:window", "Printing: Progress"));
auto topLayout = new QGridLayout(this);
mLogBrowser = new QTextBrowser(this);
topLayout->addWidget(mLogBrowser, 0, 0);
mProgressBar = new QProgressBar(this);
mProgressBar->setValue(0);
topLayout->addWidget(mProgressBar, 1, 0);
......
......@@ -42,7 +42,7 @@ public:
private:
QStringList mMessages;
QTextBrowser *mLogBrowser = nullptr;
QProgressBar *mProgressBar = nullptr;
QTextBrowser *const mLogBrowser;
QProgressBar *const mProgressBar;
};
}
Supports Markdown
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