本文整理汇总了C++中CItemData::GetURL方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemData::GetURL方法的具体用法?C++ CItemData::GetURL怎么用?C++ CItemData::GetURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemData
的用法示例。
在下文中一共展示了CItemData::GetURL方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTrayRunCommand
void DboxMain::OnTrayRunCommand(UINT nID)
{
ASSERT((nID >= ID_MENUITEM_TRAYRUNCMD1) && (nID <= ID_MENUITEM_TRAYRUNCMDMAX));
CItemData ci;
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYRUNCMD1, ci))
return;
if (ci.IsShortcut()) {
if (!SafeGetBaseEntry(ci, ci))
return; // fail safely in release
}
StringX cs_URL = ci.GetURL();
StringX::size_type ipos;
ipos = cs_URL.find(L"[alt]");
if (ipos != StringX::npos)
cs_URL.replace(ipos, 5, L"");
ipos = cs_URL.find(L"[ssh]");
if (ipos != StringX::npos)
cs_URL.replace(ipos, 5, L"");
ipos = cs_URL.find(L"{alt}");
if (ipos != StringX::npos)
cs_URL.replace(ipos, 5, L"");
SetClipboardData(cs_URL);
UpdateLastClipboardAction(CItemData::URL);
UpdateAccessTime(ci.GetUUID());
}
示例2: DoBrowse
void PasswordSafeFrame::DoBrowse(CItemData &item, bool bAutotype)
{
CItemData* pci = &item;
StringX sx_pswd;
if (pci->IsDependent()) {
CItemData *pbci = m_core.GetBaseEntry(pci);
ASSERT(pbci != NULL);
sx_pswd = pbci->GetPassword();
if (pci->IsShortcut())
pci = pbci;
} else
sx_pswd = pci->GetPassword();
wxString cs_command = towxstring(pci->GetURL());
if (!cs_command.IsEmpty()) {
std::vector<size_t> vactionverboffsets;
StringX sxautotype = PWSAuxParse::GetAutoTypeString(*pci, m_core,
vactionverboffsets);
LaunchBrowser(cs_command, sxautotype, vactionverboffsets, bAutotype);
#ifdef NOT_YET
SetClipboardData(sx_pswd);
UpdateLastClipboardAction(CItemData::PASSWORD);
#endif
UpdateAccessTime(item);
}
}
示例3: OnTraySendEmail
void DboxMain::OnTraySendEmail(UINT nID)
{
ASSERT((nID >= ID_MENUITEM_TRAYSENDEMAIL1) && (nID <= ID_MENUITEM_TRAYSENDEMAILMAX));
CItemData ci;
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYSENDEMAIL1, ci))
return;
if (ci.IsShortcut()) {
if (!SafeGetBaseEntry(ci, ci))
return; // fail safely in release
}
CString cs_command;
if (!ci.IsEmailEmpty()) {
cs_command = L"mailto:";
cs_command += ci.GetEmail().c_str();
} else {
cs_command = ci.GetURL().c_str();
}
if (!cs_command.IsEmpty()) {
std::vector<size_t> vactionverboffsets;
LaunchBrowser(cs_command, L"", vactionverboffsets, false);
UpdateAccessTime(ci.GetUUID());
}
}
示例4: GetAutoTypeString
StringX PWSAuxParse::GetAutoTypeString(const CItemData &ci,
const PWScore &core,
std::vector<size_t> &vactionverboffsets)
{
// Set up all the data (a shortcut entry will change all of them!)
StringX sxgroup = ci.GetGroup();
StringX sxtitle = ci.GetTitle();
StringX sxuser = ci.GetUser();
StringX sxpwd = ci.GetPassword();
StringX sxnotes = ci.GetNotes();
StringX sxurl = ci.GetURL();
StringX sxemail = ci.GetEmail();
StringX sxautotype = ci.GetAutoType();
if (ci.IsAlias()) {
const CItemData *pbci = core.GetBaseEntry(&ci);
if (pbci != NULL) {
sxpwd = pbci->GetPassword();
} else { // Problem - alias entry without a base!
ASSERT(0);
}
} else if (ci.IsShortcut()) {
const CItemData *pbci = core.GetBaseEntry(&ci);
if (pbci != NULL) {
sxgroup = pbci->GetGroup();
sxtitle = pbci->GetTitle();
sxuser = pbci->GetUser();
sxpwd = pbci->GetPassword();
sxnotes = pbci->GetNotes();
sxurl = pbci->GetURL();
sxemail = pbci->GetEmail();
sxautotype = pbci->GetAutoType();
} else { // Problem - shortcut entry without a base!
ASSERT(0);
}
} // ci.IsShortcut()
// If empty, try the database default
if (sxautotype.empty()) {
sxautotype = PWSprefs::GetInstance()->
GetPref(PWSprefs::DefaultAutotypeString);
// If still empty, take this default
if (sxautotype.empty()) {
// checking for user and password for default settings
if (!sxpwd.empty()){
if (!sxuser.empty())
sxautotype = DEFAULT_AUTOTYPE;
else
sxautotype = _T("\\p\\n");
}
}
}
return PWSAuxParse::GetAutoTypeString(sxautotype, sxgroup,
sxtitle, sxuser, sxpwd,
sxnotes, sxurl, sxemail,
vactionverboffsets);
}
示例5: DoEmail
void PasswordSafeFrame::DoEmail(CItemData& item )
{
const wxString mailto = item.IsEmailEmpty()?
(item.IsURLEmail()? towxstring(item.GetURL()): wxString())
: towxstring(item.GetEmail());
if (!mailto.empty()) {
::wxLaunchDefaultBrowser(mailto, wxBROWSER_NEW_WINDOW);
UpdateAccessTime(item);
}
}
示例6: DoCopyEmail
void PasswordSafeFrame::DoCopyEmail(CItemData &item)
{
const StringX mailto = item.IsEmailEmpty()?
(item.IsURLEmail()? item.GetURL(): StringX())
: item.GetEmail();
if (!mailto.empty()) {
PWSclipboard::GetInstance()->SetData(mailto);
UpdateAccessTime(item);
}
}
示例7: OnTrayBrowse
void DboxMain::OnTrayBrowse(UINT nID)
{
ASSERT(((nID >= ID_MENUITEM_TRAYBROWSE1) && (nID <= ID_MENUITEM_TRAYBROWSEMAX)) ||
((nID >= ID_MENUITEM_TRAYBROWSEPLUS1) && (nID <= ID_MENUITEM_TRAYBROWSEPLUSMAX)));
CItemData ci;
const bool bDoAutotype = (nID >= ID_MENUITEM_TRAYBROWSEPLUS1) &&
(nID <= ID_MENUITEM_TRAYBROWSEPLUSMAX);
if (!bDoAutotype) {
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYBROWSE1, ci))
return;
} else {
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYBROWSEPLUS1, ci))
return;
}
if (ci.IsShortcut()) {
if (!SafeGetBaseEntry(ci, ci))
return;
}
if (!ci.IsURLEmpty()) {
std::vector<size_t> vactionverboffsets;
StringX sxAutotype = PWSAuxParse::GetAutoTypeString(ci.GetAutoType(),
ci.GetGroup(), ci.GetTitle(),
ci.GetUser(),
ci.GetPassword(), ci.GetPreviousPassword(),
ci.GetNotes(), ci.GetURL(), ci.GetEmail(),
vactionverboffsets);
LaunchBrowser(ci.GetURL().c_str(), sxAutotype, vactionverboffsets, bDoAutotype);
if (PWSprefs::GetInstance()->GetPref(PWSprefs::CopyPasswordWhenBrowseToURL)) {
SetClipboardData(ci.GetPassword());
UpdateLastClipboardAction(CItemData::PASSWORD);
}
}
UpdateAccessTime(ci.GetUUID());
}
示例8: ReMergeNotes
static StringX ReMergeNotes(const CItemData &item)
{
StringX notes = item.GetNotes();
const StringX url(item.GetURL());
if (!url.empty()) {
notes += _T("\r\n"); notes += url;
}
const StringX at(item.GetAutoType());
if (!at.empty()) {
stringT cs_autotype;
LoadAString(cs_autotype, IDSC_AUTOTYPE);
notes += _T("\r\n");
notes += cs_autotype.c_str();
notes += at;
}
return notes;
}
示例9:
TEST_F(AliasShortcutTest, Alias)
{
CItemData al;
al.CreateUUID();
al.SetTitle(L"alias");
al.SetPassword(L"alias-password-not-used");
al.SetUser(L"alias-user");
al.SetNotes(L"alias-notes");
al.SetGroup(L"Galias");
al.SetURL(L"http://alias-url.com");
al.SetAutoType(L"alias-autotype");
al.SetEmail(L"[email protected]");
al.SetRunCommand(L"Run alias, run");
al.SetAlias();
const pws_os::CUUID base_uuid = base.GetUUID();
MultiCommands *pmulticmds = MultiCommands::Create(&core);
pmulticmds->Add(AddEntryCommand::Create(&core, base));
pmulticmds->Add(AddEntryCommand::Create(&core, al, base_uuid));
core.Execute(pmulticmds);
EXPECT_EQ(2, core.GetNumEntries());
const CItemData al2 = core.GetEntry(core.Find(al.GetUUID()));
StringX sx_group, sx_title, sx_user, sx_pswd, sx_lastpswd, sx_notes, sx_url, sx_email, sx_autotype, sx_runcmd;
bool status = PWSAuxParse::GetEffectiveValues(&al2, &base,
sx_group, sx_title, sx_user, sx_pswd, sx_lastpswd, sx_notes,
sx_url, sx_email, sx_autotype, sx_runcmd);
EXPECT_TRUE(status);
// Password should be from base:
EXPECT_EQ(sx_pswd, base.GetPassword());
// All the rest should be from alias:
EXPECT_EQ(sx_group, al.GetGroup());
EXPECT_EQ(sx_title, al.GetTitle());
EXPECT_EQ(sx_user, al.GetUser());
EXPECT_EQ(sx_lastpswd, L"");
EXPECT_EQ(sx_notes, al.GetNotes());
EXPECT_EQ(sx_url, al.GetURL());
EXPECT_EQ(sx_email, al.GetEmail());
EXPECT_EQ(sx_autotype, al.GetAutoType());
EXPECT_EQ(sx_runcmd, al.GetRunCommand());
}
示例10: Merge
//.........这里部分代码省略.........
Format(sxMergedEntry, GROUPTITLEUSERINCHEVRONS,
sx_otherGroup.c_str(), sx_otherTitle.c_str(), sx_otherUser.c_str());
ItemListConstIter foundPos = Find(sx_otherGroup, sx_otherTitle, sx_otherUser);
otherItem.GetUUID(base_uuid);
memcpy(new_base_uuid, base_uuid, sizeof(new_base_uuid));
bTitleRenamed = false;
if (foundPos != GetEntryEndIter()) {
// Found a match, see if other fields also match
CItemData curItem = GetEntry(foundPos);
// Can't merge into a protected entry. If we were going to - add instead
unsigned char ucprotected;
curItem.GetProtected(ucprotected);
stringT str_diffs(_T("")), str_temp;
int diff_flags = 0;
int32 cxtint, oxtint;
time_t cxt, oxt;
if (otherItem.GetPassword() != curItem.GetPassword()) {
diff_flags |= MRG_PASSWORD;
LoadAString(str_temp, IDSC_FLDNMPASSWORD);
str_diffs += str_temp + _T(", ");
}
if (otherItem.GetNotes() != curItem.GetNotes()) {
diff_flags |= MRG_NOTES;
LoadAString(str_temp, IDSC_FLDNMNOTES);
str_diffs += str_temp + _T(", ");
}
if (otherItem.GetURL() != curItem.GetURL()) {
diff_flags |= MRG_URL;
LoadAString(str_temp, IDSC_FLDNMURL);
str_diffs += str_temp + _T(", ");
}
if (otherItem.GetAutoType() != curItem.GetAutoType()) {
diff_flags |= MRG_AUTOTYPE;
LoadAString(str_temp, IDSC_FLDNMAUTOTYPE);
str_diffs += str_temp + _T(", ");
}
if (otherItem.GetPWHistory() != curItem.GetPWHistory()) {
diff_flags |= MRG_HISTORY;
LoadAString(str_temp, IDSC_FLDNMPWHISTORY);
str_diffs += str_temp + _T(", ");
}
// Don't test policy or symbols if either entry is using a named policy
// as these are meaningless to compare
if (otherItem.GetPolicyName().empty() && curItem.GetPolicyName().empty()) {
PWPolicy cur_pwp, oth_pwp;
if (curItem.GetPWPolicy().empty())
cur_pwp = PWSprefs::GetInstance()->GetDefaultPolicy();
else
curItem.GetPWPolicy(cur_pwp);
if (otherItem.GetPWPolicy().empty())
oth_pwp = PWSprefs::GetInstance()->GetDefaultPolicy(true);
else
otherItem.GetPWPolicy(oth_pwp);
if (cur_pwp != oth_pwp) {
diff_flags |= MRG_POLICY;
LoadAString(str_temp, IDSC_FLDNMPWPOLICY);
示例11: CompareEntries
bool CCompareResultsDlg::CompareEntries(st_CompareData *pst_data)
{
CItemData::FieldBits bsConflicts;
bsConflicts.reset();
ItemListIter iter;
iter = m_pcore0->Find(pst_data->uuid0);
CItemData currentItem = iter->second;
iter = m_pcore1->Find(pst_data->uuid1);
CItemData compItem = iter->second;
StringX sxCurrentPassword, sxComparisonPassword;
if (currentItem.GetEntryType() == CItemData::ET_ALIAS ||
currentItem.GetEntryType() == CItemData::ET_SHORTCUT) {
CItemData *pci_base = m_pcore0->GetBaseEntry(¤tItem);
sxCurrentPassword == pci_base->GetPassword();
} else
sxCurrentPassword == currentItem.GetPassword();
if (compItem.GetEntryType() == CItemData::ET_ALIAS ||
compItem.GetEntryType() == CItemData::ET_SHORTCUT) {
CItemData *pci_base = m_pcore1->GetBaseEntry(&compItem);
sxComparisonPassword == pci_base->GetPassword();
} else
sxComparisonPassword == compItem.GetPassword();
if (m_bsFields.test(CItemData::PASSWORD) &&
sxCurrentPassword != sxComparisonPassword)
bsConflicts.flip(CItemData::PASSWORD);
if (m_bsFields.test(CItemData::NOTES) &&
FieldsNotEqual(currentItem.GetNotes(), compItem.GetNotes(), m_bTreatWhiteSpaceasEmpty))
bsConflicts.flip(CItemData::NOTES);
if (m_bsFields.test(CItemData::CTIME) &&
currentItem.GetCTime() != compItem.GetCTime())
bsConflicts.flip(CItemData::CTIME);
if (m_bsFields.test(CItemData::PMTIME) &&
currentItem.GetPMTime() != compItem.GetPMTime())
bsConflicts.flip(CItemData::PMTIME);
if (m_bsFields.test(CItemData::ATIME) &&
currentItem.GetATime() != compItem.GetATime())
bsConflicts.flip(CItemData::ATIME);
if (m_bsFields.test(CItemData::XTIME) &&
currentItem.GetXTime() != compItem.GetXTime())
bsConflicts.flip(CItemData::XTIME);
if (m_bsFields.test(CItemData::RMTIME) &&
currentItem.GetRMTime() != compItem.GetRMTime())
bsConflicts.flip(CItemData::RMTIME);
if (m_bsFields.test(CItemData::XTIME_INT)) {
int current_xint, comp_xint;
currentItem.GetXTimeInt(current_xint);
compItem.GetXTimeInt(comp_xint);
if (current_xint != comp_xint)
bsConflicts.flip(CItemData::XTIME_INT);
}
if (m_bsFields.test(CItemData::URL) &&
FieldsNotEqual(currentItem.GetURL(), compItem.GetURL(),
m_bTreatWhiteSpaceasEmpty))
bsConflicts.flip(CItemData::URL);
if (m_bsFields.test(CItemData::AUTOTYPE) &&
FieldsNotEqual(currentItem.GetAutoType(), compItem.GetAutoType(),
m_bTreatWhiteSpaceasEmpty))
bsConflicts.flip(CItemData::AUTOTYPE);
if (m_bsFields.test(CItemData::PWHIST) &&
currentItem.GetPWHistory() != compItem.GetPWHistory())
bsConflicts.flip(CItemData::PWHIST);
if (m_bsFields.test(CItemData::POLICY) &&
currentItem.GetPWPolicy() != compItem.GetPWPolicy())
bsConflicts.flip(CItemData::POLICY);
if (m_bsFields.test(CItemData::POLICYNAME) &&
currentItem.GetPolicyName() != compItem.GetPolicyName())
bsConflicts.flip(CItemData::POLICYNAME);
if (m_bsFields.test(CItemData::RUNCMD) &&
currentItem.GetRunCommand() != compItem.GetRunCommand())
bsConflicts.flip(CItemData::RUNCMD);
if (m_bsFields.test(CItemData::DCA) &&
currentItem.GetDCA() != compItem.GetDCA())
bsConflicts.flip(CItemData::DCA);
if (m_bsFields.test(CItemData::SHIFTDCA) &&
currentItem.GetShiftDCA() != compItem.GetShiftDCA())
bsConflicts.flip(CItemData::SHIFTDCA);
if (m_bsFields.test(CItemData::EMAIL) &&
currentItem.GetEmail() != compItem.GetEmail())
bsConflicts.flip(CItemData::EMAIL);
if (m_bsFields.test(CItemData::PROTECTED) &&
currentItem.GetProtected() != compItem.GetProtected())
bsConflicts.flip(CItemData::PROTECTED);
if (m_bsFields.test(CItemData::SYMBOLS) &&
currentItem.GetSymbols() != compItem.GetSymbols())
bsConflicts.flip(CItemData::SYMBOLS);
if (m_bsFields.test(CItemData::KBSHORTCUT) &&
currentItem.GetKBShortcut() != compItem.GetKBShortcut())
bsConflicts.flip(CItemData::KBSHORTCUT);
return bsConflicts.none();
}
示例12: DoCopyURL
void PasswordSafeFrame::DoCopyURL(CItemData &item)
{
PWSclipboard::GetInstance()->SetData(item.GetURL());
UpdateAccessTime(item);
}