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
KMail
Commits
f86e0043
Commit
f86e0043
authored
Sep 21, 2020
by
Laurent Montel
😁
Browse files
this class was moved to mailcommon
parent
eceec032
Pipeline
#35095
canceled with stage
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
f86e0043
...
...
@@ -66,7 +66,7 @@ option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
find_package
(
Qt5
${
QT_REQUIRED_VERSION
}
CONFIG REQUIRED DBus Network Test Widgets WebEngine WebEngineWidgets
)
set
(
LIBGRAVATAR_VERSION
"5.15.40"
)
set
(
MAILCOMMON_LIB_VERSION
"5.15.4
2
"
)
set
(
MAILCOMMON_LIB_VERSION
"5.15.4
4
"
)
set
(
MESSAGELIB_LIB_VERSION
"5.15.40"
)
set
(
LIBKLEO_LIB_VERSION
"5.15.40"
)
set
(
PIMCOMMON_LIB_VERSION
"5.15.40"
)
...
...
src/CMakeLists.txt
View file @
f86e0043
...
...
@@ -43,7 +43,6 @@ set(kmailprivate_folderarchive_LIB_SRCS
)
set
(
kmailprivate_collectionpage_LIB_SRCS
collectionpage/collectiontemplatespage.cpp
collectionpage/collectiontemplateswidget.cpp
collectionpage/collectionviewpage.cpp
collectionpage/collectionquotapage.cpp
collectionpage/collectionquotawidget.cpp
...
...
src/collectionpage/collectiontemplatespage.cpp
View file @
f86e0043
...
...
@@ -5,7 +5,7 @@
*/
#include "collectiontemplatespage.h"
#include
"c
ollection
t
emplates
w
idget
.h"
#include
<MailCommon/C
ollection
T
emplates
W
idget
>
#include <MailCommon/MailKernel>
#include <MailCommon/FolderSettings>
...
...
@@ -40,7 +40,7 @@ void CollectionTemplatesPage::init()
{
QVBoxLayout
*
topLayout
=
new
QVBoxLayout
(
this
);
topLayout
->
setContentsMargins
({});
mCollectionTemplateWidget
=
new
CollectionTemplatesWidget
(
this
);
mCollectionTemplateWidget
=
new
MailCommon
::
CollectionTemplatesWidget
(
this
);
topLayout
->
addWidget
(
mCollectionTemplateWidget
);
}
...
...
src/collectionpage/collectiontemplatespage.h
View file @
f86e0043
...
...
@@ -7,8 +7,9 @@
#ifndef COLLECTIONTEMPLATESPAGE_H
#define COLLECTIONTEMPLATESPAGE_H
#include <AkonadiWidgets/collectionpropertiespage.h>
namespace
MailCommon
{
class
CollectionTemplatesWidget
;
}
template
<
typename
T
>
class
QSharedPointer
;
class
CollectionTemplatesPage
:
public
Akonadi
::
CollectionPropertiesPage
...
...
@@ -26,7 +27,7 @@ private:
void
slotCopyGlobal
();
void
slotChanged
();
void
init
();
CollectionTemplatesWidget
*
mCollectionTemplateWidget
=
nullptr
;
MailCommon
::
CollectionTemplatesWidget
*
mCollectionTemplateWidget
=
nullptr
;
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY
(
CollectionTemplatesPageFactory
,
CollectionTemplatesPage
)
...
...
src/collectionpage/collectiontemplateswidget.cpp
deleted
100644 → 0
View file @
eceec032
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "collectiontemplateswidget.h"
#include <KLocalizedString>
#include "templatesconfiguration_kfg.h"
#include <MailCommon/FolderSettings>
#include <QCheckBox>
#include <QSharedPointer>
#include <QVBoxLayout>
#include <TemplateParser/TemplatesConfiguration>
CollectionTemplatesWidget
::
CollectionTemplatesWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QVBoxLayout
*
topLayout
=
new
QVBoxLayout
(
this
);
QHBoxLayout
*
topItems
=
new
QHBoxLayout
;
topItems
->
setContentsMargins
(
0
,
0
,
0
,
0
);
topLayout
->
addLayout
(
topItems
);
mCustom
=
new
QCheckBox
(
i18n
(
"&Use custom message templates in this folder"
),
this
);
connect
(
mCustom
,
&
QCheckBox
::
clicked
,
this
,
&
CollectionTemplatesWidget
::
slotChanged
);
topItems
->
addWidget
(
mCustom
,
Qt
::
AlignLeft
);
mWidget
=
new
TemplateParser
::
TemplatesConfiguration
(
this
,
QStringLiteral
(
"folder-templates"
));
connect
(
mWidget
,
&
TemplateParser
::
TemplatesConfiguration
::
changed
,
this
,
&
CollectionTemplatesWidget
::
slotChanged
);
mWidget
->
setEnabled
(
false
);
// Move the help label outside of the templates configuration widget,
// so that the help can be read even if the widget is not enabled.
topItems
->
addStretch
(
9
);
topItems
->
addWidget
(
mWidget
->
helpLabel
(),
Qt
::
AlignRight
);
topLayout
->
addWidget
(
mWidget
);
QHBoxLayout
*
btns
=
new
QHBoxLayout
();
QPushButton
*
copyGlobal
=
new
QPushButton
(
i18n
(
"&Copy Global Templates"
),
this
);
copyGlobal
->
setEnabled
(
false
);
btns
->
addWidget
(
copyGlobal
);
topLayout
->
addLayout
(
btns
);
connect
(
mCustom
,
&
QCheckBox
::
toggled
,
mWidget
,
&
TemplateParser
::
TemplatesConfiguration
::
setEnabled
);
connect
(
mCustom
,
&
QCheckBox
::
toggled
,
copyGlobal
,
&
QPushButton
::
setEnabled
);
connect
(
copyGlobal
,
&
QPushButton
::
clicked
,
this
,
&
CollectionTemplatesWidget
::
slotCopyGlobal
);
}
CollectionTemplatesWidget
::~
CollectionTemplatesWidget
()
{
}
void
CollectionTemplatesWidget
::
save
(
const
Akonadi
::
Collection
&
)
{
if
(
mChanged
&&
!
mCollectionId
.
isEmpty
())
{
TemplateParser
::
Templates
t
(
mCollectionId
);
//qCDebug(KMAIL_LOG) << "use custom templates for folder" << fid <<":" << mCustom->isChecked();
t
.
setUseCustomTemplates
(
mCustom
->
isChecked
());
t
.
save
();
mWidget
->
saveToFolder
(
mCollectionId
);
}
}
void
CollectionTemplatesWidget
::
slotCopyGlobal
()
{
if
(
mIdentity
)
{
mWidget
->
loadFromIdentity
(
mIdentity
);
}
else
{
mWidget
->
loadFromGlobal
();
}
}
void
CollectionTemplatesWidget
::
slotChanged
()
{
mChanged
=
true
;
}
void
CollectionTemplatesWidget
::
load
(
const
Akonadi
::
Collection
&
col
)
{
const
QSharedPointer
<
MailCommon
::
FolderSettings
>
fd
=
MailCommon
::
FolderSettings
::
forCollection
(
col
,
false
);
if
(
!
fd
)
{
return
;
}
mCollectionId
=
QString
::
number
(
col
.
id
());
TemplateParser
::
Templates
t
(
mCollectionId
);
mCustom
->
setChecked
(
t
.
useCustomTemplates
());
mIdentity
=
fd
->
identity
();
mWidget
->
loadFromFolder
(
mCollectionId
,
mIdentity
);
mChanged
=
false
;
}
src/collectionpage/collectiontemplateswidget.h
deleted
100644 → 0
View file @
eceec032
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef COLLECTIONTEMPLATESWIDGET_H
#define COLLECTIONTEMPLATESWIDGET_H
#include <QWidget>
#include <AkonadiCore/Collection>
class
QCheckBox
;
namespace
TemplateParser
{
class
TemplatesConfiguration
;
}
class
CollectionTemplatesWidget
:
public
QWidget
{
Q_OBJECT
public:
explicit
CollectionTemplatesWidget
(
QWidget
*
parent
=
nullptr
);
~
CollectionTemplatesWidget
();
void
save
(
const
Akonadi
::
Collection
&
);
void
load
(
const
Akonadi
::
Collection
&
col
);
private:
void
slotCopyGlobal
();
void
slotChanged
();
QCheckBox
*
mCustom
=
nullptr
;
TemplateParser
::
TemplatesConfiguration
*
mWidget
=
nullptr
;
QString
mCollectionId
;
uint
mIdentity
=
0
;
bool
mChanged
=
false
;
};
#endif // COLLECTIONTEMPLATESWIDGET_H
Write
Preview
Supports
Markdown
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