File indexing completed on 2024-04-21 04:42:45

0001 /*
0002     SPDX-FileCopyrightText: 2012 Frederik Gladhorn <gladhorn@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "accessibleobject_p.h"
0008 #include "registry_p.h"
0009 
0010 #include <QDebug>
0011 
0012 using namespace QAccessibleClient;
0013 
0014 AccessibleObjectPrivate::AccessibleObjectPrivate(RegistryPrivate *reg, const QString &service_, const QString &path_)
0015     : registryPrivate(reg)
0016     , service(service_)
0017     , path(path_)
0018     , defunct(false)
0019     , actionsFetched(false)
0020 {
0021     //qDebug() << Q_FUNC_INFO;
0022 }
0023 
0024 AccessibleObjectPrivate::~AccessibleObjectPrivate()
0025 {
0026     //qDebug() << Q_FUNC_INFO;
0027 
0028     if (registryPrivate->m_cache) {
0029         const QString id = path + service;
0030         registryPrivate->m_cache->remove(id);
0031     }
0032 }
0033 
0034 bool AccessibleObjectPrivate::operator==(const AccessibleObjectPrivate &other) const
0035 {
0036     return registryPrivate == other.registryPrivate &&
0037             service == other.service &&
0038             path == other.path;
0039 }
0040 
0041 void AccessibleObjectPrivate::setDefunct()
0042 {
0043     defunct = true;
0044 
0045     for(int i = 0; i < actions.count(); ++i) {
0046         const QSharedPointer<QAction> &action = actions[i];
0047         action->setEnabled(false);
0048     }
0049 }