void CPanel::CreateFile() { CMyComPtr<IFolderOperations> folderOperations; if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK) { MessageBoxErrorForUpdate(E_NOINTERFACE, IDS_CREATE_FILE_ERROR, 0x03020243); return; } CPanel::CDisableTimerProcessing disableTimerProcessing2(*this); CSelectedState state; SaveSelectedState(state); CComboDialog comboDialog; comboDialog.Title = LangString(IDS_CREATE_FILE, 0x03020240); comboDialog.Static = LangString(IDS_CREATE_FILE_NAME, 0x03020241); comboDialog.Value = LangString(IDS_CREATE_FILE_DEFAULT_NAME, /*0x03020242*/ (UInt32)-1); if (comboDialog.Create(GetParent()) == IDCANCEL) return; UString newName = comboDialog.Value; HRESULT result = folderOperations->CreateFile(newName, 0); if (result != S_OK) { MessageBoxErrorForUpdate(result, IDS_CREATE_FILE_ERROR, 0x03020243); return; } int pos = newName.Find(WCHAR_PATH_SEPARATOR); if (pos >= 0) newName = newName.Left(pos); if (!_mySelectMode) state.SelectedNames.Clear(); state.FocusedName = newName; state.SelectFocused = true; RefreshListCtrl(state); }
void CPanel::SelectSpec(bool selectMode) { CComboDialog dlg; LangString(selectMode ? IDS_SELECT : IDS_DESELECT, dlg.Title ); LangString(IDS_SELECT_MASK, dlg.Static); dlg.Value = L'*'; if (dlg.Create(GetParent()) != IDOK) return; const UString &mask = dlg.Value; FOR_VECTOR (i, _selectedStatusVector) if (DoesWildcardMatchName(mask, GetItemName(i))) _selectedStatusVector[i] = selectMode; UpdateSelection(); }
void CPanel::ChangeComment() { CPanel::CDisableTimerProcessing disableTimerProcessing2(*this); int index = _listView.GetFocusedItem(); if (index < 0) return; int realIndex = GetRealItemIndex(index); if (realIndex == kParentIndex) return; CSelectedState state; SaveSelectedState(state); CMyComPtr<IFolderOperations> folderOperations; if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK) { MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208); return; } UString comment; { NCOM::CPropVariant propVariant; if (_folder->GetProperty(realIndex, kpidComment, &propVariant) != S_OK) return; if (propVariant.vt == VT_BSTR) comment = propVariant.bstrVal; else if (propVariant.vt != VT_EMPTY) return; } UString name = GetItemRelPath(realIndex); CComboDialog comboDialog; comboDialog.Title = name + L" " + LangString(IDS_COMMENT, 0x03020290); comboDialog.Value = comment; comboDialog.Static = LangString(IDS_COMMENT2, 0x03020291); if (comboDialog.Create(GetParent()) == IDCANCEL) return; NCOM::CPropVariant propVariant = comboDialog.Value; HRESULT result = folderOperations->SetProperty(realIndex, kpidComment, &propVariant, NULL); if (result != S_OK) { if (result == E_NOINTERFACE) MessageBoxErrorLang(IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208); else MessageBoxError(result, L"Set Comment Error"); } RefreshListCtrl(state); }
void CPanel::CreateFolder() { CMyComPtr<IFolderOperations> folderOperations; if (_folder.QueryInterface(IID_IFolderOperations, &folderOperations) != S_OK) { MessageBoxErrorForUpdate(E_NOINTERFACE, IDS_CREATE_FOLDER_ERROR, 0x03020233); return; } CPanel::CDisableTimerProcessing disableTimerProcessing2(*this); CSelectedState state; SaveSelectedState(state); CComboDialog comboDialog; comboDialog.Title = LangString(IDS_CREATE_FOLDER, 0x03020230); comboDialog.Static = LangString(IDS_CREATE_FOLDER_NAME, 0x03020231); comboDialog.Value = LangString(IDS_CREATE_FOLDER_DEFAULT_NAME, /*0x03020232*/ (UInt32)-1); if (comboDialog.Create(GetParent()) == IDCANCEL) return; UString newName = comboDialog.Value; if (!IsCorrectFsName(newName)) { MessageBoxError(E_INVALIDARG); return; } { CThreadFolderOperations op(FOLDER_TYPE_CREATE_FOLDER); op.FolderOperations = folderOperations; op.Name = newName; HRESULT res = op.DoOperation(*this, LangString(IDS_CREATE_FOLDER, 0x03020230), LangString(IDS_CREATE_FOLDER_ERROR, 0x03020233)); if (res != S_OK) return; } int pos = newName.Find(WCHAR_PATH_SEPARATOR); if (pos >= 0) newName = newName.Left(pos); if (!_mySelectMode) state.SelectedNames.Clear(); state.FocusedName = newName; state.SelectFocused = true; RefreshTitleAlways(); RefreshListCtrl(state); }