Changeset 71467 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 22, 2018 4:56:22 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 121436
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.cpp
r71439 r71467 22 22 /* Qt includes: */ 23 23 # include <QAbstractItemModel> 24 # include <QCheckBox> 24 25 # include <QHBoxLayout> 25 26 # include <QHeaderView> … … 97 98 98 99 void sltCreateButtonClick(); 100 void sltShowHidePassword(bool flag); 99 101 100 102 private: … … 102 104 QILineEdit *m_pUserNameEdit; 103 105 QILineEdit *m_pPasswordEdit; 104 105 QILabel *m_pUserNameLabel;106 QILabel *m_pPasswordLabel;107 106 QPushButton *m_pCreateButton; 108 107 QPushButton *m_pCloseButton; 109 110 Q HBoxLayout *m_pMainLayout;108 QHBoxLayout *m_pMainLayout; 109 QCheckBox *m_pShowPasswordCheckBox; 111 110 112 111 }; … … 129 128 , m_pUserNameEdit(0) 130 129 , m_pPasswordEdit(0) 131 , m_pUserNameLabel(0)132 , m_pPasswordLabel(0)133 130 , m_pCreateButton(0) 134 131 , m_pCloseButton(0) 135 132 , m_pMainLayout(0) 133 , m_pShowPasswordCheckBox(0) 136 134 { 137 135 prepareWidgets(); … … 143 141 if (!m_pMainLayout) 144 142 return; 143 145 144 m_pUserNameEdit = new QILineEdit; 146 145 if (m_pUserNameEdit) 147 146 { 148 m_pMainLayout->addWidget(m_pUserNameEdit); 149 } 150 m_pUserNameLabel = new QILabel; 151 if (m_pUserNameLabel) 152 { 153 m_pMainLayout->addWidget(m_pUserNameLabel); 154 } 147 m_pMainLayout->addWidget(m_pUserNameEdit, 2); 148 m_pUserNameEdit->setPlaceholderText("User Name"); 149 } 150 155 151 m_pPasswordEdit = new QILineEdit; 156 152 if (m_pPasswordEdit) 157 153 { 158 m_pMainLayout->addWidget(m_pPasswordEdit); 159 } 160 161 m_pPasswordLabel = new QILabel; 162 if (m_pPasswordLabel) 163 { 164 m_pMainLayout->addWidget(m_pPasswordLabel); 154 m_pMainLayout->addWidget(m_pPasswordEdit, 2); 155 m_pPasswordEdit->setPlaceholderText("Password"); 156 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 157 } 158 159 m_pShowPasswordCheckBox = new QCheckBox; 160 if (m_pShowPasswordCheckBox) 161 { 162 m_pShowPasswordCheckBox->setText("Show Password"); 163 m_pMainLayout->addWidget(m_pShowPasswordCheckBox); 164 connect(m_pShowPasswordCheckBox, &QCheckBox::toggled, 165 this, &UIGuestSessionCreateWidget::sltShowHidePassword); 165 166 } 166 167 … … 178 179 connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseButtonClick); 179 180 } 180 181 m_pMainLayout->insertStretch(-1, 1); 181 182 retranslateUi(); 182 183 } … … 188 189 } 189 190 191 void UIGuestSessionCreateWidget::sltShowHidePassword(bool flag) 192 { 193 if (!m_pPasswordEdit) 194 return; 195 if (flag) 196 m_pPasswordEdit->setEchoMode(QLineEdit::Normal); 197 else 198 m_pPasswordEdit->setEchoMode(QLineEdit::Password); 199 } 200 190 201 void UIGuestSessionCreateWidget::retranslateUi() 191 202 { … … 193 204 { 194 205 m_pUserNameEdit->setToolTip(UIVMInformationDialog::tr("User name to authenticate session creation")); 206 m_pUserNameEdit->setPlaceholderText(UIVMInformationDialog::tr("User Name")); 207 195 208 } 196 209 if (m_pPasswordEdit) 197 210 { 198 211 m_pPasswordEdit->setToolTip(UIVMInformationDialog::tr("Password to authenticate session creation")); 199 } 200 if (m_pUserNameLabel) 201 { 202 m_pUserNameLabel->setToolTip(UIVMInformationDialog::tr("User name to authenticate session creation")); 203 m_pUserNameLabel->setText(UIVMInformationDialog::tr("User name")); 204 } 205 if (m_pPasswordLabel) 206 { 207 m_pPasswordLabel->setToolTip(UIVMInformationDialog::tr("Password to authenticate session creation")); 208 m_pPasswordLabel->setText(UIVMInformationDialog::tr("Password")); 209 } 212 m_pPasswordEdit->setPlaceholderText(UIVMInformationDialog::tr("Password")); 213 } 214 210 215 if (m_pCreateButton) 211 216 m_pCreateButton->setText(UIVMInformationDialog::tr("Create Session")); … … 228 233 void UIGuestSessionCreateWidget::switchSessionCreateMode() 229 234 { 230 m_pUserNameEdit->setEnabled(true); 231 m_pPasswordEdit->setEnabled(true); 232 m_pUserNameLabel->setEnabled(true); 233 m_pPasswordLabel->setEnabled(true); 234 m_pCreateButton->setEnabled(true); 235 m_pCloseButton->setEnabled(false); 235 if (m_pUserNameEdit) 236 m_pUserNameEdit->setEnabled(true); 237 if (m_pPasswordEdit) 238 m_pPasswordEdit->setEnabled(true); 239 if (m_pCreateButton) 240 m_pCreateButton->setEnabled(true); 241 if (m_pCloseButton) 242 m_pCloseButton->setEnabled(false); 236 243 } 237 244 238 245 void UIGuestSessionCreateWidget::switchSessionCloseMode() 239 246 { 240 m_pUserNameEdit->setEnabled(false); 241 m_pPasswordEdit->setEnabled(false); 242 m_pUserNameLabel->setEnabled(false); 243 m_pPasswordLabel->setEnabled(false); 244 m_pCreateButton->setEnabled(false); 245 m_pCloseButton->setEnabled(true); 247 if (m_pUserNameEdit) 248 m_pUserNameEdit->setEnabled(false); 249 if (m_pPasswordEdit) 250 m_pPasswordEdit->setEnabled(false); 251 if (m_pCreateButton) 252 m_pCreateButton->setEnabled(false); 253 if (m_pCloseButton) 254 m_pCloseButton->setEnabled(true); 246 255 } 247 256 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp
r71439 r71467 157 157 const QChar UIPathOperations::delimiter = QChar('/'); 158 158 159 QString UIPathOperations::removeMultipleDelimiters(const QString &path)159 /* static */ QString UIPathOperations::removeMultipleDelimiters(const QString &path) 160 160 { 161 161 QString newPath(path); … … 167 167 } 168 168 169 QString UIPathOperations::removeTrailingDelimiters(const QString &path)169 /* static */ QString UIPathOperations::removeTrailingDelimiters(const QString &path) 170 170 { 171 171 if (path.isNull() || path.isEmpty()) … … 178 178 } 179 179 180 QString UIPathOperations::addStartDelimiter(const QString &path)180 /* static */ QString UIPathOperations::addStartDelimiter(const QString &path) 181 181 { 182 182 if (path.isEmpty()) … … 188 188 } 189 189 190 QString UIPathOperations::sanitize(const QString &path)190 /* static */ QString UIPathOperations::sanitize(const QString &path) 191 191 { 192 192 return addStartDelimiter(removeTrailingDelimiters(removeMultipleDelimiters(path))); 193 193 } 194 194 195 QString UIPathOperations::mergePaths(const QString &path, const QString &baseName)195 /* static */ QString UIPathOperations::mergePaths(const QString &path, const QString &baseName) 196 196 { 197 197 QString newBase(baseName); … … 208 208 } 209 209 210 QString UIPathOperations::getObjectName(const QString &path)210 /* static */ QString UIPathOperations::getObjectName(const QString &path) 211 211 { 212 212 if (path.length() <= 1) … … 222 222 } 223 223 224 QString UIPathOperations::getPathExceptObjectName(const QString &path)224 /* static */ QString UIPathOperations::getPathExceptObjectName(const QString &path) 225 225 { 226 226 if (path.length() <= 1) … … 234 234 } 235 235 236 QString UIPathOperations::constructNewItemPath(const QString &previousPath, const QString &newBaseName)236 /* static */ QString UIPathOperations::constructNewItemPath(const QString &previousPath, const QString &newBaseName) 237 237 { 238 238 if (previousPath.length() <= 1) … … 241 241 } 242 242 243 QStringList UIPathOperations::pathTrail(const QString &path)243 /* static */ QStringList UIPathOperations::pathTrail(const QString &path) 244 244 { 245 245 QList<QString> pathList = path.split(UIPathOperations::delimiter, QString::SkipEmptyParts); … … 944 944 return; 945 945 if (currentRoot != m_pModel->rootIndex()) 946 changeLocation(currentRoot.parent()); 946 { 947 QModelIndex parentIndex = currentRoot.parent(); 948 if (parentIndex.isValid()) 949 { 950 changeLocation(currentRoot.parent()); 951 m_pView->selectRow(currentRoot.row()); 952 } 953 } 947 954 } 948 955 … … 1255 1262 sltDelete(); 1256 1263 } 1264 else if (pEvent->key() == Qt::Key_Backspace) 1265 { 1266 sltGoUp(); 1267 } 1268 1257 1269 QWidget::keyPressEvent(pEvent); 1258 1270 } … … 1344 1356 } 1345 1357 1346 QString UIGuestControlFileTable::fileTypeString(FileObjectType type)1358 /* static */ QString UIGuestControlFileTable::fileTypeString(FileObjectType type) 1347 1359 { 1348 1360 QString strType("Unknown"); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlInterface.cpp
r71195 r71467 73 73 break; 74 74 75 QString UIGuestControlInterface::getFsObjTypeString(KFsObjType type)75 /* static */ QString UIGuestControlInterface::getFsObjTypeString(KFsObjType type) 76 76 { 77 77 QString strType; … … 664 664 } 665 665 666 bool UIGuestControlInterface::isGuestAdditionsAvailable(const CGuest &guest)666 /* static */ bool UIGuestControlInterface::isGuestAdditionsAvailable(const CGuest &guest) 667 667 { 668 668 if (!guest.isOk()) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp
r71439 r71467 259 259 } 260 260 261 FileObjectType UIGuestFileTable::fileType(const CFsObjInfo &fsInfo)261 /* static */ FileObjectType UIGuestFileTable::fileType(const CFsObjInfo &fsInfo) 262 262 { 263 263 if (fsInfo.isNull() || !fsInfo.isOk()) … … 273 273 } 274 274 275 FileObjectType UIGuestFileTable::fileType(const CGuestFsObjInfo &fsInfo)275 /* static */ FileObjectType UIGuestFileTable::fileType(const CGuestFsObjInfo &fsInfo) 276 276 { 277 277 if (fsInfo.isNull() || !fsInfo.isOk()) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp
r71439 r71467 168 168 } 169 169 170 FileObjectType UIHostFileTable::fileType(const QFileInfo &fsInfo)170 /* static */ FileObjectType UIHostFileTable::fileType(const QFileInfo &fsInfo) 171 171 { 172 172 if (!fsInfo.exists())
Note:
See TracChangeset
for help on using the changeset viewer.