| 341 | } |
| 342 | |
| 343 | STDMETHODIMP |
| 344 | DIFF_EXT::GetCommandString(UINT_PTR idCmd, UINT uFlags, UINT*, LPSTR pszName, UINT cchMax) |
| 345 | { |
| 346 | HRESULT ret = NOERROR; |
| 347 | |
| 348 | if(uFlags == GCS_HELPTEXT) |
| 349 | { |
| 350 | QString helpString; |
| 351 | if(idCmd == m_id_Diff) |
| 352 | { |
| 353 | helpString = i18nc("Contexualmenu option", "Compare selected files"); |
| 354 | } |
| 355 | else if(idCmd == m_id_DiffWith) |
| 356 | { |
| 357 | if(!m_recentFiles.empty()) |
| 358 | { |
| 359 | helpString = i18nc("Contexualmenu option", "Compare '%1' with '%2'", toQString(_file_name1), toQString(m_recentFiles.front())); |
| 360 | } |
| 361 | } |
| 362 | else if(idCmd == m_id_DiffLater) |
| 363 | { |
| 364 | helpString = i18nc("Contexualmenu option", "Save '%1' for later operation", toQString(_file_name1)); |
| 365 | } |
| 366 | else if((idCmd >= m_id_DiffWith_Base) && (idCmd < m_id_DiffWith_Base + m_recentFiles.size())) |
| 367 | { |
| 368 | if(!m_recentFiles.empty()) |
| 369 | { |
| 370 | unsigned long long num = idCmd - m_id_DiffWith_Base; |
| 371 | std::list<tstring>::iterator i = m_recentFiles.begin(); |
| 372 | for(unsigned long long j = 0; j < num && i != m_recentFiles.end(); j++) |
| 373 | i++; |
| 374 | |
| 375 | if(i != m_recentFiles.end()) |
| 376 | { |
| 377 | helpString = i18nc("Contexualmenu option", "Compare '%1' with '%2'", toQString(_file_name1), toQString(*i)); |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | lstrcpyn((LPTSTR)pszName, fromQString(helpString).c_str(), cchMax); |
| 382 | } |
| 383 | else |
| 384 | { |
| 385 | ret = E_INVALIDARG; |
| 386 | } |
| 387 | |
| 388 | return ret; |
| 389 | } |
| 390 | |
| 391 | void DIFF_EXT::diff(const tstring& arguments) |
| 392 | { |