File indexing completed on 2025-01-12 04:50:23

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "managesievetreeview.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 using namespace KSieveUi;
0012 
0013 ManageSieveTreeView::ManageSieveTreeView(QWidget *parent)
0014     : PimCommon::CustomTreeView(parent)
0015 {
0016     setDefaultText(i18n("No IMAP server configured..."));
0017     setRootIsDecorated(true);
0018     setAlternatingRowColors(true);
0019     setSelectionMode(QAbstractItemView::SingleSelection);
0020     setHeaderLabel(i18n("Available Scripts"));
0021     setSortingEnabled(true);
0022     setContextMenuPolicy(Qt::CustomContextMenu);
0023 }
0024 
0025 ManageSieveTreeView::~ManageSieveTreeView() = default;
0026 
0027 void ManageSieveTreeView::setNoImapFound(bool found)
0028 {
0029     if (mShowDefaultText != found) {
0030         setDefaultText(i18n("No IMAP server configured..."));
0031         mShowDefaultText = found;
0032         update();
0033     }
0034 }
0035 
0036 void ManageSieveTreeView::setNetworkDown(bool state)
0037 {
0038     if (!state) {
0039         setDefaultText(i18n("Network down."));
0040     }
0041     update();
0042 }
0043 
0044 #include "moc_managesievetreeview.cpp"