Changeset 10741 in vbox for trunk/src/VBox
- Timestamp:
- Jul 18, 2008 10:10:38 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33482
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxFilePathSelectorWidget.h
r10659 r10741 57 57 SelectorMode mode() const; 58 58 59 void setResetEnabled (bool aEnabled); 60 bool isResetEnabled () const; 61 59 62 void setLineEditWhatsThis (const QString &aText); 60 63 void setSelectorWhatsThis (const QString &aText); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFilePathSelectorWidget.cpp
r10659 r10741 65 65 } 66 66 67 void VBoxFilePathSelectorWidget::setResetEnabled (bool aEnabled) 68 { 69 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR 70 if (!aEnabled && 71 mCbPath->count() - 1 == ResetId) 72 mCbPath->removeItem (ResetId); 73 else 74 if (aEnabled && 75 mCbPath->count() - 1 == ResetId - 1) 76 mCbPath->insertItem (ResetId, ""); 77 retranslateUi(); 78 #else /* VBOX_USE_COMBOBOX_PATH_SELECTOR */ 79 mTbReset->setVisible (aEnabled); 80 #endif /* !VBOX_USE_COMBOBOX_PATH_SELECTOR */ 81 } 82 83 bool VBoxFilePathSelectorWidget::isResetEnabled () const 84 { 85 #ifdef VBOX_USE_COMBOBOX_PATH_SELECTOR 86 return (mCbPath->count() - 1 == ResetId); 87 #else /* VBOX_USE_COMBOBOX_PATH_SELECTOR */ 88 return mTbReset->isVisible(); 89 #endif /* !VBOX_USE_COMBOBOX_PATH_SELECTOR */ 90 } 91 67 92 void VBoxFilePathSelectorWidget::setLineEditWhatsThis (const QString &aText) 68 93 { … … 135 160 mNoneStr = tr ("None"); 136 161 mCbPath->setItemText (SelectId, tr ("Other...")); 137 mCbPath->setItemText (ResetId, tr ("Reset")); 162 if (mCbPath->count() - 1 == ResetId) 163 mCbPath->setItemText (ResetId, tr ("Reset")); 138 164 #endif /* !VBOX_USE_COMBOBOX_PATH_SELECTOR */ 139 165 } … … 197 223 #endif /* !VBOX_USE_COMBOBOX_PATH_SELECTOR */ 198 224 225 /* Applying language settings */ 199 226 retranslateUi(); 227 228 /* Set to none */ 229 setPath (""); 200 230 } 201 231 … … 210 240 QString VBoxFilePathSelectorWidget::filePath (const QString &aName, bool bLast) const 211 241 { 212 if ( mMode == PathMode)242 if (!aName.isEmpty()) 213 243 { 214 QDir dir (aName); 215 if (bLast) 216 return dir.dirName(); 244 if (mMode == PathMode) 245 { 246 QDir dir (aName); 247 if (bLast) 248 return dir.dirName(); 249 else 250 return dir.path(); 251 } 217 252 else 218 return dir.path(); 253 { 254 QFileInfo fi (aName); 255 if (bLast) 256 return fi.fileName(); 257 else 258 return fi.filePath(); 259 } 219 260 } 220 else 221 { 222 QFileInfo fi (aName); 223 if (bLast) 224 return fi.fileName(); 225 else 226 return fi.filePath(); 227 } 261 return ""; 228 262 } 229 263
Note:
See TracChangeset
for help on using the changeset viewer.