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()); } }
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()); }
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()); }
void DboxMain::OnTrayCopyPassword(UINT nID) { ASSERT((nID >= ID_MENUITEM_TRAYCOPYPASSWORD1) && (nID <= ID_MENUITEM_TRAYCOPYPASSWORDMAX)); CItemData ci; if (!GetRUEntry(m_RUEList, nID - ID_MENUITEM_TRAYCOPYPASSWORD1, ci)) return; if (ci.IsDependent()) { if (!SafeGetBaseEntry(ci, ci)) return; // fail safely in release } const StringX cs_password = ci.GetPassword(); SetClipboardData(cs_password); UpdateLastClipboardAction(CItemData::PASSWORD); UpdateAccessTime(ci.GetUUID()); }
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()); }
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); } }
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()); }
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()); }