File indexing completed on 2024-11-24 04:44:20

0001 /*
0002     SPDX-FileCopyrightText: 2009 Bertjan Broeksema <broeksema@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "lockmethodpage.h"
0008 #include "settings.h"
0009 
0010 #include <QStandardPaths>
0011 
0012 LockMethodPage::LockMethodPage(QWidget *parent)
0013     : QWidget(parent)
0014 {
0015     ui.setupUi(this);
0016     checkAvailableLockMethods();
0017 }
0018 
0019 void LockMethodPage::checkAvailableLockMethods()
0020 {
0021     // FIXME: I guess this whole checking makes only sense on linux machines.
0022 
0023     // Check for procmail lock method.
0024     if (QStandardPaths::findExecutable(QStringLiteral("lockfile")).isEmpty()) {
0025         ui.procmail->setEnabled(false);
0026         if (ui.procmail->isChecked()) { // Select another lock method if necessary
0027             ui.mutt_dotlock->setChecked(true);
0028         }
0029     }
0030 
0031     // Check for mutt lock method.
0032     if (QStandardPaths::findExecutable(QStringLiteral("mutt_dotlock")).isEmpty()) {
0033         ui.mutt_dotlock->setEnabled(false);
0034         ui.mutt_dotlock_privileged->setEnabled(false);
0035         if (ui.mutt_dotlock->isChecked() || ui.mutt_dotlock_privileged->isChecked()) {
0036             if (ui.procmail->isEnabled()) {
0037                 ui.procmail->setChecked(true);
0038             } else {
0039                 ui.none->setChecked(true);
0040             }
0041         }
0042     }
0043 }
0044 
0045 #include "moc_lockmethodpage.cpp"