[utilities/kwalletmanager] /: Drop defunct access control UI
Nicolas Fella <[email protected]>
| Newsgroups | gmane.comp.kde.cvs,gmane.comp.kde.doc |
|---|---|
| Message-ID | <[email protected]> |
Git commit c4b760e78c367688f759cedaa8a8809d20cfcb65 by Nicolas Fella.
Committed on 13/08/2026 at 13:54.
Pushed by nicolasfella into branch 'master'.
Drop defunct access control UI
KWallet 6.30 removes the functionality because it's fundamentally not reliable
M +0 -25 doc/index.docbook
M +0 -105 src/konfigurator/konfigurator.cpp
M +0 -2 src/konfigurator/konfigurator.h
M +0 -47 src/konfigurator/walletconfigwidget.ui
M +0 -4 src/manager/CMakeLists.txt
M +0 -12 src/manager/applicationsmanager.cpp
M +0 -2 src/manager/applicationsmanager.h
M +3 -46 src/manager/applicationsmanager.ui
D +0 -49 src/manager/authorizedapplicationstable.cpp
D +0 -33 src/manager/authorizedapplicationstable.h
D +0 -67 src/manager/authorizedappmodel.cpp
D +0 -36 src/manager/authorizedappmodel.h
https://invent.kde.org/utilities/kwalletmanager/-/commit/c4b760e78c367688f759cedaa8a8809d20cfcb65
diff --git a/doc/index.docbook b/doc/index.docbook
index 5369d086..8e2333f0 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -373,31 +373,6 @@ wallet file.
</para>
</sect3>
</sect2>
-
-<sect2>
-<title>Applications tab</title>
-<para>
-<screenshot>
-<screeninfo>Applications tab</screeninfo>
-<mediaobject>
-<imageobject>
-<imagedata fileref="kwallet-applications.png"/>
-</imageobject>
-<textobject>
-<phrase>Applications tab</phrase>
-</textobject>
-<caption><para>Applications tab</para></caption>
-</mediaobject>
-</screenshot>
-</para>
-<para>The first list shows all applications currently connected to the selected wallet.
-Use the button at the right side of each entry to disconnect the application.</para>
-
-<para>In the second list all applications are displayed which are authorized to access the wallet.
-Use the button right of each entry in the list to revoke the access.
-</para>
-<!-- FIXME difference to remove the policy in kwallermanager settings dialog?-->
-</sect2>
</sect1>
</chapter>
diff --git a/src/konfigurator/konfigurator.cpp b/src/konfigurator/konfigurator.cpp
index 0fc83365..63ff67e7 100644
--- a/src/konfigurator/konfigurator.cpp
+++ b/src/konfigurator/konfigurator.cpp
@@ -48,7 +48,6 @@ KWalletConfig::KWalletConfig(QObject *parent, const KPluginMetaData &data)
connect(_wcw->_autocloseManager, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
connect(_wcw->_autoclose, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
connect(_wcw->_closeIdle, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
- connect(_wcw->_openPrompt, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
connect(_wcw->_localWalletSelected, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
connect(_wcw->_idleTime, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &KWalletConfig::configChanged);
connect(_wcw->_launch, &QPushButton::clicked, this, &KWalletConfig::launchManager);
@@ -56,7 +55,6 @@ KWalletConfig::KWalletConfig(QObject *parent, const KPluginMetaData &data)
connect(_wcw->_newLocalWallet, &QPushButton::clicked, this, &KWalletConfig::newLocalWallet);
connect(_wcw->_localWallet, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &KWalletConfig::configChanged);
connect(_wcw->_defaultWallet, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &KWalletConfig::configChanged);
- connect(_wcw->_accessList, &QTreeWidget::customContextMenuRequested, this, &KWalletConfig::customContextMenuRequested);
connect(_wcw->_secretServiceAPI, &QCheckBox::clicked, this, &KWalletConfig::configChanged);
QStyle *style = widget()->style();
@@ -65,16 +63,8 @@ KWalletConfig::KWalletConfig(QObject *parent, const KPluginMetaData &data)
style->pixelMetric(QStyle::PM_LayoutRightMargin),
style->pixelMetric(QStyle::PM_LayoutBottomMargin));
- _wcw->_accessList->setAllColumnsShowFocus(true);
- _wcw->_accessList->setContextMenuPolicy(Qt::CustomContextMenu);
- _wcw->tabWidget2->tabBar()->setExpanding(true);
updateWalletLists();
- if (KCoreAddons::version() >= QT_VERSION_CHECK(6, 30, 0)) {
- _wcw->tabWidget2->removeTab(1);
- _wcw->tabWidget2->tabBar()->setVisible(false);
- }
-
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kwalletmanager"))) {
_wcw->_launch->hide();
}
@@ -167,7 +157,6 @@ void KWalletConfig::load()
{
KConfigGroup config(_cfg, QStringLiteral("Wallet"));
_wcw->_enabled->setChecked(config.readEntry("Enabled", true));
- _wcw->_openPrompt->setChecked(config.readEntry("Prompt on Open", false));
_wcw->_launchManager->setChecked(config.readEntry("Launch Manager", false));
_wcw->_autocloseManager->setChecked(!config.readEntry("Leave Manager Open", false));
_wcw->_autoclose->setChecked(!config.readEntry("Leave Open", true));
@@ -194,47 +183,6 @@ void KWalletConfig::load()
} else {
_wcw->_localWalletSelected->setChecked(false);
}
- _wcw->_accessList->clear();
- KConfigGroup ad(_cfg, QStringLiteral("Auto Deny"));
- KConfigGroup aa(_cfg, QStringLiteral("Auto Allow"));
- QStringList denykeys = ad.entryMap().keys();
- const QStringList keys = aa.entryMap().keys();
- for (QStringList::const_iterator i = keys.begin(); i != keys.end(); ++i) {
- QString walletName = *i;
- // perform cleanup in the kwalletrc file, by removing entries that correspond to non-existent
- // (previously deleted, for example) wallets
- QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
- path.append(QStringLiteral("/kwalletd/%1.kwl").arg(walletName));
- if (!QFile::exists(path)) {
- // if the wallet no longer exists, delete the entries from the configuration file and skip to next entry
- KConfigGroup cfgAllow = KSharedConfig::openConfig(QStringLiteral("kwalletrc"))->group(QStringLiteral("Auto Allow"));
- cfgAllow.deleteEntry(walletName);
-
- KConfigGroup cfgDeny = KSharedConfig::openConfig(QStringLiteral("kwalletrc"))->group(QStringLiteral("Auto Deny"));
- cfgDeny.deleteEntry(walletName);
- continue;
- }
-
- const QStringList apps = aa.readEntry(*i, QStringList());
- const QStringList denyapps = ad.readEntry(*i, QStringList());
- denykeys.removeAll(walletName);
- auto twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << walletName);
-
- for (QStringList::const_iterator j = apps.begin(), end = apps.end(); j != end; ++j) {
- new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Allow"));
- }
- for (QStringList::const_iterator j = denyapps.begin(), end = denyapps.end(); j != end; ++j) {
- new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Deny"));
- }
- }
- for (QStringList::const_iterator i = denykeys.constBegin(), denykeysEnd = denykeys.constEnd(); i != denykeysEnd; ++i) {
- const QStringList denyapps = ad.readEntry(*i, QStringList());
- auto twi = new QTreeWidgetItem(_wcw->_accessList, QStringList() << *i);
- for (QStringList::const_iterator j = denyapps.begin(), denyappsEnd = denyapps.end(); j != denyappsEnd; ++j) {
- new QTreeWidgetItem(twi, QStringList() << QString() << *j << i18n("Always Deny"));
- }
- }
- _wcw->_accessList->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
KConfigGroup secretsAPIConfig(_cfg, QStringLiteral("org.freedesktop.secrets"));
_wcw->_secretServiceAPI->setChecked(secretsAPIConfig.readEntry("apiEnabled", true));
@@ -274,7 +222,6 @@ void KWalletConfig::save()
config.writeEntry("Leave Open", !_wcw->_autoclose->isChecked());
config.writeEntry("Close When Idle", _wcw->_closeIdle->isChecked());
config.writeEntry("Idle Timeout", _wcw->_idleTime->value());
- config.writeEntry("Prompt on Open", _wcw->_openPrompt->isChecked());
config.writeEntry("Use One Wallet", !_wcw->_localWalletSelected->isChecked());
if (_wcw->_localWalletSelected->isChecked()) {
@@ -289,35 +236,6 @@ void KWalletConfig::save()
config.deleteEntry("Default Wallet");
}
- // FIXME: won't survive a language change
- _cfg->deleteGroup(QStringLiteral("Auto Allow"));
- _cfg->deleteGroup(QStringLiteral("Auto Deny"));
- config = _cfg->group(QStringLiteral("Auto Allow"));
- for (int i = 0; i < _wcw->_accessList->topLevelItemCount(); ++i) {
- QTreeWidgetItem *parentItem = _wcw->_accessList->topLevelItem(i);
- QStringList al;
- for (int j = 0; j < parentItem->childCount(); ++j) {
- QTreeWidgetItem *childItem = parentItem->child(j);
- if (childItem->text(2) == i18n("Always Allow")) {
- al << childItem->text(1);
- }
- }
- config.writeEntry(parentItem->text(0), al);
- }
-
- config = _cfg->group(QStringLiteral("Auto Deny"));
- for (int i = 0; i < _wcw->_accessList->topLevelItemCount(); ++i) {
- QTreeWidgetItem *parentItem = _wcw->_accessList->topLevelItem(i);
- QStringList al;
- for (int j = 0; j < parentItem->childCount(); ++j) {
- QTreeWidgetItem *childItem = parentItem->child(j);
- if (childItem->text(2) == i18n("Always Deny")) {
- al << childItem->text(1);
- }
- }
- config.writeEntry(parentItem->text(0), al);
- }
-
KConfigGroup secretsAPIConfig(_cfg, QStringLiteral("org.freedesktop.secrets"));
secretsAPIConfig.writeEntry("apiEnabled", _wcw->_secretServiceAPI->isChecked());
@@ -337,7 +255,6 @@ void KWalletConfig::save()
void KWalletConfig::defaults()
{
_wcw->_enabled->setChecked(true);
- _wcw->_openPrompt->setChecked(false);
_wcw->_launchManager->setChecked(true);
_wcw->_autocloseManager->setChecked(false);
_wcw->_autoclose->setChecked(true);
@@ -346,32 +263,10 @@ void KWalletConfig::defaults()
_wcw->_defaultWallet->setCurrentIndex(0);
_wcw->_localWalletSelected->setChecked(false);
_wcw->_localWallet->setCurrentIndex(0);
- _wcw->_accessList->clear();
_wcw->_secretServiceAPI->setChecked(true);
setNeedsSave(true);
}
-void KWalletConfig::customContextMenuRequested(const QPoint &pos)
-{
- QTreeWidgetItem *item = _wcw->_accessList->itemAt(pos);
- if (item && item->parent()) {
- auto m = new QMenu(widget());
- m->setTitle(item->parent()->text(0));
- m->addAction(i18n("&Delete"), Qt::Key_Delete, this, &KWalletConfig::deleteEntry);
- m->exec(_wcw->_accessList->mapToGlobal(pos));
- delete m;
- }
-}
-
-void KWalletConfig::deleteEntry()
-{
- QList<QTreeWidgetItem *> items = _wcw->_accessList->selectedItems();
- if (items.count() == 1 && items[0]) {
- delete items[0];
- setNeedsSave(true);
- }
-}
-
#include "konfigurator.moc"
#include "moc_konfigurator.cpp"
diff --git a/src/konfigurator/konfigurator.h b/src/konfigurator/konfigurator.h
index fa508c1b..0c26036f 100644
--- a/src/konfigurator/konfigurator.h
+++ b/src/konfigurator/konfigurator.h
@@ -38,8 +38,6 @@ public Q_SLOTS:
void newLocalWallet();
void newNetworkWallet();
void updateWalletLists();
- void deleteEntry();
- void customContextMenuRequested(const QPoint &pos);
private:
QString newWallet();
diff --git a/src/konfigurator/walletconfigwidget.ui b/src/konfigurator/walletconfigwidget.ui
index 3aebb3e5..2a583a18 100644
--- a/src/konfigurator/walletconfigwidget.ui
+++ b/src/konfigurator/walletconfigwidget.ui
@@ -15,13 +15,6 @@
<number>0</number>
</property>
<item>
- <widget class="QTabWidget" name="tabWidget2">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <property name="documentMode">
- <bool>true</bool>
- </property>
<widget class="QWidget" name="tab1">
<attribute name="title">
<string>Wallet Preferences</string>
@@ -373,46 +366,6 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab2">
- <attribute name="title">
- <string>Access Control</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="_openPrompt">
- <property name="text">
- <string>&Prompt when an application accesses a wallet</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QTreeWidget" name="_accessList">
- <property name="rootIsDecorated">
- <bool>true</bool>
- </property>
- <column>
- <property name="text">
- <string>Wallet</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Application</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Policy</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
</item>
<item>
<widget class="KSeparator" name="kseparator2"/>
diff --git a/src/manager/CMakeLists.txt b/src/manager/CMakeLists.txt
index 4d0efaad..8856070d 100644
--- a/src/manager/CMakeLists.txt
+++ b/src/manager/CMakeLists.txt
@@ -18,8 +18,6 @@ target_sources(kwalletmanager5 PRIVATE
connectedapplicationstable.cpp
connectedappmodel.cpp
disconnectappbutton.cpp
- authorizedappmodel.cpp
- authorizedapplicationstable.cpp
revokeauthbutton.cpp
clipboardutils.cpp
kwalletmanager.h
@@ -27,10 +25,8 @@ target_sources(kwalletmanager5 PRIVATE
walletcontrolwidget.h
allyourbase.h
kwhexview.h
- authorizedapplicationstable.h
kwalletmanagerwidgetitem.h
connectedapplicationstable.h
- authorizedappmodel.h
kwalleteditor.h
connectedappmodel.h
kwalletpopup.h
diff --git a/src/manager/applicationsmanager.cpp b/src/manager/applicationsmanager.cpp
index 36e4c220..28c77990 100644
--- a/src/manager/applicationsmanager.cpp
+++ b/src/manager/applicationsmanager.cpp
@@ -5,7 +5,6 @@
*/
#include "applicationsmanager.h"
-#include "authorizedappmodel.h"
#include "connectedappmodel.h"
#include <KCoreAddons>
#include <KWallet>
@@ -14,17 +13,11 @@ ApplicationsManager::ApplicationsManager(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
-
- if (KCoreAddons::version() >= QT_VERSION_CHECK(6, 30, 0)) {
- _authorizedApps->setVisible(false);
- label_2->setVisible(false);
- }
}
ApplicationsManager::~ApplicationsManager()
{
delete _connectedAppsModel;
- delete _authorizedAppModel;
}
void ApplicationsManager::setWallet(KWallet::Wallet *wallet)
@@ -33,16 +26,11 @@ void ApplicationsManager::setWallet(KWallet::Wallet *wallet)
_wallet = wallet;
delete _connectedAppsModel;
- delete _authorizedAppModel;
// create the disconnect widget menu
_connectedAppsModel = new ConnectedAppModel(_wallet);
_connectedApps->setWallet(_wallet);
_connectedApps->setModel(_connectedAppsModel);
-
- _authorizedAppModel = new AuthorizedAppModel(_wallet);
- _authorizedApps->setWallet(_wallet);
- _authorizedApps->setModel(_authorizedAppModel);
}
#include "moc_applicationsmanager.cpp"
diff --git a/src/manager/applicationsmanager.h b/src/manager/applicationsmanager.h
index 17ec02ef..5035f3e4 100644
--- a/src/manager/applicationsmanager.h
+++ b/src/manager/applicationsmanager.h
@@ -10,7 +10,6 @@
#include "ui_applicationsmanager.h"
#include <QWidget>
-class AuthorizedAppModel;
class ConnectedAppModel;
namespace KWallet
{
@@ -29,7 +28,6 @@ public:
private:
KWallet::Wallet *_wallet = nullptr;
ConnectedAppModel *_connectedAppsModel = nullptr;
- AuthorizedAppModel *_authorizedAppModel = nullptr;
};
#endif // APPLICATIONSMANAGER_H
diff --git a/src/manager/applicationsmanager.ui b/src/manager/applicationsmanager.ui
index bba76f57..21891b26 100644
--- a/src/manager/applicationsmanager.ui
+++ b/src/manager/applicationsmanager.ui
@@ -21,7 +21,7 @@
<item>
<widget class="ConnectedApplicationsTable" name="_connectedApps">
<property name="horizontalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
+ <enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
@@ -33,10 +33,10 @@
<bool>true</bool>
</property>
<property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
+ <enum>QAbstractItemView::SelectionMode::SingleSelection</enum>
</property>
<property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
+ <enum>QAbstractItemView::SelectionBehavior::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
@@ -58,44 +58,6 @@
</attribute>
</widget>
</item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>These applications are authorized to access this wallet:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="AuthorizedApplicationsTable" name="_authorizedApps">
- <property name="showDropIndicator" stdset="0">
- <bool>false</bool>
- </property>
- <property name="dragDropOverwriteMode">
- <bool>false</bool>
- </property>
- <property name="alternatingRowColors">
- <bool>true</bool>
- </property>
- <property name="selectionMode">
- <enum>QAbstractItemView::SingleSelection</enum>
- </property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
- <property name="showGrid">
- <bool>false</bool>
- </property>
- <attribute name="horizontalHeaderVisible">
- <bool>false</bool>
- </attribute>
- <attribute name="horizontalHeaderStretchLastSection">
- <bool>true</bool>
- </attribute>
- <attribute name="verticalHeaderVisible">
- <bool>false</bool>
- </attribute>
- </widget>
- </item>
</layout>
</widget>
<customwidgets>
@@ -104,11 +66,6 @@
<extends>QTableView</extends>
<header>connectedapplicationstable.h</header>
</customwidget>
- <customwidget>
- <class>AuthorizedApplicationsTable</class>
- <extends>QTableView</extends>
- <header>authorizedapplicationstable.h</header>
- </customwidget>
</customwidgets>
<resources/>
<connections/>
diff --git a/src/manager/authorizedapplicationstable.cpp b/src/manager/authorizedapplicationstable.cpp
deleted file mode 100644
index cecacf83..00000000
--- a/src/manager/authorizedapplicationstable.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2013 Valentin Rusu <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "authorizedapplicationstable.h"
-#include "authorizedappmodel.h"
-#include "revokeauthbutton.h"
-
-AuthorizedApplicationsTable::AuthorizedApplicationsTable(QWidget *parent)
- : QTableView(parent)
-{
-}
-
-void AuthorizedApplicationsTable::setWallet(KWallet::Wallet *wallet)
-{
- _wallet = wallet;
-}
-
-void AuthorizedApplicationsTable::setModel(QAbstractItemModel *model)
-{
- Q_ASSERT(_wallet != nullptr);
-
- auto appModel = qobject_cast<AuthorizedAppModel *>(model);
- Q_ASSERT(appModel != nullptr);
-
- QTableView::setModel(model);
- const int numberRow(model->rowCount());
- for (int row = 0; row < numberRow; row++) {
- auto btn = new RevokeAuthButton(model->index(row, 0).data().toString(), _wallet);
- btn->setFixedHeight(btn->sizeHint().height());
- setRowHeight(row, btn->height());
- setIndexWidget(model->index(row, 1), btn);
- connect(btn, &RevokeAuthButton::appRevoked, appModel, &AuthorizedAppModel::removeApp);
- }
-}
-
-void AuthorizedApplicationsTable::resizeEvent(QResizeEvent *resizeEvent)
-{
- // this will keep disconnect buttons column at it's minimum size and
- // make the application names take the reminder of the horizontal space
- resizeColumnsToContents();
- const int appColumnSize = contentsRect().width() - columnWidth(1) - 50;
- setColumnWidth(0, appColumnSize);
- QAbstractItemView::resizeEvent(resizeEvent);
-}
-
-#include "moc_authorizedapplicationstable.cpp"
diff --git a/src/manager/authorizedapplicationstable.h b/src/manager/authorizedapplicationstable.h
deleted file mode 100644
index a17eb91a..00000000
--- a/src/manager/authorizedapplicationstable.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2013 Valentin Rusu <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef AUTHORIZEDAPPLICATIONSTABLE_H
-#define AUTHORIZEDAPPLICATIONSTABLE_H
-
-#include <QTableView>
-
-namespace KWallet
-{
-class Wallet;
-}
-
-class AuthorizedApplicationsTable : public QTableView
-{
- Q_OBJECT
-public:
- explicit AuthorizedApplicationsTable(QWidget *parent);
-
- void setModel(QAbstractItemModel *model) override;
- void setWallet(KWallet::Wallet *wallet);
-
-protected:
- void resizeEvent(QResizeEvent *resizeEvent) override;
-
-private:
- KWallet::Wallet *_wallet = nullptr;
-};
-
-#endif // AUTHORIZEDAPPLICATIONSTABLE_H
diff --git a/src/manager/authorizedappmodel.cpp b/src/manager/authorizedappmodel.cpp
deleted file mode 100644
index 609caa54..00000000
--- a/src/manager/authorizedappmodel.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2013 Valentin Rusu <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "authorizedappmodel.h"
-#include "kwalletmanager_debug.h"
-#include <KConfigGroup>
-#include <KWallet>
-#include <QTimer>
-
-AuthorizedAppModel::AuthorizedAppModel(KWallet::Wallet *wallet)
- : QStandardItemModel()
- , _cfg(KSharedConfig::openConfig(QStringLiteral("kwalletrc"), KConfig::NoGlobals))
- , _wallet(wallet)
-{
- // TODO: handle "Auto Deny" applications
- // KConfigGroup ad(_cfg, "Auto Deny");
-
- KConfigGroup aa(_cfg, QStringLiteral("Auto Allow"));
- QString walletName = _wallet->walletName();
- const QStringList keys = aa.entryMap().keys();
- for (const QString &cfgWalletName : keys) {
- if (cfgWalletName == walletName) {
- const QStringList apps = aa.readEntry(cfgWalletName, QStringList());
- int row = 0;
- for (const QString &appName : apps) {
- setItem(row, 0, new QStandardItem(appName));
- setItem(row, 1, new QStandardItem(QStringLiteral("dummy"))); // this item will be hidden by the disconnect button, see below setIndexWidget call
- _authorizedAppsIndexMap.insert(appName, QPersistentModelIndex(index(row, 0)));
- row++;
- }
- }
- }
-}
-
-void AuthorizedAppModel::removeApp(const QString &appName)
-{
- if (_authorizedAppsIndexMap.contains(appName)) {
- QPersistentModelIndex idx = _authorizedAppsIndexMap[appName];
- if (idx.isValid()) {
- if (!removeRow(idx.row())) {
- qCDebug(KWALLETMANAGER_LOG) << "Remove row failed for app " << appName;
- }
- }
- } else {
- qCDebug(KWALLETMANAGER_LOG) << "Attempting to remove unknown application " << appName;
- }
- QTimer::singleShot(0, this, &AuthorizedAppModel::saveConfig);
-}
-
-void AuthorizedAppModel::saveConfig()
-{
- QStringList appList;
- appList.reserve(rowCount());
- for (int r = 0; r < rowCount(); r++) {
- appList << item(r)->text();
- }
- QString walletName = _wallet->walletName();
- KConfigGroup config(_cfg, QStringLiteral("Auto Allow"));
- config.deleteEntry(walletName);
- config.writeEntry(_wallet->walletName(), appList);
- _cfg->sync();
-}
-
-#include "moc_authorizedappmodel.cpp"
diff --git a/src/manager/authorizedappmodel.h b/src/manager/authorizedappmodel.h
deleted file mode 100644
index d9af2d85..00000000
--- a/src/manager/authorizedappmodel.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2013 Valentin Rusu <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef AUTHORIZEDAPPMODEL_H
-#define AUTHORIZEDAPPMODEL_H
-
-#include <KSharedConfig>
-#include <QStandardItemModel>
-
-namespace KWallet
-{
-class Wallet;
-}
-
-class AuthorizedAppModel : public QStandardItemModel
-{
- Q_OBJECT
-public:
- explicit AuthorizedAppModel(KWallet::Wallet *wallet);
-
-public Q_SLOTS:
- void removeApp(const QString &);
-
-private Q_SLOTS:
- void saveConfig();
-
-private:
- KSharedConfig::Ptr _cfg;
- KWallet::Wallet *const _wallet;
- QMap<QString, QPersistentModelIndex> _authorizedAppsIndexMap;
-};
-
-#endif // AUTHORIZEDAPPMODEL_H