File indexing completed on 2025-06-29 04:48:30

0001 /*
0002   SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "identityfolderrequester.h"
0008 #include <Akonadi/Collection>
0009 #include <KColorScheme>
0010 #include <KStatefulBrush>
0011 
0012 using namespace KMail;
0013 
0014 IdentityFolderRequester::IdentityFolderRequester(QWidget *parent)
0015     : MailCommon::FolderRequester(parent)
0016 {
0017 }
0018 
0019 IdentityFolderRequester::~IdentityFolderRequester() = default;
0020 
0021 void IdentityFolderRequester::setIsInvalidFolder(const Akonadi::Collection &col)
0022 {
0023     const KStatefulBrush bgBrush(KColorScheme::View, KColorScheme::NegativeBackground);
0024     setStyleSheet(QStringLiteral("QLineEdit{ background-color:%1 }").arg(bgBrush.brush(palette()).color().name()));
0025     setCollection(col);
0026     connect(this, &IdentityFolderRequester::folderChanged, this, &IdentityFolderRequester::slotFolderChanged, Qt::UniqueConnection);
0027 }
0028 
0029 void IdentityFolderRequester::slotFolderChanged(const Akonadi::Collection &col)
0030 {
0031     if (col.isValid()) {
0032         setStyleSheet(QString());
0033     }
0034 }
0035 
0036 #include "moc_identityfolderrequester.cpp"