Changeset 1863 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui
- Timestamp:
- Apr 2, 2007 2:55:09 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20083
- Location:
- trunk/src/VBox/Frontends/VirtualBox/ui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui
r879 r1863 487 487 <property name="whatsThis" stdset="0"> 488 488 <string>When checked, the keyboard is automatically 489 captured every time the VM window is activated. When the keyboard is captured, 489 captured every time the VM window is activated. When the keyboard is captured, 490 490 all keystrokes (including system ones like Alt-Tab) are directed to the VM.</string> 491 491 </property> … … 1041 1041 <variable access="private">bool mUSBFilterListModified;</variable> 1042 1042 <variable access="private">VBoxUSBMenu *usbDevicesMenu;</variable> 1043 <variable access="private">QLineEdit *mLastAccessedField;</variable> 1043 1044 </variables> 1044 1045 <slots> … … 1049 1050 <slot>tbResetFolder_clicked()</slot> 1050 1051 <slot>tbSelectFolder_clicked()</slot> 1052 <slot>folderSelected( const QString & )</slot> 1051 1053 <slot>addUSBFilter( const CUSBDeviceFilter &, bool )</slot> 1052 1054 <slot>lvUSBFilters_currentChanged( QListViewItem * )</slot> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h
r1234 r1863 148 148 149 149 /* General page */ 150 151 mLastAccessedField = 0; 152 connect (&vboxGlobal(), SIGNAL (existingDirectoryResult (const QString&)), 153 this, SLOT (folderSelected (const QString&))); 150 154 151 155 /// @todo (dmik) remove … … 350 354 /* disable validators if any */ 351 355 pageUSB->setEnabled (false); 352 356 353 357 #ifdef Q_OS_WIN32 354 358 /* Show an error message (if there is any). … … 499 503 if (tb == tbSelectVDIFolder) le = leVDIFolder; 500 504 else if (tb == tbSelectMachineFolder) le = leMachineFolder; 505 mLastAccessedField = le; 501 506 Assert (le); 502 507 503 QString homeFolder = vboxGlobal().virtualBox().GetHomeFolder(); 504 505 QFileDialog dlg (homeFolder, QString::null, this); 506 dlg.setMode (QFileDialog::DirectoryOnly); 508 QString initDir = vboxGlobal().virtualBox().GetHomeFolder(); 507 509 508 510 if (!le->text().isEmpty()) 509 511 { 510 512 /* set the first parent directory that exists as the current */ 511 #if 0 /** @todo fix this linux bustage properly */ 512 QFileInfo fld (QDir (homeFolder), le->text()); 513 #else 514 const QDir _dir (homeFolder); 513 const QDir _dir (initDir); 515 514 QFileInfo fld (_dir, le->text()); 516 #endif517 515 do 518 516 { … … 523 521 524 522 if (fld.exists()) 525 dlg.setDir (fld.absFilePath()); 526 } 527 528 if (dlg.exec() == QDialog::Accepted) 529 { 530 QString folder = QDir::convertSeparators (dlg.selectedFile()); 531 /* remove trailing slash */ 532 folder.truncate (folder.length() - 1); 533 534 /* 535 * do this instead of le->setText (folder) to cause 536 * isModified() return true 537 */ 538 le->selectAll(); 539 le->insert (folder); 523 initDir = fld.absFilePath(); 524 } 525 526 vboxGlobal().getExistingDirectory (initDir, this); 527 } 528 529 void VBoxGlobalSettingsDlg::folderSelected (const QString &aFolder) 530 { 531 if (aFolder.isNull()) 532 return; 533 534 QString folder = QDir::convertSeparators (aFolder); 535 /* remove trailing slash if any */ 536 folder.remove (QRegExp ("[\\\\/]$")); 537 538 /* 539 * do this instead of le->setText (folder) to cause 540 * isModified() return true 541 */ 542 if (mLastAccessedField) 543 { 544 mLastAccessedField->selectAll(); 545 mLastAccessedField->insert (folder); 546 mLastAccessedField = 0; 540 547 } 541 548 } -
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 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui
r1628 r1863 2698 2698 <slot>tbResetSavedStateFolder_clicked()</slot> 2699 2699 <slot>tbSelectSavedStateFolder_clicked()</slot> 2700 <slot>folderSelected( const QString & )</slot> 2700 2701 <slot>addUSBFilter( const CUSBDeviceFilter & aFilter, bool isNew )</slot> 2701 2702 <slot>lvUSBFilters_currentChanged( QListViewItem * item )</slot> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r1707 r1863 1850 1850 QFileInfo (cmachine.GetSettingsFilePath()).dirPath (true); 1851 1851 1852 QFileDialog dlg (settingsFolder, QString::null, this);1853 dlg.setMode (QFileDialog::DirectoryOnly);1854 1855 1852 if (!leSnapshotFolder->text().isEmpty()) 1856 1853 { 1857 1854 /* set the first parent directory that exists as the current */ 1858 QDir dir (settingsFolder);1855 const QDir dir (settingsFolder); 1859 1856 QFileInfo fld (dir, leSnapshotFolder->text()); 1860 1857 do … … 1866 1863 1867 1864 if (fld.exists()) 1868 dlg.setDir (fld.absFilePath()); 1869 } 1870 1871 if (dlg.exec() == QDialog::Accepted) 1872 { 1873 QString folder = QDir::convertSeparators (dlg.selectedFile()); 1874 /* remove trailing slash */ 1875 folder.truncate (folder.length() - 1); 1876 1877 /* 1878 * do this instead of le->setText (folder) to cause 1879 * isModified() return true 1880 */ 1881 leSnapshotFolder->selectAll(); 1882 leSnapshotFolder->insert (folder); 1883 } 1865 settingsFolder = fld.absFilePath(); 1866 } 1867 1868 vboxGlobal().getExistingDirectory (settingsFolder, this); 1869 } 1870 1871 void VBoxVMSettingsDlg::folderSelected (const QString &aFolder) 1872 { 1873 if (aFolder.isNull()) 1874 return; 1875 1876 QString folder = QDir::convertSeparators (aFolder); 1877 /* remove trailing slash if any */ 1878 folder.remove (QRegExp ("[\\\\/]$")); 1879 1880 /* 1881 * do this instead of le->setText (folder) to cause 1882 * isModified() return true 1883 */ 1884 leSnapshotFolder->selectAll(); 1885 leSnapshotFolder->insert (folder); 1884 1886 } 1885 1887
Note:
See TracChangeset
for help on using the changeset viewer.