Changeset 77839 in vbox for trunk/src/VBox
- Timestamp:
- Mar 22, 2019 8:00:48 AM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.cpp
r77822 r77839 167 167 :QObject(parent) 168 168 , m_comGuest(comGuest) 169 , m_strHelp("[common-options] [--username <name>] [--domain <domain>]\n" 170 " [--passwordfile <file> | --password <password>]\n" 171 "start [common-options]\n" 172 " [--exe <path to executable>] [--timeout <msec>]\n" 173 " [--sessionid <id> | [sessionname <name>]]\n" 174 " [-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n" 175 " [--ignore-operhaned-processes] [--profile]\n" 176 " -- <program/arg0> [argument1] ... [argumentN]]\n" 177 "createsession [common-options] [--sessionname <name>]\n" 178 "mkdir [common-options]\n" 179 " [-P|--parents] [<guest directory>\n" 180 " [--sessionid <id> | [sessionname <name>]]\n" 181 "stat|ls [common-options]\n" 182 " [--sessionid <id> | [sessionname <name>]]\n" 169 , m_strHelp("[common-options]\t[--username <name>] [--domain <domain>]\n" 170 "\t\t[--passwordfile <file> | --password <password>]\n" 171 "start\t\t[common-options]\n" 172 "\t\t[--exe <path to executable>] [--timeout <msec>]\n" 173 "\t\t[--sessionid <id> | [sessionname <name>]]\n" 174 "\t\t[-E|--putenv <NAME>[=<VALUE>]] [--unquoted-args]\n" 175 "\t\t[--ignore-operhaned-processes] [--profile]\n" 176 "\t\t-- <program/arg0> [argument1] ... [argumentN]]\n" 177 "createsession\t\t[common-options] [--sessionname <name>]\n" 178 "mkdir\t\t[common-options]\n" 179 "\t\t[-P|--parents] [<guest directory>\n" 180 "\t\t[--sessionid <id> | --sessionname <name>]\n" 181 "stat|ls\t\t[common-options]\n" 182 "\t\t[--sessionid <id> | --sessionname <name>]\n" 183 "list\n" 183 184 ) 184 185 { … … 258 259 bool UIGuestControlInterface::handleStat(int argc, char** argv) 259 260 { 260 261 261 CommandData commandData; 262 262 … … 346 346 } 347 347 RETURN_MESSAGE(strObjectInfo); 348 } 349 350 bool UIGuestControlInterface::handleList(int, char**) 351 { 352 if (!m_comGuest.isOk()) 353 RETURN_ERROR("The guest session is not valid"); 354 355 QString strSessionInfo; 356 QVector<CGuestSession> sessions = m_comGuest.GetSessions(); 357 if (sessions.isEmpty()) 358 { 359 strSessionInfo.append("No guest sessions"); 360 RETURN_MESSAGE(strSessionInfo); 361 } 362 strSessionInfo += QString("Listing %1 guest sessions in total:\n").arg(QString::number(sessions.size())); 363 //strSessionInfo += QString("\t%1\t%2\n").arg("Session Name").arg("Session Id"); 364 365 for (int i = 0; i < sessions.size(); ++i) 366 { 367 strSessionInfo += QString("\tName: %1\t\tID: %2\n").arg(sessions[i].GetName()).arg(QString::number(sessions[i].GetId())); 368 QVector<CGuestProcess> processes = sessions[i].GetProcesses(); 369 strSessionInfo += QString("\t%1 guest prcesses for this session:\n").arg(QString::number(processes.size())); 370 371 for (int j = 0; j < processes.size(); ++j) 372 { 373 strSessionInfo += QString("\t\tName: %1\t\tID: %2\n").arg(processes[j].GetName()).arg(QString::number(processes[j].GetPID())); 374 375 } 376 } 377 RETURN_MESSAGE(strSessionInfo); 348 378 } 349 379 … … 429 459 RETURN_ERROR(QString(m_strHelp).append("No session with id %1 found.\n").arg(commandData.m_uSessionId)); 430 460 } 461 else 462 return true; 431 463 } 432 464 /* If sessionname is given then look for the session. if not try to create a session with the provided name: */ … … 437 469 if (!createSession(commandData, outGuestSession)) 438 470 return false; 439 } 471 else 472 return true; 473 } 474 else 475 return true; 440 476 } 441 477 /* search within the existing CGuestSessions and return a valid one if found: */ … … 511 547 QVector<KProcessCreateFlag> createFlags; 512 548 createFlags.push_back(KProcessCreateFlag_WaitForProcessStartOnly); 513 514 549 CGuestProcess process = guestSession.ProcessCreate(commandData.m_strExePath, 515 550 commandData.m_arguments, … … 534 569 m_subCommandHandlers.insert("stat" , &UIGuestControlInterface::handleStat); 535 570 m_subCommandHandlers.insert("ls" , &UIGuestControlInterface::handleStat); 571 m_subCommandHandlers.insert("list" , &UIGuestControlInterface::handleList); 536 572 } 537 573 -
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlInterface.h
r77822 r77839 89 89 bool handleMkdir(int, char**); 90 90 bool handleStat(int, char**); 91 /** Handles the list command and lists all the guest sessions and processes. */ 92 bool handleList(int, char**); 91 93 template<typename T> 92 94 QString getFsObjInfoString(const T &fsObjectInfo) const;
Note:
See TracChangeset
for help on using the changeset viewer.