Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KIdentityManagement
Commits
ca944b70
Commit
ca944b70
authored
Oct 07, 2021
by
Laurent Montel
😁
Browse files
Use unique_ptr here
parent
c10327f8
Pipeline
#86221
passed with stage
in 3 minutes and 54 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/identitycombo.cpp
View file @
ca944b70
...
...
@@ -91,10 +91,7 @@ IdentityCombo::IdentityCombo(IdentityManager *manager, QWidget *parent)
slotUpdateTooltip
(
currentIdentity
());
}
IdentityCombo
::~
IdentityCombo
()
{
delete
d
;
}
IdentityCombo
::~
IdentityCombo
()
=
default
;
QString
IdentityCombo
::
currentIdentityName
()
const
{
...
...
src/identitycombo.h
View file @
ca944b70
...
...
@@ -75,7 +75,7 @@ protected Q_SLOTS:
private:
//@cond PRIVATE
IdentityComboPrivate
*
const
d
;
std
::
unique_ptr
<
IdentityComboPrivate
>
const
d
;
//@endcond
};
}
...
...
src/identitymanager.cpp
View file @
ca944b70
...
...
@@ -52,11 +52,11 @@ static QString newDBusObjectName()
* @internal
*/
//@cond PRIVATE
class
Q_DECL_HIDDEN
KIdentityManagement
::
IdentityManager
::
Private
class
IdentityManagerPrivate
{
public:
Private
(
KIdentityManagement
::
IdentityManager
*
);
~
Private
();
IdentityManager
Private
(
KIdentityManagement
::
IdentityManager
*
);
~
IdentityManager
Private
();
void
writeConfig
()
const
;
void
readConfig
(
KConfig
*
config
);
void
createDefaultIdentity
();
...
...
@@ -74,12 +74,12 @@ public:
KIdentityManagement
::
IdentityManager
*
const
q
;
};
IdentityManager
::
Private
::
Private
(
KIdentityManagement
::
IdentityManager
*
manager
)
IdentityManagerPrivate
::
IdentityManager
Private
(
KIdentityManagement
::
IdentityManager
*
manager
)
:
q
(
manager
)
{
}
void
IdentityManager
::
Private
::
writeConfig
()
const
void
IdentityManagerPrivate
::
writeConfig
()
const
{
const
QStringList
identities
=
groupList
(
mConfig
);
QStringList
::
const_iterator
groupEnd
=
identities
.
constEnd
();
...
...
@@ -87,8 +87,8 @@ void IdentityManager::Private::writeConfig() const
mConfig
->
deleteGroup
(
*
group
);
}
int
i
=
0
;
ConstIterator
end
=
mIdentities
.
constEnd
();
for
(
ConstIterator
it
=
mIdentities
.
constBegin
();
it
!=
end
;
++
it
,
++
i
)
{
IdentityManager
::
ConstIterator
end
=
mIdentities
.
constEnd
();
for
(
IdentityManager
::
ConstIterator
it
=
mIdentities
.
constBegin
();
it
!=
end
;
++
it
,
++
i
)
{
KConfigGroup
cg
(
mConfig
,
QStringLiteral
(
"Identity #%1"
).
arg
(
i
));
(
*
it
).
writeConfig
(
cg
);
if
((
*
it
).
isDefault
())
{
...
...
@@ -107,7 +107,7 @@ void IdentityManager::Private::writeConfig() const
mConfig
->
sync
();
}
void
IdentityManager
::
Private
::
readConfig
(
KConfig
*
config
)
void
IdentityManagerPrivate
::
readConfig
(
KConfig
*
config
)
{
mIdentities
.
clear
();
...
...
@@ -147,7 +147,7 @@ void IdentityManager::Private::readConfig(KConfig *config)
shadowIdentities
=
mIdentities
;
}
void
IdentityManager
::
Private
::
createDefaultIdentity
()
void
IdentityManagerPrivate
::
createDefaultIdentity
()
{
QString
fullName
;
QString
emailAddress
;
...
...
@@ -219,12 +219,12 @@ void IdentityManager::Private::createDefaultIdentity()
}
}
QStringList
IdentityManager
::
Private
::
groupList
(
KConfig
*
config
)
const
QStringList
IdentityManagerPrivate
::
groupList
(
KConfig
*
config
)
const
{
return
config
->
groupList
().
filter
(
QRegularExpression
(
QStringLiteral
(
"^Identity #
\\
d+$"
)));
}
int
IdentityManager
::
Private
::
newUoid
()
int
IdentityManagerPrivate
::
newUoid
()
{
int
uoid
;
...
...
@@ -253,7 +253,7 @@ int IdentityManager::Private::newUoid()
return
uoid
;
}
void
IdentityManager
::
Private
::
slotIdentitiesChanged
(
const
QString
&
id
)
void
IdentityManagerPrivate
::
slotIdentitiesChanged
(
const
QString
&
id
)
{
qCDebug
(
KIDENTITYMANAGEMENT_LOG
)
<<
" KIdentityManagement::IdentityManager::slotIdentitiesChanged :"
<<
id
;
const
QString
ourIdentifier
=
QStringLiteral
(
"%1/%2"
).
arg
(
QDBusConnection
::
sessionBus
().
baseService
(),
q
->
property
(
"uniqueDBusPath"
).
toString
());
...
...
@@ -275,7 +275,7 @@ IdentityManager *IdentityManager::self()
IdentityManager
::
IdentityManager
(
bool
readonly
,
QObject
*
parent
,
const
char
*
name
)
:
QObject
(
parent
)
,
d
(
new
Private
(
this
))
,
d
(
new
IdentityManager
Private
(
this
))
{
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(6, 0, 0)
static
bool
triedMigration
=
false
;
...
...
@@ -356,7 +356,6 @@ IdentityManager::~IdentityManager()
if
(
hasPendingChanges
())
{
qCWarning
(
KIDENTITYMANAGEMENT_LOG
)
<<
"IdentityManager: There were uncommitted changes!"
;
}
delete
d
;
}
QString
IdentityManager
::
makeUnique
(
const
QString
&
name
)
const
...
...
@@ -690,7 +689,7 @@ void KIdentityManagement::IdentityManager::slotRollback()
rollback
();
}
IdentityManager
::
Private
::~
Private
()
IdentityManagerPrivate
::~
IdentityManager
Private
()
{
delete
mConfig
;
}
...
...
src/identitymanager.h
View file @
ca944b70
...
...
@@ -11,9 +11,11 @@
#include <kidentitymanagement_export.h>
#include <QStringList>
#include <memory>
namespace
KIdentityManagement
{
class
IdentityManagerPrivate
;
class
Identity
;
/**
* @short Manages the list of identities.
...
...
@@ -215,8 +217,8 @@ Q_SIGNALS:
private:
//@cond PRIVATE
class
Private
;
Private
*
d
;
friend
class
IdentityManager
Private
;
std
::
unique_ptr
<
IdentityManagerPrivate
>
const
d
;
//@endcond
Q_PRIVATE_SLOT
(
d
,
void
slotIdentitiesChanged
(
const
QString
&
id
))
};
...
...
src/signature.cpp
View file @
ca944b70
...
...
@@ -24,7 +24,7 @@
using
namespace
KIdentityManagement
;
class
Q_DECL_HIDDEN
KIdentityManagement
::
SignaturePrivate
class
KIdentityManagement
::
SignaturePrivate
{
public:
SignaturePrivate
(
Signature
*
qq
)
...
...
@@ -354,10 +354,7 @@ Signature &Signature::operator=(const KIdentityManagement::Signature &that)
return
*
this
;
}
Signature
::~
Signature
()
{
delete
d
;
}
Signature
::~
Signature
()
=
default
;
QString
Signature
::
rawText
(
bool
*
ok
)
const
{
...
...
src/signature.h
View file @
ca944b70
...
...
@@ -14,6 +14,7 @@
#include <QHash>
#include <QImage>
#include <QString>
#include <memory>
namespace
KIdentityManagement
{
...
...
@@ -235,7 +236,7 @@ protected:
private:
//@cond PRIVATE
SignaturePrivate
*
const
d
;
std
::
unique_ptr
<
SignaturePrivate
>
const
d
;
//@endcond
};
...
...
src/signatureconfigurator.cpp
View file @
ca944b70
...
...
@@ -49,10 +49,10 @@ namespace KIdentityManagement
@internal
*/
//@cond PRIVATE
class
Q_DECL_HIDDEN
SignatureConfigurator
::
Private
class
Q_DECL_HIDDEN
SignatureConfiguratorPrivate
{
public:
explicit
Private
(
SignatureConfigurator
*
parent
);
explicit
SignatureConfigurator
Private
(
SignatureConfigurator
*
parent
);
void
init
();
// Returns the current text of the textedit as HTML code, but strips
// unnecessary tags Qt inserts
...
...
@@ -73,13 +73,13 @@ public:
};
//@endcond
SignatureConfigurator
::
Private
::
Private
(
SignatureConfigurator
*
parent
)
SignatureConfiguratorPrivate
::
SignatureConfigurator
Private
(
SignatureConfigurator
*
parent
)
:
q
(
parent
)
,
inlinedHtml
(
true
)
{
}
QString
SignatureConfigurator
::
Private
::
asCleanedHTML
()
const
QString
SignatureConfiguratorPrivate
::
asCleanedHTML
()
const
{
QString
text
=
mTextEdit
->
toHtml
();
...
...
@@ -95,7 +95,7 @@ QString SignatureConfigurator::Private::asCleanedHTML() const
return
text
;
}
void
SignatureConfigurator
::
Private
::
init
()
void
SignatureConfiguratorPrivate
::
init
()
{
auto
vlay
=
new
QVBoxLayout
(
q
);
vlay
->
setObjectName
(
QStringLiteral
(
"main layout"
));
...
...
@@ -263,15 +263,12 @@ void SignatureConfigurator::Private::init()
SignatureConfigurator
::
SignatureConfigurator
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
d
(
new
Private
(
this
))
,
d
(
new
SignatureConfigurator
Private
(
this
))
{
d
->
init
();
}
SignatureConfigurator
::~
SignatureConfigurator
()
{
delete
d
;
}
SignatureConfigurator
::~
SignatureConfigurator
()
=
default
;
bool
SignatureConfigurator
::
isSignatureEnabled
()
const
{
...
...
src/signatureconfigurator.h
View file @
ca944b70
...
...
@@ -12,11 +12,13 @@
#include "kidentitymanagement_export.h"
#include "signature.h" // for Signature::Type
#include <QWidget>
#include <memory>
using
KIdentityManagement
::
Signature
;
namespace
KIdentityManagement
{
class
SignatureConfiguratorPrivate
;
/**
* This widget gives an interface so users can edit their signature.
* You can set a signature via setSignature(), let the user edit the
...
...
@@ -129,8 +131,8 @@ private:
void
slotSetHtml
();
//@cond PRIVATE
class
Private
;
Private
*
const
d
;
friend
class
SignatureConfigurator
Private
;
std
::
unique_ptr
<
SignatureConfigurator
Private
>
const
d
;
//@endcond
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment