Changeset 1863 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
- Timestamp:
- Apr 2, 2007 2:55:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
r1062 r1863 188 188 this, SLOT (validate())); 189 189 connect (tbPath, SIGNAL (clicked()), this, SLOT (showFileDialog())); 190 connect (&vboxGlobal(), SIGNAL (existingDirectoryResult (const QString&)), 191 this, SLOT (folderSelected (const QString&))); 190 192 QWhatsThis::add (mLePath, tr ("Enter existing path for the shared folder here")); 191 193 QWhatsThis::add (mLeName, tr ("Enter name for the shared folder to be created")); … … 231 233 void showFileDialog() 232 234 { 233 QFileDialog dlg (QDir::rootDirPath(), QString::null, this); 234 dlg.setMode (QFileDialog::DirectoryOnly); 235 dlg.setCaption (tr ("Select a folder to share")); 236 if (dlg.exec() == QDialog::Accepted) 237 { 238 QString folderName = QDir::convertSeparators (dlg.selectedFile()); 239 QRegExp commonRule ("[\\\\/]([^\\\\^/]+)[\\\\/]?$"); 240 QRegExp rootRule ("(([a-zA-Z])[^\\\\^/])?[\\\\/]$"); 241 if (commonRule.search (folderName) != -1) 242 { 243 /* processing non-root folder */ 244 mLePath->setText (folderName.remove (QRegExp ("[\\\\/]$"))); 245 mLeName->setText (commonRule.cap (1)); 246 } 247 else if (rootRule.search (folderName) != -1) 248 { 249 /* processing root folder */ 250 mLePath->setText (folderName); 235 vboxGlobal().getExistingDirectory (QDir::convertSeparators ( 236 QDir::rootDirPath()), 237 this, "addSharedFolderDialog", 238 tr ("Select a folder to share")); 239 } 240 241 void folderSelected (const QString &aFolder) 242 { 243 if (aFolder.isNull()) 244 return; 245 246 QString folderName = QDir::convertSeparators (aFolder); 247 QRegExp commonRule ("[\\\\/]([^\\\\^/]+)[\\\\/]?$"); 248 QRegExp rootRule ("(([a-zA-Z])[^\\\\^/])?[\\\\/]$"); 249 if (commonRule.search (folderName) != -1) 250 { 251 /* processing non-root folder */ 252 mLePath->setText (folderName.remove (QRegExp ("[\\\\/]$"))); 253 mLeName->setText (commonRule.cap (1)); 254 } 255 else if (rootRule.search (folderName) != -1) 256 { 257 /* processing root folder */ 258 mLePath->setText (folderName); 251 259 #if defined(Q_WS_WIN32) 252 260 mLeName->setText (rootRule.cap (2) + "_DRIVE"); 253 261 #elif defined(Q_WS_X11) 254 262 mLeName->setText ("ROOT"); 255 263 #endif 256 } 257 else 258 return; /* hm, what type of folder it was? */ 259 } 264 } 265 else 266 return; /* hm, what type of folder it was? */ 260 267 } 261 268
Note:
See TracChangeset
for help on using the changeset viewer.