2013-05-15 21:30:20 +02:00
|
|
|
/* ============================================================
|
|
|
|
* KWalletPasswords - KWallet support plugin for QupZilla
|
2014-01-11 16:11:42 +01:00
|
|
|
* Copyright (C) 2013-2014 David Rosca <nowrep@gmail.com>
|
2013-05-15 21:30:20 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#include "kwalletplugin.h"
|
|
|
|
#include "kwalletpasswordbackend.h"
|
|
|
|
#include "pluginproxy.h"
|
|
|
|
#include "qupzilla.h"
|
|
|
|
|
|
|
|
#include <QTranslator>
|
|
|
|
|
|
|
|
KWalletPlugin::KWalletPlugin()
|
|
|
|
: QObject()
|
|
|
|
, m_backend(0)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
PluginSpec KWalletPlugin::pluginSpec()
|
|
|
|
{
|
|
|
|
PluginSpec spec;
|
|
|
|
spec.name = "KWallet Passwords";
|
|
|
|
spec.info = "KWallet password backend";
|
|
|
|
spec.description = "Provides support for storing passwords in KWallet";
|
2013-05-20 11:14:00 +02:00
|
|
|
spec.version = "0.1.2";
|
2013-05-15 21:30:20 +02:00
|
|
|
spec.author = "David Rosca <nowrep@gmail.com>";
|
|
|
|
spec.icon = QPixmap(":kwp/data/icon.png");
|
|
|
|
spec.hasSettings = false;
|
|
|
|
|
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
2013-05-24 11:03:16 +02:00
|
|
|
void KWalletPlugin::init(InitState state, const QString &settingsPath)
|
2013-05-15 21:30:20 +02:00
|
|
|
{
|
2013-05-24 11:03:16 +02:00
|
|
|
Q_UNUSED(state);
|
|
|
|
Q_UNUSED(settingsPath);
|
2013-05-15 21:30:20 +02:00
|
|
|
|
|
|
|
m_backend = new KWalletPasswordBackend;
|
|
|
|
QZ_REGISTER_PASSWORD_BACKEND("KWallet", m_backend);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWalletPlugin::unload()
|
|
|
|
{
|
|
|
|
QZ_UNREGISTER_PASSWORD_BACKEND(m_backend);
|
|
|
|
delete m_backend;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KWalletPlugin::testPlugin()
|
|
|
|
{
|
2014-01-26 19:12:34 +01:00
|
|
|
return (QupZilla::VERSION == QLatin1String("1.7.0"));
|
2013-05-15 21:30:20 +02:00
|
|
|
}
|
|
|
|
|
2013-06-08 21:04:58 +02:00
|
|
|
QTranslator* KWalletPlugin::getTranslator(const QString &locale)
|
|
|
|
{
|
|
|
|
QTranslator* translator = new QTranslator(this);
|
|
|
|
translator->load(locale, ":/kwp/locale/");
|
|
|
|
return translator;
|
|
|
|
}
|
|
|
|
|
2013-05-15 21:30:20 +02:00
|
|
|
#if QT_VERSION < 0x050000
|
|
|
|
Q_EXPORT_PLUGIN2(KWalletPasswords, KWalletPlugin)
|
|
|
|
#endif
|