${KDE4_KIO_LIBS}
${KDE4_KCMUTILS_LIBS}
${KDE4_KNOTIFYCONFIG_LIBS}
+ ${KDE4_KPASSWDSTORE_LIBS}
kgetcore
)
#include <KMessageBox>
#include <KLocale>
-#include <kwallet.h>
DlgWebinterface::DlgWebinterface(KDialog *parent)
: QWidget(parent),
- m_wallet(0)
+ m_passwdstore(nullptr)
{
setupUi(this);
DlgWebinterface::~DlgWebinterface()
{
- delete m_wallet;
}
void DlgWebinterface::readConfig()
{
if (Settings::webinterfaceEnabled()) {
- m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(),
- winId(),///Use MainWindow?
- KWallet::Wallet::Asynchronous);
- if (m_wallet) {
- connect(m_wallet, SIGNAL(walletOpened(bool)), SLOT(walletOpened(bool)));
- } else {
- KMessageBox::error(0, i18n("Could not open KWallet"));
+ if (!m_passwdstore) {
+ m_passwdstore = new KPasswdStore(this);
+ m_passwdstore->setStoreID("KGet");
}
- }
-}
-void DlgWebinterface::walletOpened(bool opened)
-{
- if (opened &&
- (m_wallet->hasFolder("KGet") ||
- m_wallet->createFolder("KGet")) &&
- m_wallet->setFolder("KGet")) {
- QString pwd;
- m_wallet->readPassword("Webinterface", pwd);
- webinterfacePwd->setText(pwd);
- } else {
- KMessageBox::error(0, i18n("Could not open KWallet"));
+ if (m_passwdstore->openStore(winId())) {
+ webinterfacePwd->setText(m_passwdstore->getPasswd("Webinterface", winId()));
+ } else {
+ KMessageBox::error(nullptr, i18n("Could not open KPasswdStore"));
+ }
}
}
void DlgWebinterface::saveSettings()
{
- if (m_wallet) {
- m_wallet->writePassword("Webinterface", webinterfacePwd->text());
+ if (m_passwdstore && m_passwdstore->openStore(winId())) {
+ m_passwdstore->storePasswd("Webinterface", webinterfacePwd->text(), winId());
}
emit saved();
}
#include <QWidget>
#include <KDialog>
+#include <kpasswdstore.h>
#include "ui_dlgwebinterface.h"
-namespace KWallet {
- class Wallet;
-}
-
class DlgWebinterface : public QWidget, public Ui::DlgWebinterface
{
Q_OBJECT
private Q_SLOTS:
void readConfig();
void saveSettings();
- void walletOpened(bool);
private:
- KWallet::Wallet *m_wallet;
+ KPasswdStore *m_passwdstore;
};
#endif
#include <KDebug>
#include <KGlobalSettings>
#include <KStandardDirs>
-#include <kwallet.h>
#include <QTcpServer>
#include <QTcpSocket>
HttpServer::HttpServer(QWidget *parent)
: QObject(parent),
- m_wallet(0)
+ m_passwdstore(nullptr)
{
- m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::LocalWallet(),
- parent->winId(),///Use MainWindow?
- KWallet::Wallet::Asynchronous);
- if (m_wallet) {
- connect(m_wallet, SIGNAL(walletOpened(bool)), SLOT(init(bool)));
+ m_passwdstore = new KPasswdStore(this);
+ m_passwdstore->setStoreID("KGet");
+
+ if (m_passwdstore && m_passwdstore->openStore(parent->winId())) {
+ m_pwd = m_passwdstore->getPasswd("Webinterface", parent->winId());
+
+ m_tcpServer = new QTcpServer(this);
+ if (!m_tcpServer->listen(QHostAddress::Any, Settings::webinterfacePort())) {
+ KGet::showNotification(parent, "error", i18nc("@info", "Unable to start WebInterface: %1", m_tcpServer->errorString()));
+ return;
+ }
+
+ connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(handleRequest()));
} else {
- KGet::showNotification(parent, "error", i18n("Unable to start WebInterface: Could not open KWallet"));
+ KGet::showNotification(parent, "error", i18n("Unable to start WebInterface: Could not open KPasswdStore"));
}
}
HttpServer::~HttpServer()
{
- delete m_wallet;
-}
-
-void HttpServer::init(bool opened)
-{
- if (opened &&
- m_wallet->hasFolder("KGet") &&
- m_wallet->setFolder("KGet")) {
- m_wallet->readPassword("Webinterface", m_pwd);
- } else {
- KGet::showNotification(static_cast<QWidget*>(parent()), "error", i18n("Unable to start WebInterface: Could not open KWallet"));
- return;
- }
- m_tcpServer = new QTcpServer(this);
- if (!m_tcpServer->listen(QHostAddress::Any, Settings::webinterfacePort())) {
- KGet::showNotification(static_cast<QWidget*>(parent()), "error", i18nc("@info", "Unable to start WebInterface: %1", m_tcpServer->errorString()));
- return;
- }
-
- connect(m_tcpServer, SIGNAL(newConnection()), this, SLOT(handleRequest()));
}
void HttpServer::settingsChanged()
{
- if (m_wallet) {
- m_wallet->readPassword("Webinterface", m_pwd);
+ if (m_passwdstore && m_passwdstore->openStore(static_cast<QWidget*>(parent())->winId())) {
+ m_pwd = m_passwdstore->getPasswd("Webinterface");
}
}
#define HTTPSERVER_H
#include <QWidget>
-
#include <QTcpServer>
-namespace KWallet {
- class Wallet;
-}
+#include <kpasswdstore.h>
class HttpServer : public QObject
{
void settingsChanged();
private slots:
- void init(bool);
void handleRequest();
private:
- KWallet::Wallet *m_wallet;
+ KPasswdStore *m_passwdstore;
QTcpServer *m_tcpServer;
QString m_pwd;
};
<item>
<widget class="QCheckBox" name="kcfg_WalletSupport">
<property name="text">
- <string>Remember passwords (KWallet)</string>
+ <string>Remember passwords (KPasswdStore)</string>
</property>
</widget>
</item>
add_library(krdccore SHARED ${krdccore_SRCS})
-target_link_libraries(krdccore ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
+target_link_libraries(krdccore
+ ${KDE4_KDECORE_LIBS}
+ ${KDE4_KDEUI_LIBS}
+ ${KDE4_KPASSWDSTORE_LIBS}
+)
set_target_properties(krdccore PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
showAgainCheckBox->setChecked(showConfigAgain());
walletSupportCheckBox = new QCheckBox(mainWidget);
- walletSupportCheckBox->setText(i18n("Remember password (KWallet)"));
+ walletSupportCheckBox->setText(i18n("Remember password (KPasswdStore)"));
walletSupportCheckBox->setChecked(walletSupport());
layout->addWidget(showAgainCheckBox);
m_scale(false),
m_keyboardIsGrabbed(false),
#ifndef QTONLY
- m_wallet(0),
+ m_passwdStore(0),
#endif
m_dotCursorState(CursorOff)
{
RemoteView::~RemoteView()
{
#ifndef QTONLY
- delete m_wallet;
+ delete m_passwdStore;
#endif
}
#ifndef QTONLY
QString RemoteView::readWalletPassword(bool fromUserNameOnly)
{
- const QString KRDCFOLDER = "KRDC";
-
window()->setDisabled(true); // WORKAROUND: disable inputs so users cannot close the current tab (see #181230)
- m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), window()->winId());
+ m_passwdStore = new KPasswdStore(this);
+ m_passwdStore->setStoreID("KRDC");
window()->setDisabled(false);
- if (m_wallet) {
- bool walletOK = m_wallet->hasFolder(KRDCFOLDER);
- if (!walletOK) {
- walletOK = m_wallet->createFolder(KRDCFOLDER);
- kDebug(5010) << "Wallet folder created";
- }
+ if (m_passwdStore) {
+ const qlonglong windowId = window()->winId();
+ bool walletOK = m_passwdStore->openStore(windowId);
if (walletOK) {
kDebug(5010) << "Wallet OK";
- m_wallet->setFolder(KRDCFOLDER);
- QString password;
-
+
QString key;
if (fromUserNameOnly)
key = m_url.userName();
else
key = m_url.prettyUrl(KUrl::RemoveTrailingSlash);
- if (m_wallet->hasEntry(key) &&
- !m_wallet->readPassword(key, password)) {
+ QString password = m_passwdStore->getPasswd(key.toUtf8(), windowId);
+ if (!password.isEmpty()) {
kDebug(5010) << "Password read OK";
return password;
else
key = m_url.prettyUrl(KUrl::RemoveTrailingSlash);
- if (m_wallet && m_wallet->isOpen()) {
+ const qlonglong windowId = window()->winId();
+ if (m_passwdStore && m_passwdStore->openStore(windowId)) {
kDebug(5010) << "Write wallet password";
- m_wallet->writePassword(key, password);
+ m_passwdStore->storePasswd(key.toUtf8(), password, windowId);
}
}
#endif
#define KRDCCORE_EXPORT
#else
#include <KUrl>
- #include <KWallet/Wallet>
+ #include <kpasswdstore.h>
#include "krdccore_export.h"
#endif
#ifndef QTONLY
QString readWalletPassword(bool fromUserNameOnly = false);
void saveWalletPassword(const QString &password, bool fromUserNameOnly = false);
- KWallet::Wallet *m_wallet;
+ KPasswdStore *m_passwdStore;
#endif
DotCursorState m_dotCursorState;
${QT_QTNETWORK_LIBRARY}
${KDE4_KDNSSD_LIBS}
${KDE4_KDEUI_LIBS}
+ ${KDE4_KPASSWDSTORE_LIBS}
${LIBVNCSERVER_LIBRARIES}
)
#include "invitationsrfbclient.h"
#include "krfbconfig.h"
#include "rfbservermanager.h"
+
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtNetwork/QHostInfo>
#include <KUser>
#include <KRandom>
#include <KStringHandler>
-#include <KWallet/Wallet>
#include <DNSSD/PublicService>
-using KWallet::Wallet;
//static
InvitationsRfbServer *InvitationsRfbServer::instance;
instance->setListeningPort(KrfbConfig::port());
instance->setPasswordRequired(true);
- instance->m_wallet = Wallet::openWallet(
- Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
- if(instance->m_wallet) {
- connect(instance->m_wallet, SIGNAL(walletOpened(bool)),
- instance, SLOT(walletOpened(bool)));
+ instance->m_passwdStore = new KPasswdStore(instance);
+ instance->m_passwdStore->setStoreID("krfb");
+ QString desktopPassword;
+ QString unattendedPassword;
+ if ( !instance->m_passwdStore->openStore() ) {
+ desktopPassword = instance->m_passwdStore->getPasswd("desktopSharingPassword");
+ if (!desktopPassword.isEmpty()) {
+ instance->m_desktopPassword = desktopPassword;
+ emit instance->passwordChanged(instance->m_desktopPassword);
+ }
+
+ unattendedPassword = instance->m_passwdStore->getPasswd("unattendedAccessPassword");
+ if (!unattendedPassword.isEmpty()) {
+ instance->m_unattendedPassword = unattendedPassword;
+ }
+ } else {
+ kDebug() << "KPasswdStore is disabled, falling back to config file";
+ KSharedConfigPtr config = KGlobal::config();
+ KConfigGroup krfbConfig(config,"Security");
+
+ desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
+ "desktopPassword", QString()));
+ if(!desktopPassword.isEmpty()) {
+ instance->m_desktopPassword = desktopPassword;
+ emit instance->passwordChanged(instance->m_desktopPassword);
+ }
+
+ unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
+ "unattendedPassword", QString()));
+ if(!unattendedPassword.isEmpty()) {
+ instance->m_unattendedPassword = unattendedPassword;
+ }
}
}
KSharedConfigPtr config = KGlobal::config();
KConfigGroup krfbConfig(config,"Security");
krfbConfig.writeEntry("allowUnattendedAccess",m_allowUnattendedAccess);
- if(m_wallet && m_wallet->isOpen()) {
-
- if( (m_wallet->currentFolder()=="krfb") ||
- ((m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb")) &&
- m_wallet->setFolder("krfb")) ) {
-
- m_wallet->writePassword("desktopSharingPassword",m_desktopPassword);
- m_wallet->writePassword("unattendedAccessPassword",m_unattendedPassword);
- }
-
+ if (m_passwdStore && m_passwdStore->openStore()) {
+ m_passwdStore->storePasswd("desktopSharingPassword", m_desktopPassword);
+ m_passwdStore->storePasswd("unattendedAccessPassword", m_unattendedPassword);
} else {
krfbConfig.writeEntry("desktopPassword",
KStringHandler::obscure(m_desktopPassword));
return new PendingInvitationsRfbClient(client, this);
}
-void InvitationsRfbServer::walletOpened(bool opened)
-{
- QString desktopPassword;
- QString unattendedPassword;
- Q_ASSERT(m_wallet);
- if( opened &&
- ( m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb") ) &&
- m_wallet->setFolder("krfb") ) {
-
- if(m_wallet->readPassword("desktopSharingPassword", desktopPassword)==0 &&
- !desktopPassword.isEmpty()) {
- m_desktopPassword = desktopPassword;
- emit passwordChanged(m_desktopPassword);
- }
-
- if(m_wallet->readPassword("unattendedAccessPassword", unattendedPassword)==0 &&
- !unattendedPassword.isEmpty()) {
- m_unattendedPassword = unattendedPassword;
- }
-
- } else {
-
- kDebug() << "Could not open KWallet, Falling back to config file";
- KSharedConfigPtr config = KGlobal::config();
- KConfigGroup krfbConfig(config,"Security");
-
- desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
- "desktopPassword", QString()));
- if(!desktopPassword.isEmpty()) {
- m_desktopPassword = desktopPassword;
- emit passwordChanged(m_desktopPassword);
- }
-
- unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
- "unattendedPassword", QString()));
- if(!unattendedPassword.isEmpty()) {
- m_unattendedPassword = unattendedPassword;
- }
-
- }
-}
-
// a random string that doesn't contain i, I, o, O, 1, l, 0
// based on KRandom::randomString()
QString InvitationsRfbServer::readableRandomString(int length)
#include "rfbserver.h"
-namespace KWallet {
- class Wallet;
-}
+#include <kpasswdstore.h>
namespace DNSSD {
class PublicService;
virtual ~InvitationsRfbServer();
virtual PendingRfbClient* newClient(rfbClientPtr client);
-private Q_SLOTS:
- void walletOpened(bool);
-
private:
DNSSD::PublicService *m_publicService;
bool m_allowUnattendedAccess;
QString m_desktopPassword;
QString m_unattendedPassword;
- KWallet::Wallet *m_wallet;
+ KPasswdStore *m_passwdStore;
QString readableRandomString(int);
Q_DISABLE_COPY(InvitationsRfbServer)
target_link_libraries(okularpart
${KDE4_KPARTS_LIBS}
${KDE4_SOLID_LIBS}
+ ${KDE4_KPASSWDSTORE_LIBS}
${QT_QTGUI_LIBRARY}
${MATH_LIB}
okularcore
-> various backends: fill about data information
-> gui: add config for gfx (yes/no) and text (yes/no/kde) antialias
-> core: provide a binary compatible okularcore library to extend the format capabilities
--> KPDF -> okular conversion of configuration & datafiles {configuration(done), document data(in progress), kwallet passwords(missing)}
+-> KPDF -> okular conversion of configuration & datafiles {configuration(done), document data(in progress), kpasswdstore passwords(missing)}
-> inverse search (BR113191)
find with an usability expert the "best" way to activate such a link
provide a configuration widget to choose the editor and configure a custom one
foreachObserver( notifySetup( d->m_pagesVector, 0 ) );
}
-void Document::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
+void Document::walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const
{
if (d->m_generator) {
- d->m_generator->walletDataForFile( fileName, walletName, walletFolder, walletKey );
+ d->m_generator->walletDataForFile( fileName, walletName, walletKey );
} else if (d->m_walletGenerator) {
- d->m_walletGenerator->walletDataForFile( fileName, walletName, walletFolder, walletKey );
+ d->m_walletGenerator->walletDataForFile( fileName, walletName, walletKey );
}
}
*
* @since 0.20 (KDE 4.14)
*/
- void walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const;
+ void walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const;
public Q_SLOTS:
/**
#include <kdebug.h>
#include <kicon.h>
#include <klocale.h>
-#include <kwallet.h>
#include "document.h"
#include "document_p.h"
return false;
}
-void Generator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
+void Generator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const
{
*walletKey = fileName.section('/', -1, -1);
- *walletName = KWallet::Wallet::NetworkWallet();
- *walletFolder = "KPdf";
+ *walletName = "KPdf";
}
bool Generator::hasFeature( GeneratorFeature feature ) const
* Unless you have very special requirements to where wallet data should be stored you
* don't need to reimplement this method.
*/
- virtual void walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const;
+ virtual void walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const;
/**
* Query for the specified @p feature.
#include <kaboutdata.h>
#include <klocale.h>
#include <kconfigdialog.h>
-#include <kwallet.h>
static KAboutData createAboutData()
{
dlg->addPage( widget, generalSettings(), i18n("OpenDocument Text"), "application-vnd.oasis.opendocument.text", i18n("OpenDocument Text Backend Configuration") );
}
-void KOOOGenerator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const
+void KOOOGenerator::walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const
{
*walletKey = fileName + "/opendocument";
- *walletName = KWallet::Wallet::LocalWallet();
- *walletFolder = KWallet::Wallet::PasswordFolder();
+ *walletName = "okular_ooo_generator";
}
// [INHERITED] reparse configuration
void addPages( KConfigDialog* dlg );
- virtual void walletDataForFile( const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey ) const;
+ virtual void walletDataForFile( const QString &fileName, QString *walletName, QString *walletKey ) const;
};
#endif
#include <kdeprintdialog.h>
#include <kbookmarkmenu.h>
#include <kpassworddialog.h>
-#include <kwallet.h>
+#include <kpasswdstore.h>
// local includes
#include "aboutdata.h"
}
// if the file didn't open correctly it might be encrypted, so ask for a pass
- QString walletName, walletFolder, walletKey;
- m_document->walletDataForFile(fileNameToOpen, &walletName, &walletFolder, &walletKey);
+ QString walletName, walletKey;
+ m_document->walletDataForFile(fileNameToOpen, &walletName, &walletKey);
bool firstInput = true;
bool triedWallet = false;
- KWallet::Wallet * wallet = 0;
bool keep = true;
while ( openResult == Document::OpenNeedsPassword )
{
+ KPasswdStore store;
+ bool storeopened = false;
+ const WId parentwid = widget()->effectiveWinId();
QString password;
- // 1.A. try to retrieve the first password from the kde wallet system
+ // 1.A. try to retrieve the first password from the kde store system
if ( !triedWallet && !walletKey.isNull() )
{
- const WId parentwid = widget()->effectiveWinId();
- wallet = KWallet::Wallet::openWallet( walletName, parentwid );
- if ( wallet )
+ storeopened = store.openStore( parentwid );
+ store.setStoreID(walletName);
+ if ( storeopened )
{
- // use the KPdf folder (and create if missing)
- if ( !wallet->hasFolder( walletFolder ) )
- wallet->createFolder( walletFolder );
- wallet->setFolder( walletFolder );
-
// look for the pass in that folder
- QString retrievedPass;
- if ( wallet->readPassword( walletKey, retrievedPass ) == 0)
+ QString retrievedPass = store.getPasswd( walletKey.toUtf8(), parentwid );
+ if (!retrievedPass.isEmpty())
password = retrievedPass;
}
triedWallet = true;
firstInput = false;
// if the user presses cancel, abort opening
- KPasswordDialog dlg( widget(), wallet ? KPasswordDialog::ShowKeepPassword : KPasswordDialog::KPasswordDialogFlags() );
+ KPasswordDialog dlg( widget(), storeopened ? KPasswordDialog::ShowKeepPassword : KPasswordDialog::KPasswordDialogFlags() );
dlg.setCaption( i18n( "Document Password" ) );
dlg.setPrompt( prompt );
if( !dlg.exec() )
break;
password = dlg.password();
- if ( wallet )
+ if ( storeopened )
keep = dlg.keepPassword();
}
}
// 3. if the password is correct and the user chose to remember it, store it to the wallet
- if ( openResult == Document::OpenSuccess && wallet && /*safety check*/ wallet->isOpen() && keep )
+ if ( openResult == Document::OpenSuccess && storeopened && keep )
{
- wallet->writePassword( walletKey, password );
+ store.storePasswd( walletKey.toUtf8(), password, parentwid );
}
}
}