- Timestamp:
- Apr 3, 2007 5:21:56 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20151
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r1889 r1902 407 407 bool resolveSymLinks = true); 408 408 409 static QString get StartingDir (const QString &);409 static QString getFirstExistingDir (const QString &); 410 410 411 411 signals: -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r1889 r1902 2198 2198 2199 2199 /** 2200 * Reimplementation of QFileDialog::getExistingDirectory() which is runs2201 * "open existing directory" dialog.2202 * 2203 * On Win32, this function makes sure a native dialog will belaunched in2204 * another thread to avoid dialog visualization errors occur eddue to2200 * Reimplementation of QFileDialog::getExistingDirectory() that removes some 2201 * oddities and limitations. 2202 * 2203 * On Win32, this function makes sure a native dialog is launched in 2204 * another thread to avoid dialog visualization errors occuring due to 2205 2205 * multi-threaded COM apartment initialization on the main UI thread while 2206 2206 * the appropriate native dialog function expects a single-threaded one. … … 2245 2245 public: 2246 2246 2247 Thread ( const WId &aId, QObject *aTarget,2247 Thread (QWidget *aParent, QObject *aTarget, 2248 2248 const QString &aDir, const QString &aCaption) 2249 : m Id (aId), mTarget (aTarget), mDir (aDir), mCaption (aCaption) {}2249 : mParent (aParent), mTarget (aTarget), mDir (aDir), mCaption (aCaption) {} 2250 2250 2251 2251 virtual void run() … … 2253 2253 QString result; 2254 2254 2255 QWidget *parent = QWidget::find (mId); 2256 QWidget *topParent = parent ? parent->topLevelWidget() : qApp->mainWidget(); 2257 QString title = mCaption.isNull() ? tr ("Select a Directory") : mCaption; 2255 QWidget *topParent = mParent ? mParent->topLevelWidget() : qApp->mainWidget(); 2256 QString title = mCaption.isNull() ? tr ("Select a directory") : mCaption; 2258 2257 2259 2258 TCHAR path[MAX_PATH]; … … 2270 2269 bi.lpfn = winGetExistDirCallbackProc; 2271 2270 bi.lParam = Q_ULONG (&mDir); 2272 if ( parent) parent->setEnabled (false);2271 if (mParent) mParent->setEnabled (false); 2273 2272 LPITEMIDLIST itemIdList = SHBrowseForFolder (&bi); 2274 2273 if (itemIdList) … … 2288 2287 result = QString::null; 2289 2288 QApplication::postEvent (mTarget, new VBoxGetExistDirectoryEvent (result)); 2290 if ( parent) parent->setEnabled (true);2289 if (mParent) mParent->setEnabled (true); 2291 2290 } 2292 2291 2293 2292 private: 2294 2293 2295 WId mId;2294 QWidget *mParent; 2296 2295 QObject *mTarget; 2297 2296 QString mDir; … … 2328 2327 }; 2329 2328 2330 /* this dialog is proposed to be a modal */2331 if (!aParent) return QString::null;2332 2329 QString dir = QDir::convertSeparators (aDir); 2333 2330 LoopObject loopObject; 2334 Thread openDirThread (aParent ->winId(), &loopObject, dir, aCaption);2331 Thread openDirThread (aParent, &loopObject, dir, aCaption); 2335 2332 openDirThread.start(); 2336 2333 qApp->eventLoop()->enterLoop(); … … 2391 2388 workDir += "\\"; 2392 2389 2393 QString title = caption.isNull() ? tr ("Select file to open") : caption;2390 QString title = caption.isNull() ? tr ("Select a file") : caption; 2394 2391 2395 2392 if (parent) … … 2453 2450 2454 2451 /** 2455 * Search for the first directory that exists starting from the passed one .2456 * In case of there is no directory (and all of its parent except root) exist2457 * the function returns QString::null.2452 * Search for the first directory that exists starting from the passed one 2453 * and going up through its parents. In case if none of the directories 2454 * exist (except the root one), the function returns QString::null. 2458 2455 */ 2459 2456 /* static */ 2460 QString VBoxGlobal::get StartingDir (const QString &aStartDir)2457 QString VBoxGlobal::getFirstExistingDir (const QString &aStartDir) 2461 2458 { 2462 2459 QString result = QString::null; -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxGlobalSettingsDlg.ui.h
r1889 r1902 501 501 Assert (le); 502 502 503 QString initDir = VBoxGlobal::get StartingDir (le->text());503 QString initDir = VBoxGlobal::getFirstExistingDir (le->text()); 504 504 if (initDir.isNull()) 505 505 initDir = vboxGlobal().virtualBox().GetHomeFolder(); -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r1889 r1902 1847 1847 void VBoxVMSettingsDlg::tbSelectSavedStateFolder_clicked() 1848 1848 { 1849 QString settingsFolder = VBoxGlobal::get StartingDir (leSnapshotFolder->text());1849 QString settingsFolder = VBoxGlobal::getFirstExistingDir (leSnapshotFolder->text()); 1850 1850 if (settingsFolder.isNull()) 1851 1851 settingsFolder = QFileInfo (cmachine.GetSettingsFilePath()).dirPath (true);
Note:
See TracChangeset
for help on using the changeset viewer.