本文整理汇总了C++中Wallet类的典型用法代码示例。如果您正苦于以下问题:C++ Wallet类的具体用法?C++ Wallet怎么用?C++ Wallet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wallet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OFX_PASSWORD_KEY
QString MyMoneyOfxConnector::password() const
{
// if we don't find a password in the wallet, we use the old method
// and retrieve it from the settings stored in the KMyMoney data storage.
// in case we don't have a password on file, we ask the user
QString key = OFX_PASSWORD_KEY(m_fiSettings.value("url"), m_fiSettings.value("uniqueId"));
QString pwd = m_fiSettings.value("password");
// now check for the wallet
Wallet *wallet = openSynchronousWallet();
if (wallet
&& !Wallet::keyDoesNotExist(Wallet::NetworkWallet(), Wallet::PasswordFolder(), key)) {
wallet->setFolder(Wallet::PasswordFolder());
wallet->readPassword(key, pwd);
}
if (pwd.isEmpty()) {
QPointer<KPasswordDialog> dlg = new KPasswordDialog(0);
dlg->setPrompt(i18n("Enter your password for account <b>%1</b>").arg(m_account.name()));
if (dlg->exec())
pwd = dlg->password();
delete dlg;
}
return pwd;
}
示例2: readPassword
void NetworkAccount::readPassword()
{
if(!storePasswd())
return;
// ### workaround for broken Wallet::keyDoesNotExist() which returns wrong
// results for new entries without closing and reopening the wallet
if(Wallet::isOpen(Wallet::NetworkWallet()))
{
Wallet *wallet = kmkernel->wallet();
if(!wallet || !wallet->hasEntry("account-" + QString::number(mId)))
return;
}
else
{
if(Wallet::keyDoesNotExist(Wallet::NetworkWallet(), "kmail", "account-" + QString::number(mId)))
return;
}
if(kmkernel->wallet())
{
QString passwd;
kmkernel->wallet()->readPassword("account-" + QString::number(mId), passwd);
setPasswd(passwd, true);
mPasswdDirty = false;
}
}
示例3: Clamp
void CoreScript::AddTech()
{
tech += TECH_ADDED_BY_VISITOR;
tech = Clamp( tech, 0.0, Min( double(TECH_MAX), double( MaxTech() ) - 0.01 ));
achievement.techLevel = Max(achievement.techLevel, (int)tech);
int team = ParentChit()->Team();
int superTeam = Team::Instance()->SuperTeam(team);
if (team != superTeam) {
CoreScript* super = CoreScript::GetCoreFromTeam(superTeam);
if (super) {
super->AddTech();
// EXPERIMENTAL: also transfer Au
Wallet* wallet = parentChit->GetWallet();
GLASSERT(wallet);
if (wallet
&& super->ParentChit()->GetWallet()
&& (wallet->Gold() > (GOLD_XFER_TAKEOVER *3/2)))
{
int gold = GOLD_XFER_TAKEOVER / 10;
super->ParentChit()->GetWallet()->Deposit(wallet, gold);
}
}
}
}
示例4: bridgeWatcherStart
Status
bridgeWatcherStart(Wallet &self)
{
if (watchers_.end() != watchers_.find(self.id()))
return ABC_ERROR(ABC_CC_Error,
"Watcher already exists for " + self.id());
watchers_[self.id()].reset(new WatcherInfo(self));
return Status();
}
示例5: argToStr
//public member functions
void Command::parse(char* args[])
{
mainArg = argToStr(args[1]);
Wallet wallet;
if(mainArg == "getnewaddress")
{
wallet.walletName = argToStr(args[2]);
wallet.getNewAddress();
}
}
示例6: if
void MapScene::ItemTapped(const gamui::UIItem* item)
{
Vector2I sector = { 0, 0 };
Vector2I v = data->destSector;
CoreScript* cs = CoreScript::GetCore(v);
CoreScript* homeCore = lumosChitBag->GetHomeCore();
if (item == &okay) {
data->destSector.Zero();
lumosGame->PopScene();
}
else if (item == &gridTravel) {
lumosGame->PopScene();
}
else if (item == &viewButton) {
data->view = true;
lumosGame->PopScene();
}
else if (item == &mapImage) {
float x = 0, y = 0;
gamui2D.GetRelativeTap(&x, &y);
sector.x = int(x * float(NUM_SECTORS));
sector.y = int(y * float(NUM_SECTORS));
data->destSector = sector;
DrawMap();
EnableButtons();
}
else if (item == &mapImage2) {
float x = 0, y = 0;
gamui2D.GetRelativeTap(&x, &y);
Rectangle2I b = MapBounds2();
sector.x = b.min.x + int(x * float(b.Width()));
sector.y = b.min.y + int(y * float(b.Height()));
data->destSector = sector;
DrawMap();
EnableButtons();
}
else if (item == &warButton) {
Team::Instance()->War(cs, homeCore, true, &lumosChitBag->GetSim()->GetCachedWeb());
DrawMap();
EnableButtons();
}
else if (item == &peaceButton) {
int cost = Team::Instance()->Peace(cs, homeCore, false, &lumosChitBag->GetSim()->GetCachedWeb());
Wallet* wallet = homeCore->ParentChit()->GetWallet();
if (wallet->HasGold(cost)) {
ReserveBank::Instance()->GetWallet()->Deposit(wallet, cost);
Team::Instance()->Peace(cs, homeCore, true, &lumosChitBag->GetSim()->GetCachedWeb());
DrawMap();
EnableButtons();
}
}
}
示例7: viewWallet
//Get values from wallet class and display them on screen
void viewWallet(Wallet &myWallet)
{
cout << endl << " ***Viewing Wallet***" << endl << endl
<< " 1: Dollars: " << fixed << setprecision(2) << myWallet.getMoney(Wallet::DOLLAR) << "\n"
<< " 2: Dinars: " << fixed << setprecision(2) << myWallet.getMoney(Wallet::DINAR) << "\n"
<< " 3: Euro: " << fixed << setprecision(2) << myWallet.getMoney(Wallet::EURO) << "\n"
<< " 4: Peso: " << fixed << setprecision(2) << myWallet.getMoney(Wallet::PESO) << "\n"
<< " 5: Pound: " << fixed << setprecision(2) << myWallet.getMoney(Wallet::POUND) << "\n"
<< endl << endl;
system("pause");
}
示例8: sender
void PasswordHandler::onWalletOpened(bool success)
{
#if USE_KWALLET
Wallet *wallet = qobject_cast<Wallet*>( sender() );
if (wallet && success) {
// read and store the password
password();
emit passwordAvailable();
}
if (wallet) {
wallet->deleteLater();
}
#else
Q_UNUSED(success);
#endif
}
示例9: ABC_BridgeWatcherConnect
tABC_CC ABC_BridgeWatcherConnect(Wallet &self, tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
tABC_GeneralInfo *ppInfo = NULL;
const char *szServer = FALLBACK_OBELISK;
Watcher *watcher = nullptr;
ABC_CHECK_NEW(watcherFind(watcher, self));
// Pick a server:
if (isTestnet())
{
szServer = TESTNET_OBELISK;
}
else if (ABC_CC_Ok == ABC_GeneralGetInfo(&ppInfo, pError) &&
0 < ppInfo->countObeliskServers)
{
++gLastObelisk;
if (ppInfo->countObeliskServers <= gLastObelisk)
gLastObelisk = 0;
szServer = ppInfo->aszObeliskServers[gLastObelisk];
}
// Connect:
ABC_DebugLog("Wallet %s connecting to %s", self.id().c_str(), szServer);
watcher->connect(szServer);
exit:
ABC_GeneralFreeInfo(ppInfo);
return cc;
}
示例10: mainBranch
static bc::hd_private_key
mainBranch(const Wallet &wallet)
{
return bc::hd_private_key(wallet.bitcoinKey()).
generate_private_key(0).
generate_private_key(0);
}
示例11: bridgeWatcherDelete
Status
bridgeWatcherDelete(Wallet &self)
{
watcherSave(self).log(); // Failure is not fatal
watchers_.erase(self.id());
return Status();
}
示例12: ABC_BridgeWatcherDelete
tABC_CC ABC_BridgeWatcherDelete(Wallet &self, tABC_Error *pError)
{
tABC_CC cc = ABC_CC_Ok;
watcherSave(self); // Failure is not fatal
watchers_.erase(self.id());
return cc;
}
示例13: emptyWallet
//Calls function from wallet class to set all values to zero
void emptyWallet(Wallet &myWallet)
{
cout << endl << " ***Emptying Wallet...***" << endl;
myWallet.emptyWallet();
cout << endl << " ***Wallet Emptied***" << endl;
system("pause");
}
示例14: openWallet
// return 0 on success, -1 on error or not found, -2 on user reject
// if success, password contain the password
int SQLManager::readCredentials(const QString &name, QString &password)
{
Wallet *wallet = openWallet();
if (!wallet) // user reject
return -2;
QMap<QString, QString> map;
if (wallet->readMap(name, map) == 0)
{
if (!map.isEmpty())
{
password = map.value("password");
return 0;
}
}
return -1;
}
示例15: watcherFind
static Status
watcherFind(WatcherInfo *&result, Wallet &self)
{
std::string id = self.id();
auto row = watchers_.find(id);
if (row == watchers_.end())
return ABC_ERROR(ABC_CC_Synchronizing, "Cannot find watcher for " + id);
result = row->second.get();
return Status();
}