File indexing completed on 2024-05-19 04:59:15

0001 /* ============================================================
0002 * GnomeKeyringPasswords - gnome-keyring support plugin for Falkon
0003 * Copyright (C) 2013-2014  David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #include "gnomekeyringplugin.h"
0019 #include "gnomekeyringpasswordbackend.h"
0020 #include "pluginproxy.h"
0021 #include "browserwindow.h"
0022 #include "../config.h"
0023 #include "mainapplication.h"
0024 #include "autofill.h"
0025 #include "passwordmanager.h"
0026 
0027 GnomeKeyringPlugin::GnomeKeyringPlugin()
0028     : QObject()
0029     , m_backend(nullptr)
0030 {
0031 }
0032 
0033 void GnomeKeyringPlugin::init(InitState state, const QString &settingsPath)
0034 {
0035     Q_UNUSED(state);
0036     Q_UNUSED(settingsPath);
0037 
0038     m_backend = new GnomeKeyringPasswordBackend;
0039     mApp->autoFill()->passwordManager()->registerBackend(QSL("GnomeKeyring"), m_backend);
0040 }
0041 
0042 void GnomeKeyringPlugin::unload()
0043 {
0044     mApp->autoFill()->passwordManager()->unregisterBackend(m_backend);
0045     delete m_backend;
0046 }
0047 
0048 bool GnomeKeyringPlugin::testPlugin()
0049 {
0050     // Require the version that the plugin was built with
0051     return (QString::fromLatin1(Qz::VERSION) == QLatin1String(FALKON_VERSION));
0052 }