Changeset 71693 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 6, 2018 7:43:08 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.cpp
r71639 r71693 25 25 # include <QHBoxLayout> 26 26 # include <QHeaderView> 27 # include <Q PlainTextEdit>27 # include <QTextEdit> 28 28 # include <QPushButton> 29 29 # include <QSplitter> … … 36 36 # include "QITreeWidget.h" 37 37 # include "QIWithRetranslateUI.h" 38 # include "UIErrorString.h" 38 39 # include "UIExtraDataManager.h" 39 40 # include "UIIconPool.h" … … 392 393 } 393 394 394 m_pLogOutput = new Q PlainTextEdit;395 m_pLogOutput = new QTextEdit; 395 396 if (m_pLogOutput) 396 397 { … … 482 483 if (m_pLogOutput) 483 484 { 484 m_pLogOutput->append PlainText("Could not find Guest Additions");485 m_pLogOutput->append("Could not find Guest Additions"); 485 486 postSessionClosed(); 486 487 return; … … 490 491 { 491 492 if (m_pLogOutput) 492 m_pLogOutput->append PlainText("No user name is given");493 m_pLogOutput->append("No user name is given"); 493 494 return; 494 495 } … … 500 501 if (!m_comGuestSession.isOk()) 501 502 { 502 m_pLogOutput->append PlainText("Guest session is not valid");503 m_pLogOutput->append("Guest session is not valid"); 503 504 postSessionClosed(); 504 505 return; … … 511 512 512 513 m_comGuestSession.Close(); 513 m_pLogOutput->append PlainText("Guest session is closed");514 m_pLogOutput->append("Guest session is closed"); 514 515 postSessionClosed(); 515 516 } … … 522 523 if (cErrorInfo.isOk()) 523 524 { 524 m_pLogOutput->append PlainText(cErrorInfo.GetText());525 m_pLogOutput->append(cErrorInfo.GetText()); 525 526 } 526 527 } … … 532 533 else 533 534 { 534 m_pLogOutput->append PlainText("Session status has changed");535 m_pLogOutput->append("Session status has changed"); 535 536 } 536 537 } … … 539 540 { 540 541 if (m_pLogOutput) 541 m_pLogOutput->append PlainText(strOutput);542 m_pLogOutput->append(strOutput); 542 543 } 543 544 … … 601 602 if (!m_comGuestSession.isOk()) 602 603 { 603 m_pLogOutput->append PlainText("Guest session could not be created");604 m_pLogOutput->append(UIErrorString::formatErrorInfo(m_comGuestSession)); 604 605 return false; 605 606 } 606 607 607 m_pLogOutput->append PlainText("Guest session has been created");608 m_pLogOutput->append("Guest session has been created"); 608 609 if (m_pSessionCreateWidget) 609 610 m_pSessionCreateWidget->switchSessionCloseMode(); … … 624 625 /* Wait session to start. For some reason we cannot get GuestSessionStatusChanged event 625 626 consistently. So we wait: */ 626 m_pLogOutput->append PlainText("Waiting the session to start");627 m_pLogOutput->append("Waiting the session to start"); 627 628 const ULONG waitTimeout = 2000; 628 629 KGuestSessionWaitResult waitResult = m_comGuestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout); 629 630 if (waitResult != KGuestSessionWaitResult_Start) 630 631 { 631 m_pLogOutput->append PlainText("The session did not start");632 m_pLogOutput->append("The session did not start"); 632 633 sltCloseSession(); 633 634 return false; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.h
r71654 r71693 35 35 /* Forward declarations: */ 36 36 class QHBoxLayout; 37 class Q PlainTextEdit;37 class QTextEdit; 38 38 class QVBoxLayout; 39 39 class QSplitter; … … 105 105 QVBoxLayout *m_pMainLayout; 106 106 QSplitter *m_pVerticalSplitter; 107 Q PlainTextEdit*m_pLogOutput;107 QTextEdit *m_pLogOutput; 108 108 UIToolBar *m_pToolBar; 109 109 QAction *m_pCopyGuestToHost; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp
r71654 r71693 269 269 /* static */ QStringList UIPathOperations::pathTrail(const QString &path) 270 270 { 271 Q List<QString>pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts);271 QStringList pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 272 272 return pathList; 273 273 } … … 1068 1068 } 1069 1069 1070 void UIGuestControlFileTable::goIntoDirectory(const Q List<QString>&pathTrail)1070 void UIGuestControlFileTable::goIntoDirectory(const QStringList &pathTrail) 1071 1071 { 1072 1072 UIFileTableItem *parent = getStartDirectoryItem(); … … 1229 1229 return; 1230 1230 1231 Q List<QString>pathList = comboLocation.split(UIPathOperations::delimiter, QString::SkipEmptyParts);1231 QStringList pathList = comboLocation.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 1232 1232 goIntoDirectory(pathList); 1233 1233 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h
r71654 r71693 269 269 void goIntoDirectory(const QModelIndex &itemIndex); 270 270 /** Follows the path trail, opens directories as it descends */ 271 void goIntoDirectory(const Q List<QString>&pathTrail);271 void goIntoDirectory(const QStringList &pathTrail); 272 272 /** Goes into directory pointed by the @p item */ 273 273 void goIntoDirectory(UIFileTableItem *item); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp
r71670 r71693 27 27 /* GUI includes: */ 28 28 # include "QILabel.h" 29 # include "UIErrorString.h" 29 30 # include "UIGuestFileTable.h" 30 31 # include "UIVMInformationDialog.h" … … 100 101 if (!m_comGuestSession.isOk()) 101 102 return; 102 103 103 /* if the object is a file or a symlink then read the size and return: */ 104 104 if (fileInfo.GetType() == KFsObjType_File) … … 122 122 QVector<KDirectoryOpenFlag> flag(KDirectoryOpenFlag_None); 123 123 CGuestDirectory directory = m_comGuestSession.DirectoryOpen(path, /*aFilter*/ "", flag); 124 if (!m_comGuestSession.isOk()) 125 return; 124 126 125 127 if (directory.isOk()) … … 155 157 return; 156 158 m_comGuestSession = session; 157 158 159 159 initializeFileTree(); 160 160 } … … 179 179 180 180 directory = m_comGuestSession.DirectoryOpen(strPath, /*aFilter*/ "", flag); 181 if (!m_comGuestSession.isOk()) 182 { 183 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 184 return; 185 } 186 181 187 parent->setIsOpened(true); 182 188 if (directory.isOk()) … … 229 235 if (!item) 230 236 return; 231 if (!m_comGuestSession.isOk())232 return;233 237 if (item->isUpDirectory()) 234 238 return; … … 242 246 m_comGuestSession.FsObjRemove(item->path()); 243 247 if (!m_comGuestSession.isOk()) 248 { 244 249 emit sigLogOutput(QString(item->path()).append(" could not be deleted")); 245 250 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 251 } 246 252 } 247 253 … … 257 263 258 264 QString userHome = UIPathOperations::sanitize(m_comGuestSession.GetUserHome()); 259 QList<QString> pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 265 if (!m_comGuestSession.isOk()) 266 { 267 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 268 return; 269 } 270 QStringList pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 260 271 goIntoDirectory(pathList); 261 272 } … … 264 275 { 265 276 266 if (!item || item->isUpDirectory() || newBaseName.isEmpty() || !m_comGuestSession.isOk())277 if (!item || item->isUpDirectory() || newBaseName.isEmpty()) 267 278 return false; 268 279 QString newPath = UIPathOperations::constructNewItemPath(item->path(), newBaseName); … … 271 282 m_comGuestSession.FsObjRename(item->path(), newPath, aFlags); 272 283 if (!m_comGuestSession.isOk()) 273 return false; 284 { 285 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 286 return false; 287 } 288 274 289 item->setPath(newPath); 275 290 return true; … … 278 293 bool UIGuestFileTable::createDirectory(const QString &path, const QString &directoryName) 279 294 { 280 if (!m_comGuestSession.isOk())281 return false;282 283 295 QString newDirectoryPath = UIPathOperations::mergePaths(path, directoryName); 284 296 QVector<KDirectoryCreateFlag> flags(KDirectoryCreateFlag_None); 285 297 286 298 m_comGuestSession.DirectoryCreate(newDirectoryPath, 0/*aMode*/, flags); 299 287 300 if (!m_comGuestSession.isOk()) 288 301 { 289 302 emit sigLogOutput(newDirectoryPath.append(" could not be created")); 303 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 290 304 return false; 291 305 } … … 331 345 } 332 346 if (!m_comGuestSession.isOk()) 333 return false; 347 { 348 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 349 return false; 350 } 351 334 352 return true; 335 353 } … … 342 360 if (!hostFileInfo.exists()) 343 361 return false; 344 362 CProgress comProgress; 345 363 /* Currently API expects a path including a file name for file copy*/ 346 364 if (hostFileInfo.isFile() || hostFileInfo.isSymLink()) … … 349 367 QString destinationFilePath = UIPathOperations::addTrailingDelimiters(guestDestinationPath); 350 368 /** @todo listen to CProgress object to monitor copy operation: */ 351 /*CProgress comProgress =*/m_comGuestSession.FileCopyToGuest(hostSourcePath, destinationFilePath, flags);369 comProgress = m_comGuestSession.FileCopyToGuest(hostSourcePath, destinationFilePath, flags); 352 370 } 353 371 else if(hostFileInfo.isDir()) … … 357 375 QString destinationFilePath = UIPathOperations::addTrailingDelimiters(guestDestinationPath); 358 376 /** @todo listen to CProgress object to monitor copy operation: */ 359 /*CProgress comProgress = */ m_comGuestSession.DirectoryCopyToGuest(hostSourcePath, destinationFilePath, aFlags); 360 } 361 if (!m_comGuestSession.isOk()) 362 return false; 377 comProgress = m_comGuestSession.DirectoryCopyToGuest(hostSourcePath, destinationFilePath, aFlags); 378 379 380 } 381 /** @todo currently I cannot get an errorfrom CProgress: */ 382 if (m_comGuestSession.isOk()) 383 { 384 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 385 { 386 emit sigLogOutput(UIErrorString::formatErrorInfo(comProgress)); 387 return false; 388 } 389 } 390 else 391 { 392 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 393 return false; 394 } 395 363 396 return true; 364 397 } … … 405 438 CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(selectedObjects.at(0), true); 406 439 if (!m_comGuestSession.isOk()) 440 { 441 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 407 442 return QString(); 443 } 444 408 445 409 446 QString propertyString; … … 440 477 CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(selectedObjects.at(0), true); 441 478 if (!m_comGuestSession.isOk()) 479 { 480 emit sigLogOutput(UIErrorString::formatErrorInfo(m_comGuestSession)); 442 481 continue; 482 } 483 443 484 FileObjectType type = fileType(fileInfo); 444 485 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp
r71645 r71693 227 227 228 228 QString userHome = UIPathOperations::sanitize(QDir::homePath()); 229 Q List<QString>pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts);229 QStringList pathList = userHome.split(UIPathOperations::delimiter, QString::SkipEmptyParts); 230 230 goIntoDirectory(pathList); 231 231 }
Note:
See TracChangeset
for help on using the changeset viewer.