Commit 354473f1 authored by Laurent Montel's avatar Laurent Montel 😁

Create own widget

parent 739dd45a
Pipeline #28005 canceled with stage
......@@ -3,6 +3,7 @@ set(messageviewer_folderconfiguresettingsplugin_SRCS
folderconfiguresettingsdialog.cpp
folderconfiguresettingswidget.cpp
foldersettingfilterproxymodel.cpp
folderconfiguretreewidget.cpp
)
kcoreaddons_add_plugin(messageviewer_folderconfiguresettingsplugin JSON messageviewer_folderconfiguresettingsplugin.json SOURCES
......
......@@ -18,11 +18,8 @@
*/
#include "folderconfiguresettingswidget.h"
#include "foldersettingfilterproxymodel.h"
#include <KCheckableProxyModel>
#include "folderconfiguretreewidget.h"
#include <QHBoxLayout>
#include <MailCommon/FolderTreeWidget>
#include <MailCommon/FolderTreeView>
FolderConfigureSettingsWidget::FolderConfigureSettingsWidget(QWidget *parent)
: QWidget(parent)
......@@ -30,31 +27,10 @@ FolderConfigureSettingsWidget::FolderConfigureSettingsWidget(QWidget *parent)
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
auto ftw = new MailCommon::FolderTreeWidget(this, nullptr,
MailCommon::FolderTreeWidget::TreeViewOptions(MailCommon::FolderTreeWidget::UseDistinctSelectionModel
|MailCommon::FolderTreeWidget::HideStatistics
|MailCommon::FolderTreeWidget::HideHeaderViewMenu));
ftw->setObjectName(QStringLiteral("foldertreewidget"));
ftw->folderTreeView()->setDragEnabled(false);
auto ftv = ftw->folderTreeView();
auto sourceModel = ftv->model();
auto selectionModel = ftw->selectionModel();
auto checkable = new KCheckableProxyModel(this);
checkable->setObjectName(QStringLiteral("checkable"));
checkable->setSourceModel(sourceModel);
checkable->setSelectionModel(selectionModel);
auto folderSettingFilterProxyModel = new FolderSettingFilterProxyModel(this);
folderSettingFilterProxyModel->setObjectName(QStringLiteral("folderSettingFilterProxyModel"));
folderSettingFilterProxyModel->setSourceModel(checkable);
ftv->setModel(folderSettingFilterProxyModel);
ftv->expandAll();
mainLayout->addWidget(ftw);
mFolderConfigureTreeWidget = new FolderConfigureTreeWidget(this);
mFolderConfigureTreeWidget->setObjectName(QStringLiteral("mFolderConfigureTreeWidget"));
mainLayout->addWidget(mFolderConfigureTreeWidget);
}
FolderConfigureSettingsWidget::~FolderConfigureSettingsWidget()
......
......@@ -21,7 +21,7 @@
#define FOLDERCONFIGURESETTINGSWIDGET_H
#include <QWidget>
class FolderConfigureTreeWidget;
class FolderConfigureSettingsWidget : public QWidget
{
Q_OBJECT
......@@ -29,6 +29,8 @@ public:
explicit FolderConfigureSettingsWidget(QWidget *parent = nullptr);
~FolderConfigureSettingsWidget();
void save();
private:
FolderConfigureTreeWidget *mFolderConfigureTreeWidget = nullptr;
};
#endif // FOLDERCONFIGURESETTINGSWIDGET_H
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "folderconfiguretreewidget.h"
#include "foldersettingfilterproxymodel.h"
#include <QVBoxLayout>
#include <KCheckableProxyModel>
#include <MailCommon/FolderTreeWidget>
#include <MailCommon/FolderTreeView>
FolderConfigureTreeWidget::FolderConfigureTreeWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
auto ftw = new MailCommon::FolderTreeWidget(this, nullptr,
MailCommon::FolderTreeWidget::TreeViewOptions(MailCommon::FolderTreeWidget::UseDistinctSelectionModel
|MailCommon::FolderTreeWidget::HideStatistics
|MailCommon::FolderTreeWidget::HideHeaderViewMenu));
ftw->setObjectName(QStringLiteral("foldertreewidget"));
ftw->folderTreeView()->setDragEnabled(false);
auto ftv = ftw->folderTreeView();
auto sourceModel = ftv->model();
auto selectionModel = ftw->selectionModel();
auto checkable = new KCheckableProxyModel(this);
checkable->setObjectName(QStringLiteral("checkable"));
checkable->setSourceModel(sourceModel);
checkable->setSelectionModel(selectionModel);
auto folderSettingFilterProxyModel = new FolderSettingFilterProxyModel(this);
folderSettingFilterProxyModel->setObjectName(QStringLiteral("folderSettingFilterProxyModel"));
folderSettingFilterProxyModel->setSourceModel(checkable);
ftv->setModel(folderSettingFilterProxyModel);
ftv->expandAll();
mainLayout->addWidget(ftw);
}
FolderConfigureTreeWidget::~FolderConfigureTreeWidget()
{
}
/*
Copyright (C) 2020 Laurent Montel <montel@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef FOLDERCONFIGURETREEWIDGET_H
#define FOLDERCONFIGURETREEWIDGET_H
#include <QWidget>
class FolderConfigureTreeWidget : public QWidget
{
Q_OBJECT
public:
explicit FolderConfigureTreeWidget(QWidget *parent = nullptr);
~FolderConfigureTreeWidget();
};
#endif // FOLDERCONFIGURETREEWIDGET_H
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