Commit 254dc57e authored by Laurent Montel's avatar Laurent Montel 😁

implement folderconfiguresettingsexperywidget

parent 6d41df37
Pipeline #35742 failed with stage
in 88 minutes and 5 seconds
......@@ -10,6 +10,7 @@ set(folderconfiguresettings_SRCS
folderconfiguresettingsviewwidget.cpp
folderconfiguremodifycollectionjob.cpp
folderconfiguresettingspagebase.cpp
folderconfiguresettingsexperywidget.cpp
)
ecm_qt_declare_logging_category(folderconfiguresettings_SRCS HEADER libfolderconfiguresettings_debug.h IDENTIFIER LIBFOLDERCONFIGURESETTINGS_PLUGIN_LOG CATEGORY_NAME org.kde.pim.libfolderconfiguresettingsplugin
......
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "folderconfiguresettingsexperywidget.h"
#include <MailCommon/CollectionExpiryWidget>
FolderConfigureSettingsExperyWidget::FolderConfigureSettingsExperyWidget(QWidget *parent)
: FolderConfigureSettingsPageBase(parent)
{
mCollectionExpiryWidget = new MailCommon::CollectionExpiryWidget(this);
mCollectionExpiryWidget->setObjectName(QStringLiteral("mCollectionExpiryWidget"));
mCollectionExpiryWidget->hideExpireNowButton();
addMainWidget(mCollectionExpiryWidget);
}
FolderConfigureSettingsExperyWidget::~FolderConfigureSettingsExperyWidget()
{
}
void FolderConfigureSettingsExperyWidget::save(Akonadi::Collection &col)
{
const MailCommon::CollectionExpirySettings settings = mCollectionExpiryWidget->settings();
if (wasModified()) {
mCollectionExpiryWidget->save(settings, col, true, false);
}
}
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef FOLDERCONFIGURESETTINGSEXPERYWIDGET_H
#define FOLDERCONFIGURESETTINGSEXPERYWIDGET_H
#include "folderconfiguresettingspagebase.h"
#include <AkonadiCore/Collection>
namespace MailCommon {
class CollectionExpiryWidget;
}
class FolderConfigureSettingsExperyWidget : public FolderConfigureSettingsPageBase
{
Q_OBJECT
public:
explicit FolderConfigureSettingsExperyWidget(QWidget *parent = nullptr);
~FolderConfigureSettingsExperyWidget();
void save(Akonadi::Collection &col);
private:
MailCommon::CollectionExpiryWidget *mCollectionExpiryWidget = nullptr;
};
#endif // FOLDERCONFIGURESETTINGSEXPERYWIDGET_H
......@@ -9,6 +9,7 @@
#include "folderconfiguresettingstemplatewidget.h"
#include "folderconfiguresettingsviewwidget.h"
#include "folderconfiguremodifycollectionjob.h"
#include "folderconfiguresettingsexperywidget.h"
#include <MailCommon/CollectionExpiryWidget>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -37,9 +38,8 @@ FolderConfigureSettingsPageWidget::FolderConfigureSettingsPageWidget(QWidget *pa
tab->addTab(mFolderConfigureSettingsViewWidget, i18n("View"));
//Expiry => add Tab
mCollectionExpiryWidget = new MailCommon::CollectionExpiryWidget(this);
mCollectionExpiryWidget = new FolderConfigureSettingsExperyWidget(this);
mCollectionExpiryWidget->setObjectName(QStringLiteral("mCollectionExpiryWidget"));
mCollectionExpiryWidget->hideExpireNowButton();
tab->addTab(mCollectionExpiryWidget, i18n("Expiry"));
//Template
......@@ -56,10 +56,10 @@ void FolderConfigureSettingsPageWidget::save(const Akonadi::Collection::List &co
{
if (KMessageBox::Continue ==
KMessageBox::warningContinueCancel(this, i18n("It will override all settings for each selected folder. Do you want to continue?"),i18n("Save Folder Settings"))) {
const MailCommon::CollectionExpirySettings settings = mCollectionExpiryWidget->settings();
for (Akonadi::Collection col : cols) {
mFolderConfigureSettingsGeneralWidget->save(col);
mCollectionExpiryWidget->save(settings, col, true, false);
mCollectionExpiryWidget->save(col);
mFolderConfigureSettingsViewWidget->save(col);
mCollectionTemplateWidget->save(col);
FolderConfigureModifyCollectionJob *job = new FolderConfigureModifyCollectionJob();
......
......@@ -10,12 +10,10 @@
#include <QWidget>
#include "folderconfiguresettings_private_export.h"
#include <AkonadiCore/Collection>
namespace MailCommon {
class CollectionExpiryWidget;
}
class FolderConfigureSettingsGeneralWidget;
class FolderConfigureSettingsTemplateWidget;
class FolderConfigureSettingsViewWidget;
class FolderConfigureSettingsExperyWidget;
class LIBFOLDERCONFIGURESETTINGS_TESTS_EXPORT FolderConfigureSettingsPageWidget : public QWidget
{
Q_OBJECT
......@@ -25,7 +23,7 @@ public:
void save(const Akonadi::Collection::List &cols);
private:
MailCommon::CollectionExpiryWidget *mCollectionExpiryWidget = nullptr;
FolderConfigureSettingsExperyWidget *mCollectionExpiryWidget = nullptr;
FolderConfigureSettingsGeneralWidget *mFolderConfigureSettingsGeneralWidget = nullptr;
FolderConfigureSettingsTemplateWidget *mCollectionTemplateWidget = nullptr;
FolderConfigureSettingsViewWidget *mFolderConfigureSettingsViewWidget = nullptr;
......
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