You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
714 lines
13 KiB
714 lines
13 KiB
15 years ago
|
/* This file is part of the KDE project
|
||
|
*
|
||
|
* Copyright (C) 2002-2004 George Staikos <staikos@kde.org>
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library 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
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
12 years ago
|
#include "tdewallettypes.h"
|
||
|
#include "tdewallet.h"
|
||
12 years ago
|
#include <tdeconfig.h>
|
||
15 years ago
|
#include <kdebug.h>
|
||
13 years ago
|
#include <tdeversion.h>
|
||
15 years ago
|
#include <dcopclient.h>
|
||
|
#include <dcopref.h>
|
||
15 years ago
|
#include <tqpopupmenu.h>
|
||
|
#include <tqapplication.h>
|
||
15 years ago
|
|
||
|
#include <assert.h>
|
||
|
|
||
11 years ago
|
using namespace TDEWallet;
|
||
15 years ago
|
|
||
|
|
||
15 years ago
|
const TQString Wallet::LocalWallet() {
|
||
12 years ago
|
TDEConfig cfg("tdewalletrc", true);
|
||
15 years ago
|
cfg.setGroup("Wallet");
|
||
|
if (!cfg.readBoolEntry("Use One Wallet", true)) {
|
||
15 years ago
|
TQString tmp = cfg.readEntry("Local Wallet", "localwallet");
|
||
15 years ago
|
if (tmp.isEmpty()) {
|
||
|
return "localwallet";
|
||
|
}
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQString tmp = cfg.readEntry("Default Wallet", "kdewallet");
|
||
15 years ago
|
if (tmp.isEmpty()) {
|
||
|
return "kdewallet";
|
||
|
}
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
15 years ago
|
const TQString Wallet::NetworkWallet() {
|
||
12 years ago
|
TDEConfig cfg("tdewalletrc", true);
|
||
15 years ago
|
cfg.setGroup("Wallet");
|
||
|
|
||
15 years ago
|
TQString tmp = cfg.readEntry("Default Wallet", "kdewallet");
|
||
15 years ago
|
if (tmp.isEmpty()) {
|
||
|
return "kdewallet";
|
||
|
}
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
15 years ago
|
const TQString Wallet::PasswordFolder() {
|
||
15 years ago
|
return "Passwords";
|
||
|
}
|
||
|
|
||
15 years ago
|
const TQString Wallet::FormDataFolder() {
|
||
15 years ago
|
return "Form Data";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
15 years ago
|
Wallet::Wallet(int handle, const TQString& name)
|
||
|
: TQObject(0L), DCOPObject(), d(0L), _name(name), _handle(handle) {
|
||
15 years ago
|
|
||
12 years ago
|
_dcopRef = new DCOPRef("kded", "tdewalletd");
|
||
15 years ago
|
|
||
|
_dcopRef->dcopClient()->setNotifications(true);
|
||
|
connect(_dcopRef->dcopClient(),
|
||
15 years ago
|
TQT_SIGNAL(applicationRemoved(const TQCString&)),
|
||
15 years ago
|
this,
|
||
15 years ago
|
TQT_SLOT(slotAppUnregistered(const TQCString&)));
|
||
15 years ago
|
|
||
|
connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "walletClosed(int)", "slotWalletClosed(int)", false);
|
||
15 years ago
|
connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "folderListUpdated(TQString)", "slotFolderListUpdated(TQString)", false);
|
||
|
connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "folderUpdated(TQString, TQString)", "slotFolderUpdated(TQString, TQString)", false);
|
||
|
connectDCOPSignal(_dcopRef->app(), _dcopRef->obj(), "applicationDisconnected(TQString, TQCString)", "slotApplicationDisconnected(TQString, TQCString)", false);
|
||
15 years ago
|
|
||
|
// Verify that the wallet is still open
|
||
|
if (_handle != -1) {
|
||
|
DCOPReply r = _dcopRef->call("isOpen", _handle);
|
||
|
if (r.isValid()) {
|
||
|
bool rc = false;
|
||
|
r.get(rc);
|
||
|
if (!rc) {
|
||
|
_handle = -1;
|
||
15 years ago
|
_name = TQString::null;
|
||
15 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
Wallet::~Wallet() {
|
||
|
if (_handle != -1) {
|
||
|
_dcopRef->call("close", _handle, false);
|
||
|
_handle = -1;
|
||
15 years ago
|
_folder = TQString::null;
|
||
|
_name = TQString::null;
|
||
15 years ago
|
}
|
||
|
|
||
|
delete _dcopRef;
|
||
|
_dcopRef = 0L;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
TQStringList Wallet::walletList() {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("wallets");
|
||
15 years ago
|
TQStringList rc;
|
||
15 years ago
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
void Wallet::changePassword(const TQString& name, WId w) {
|
||
12 years ago
|
DCOPRef("kded", "tdewalletd").send("changePassword", name, uint(w));
|
||
15 years ago
|
}
|
||
|
|
||
|
|
||
|
bool Wallet::isEnabled() {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("isEnabled");
|
||
15 years ago
|
bool rc = false;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::isOpen(const TQString& name) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("isOpen", name);
|
||
15 years ago
|
bool rc = false;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::closeWallet(const TQString& name, bool force) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("close", name, force);
|
||
15 years ago
|
int rc = -1;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::deleteWallet(const TQString& name) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("deleteWallet", name);
|
||
15 years ago
|
int rc = -1;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
Wallet *Wallet::openWallet(const TQString& name, WId w, OpenType ot) {
|
||
15 years ago
|
if (ot == Asynchronous) {
|
||
|
Wallet *wallet = new Wallet(-1, name);
|
||
12 years ago
|
DCOPRef("kded", "tdewalletd").send("openAsynchronous", name, wallet->objId(), uint(w));
|
||
15 years ago
|
return wallet;
|
||
|
}
|
||
|
|
||
|
// avoid deadlock if the app has some popup open (#65978/#71048)
|
||
14 years ago
|
while( TQWidget* widget = TQT_TQWIDGET(tqApp->activePopupWidget()))
|
||
15 years ago
|
widget->close();
|
||
|
|
||
|
bool isPath = ot == Path;
|
||
|
DCOPReply r;
|
||
|
|
||
|
if (isPath) {
|
||
12 years ago
|
r = DCOPRef("kded", "tdewalletd").call("openPath", name, uint(w));
|
||
15 years ago
|
} else {
|
||
12 years ago
|
r = DCOPRef("kded", "tdewalletd").call("open", name, uint(w));
|
||
15 years ago
|
}
|
||
|
|
||
|
if (r.isValid()) {
|
||
|
int drc = -1;
|
||
|
r.get(drc);
|
||
|
if (drc != -1) {
|
||
|
return new Wallet(drc, name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::disconnectApplication(const TQString& wallet, const TQCString& app) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("disconnectApplication", wallet, app);
|
||
15 years ago
|
bool rc = false;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
TQStringList Wallet::users(const TQString& name) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("users", name);
|
||
15 years ago
|
TQStringList drc;
|
||
15 years ago
|
if (r.isValid()) {
|
||
|
r.get(drc);
|
||
|
}
|
||
|
return drc;
|
||
|
}
|
||
|
|
||
|
|
||
|
int Wallet::sync() {
|
||
|
if (_handle == -1) {
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
_dcopRef->call("sync", _handle);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
int Wallet::lockWallet() {
|
||
|
if (_handle == -1) {
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("close", _handle, true);
|
||
|
_handle = -1;
|
||
15 years ago
|
_folder = TQString::null;
|
||
|
_name = TQString::null;
|
||
15 years ago
|
if (r.isValid()) {
|
||
|
int drc = -1;
|
||
|
r.get(drc);
|
||
|
return drc;
|
||
|
}
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
const TQString& Wallet::walletName() const {
|
||
15 years ago
|
return _name;
|
||
|
}
|
||
|
|
||
|
|
||
|
bool Wallet::isOpen() const {
|
||
|
return _handle != -1;
|
||
|
}
|
||
|
|
||
|
|
||
|
void Wallet::requestChangePassword(WId w) {
|
||
|
if (_handle == -1) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
_dcopRef->send("changePassword", _name, uint(w));
|
||
|
}
|
||
|
|
||
|
|
||
|
void Wallet::slotWalletClosed(int handle) {
|
||
|
if (_handle == handle) {
|
||
|
_handle = -1;
|
||
15 years ago
|
_folder = TQString::null;
|
||
|
_name = TQString::null;
|
||
15 years ago
|
emit walletClosed();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
TQStringList Wallet::folderList() {
|
||
|
TQStringList rc;
|
||
15 years ago
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("folderList", _handle);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
TQStringList Wallet::entryList() {
|
||
|
TQStringList rc;
|
||
15 years ago
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("entryList", _handle, _folder);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::hasFolder(const TQString& f) {
|
||
15 years ago
|
bool rc = false;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("hasFolder", _handle, f);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::createFolder(const TQString& f) {
|
||
15 years ago
|
bool rc = true;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
if (!hasFolder(f)) {
|
||
|
DCOPReply r = _dcopRef->call("createFolder", _handle, f);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::setFolder(const TQString& f) {
|
||
15 years ago
|
bool rc = false;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
// Don't do this - the folder could have disappeared?
|
||
|
#if 0
|
||
|
if (f == _folder) {
|
||
|
return true;
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
if (hasFolder(f)) {
|
||
|
_folder = f;
|
||
|
rc = true;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::removeFolder(const TQString& f) {
|
||
15 years ago
|
bool rc = false;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("removeFolder", _handle, f);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
if (_folder == f) {
|
||
15 years ago
|
setFolder(TQString::null);
|
||
15 years ago
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
const TQString& Wallet::currentFolder() const {
|
||
15 years ago
|
return _folder;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readEntry(const TQString& key, TQByteArray& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readEntry", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(value);
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readEntryList(const TQString& key, TQMap<TQString, TQByteArray>& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readEntryList", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(value);
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::renameEntry(const TQString& oldName, const TQString& newName) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("renameEntry", _handle, _folder, oldName, newName);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readMap(const TQString& key, TQMap<TQString,TQString>& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readMap", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
15 years ago
|
TQByteArray v;
|
||
15 years ago
|
r.get(v);
|
||
|
if (!v.isEmpty()) {
|
||
15 years ago
|
TQDataStream ds(v, IO_ReadOnly);
|
||
15 years ago
|
ds >> value;
|
||
|
}
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readMapList(const TQString& key, TQMap<TQString, TQMap<TQString, TQString> >& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readMapList", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
15 years ago
|
TQMap<TQString,TQByteArray> unparsed;
|
||
15 years ago
|
r.get(unparsed);
|
||
15 years ago
|
for (TQMap<TQString,TQByteArray>::ConstIterator i = unparsed.begin(); i != unparsed.end(); ++i) {
|
||
15 years ago
|
if (!i.data().isEmpty()) {
|
||
15 years ago
|
TQDataStream ds(i.data(), IO_ReadOnly);
|
||
|
TQMap<TQString,TQString> v;
|
||
15 years ago
|
ds >> v;
|
||
|
value.insert(i.key(), v);
|
||
|
}
|
||
|
}
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readPassword(const TQString& key, TQString& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readPassword", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(value);
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::readPasswordList(const TQString& key, TQMap<TQString, TQString>& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("readPasswordList", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(value);
|
||
|
rc = 0;
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::writeEntry(const TQString& key, const TQByteArray& value, EntryType entryType) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("writeEntry", _handle, _folder, key, value, int(entryType));
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::writeEntry(const TQString& key, const TQByteArray& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("writeEntry", _handle, _folder, key, value);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::writeMap(const TQString& key, const TQMap<TQString,TQString>& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
15 years ago
|
TQByteArray a;
|
||
|
TQDataStream ds(a, IO_WriteOnly);
|
||
15 years ago
|
ds << value;
|
||
|
DCOPReply r = _dcopRef->call("writeMap", _handle, _folder, key, a);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::writePassword(const TQString& key, const TQString& value) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("writePassword", _handle, _folder, key, value);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::hasEntry(const TQString& key) {
|
||
15 years ago
|
bool rc = false;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("hasEntry", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
int Wallet::removeEntry(const TQString& key) {
|
||
15 years ago
|
int rc = -1;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("removeEntry", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
Wallet::EntryType Wallet::entryType(const TQString& key) {
|
||
15 years ago
|
int rc = 0;
|
||
|
|
||
|
if (_handle == -1) {
|
||
|
return Wallet::Unknown;
|
||
|
}
|
||
|
|
||
|
DCOPReply r = _dcopRef->call("entryType", _handle, _folder, key);
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
|
||
|
return static_cast<EntryType>(rc);
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
void Wallet::slotAppUnregistered(const TQCString& app) {
|
||
15 years ago
|
if (_handle >= 0 && app == "kded") {
|
||
|
slotWalletClosed(_handle);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
void Wallet::slotFolderUpdated(const TQString& wallet, const TQString& folder) {
|
||
15 years ago
|
if (_name == wallet) {
|
||
|
emit folderUpdated(folder);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
void Wallet::slotFolderListUpdated(const TQString& wallet) {
|
||
15 years ago
|
if (_name == wallet) {
|
||
|
emit folderListUpdated();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
void Wallet::slotApplicationDisconnected(const TQString& wallet, const TQCString& application) {
|
||
15 years ago
|
if (_handle >= 0
|
||
|
&& _name == wallet
|
||
|
&& application == _dcopRef->dcopClient()->appId()) {
|
||
|
slotWalletClosed(_handle);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
void Wallet::walletOpenResult(int id) {
|
||
|
if (_handle != -1) {
|
||
|
// This is BAD.
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (id > 0) {
|
||
|
_handle = id;
|
||
|
emit walletOpened(true);
|
||
|
} else if (id < 0) {
|
||
|
emit walletOpened(false);
|
||
|
} // id == 0 => wait
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::folderDoesNotExist(const TQString& wallet, const TQString& folder) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("folderDoesNotExist", wallet, folder);
|
||
15 years ago
|
bool rc = true;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
15 years ago
|
bool Wallet::keyDoesNotExist(const TQString& wallet, const TQString& folder, const TQString& key) {
|
||
12 years ago
|
DCOPReply r = DCOPRef("kded", "tdewalletd").call("keyDoesNotExist", wallet, folder, key);
|
||
15 years ago
|
bool rc = true;
|
||
|
if (r.isValid()) {
|
||
|
r.get(rc);
|
||
|
}
|
||
|
return rc;
|
||
|
}
|
||
|
|
||
|
|
||
|
void Wallet::virtual_hook(int, void*) {
|
||
|
//BASE::virtual_hook( id, data );
|
||
|
}
|
||
|
|
||
12 years ago
|
#include "tdewallet.moc"
|