本文整理汇总了C++中CItemData::IsShortcut方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemData::IsShortcut方法的具体用法?C++ CItemData::IsShortcut怎么用?C++ CItemData::IsShortcut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItemData
的用法示例。
在下文中一共展示了CItemData::IsShortcut方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
示例2: 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());
}
示例3: DoEdit
//This function intentionally takes the argument by value and not by
//reference to avoid touching an item invalidated by idle timeout
void PasswordSafeFrame::DoEdit(CItemData item)
{
int rc = 0;
if (!item.IsShortcut()) {
AddEditPropSheet editDbox(this, m_core, AddEditPropSheet::EDIT, &item, this);
rc = editDbox.ShowModal();
} else {
EditShortcut editDbox(this, m_core, &item);
rc = editDbox.ShowModal();
}
if (rc == wxID_OK) {
uuid_array_t uuid;
item.GetUUID(uuid);
//Find the item in the database, which might have been loaded afresh
//after lock/unlock, so the old data structures are no longer valid
ItemListIter iter = m_core.Find(uuid);
if ( iter != m_core.GetEntryEndIter()) {
CItemData& origItem = m_core.GetEntry(iter);
//The Item is updated in DB by AddEditPropSheet
UpdateAccessTime(origItem);
SetChanged(Data);
}
else {
wxFAIL_MSG(wxT("Item being edited not found in currently loaded DB"));
}
}
}
示例4: 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);
}
}
示例5: 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);
}
示例6: OnTrayCopyNotes
void DboxMain::OnTrayCopyNotes(UINT nID)
{
ASSERT((nID >= ID_MENUITEM_TRAYCOPYNOTES1) && (nID <= ID_MENUITEM_TRAYCOPYNOTESMAX));
CItemData ci;
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYCOPYNOTES1, ci))
return;
if (ci.IsShortcut())
if (!SafeGetBaseEntry(ci, ci))
return;
SetClipboardData(ci.GetNotes());
UpdateLastClipboardAction(CItemData::NOTES);
UpdateAccessTime(ci.GetUUID());
}
示例7: OnTrayCopyUsername
void DboxMain::OnTrayCopyUsername(UINT nID)
{
ASSERT((nID >= ID_MENUITEM_TRAYCOPYUSERNAME1) &&
(nID <= ID_MENUITEM_TRAYCOPYUSERNAMEMAX));
CItemData ci;
if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYCOPYUSERNAME1, ci))
return;
if (ci.IsShortcut()) {
if (!SafeGetBaseEntry(ci, ci))
return; // fail safely in release
}
const StringX cs_username = ci.GetUser();
SetClipboardData(cs_username);
UpdateLastClipboardAction(CItemData::USER);
UpdateAccessTime(ci.GetUUID());
}
示例8: OnUpdateTrayBrowse
void DboxMain::OnUpdateTrayBrowse(CCmdUI *pCmdUI)
{
int nID = pCmdUI->m_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;
}
// Has it an embedded URL
if (ci.IsURLEmpty()) {
pCmdUI->Enable(FALSE);
} else {
const bool bIsEmail = ci.IsURLEmail();
MapMenuShortcutsIter iter;
if (!bIsEmail && (nID >= ID_MENUITEM_TRAYBROWSE1) && (nID <= ID_MENUITEM_TRAYBROWSEMAX))
iter = m_MapMenuShortcuts.find(ID_MENUITEM_BROWSEURL);
else if (!bIsEmail && (nID >= ID_MENUITEM_TRAYBROWSEPLUS1) && (nID <= ID_MENUITEM_TRAYBROWSEPLUSMAX))
iter = m_MapMenuShortcuts.find(ID_MENUITEM_BROWSEURLPLUS);
else if (bIsEmail && (nID >= ID_MENUITEM_TRAYBROWSE1) && (nID <= ID_MENUITEM_TRAYBROWSEMAX))
iter = m_MapMenuShortcuts.find(ID_MENUITEM_SENDEMAIL);
ASSERT(iter != m_MapMenuShortcuts.end());
CString cs_text = iter->second.name.c_str();
int nPos = cs_text.Find(L"\t");
if (nPos > 0)
cs_text = cs_text.Left(nPos);
pCmdUI->SetText(cs_text);
}
}
示例9: OnTrayCopyEmail
void DboxMain::OnTrayCopyEmail(UINT nID)
{
ASSERT((nID >= ID_MENUITEM_TRAYCOPYEMAIL1) &&
(nID <= ID_MENUITEM_TRAYCOPYEMAILMAX));
CItemData ci;
if (!m_RUEList.GetPWEntry(nID - ID_MENUITEM_TRAYCOPYEMAIL1, ci))
return;
if (ci.IsShortcut()) {
if (!SafeGetBaseEntry(ci, ci))
return; // fail safely in release
}
const StringX cs_email = ci.GetEmail();
SetClipboardData(cs_email);
UpdateLastClipboardAction(CItemData::EMAIL);
UpdateAccessTime(ci.GetUUID());
}
示例10: 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());
}