当前位置: 首页>>代码示例>>C++>>正文


C++ Wallet::writePassword方法代码示例

本文整理汇总了C++中Wallet::writePassword方法的典型用法代码示例。如果您正苦于以下问题:C++ Wallet::writePassword方法的具体用法?C++ Wallet::writePassword怎么用?C++ Wallet::writePassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wallet的用法示例。


在下文中一共展示了Wallet::writePassword方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeConfig

void NetworkAccount::writeConfig(KConfig/*Base*/ & config)   /*const*/
{
    KMAccount::writeConfig(config);

    config.writeEntry("login", login());
    config.writeEntry("store-passwd", storePasswd());

    if(storePasswd())
    {
        // write password to the wallet if possbile and necessary
        bool passwdStored = false;
        if(mPasswdDirty)
        {
            Wallet *wallet = kmkernel->wallet();
            if(wallet && wallet->writePassword("account-" + QString::number(mId), passwd()) == 0)
            {
                passwdStored = true;
                mPasswdDirty = false;
                mStorePasswdInConfig = false;
            }
        }
        else
        {
            passwdStored = !mStorePasswdInConfig; // already in the wallet
        }
        // if wallet is not available, write to config file, since the account
        // manager deletes this group, we need to write it always
        if(!passwdStored && (mStorePasswdInConfig || KMessageBox::warningYesNo(0,
                             i18n("KWallet is not available. It is strongly recommended to use "
                                  "KWallet for managing your passwords.\n"
                                  "However, KMail can store the password in its configuration "
                                  "file instead. The password is stored in an obfuscated format, "
                                  "but should not be considered secure from decryption efforts "
                                  "if access to the configuration file is obtained.\n"
                                  "Do you want to store the password for account '%1' in the "
                                  "configuration file?").arg(name()),
                             i18n("KWallet Not Available"),
                             KGuiItem(i18n("Store Password")),
                             KGuiItem(i18n("Do Not Store Password")))
                             == KMessageBox::Yes))
        {
            config.writeEntry("pass", encryptStr(passwd()));
            mStorePasswdInConfig = true;
        }
    }

    // delete password from the wallet if password storage is disabled
    if(!storePasswd() && !Wallet::keyDoesNotExist(
                Wallet::NetworkWallet(), "kmail", "account-" + QString::number(mId)))
    {
        Wallet *wallet = kmkernel->wallet();
        if(wallet)
            wallet->removeEntry("account-" + QString::number(mId));
    }

    config.writeEntry("host", host());
    config.writeEntry("port", static_cast<unsigned int>(port()));
    config.writeEntry("auth", auth());
    config.writeEntry("use-ssl", useSSL());
    config.writeEntry("use-tls", useTLS());

    mSieveConfig.writeConfig(config);
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:63,代码来源:networkaccount.cpp


注:本文中的Wallet::writePassword方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。