MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / OnContextMenu

Method OnContextMenu

cppcryptfs/ui/MountPropertyPage.cpp:1727–1816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1725
1726
1727void CMountPropertyPage::OnContextMenu(CWnd* pWnd, CPoint point)
1728{
1729 // TODO: Add your message handler code here
1730
1731 CListCtrl* pList = (CListCtrl*)GetDlgItem(IDC_DRIVE_LETTERS);
1732
1733 enum { DismountV=1, AddMountPointV, DeleteMountPointV, PropertiesV, OpenV };
1734
1735 if ((CWnd*)pList == pWnd) {
1736 CMenu menu;
1737
1738 if (!menu.CreatePopupMenu())
1739 return;
1740
1741 menu.AppendMenu(MF_ENABLED, AddMountPointV, LocUtils::GetStringFromResources(IDS_MENU_ADD_MOUNT_POINT).c_str());
1742
1743 int item = -1;
1744
1745 for (int i = 0; i < pList->GetItemCount(); i++) {
1746 if (pList->GetItemState(i, LVIS_SELECTED) & LVIS_SELECTED) {
1747 item = i;
1748 break;
1749 }
1750 }
1751
1752 CString cmp;
1753 if (item >= 0) {
1754 cmp = pList->GetItemText(item, 0);
1755 wstring mpstr;
1756 bool mounted = MountPointManager::getInstance().find(cmp, mpstr);
1757 if (mounted) {
1758 menu.AppendMenu(MF_ENABLED, OpenV, LocUtils::GetStringFromResources(IDS_MENU_OPEN).c_str());
1759 menu.AppendMenu(MF_ENABLED, PropertiesV, LocUtils::GetStringFromResources(IDS_MENU_PROPERTIES).c_str());
1760 menu.AppendMenu(MF_ENABLED, DismountV, LocUtils::GetStringFromResources(IDS_MENU_DISMOUNT).c_str());
1761 }
1762 if (is_mountpoint_a_dir(cmp)) {
1763 menu.AppendMenu(mounted ? MF_DISABLED : MF_ENABLED, DeleteMountPointV, LocUtils::GetStringFromResources(IDS_MENU_DELETE_MPOINT).c_str());
1764 }
1765
1766 }
1767
1768 int retVal = menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, this);
1769
1770 switch (retVal) {
1771 case DismountV: {
1772 if (cmp.GetLength() > 1) {
1773 Dismount(cmp, true, false);
1774 }
1775 break;
1776 }
1777 case AddMountPointV:
1778 {
1779 CFolderDialog fdlg;
1780 fdlg.DoModal();
1781 CString path = fdlg.GetPathName();
1782 if (path.GetLength())
1783 AddMountPoint(path);
1784 }

Callers

nothing calls this directly

Calls 5

is_mountpoint_a_dirFunction · 0.85
get_fs_infoFunction · 0.85
findMethod · 0.80
GetPathNameMethod · 0.80
DoModalMethod · 0.45

Tested by

no test coverage detected