Version: (using KDE KDE 3.5.5) Installed from: SuSE RPMs If I create the folder "Pass" in my wallet and start the following programm the return from readPassword is 0. I would expect another value because the entry does not exist yet. #include <qstring.h> #include <kwallet.h> #include <kapplication.h> #include <kaboutdata.h> #include <kcmdlineargs.h> #include <iostream> int main(int argc, char ** argv) { KAboutData aboutData("pass", I18N_NOOP("Password Check"), "", "", KAboutData::License_GPL, ""); KCmdLineArgs::init( argc, argv, &aboutData ); KApplication app(false, false); QString localwallet = KWallet::Wallet::LocalWallet(); std::cout << localwallet.latin1() << std::endl; KWallet::Wallet * wallet = KWallet::Wallet::openWallet(localwallet); if (not wallet) return 1; if (not wallet->hasFolder("Pass")) { std::cout << "No folder" << std::endl; return 1; } if (not wallet->setFolder("Pass")) { std::cout << "Cannot change to folder" << std::endl; return 1; } QString key = "key"; // if (not wallet->hasEntry(key)) { // std::cout << "No entry: " << key << std::endl; // return 1; // } QString password = "Dummy"; int ret = wallet->readPassword(key, password); std::cerr << "Ret: " << ret << std::endl; if (ret == 0) { std::cerr << " Key: " << key.latin1() << " Password: " << password.latin1() << std::endl; } else { return 1; } return 0; }
You will have to check hasEntry before readPassword for now. It appears to be a design problem. -- George Staikos KDE Developer http://www.kde.org/ Staikos Computing Services Inc. http://www.staikos.net/
Hi, kdelibs (version 4 and earlier) is no longer maintained since a few years. KDE Frameworks 5 or 6 might already have resolved this bug. If not, please re-open against the matching framework if feasible or against the application that shows the issue. We then can still dispatch it to the right Bugzilla product or component. Greetings Christoph Cullmann