- Timestamp:
- Jul 24, 2007 9:12:30 AM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r3610 r3802 131 131 src/QIMessageBox.cpp \ 132 132 src/QIRichLabel.cpp \ 133 src/VBoxDefs.cpp \ 133 134 src/VBoxGlobalSettings.cpp \ 134 135 src/VBoxGlobal.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleWnd.h
r3762 r3802 144 144 void devicesUnmountDVD(); 145 145 void devicesSwitchVrdp (bool); 146 void devices ToggleSFDialog (bool);146 void devicesOpenSFDialog(); 147 147 void devicesInstallGuestAdditions(); 148 148 … … 157 157 void activateNetworkMenu (int aId); 158 158 void switchUSB (int aId); 159 void activateSFMenu();160 159 161 160 void statusTipChanged (const QString &); … … 326 325 public: 327 326 328 VBoxSFDialog (QWidget*, CSession&, QAction*); 329 ~VBoxSFDialog(); 327 VBoxSFDialog (QWidget*, CSession&); 330 328 331 329 protected slots: 332 330 333 331 virtual void accept(); 334 virtual void suicide (bool);335 332 336 333 protected: … … 342 339 VBoxSharedFoldersSettings *mSettings; 343 340 CSession &mSession; 344 QAction *mAction;345 341 }; 346 342 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxDefs.h
r3674 r3802 146 146 #endif 147 147 }; 148 149 static const char* GUI_LastWindowPosition; 150 static const char* GUI_LastWindowPosition_Max; 151 static const char* GUI_Fullscreen; 152 static const char* GUI_Seamless; 153 static const char* GUI_AutoresizeGuest; 154 static const char* GUI_FirstRun; 155 static const char* GUI_SaveMountedAtRuntime; 156 static const char* GUI_LastCloseAction; 157 static const char* GUI_SuppressMessages; 158 static const char* GUI_PermanentSharedFoldersAtRuntime; 148 159 }; 149 160 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp
r3801 r3802 340 340 341 341 devicesSFDialogAction = new QAction (runningActions, "devicesSFDialogAction"); 342 devicesSFDialogAction->setToggleAction (true);343 342 devicesSFDialogAction->setIconSet (VBoxGlobal::iconSet ("shared_folder_16px.png", 344 343 "shared_folder_disabled_16px.png")); … … 583 582 connect (devicesUnmountDVDAction, SIGNAL(activated()), this, SLOT(devicesUnmountDVD())); 584 583 connect (devicesSwitchVrdpAction, SIGNAL(toggled (bool)), this, SLOT(devicesSwitchVrdp (bool))); 585 connect (devicesSFDialogAction, SIGNAL( toggled (bool)), this, SLOT(devicesToggleSFDialog (bool)));584 connect (devicesSFDialogAction, SIGNAL(activated()), this, SLOT(devicesOpenSFDialog())); 586 585 connect (devicesInstallGuestToolsAction, SIGNAL(activated()), this, SLOT(devicesInstallGuestAdditions())); 587 586 … … 596 595 connect (devicesMountDVDMenu, SIGNAL(activated(int)), this, SLOT(captureDVD(int))); 597 596 connect (devicesUSBMenu, SIGNAL(activated(int)), this, SLOT(switchUSB(int))); 598 connect (devicesSharedFolders, SIGNAL(activated(int)), this, SLOT( activateSFMenu()));597 connect (devicesSharedFolders, SIGNAL(activated(int)), this, SLOT(devicesOpenSFDialog())); 599 598 connect (devicesNetworkMenu, SIGNAL(activated(int)), this, SLOT(activateNetworkMenu(int))); 600 599 … … 699 698 ///////////////////////////////////////////////////////////////////////////// 700 699 701 static const char *GUI_LastWindowPosition = "GUI/LastWindowPostion";702 static const char *GUI_LastWindowPosition_Max = "max";703 704 static const char *GUI_Fullscreen = "GUI/Fullscreen";705 static const char *GUI_Seamless = "GUI/Seamless";706 static const char *GUI_AutoresizeGuest = "GUI/AutoresizeGuest";707 extern const char *GUI_FirstRun = "GUI/FirstRun";708 extern const char *GUI_SaveMountedAtRuntime = "GUI/SaveMountedAtRuntime";709 710 700 /** 711 701 * Opens a new console view to interact with a given VM. … … 751 741 /* restore the position of the window and some options */ 752 742 { 753 QString str = cmachine.GetExtraData ( GUI_Fullscreen);743 QString str = cmachine.GetExtraData (VBoxDefs::GUI_Fullscreen); 754 744 if (str == "on") 755 745 vmFullscreenAction->setOn (true); 756 746 757 747 vmSeamlessAction->setEnabled (false); 758 str = cmachine.GetExtraData ( GUI_Seamless);748 str = cmachine.GetExtraData (VBoxDefs::GUI_Seamless); 759 749 if (str == "on") 760 750 vmSeamlessAction->setOn (true); 761 751 762 str = cmachine.GetExtraData ( GUI_AutoresizeGuest);752 str = cmachine.GetExtraData (VBoxDefs::GUI_AutoresizeGuest); 763 753 if (str != "off") 764 754 vmAutoresizeGuestAction->setOn (true); 765 755 766 str = cmachine.GetExtraData ( GUI_FirstRun);756 str = cmachine.GetExtraData (VBoxDefs::GUI_FirstRun); 767 757 if (str == "yes") 768 758 mIsFirstTimeStarted = true; 769 759 else if (!str.isEmpty()) 770 cmachine.SetExtraData ( GUI_FirstRun, QString::null);771 772 str = cmachine.GetExtraData ( GUI_SaveMountedAtRuntime);760 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null); 761 762 str = cmachine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime); 773 763 if (str == "no") 774 764 mIsAutoSaveMedia = false; 775 765 776 str = cmachine.GetExtraData ( GUI_LastWindowPosition);766 str = cmachine.GetExtraData (VBoxDefs::GUI_LastWindowPosition); 777 767 778 768 QRect ar = QApplication::desktop()->availableGeometry (this); … … 787 777 h = str.section (',', 3, 3).toInt (&ok); 788 778 if (ok) 789 max = str.section (',', 4, 4) == GUI_LastWindowPosition_Max;779 max = str.section (',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max; 790 780 if (ok) 791 781 { … … 950 940 /* Remove GUI_FirstRun extra data key from the machine settings 951 941 * file after showing the wizard once. */ 952 cmachine.SetExtraData ( GUI_FirstRun, QString::null);942 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null); 953 943 } 954 944 … … 1047 1037 if (isMaximized() || (mIsFullscreen && was_max) 1048 1038 || (mIsSeamless && was_max)) 1049 winPos += QString (",%1").arg ( GUI_LastWindowPosition_Max);1050 1051 machine.SetExtraData ( GUI_LastWindowPosition, winPos);1052 1053 machine.SetExtraData ( GUI_Fullscreen,1039 winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowPosition_Max); 1040 1041 machine.SetExtraData (VBoxDefs::GUI_LastWindowPosition, winPos); 1042 1043 machine.SetExtraData (VBoxDefs::GUI_Fullscreen, 1054 1044 vmFullscreenAction->isOn() ? "on" : "off"); 1055 machine.SetExtraData ( GUI_Seamless,1045 machine.SetExtraData (VBoxDefs::GUI_Seamless, 1056 1046 vmSeamlessAction->isOn() ? "on" : "off"); 1057 machine.SetExtraData ( GUI_AutoresizeGuest,1047 machine.SetExtraData (VBoxDefs::GUI_AutoresizeGuest, 1058 1048 vmAutoresizeGuestAction->isOn() ? "on" : "off"); 1059 1049 } … … 1172 1162 LogFlowFuncEnter(); 1173 1163 1174 static const char *GUI_LastCloseAction = "GUI/LastCloseAction";1175 1164 static const char *Save = "save"; 1176 1165 static const char *PowerOff = "powerOff"; … … 1234 1223 /* read the last user's choice for the given VM */ 1235 1224 QStringList lastAction = QStringList::split (',', 1236 cmachine.GetExtraData ( GUI_LastCloseAction));1225 cmachine.GetExtraData (VBoxDefs::GUI_LastCloseAction)); 1237 1226 AssertWrapperOk (cmachine); 1238 1227 if (lastAction [0] == PowerOff) … … 1325 1314 if (dlg.cbDiscardCurState->isChecked()) 1326 1315 (lastAction += ",") += DiscardCurState; 1327 cmachine.SetExtraData ( GUI_LastCloseAction, lastAction);1316 cmachine.SetExtraData (VBoxDefs::GUI_LastCloseAction, lastAction); 1328 1317 AssertWrapperOk (cmachine); 1329 1318 } … … 2293 2282 } 2294 2283 2295 void VBoxConsoleWnd::devices ToggleSFDialog (bool aOn)2284 void VBoxConsoleWnd::devicesOpenSFDialog() 2296 2285 { 2297 2286 if (!console) return; 2298 2287 2299 if (aOn)2300 (new VBoxSFDialog (console, csession, devicesSFDialogAction))->show();2288 VBoxSFDialog dlg (console, csession); 2289 dlg.exec(); 2301 2290 } 2302 2291 … … 2617 2606 } 2618 2607 } 2619 }2620 2621 /**2622 * Show Shared Folders list.2623 */2624 void VBoxConsoleWnd::activateSFMenu()2625 {2626 if (!devicesSFDialogAction->isOn())2627 devicesSFDialogAction->setOn (true);2628 2608 } 2629 2609 … … 2940 2920 #endif 2941 2921 2942 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession, QAction *aAction) 2943 : QDialog (aParent, "VBoxSFDialog", false /* modal */, 2944 WStyle_Customize | WStyle_Title | WStyle_SysMenu | 2945 WStyle_MinMax | WDestructiveClose) 2946 , mSettings (0), mSession (aSession), mAction (aAction) 2947 { 2948 /* Setup Dialog's title */ 2922 VBoxSFDialog::VBoxSFDialog (QWidget *aParent, CSession &aSession) 2923 : QDialog (aParent, "VBoxSFDialog", true /* modal */, 2924 WType_Dialog | WShowModal) 2925 , mSettings (0), mSession (aSession) 2926 { 2927 /* Setup Dialog's options */ 2949 2928 setCaption (tr ("Shared Folders")); 2950 2929 setIcon (QPixmap::fromMimeSource ("select_file_16px.png")); 2930 setSizeGripEnabled (true); 2951 2931 2952 2932 /* Setup main dialog's layout */ … … 2955 2935 /* Setup settings layout */ 2956 2936 mSettings = new VBoxSharedFoldersSettings (this, "mSettings"); 2957 mSettings->setDialogType (VBoxSharedFoldersSettings::ConsoleType); 2937 mSettings->setDialogType (VBoxSharedFoldersSettings::MachineType | 2938 VBoxSharedFoldersSettings::ConsoleType); 2958 2939 mSettings->getFromMachine (aSession.GetMachine()); 2959 2940 mSettings->getFromConsole (aSession.GetConsole()); … … 2962 2943 /* Setup button's layout */ 2963 2944 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout"); 2945 QPushButton *pbHelp = new QPushButton (tr ("Help"), this, "pbHelp"); 2946 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); 2964 2947 QPushButton *pbOk = new QPushButton (tr ("OK"), this, "pbOk"); 2965 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);2966 2948 QPushButton *pbCancel = new QPushButton (tr ("Cancel"), this, "pbCancel"); 2949 connect (pbHelp, SIGNAL (clicked()), &vboxProblem(), SLOT (showHelpHelpDialog())); 2967 2950 connect (pbOk, SIGNAL (clicked()), this, SLOT (accept())); 2968 2951 connect (pbCancel, SIGNAL (clicked()), this, SLOT (reject())); 2952 buttonLayout->addWidget (pbHelp); 2953 buttonLayout->addItem (spacer); 2969 2954 buttonLayout->addWidget (pbOk); 2970 buttonLayout->addItem (spacer);2971 2955 buttonLayout->addWidget (pbCancel); 2972 2956 2973 /* Setup destruction handler */ 2974 connect (mAction, SIGNAL (toggled (bool)), this, SLOT (suicide (bool))); 2975 } 2976 2977 VBoxSFDialog::~VBoxSFDialog() 2978 { 2979 mAction->setOn (false); 2957 /* Setup the default push button */ 2958 pbOk->setAutoDefault (true); 2959 pbOk->setDefault (true); 2980 2960 } 2981 2961 … … 2983 2963 { 2984 2964 mSettings->putBackToConsole(); 2965 mSettings->putBackToMachine(); 2966 CMachine machine = mSession.GetMachine(); 2967 machine.SaveSettings(); 2968 if (!machine.isOk()) 2969 vboxProblem().cannotSaveMachineSettings (machine); 2985 2970 QDialog::accept(); 2986 2971 } 2987 2972 2988 void VBoxSFDialog::suicide (bool aNo)2989 {2990 if (!aNo) close();2991 }2992 2993 2973 void VBoxSFDialog::showEvent (QShowEvent *aEvent) 2994 2974 { 2975 resize (600, 500); 2976 VBoxGlobal::centerWidget (this, parentWidget()); 2977 setMinimumWidth (400); 2995 2978 QDialog::showEvent (aEvent); 2996 setMinimumWidth (400); 2997 VBoxGlobal::centerWidget (this, parentWidget()); 2998 } 2979 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r3718 r3802 196 196 } 197 197 198 199 static const char *GUI_SuppressMessages = "GUI/SuppressMessages";200 198 201 199 /** @class VBoxProblemReporter … … 291 289 { 292 290 vbox = vboxGlobal().virtualBox(); 293 msgs = QStringList::split (',', vbox.GetExtraData ( GUI_SuppressMessages));291 msgs = QStringList::split (',', vbox.GetExtraData (VBoxDefs::GUI_SuppressMessages)); 294 292 if (msgs.findIndex (autoConfirmId) >= 0) { 295 293 int rc = AutoConfirmed; … … 352 350 { 353 351 msgs << autoConfirmId; 354 vbox.SetExtraData ( GUI_SuppressMessages, msgs.join (","));352 vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, msgs.join (",")); 355 353 } 356 354 } … … 1745 1743 { 1746 1744 CVirtualBox vbox = vboxGlobal().virtualBox(); 1747 vbox.SetExtraData ( GUI_SuppressMessages, QString::null);1745 vbox.SetExtraData (VBoxDefs::GUI_SuppressMessages, QString::null); 1748 1746 } 1749 1747 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r3450 r3802 48 48 #include <qvbox.h> 49 49 50 51 static const char *GUI_LastWindowPosition = "GUI/LastWindowPostion";52 static const char *GUI_LastWindowPosition_Max = "max";53 50 54 51 // VBoxVMDetailsView class … … 529 526 { 530 527 CVirtualBox vbox = vboxGlobal().virtualBox(); 531 QString winPos = vbox.GetExtraData ( GUI_LastWindowPosition);528 QString winPos = vbox.GetExtraData (VBoxDefs::GUI_LastWindowPosition); 532 529 533 530 QRect ar = QApplication::desktop()->availableGeometry (pos()); … … 542 539 h = winPos.section (',', 3, 3).toInt (&ok); 543 540 if (ok) 544 max = winPos.section (',', 4, 4) == GUI_LastWindowPosition_Max;541 max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max; 545 542 if (ok) 546 543 { … … 621 618 .arg (normal_size.height()); 622 619 if (isMaximized()) 623 winPos += QString (",%1").arg ( GUI_LastWindowPosition_Max);624 625 vbox.SetExtraData ( GUI_LastWindowPosition, winPos);620 winPos += QString (",%1").arg (VBoxDefs::GUI_LastWindowPosition_Max); 621 622 vbox.SetExtraData (VBoxDefs::GUI_LastWindowPosition, winPos); 626 623 } 627 624 } -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxNewVMWzd.ui.h
r3528 r3802 33 33 *****************************************************************************/ 34 34 35 /* defined in VBoxConsoleWnd.cpp */36 extern const char *GUI_FirstRun;37 35 38 36 /** … … 317 315 } 318 316 if (uuidHD.isNull() || !chd.isNull()) 319 cmachine.SetExtraData ( GUI_FirstRun, "yes");317 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, "yes"); 320 318 } 321 319 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui
r2988 r3802 40 40 </property> 41 41 <property name="caption"> 42 <string>VBox USBFilterSettings</string>42 <string>VBoxSharedFoldersSettings</string> 43 43 <comment>don't translate</comment> 44 44 </property> … … 190 190 </vbox> 191 191 </widget> 192 <connections> 193 <connection> 194 <sender>listView</sender> 195 <signal>doubleClicked(QListViewItem*)</signal> 196 <receiver>VBoxSharedFoldersSettings</receiver> 197 <slot>processDoubleClick(QListViewItem*)</slot> 198 </connection> 199 </connections> 192 200 <includes> 193 201 <include location="local" impldecl="in declaration">VBoxGlobal.h</include> … … 200 208 </includes> 201 209 <variables> 202 <variable access="public">enum SFDialogType { WrongType = 0, GlobalType = 1, MachineType = 2, ConsoleType = 3};</variable>210 <variable access="public">enum SFDialogType { WrongType, GlobalType = 0x01, MachineType = 0x02, ConsoleType = 0x04 };</variable> 203 211 <variable access="private">bool mIsListViewChanged;</variable> 204 <variable access="private"> SFDialogTypemDialogType;</variable>212 <variable access="private">int mDialogType;</variable> 205 213 <variable access="private">CMachine mMachine;</variable> 206 214 <variable access="private">CConsole mConsole;</variable> … … 212 220 <slot>processOnItem( QListViewItem* )</slot> 213 221 <slot>processCurrentChanged( QListViewItem* )</slot> 222 <slot>processDoubleClick( QListViewItem* )</slot> 214 223 </slots> 215 224 <functions> 216 225 <function access="private">init()</function> 217 <function>setDialogType( VBoxSharedFoldersSettings::SFDialogType)</function>226 <function>setDialogType( int )</function> 218 227 <function access="private">removeSharedFolder( const QString &, const QString &, VBoxSharedFoldersSettings::SFDialogType )</function> 219 228 <function access="private">createSharedFolder( const QString &, const QString &, VBoxSharedFoldersSettings::SFDialogType )</function> … … 226 235 <function>putBackToConsole()</function> 227 236 <function access="private">putBackTo( CSharedFolderEnumerator &, QListViewItem* )</function> 237 <function access="private" returnType="QListViewItem*">searchRoot( bool )</function> 228 238 <function access="private" returnType="bool">isEditable( const QString & )</function> 229 239 </functions> -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
r2981 r3802 154 154 public: 155 155 156 enum DialogType { AddDType, EditDType }; 157 158 VBoxAddSFDialog (QWidget *aParent, VBoxAddSFDialog::DialogType aType) : 156 enum DialogType { AddDialogType, EditDialogType }; 157 158 VBoxAddSFDialog (QWidget *aParent, VBoxAddSFDialog::DialogType aType, 159 bool aEnableSelector /* for "permanent" checkbox */) : 159 160 QDialog (aParent, "VBoxAddSFDialog", true /* modal */), 160 mLePath (0), mLeName (0) 161 mLePath (0), mLeName (0), mCbPermanent (0) 161 162 { 162 163 switch (aType) 163 164 { 164 case AddD Type:165 case AddDialogType: 165 166 setCaption (tr ("Add Share")); 166 167 break; 167 case EditD Type:168 case EditDialogType: 168 169 setCaption (tr ("Edit Share")); 169 170 break; … … 174 175 175 176 /* Setup Input layout */ 176 QGridLayout *inputLayout = new QGridLayout (mainLayout, 2, 3, 10, "inputLayout");177 QGridLayout *inputLayout = new QGridLayout (mainLayout, 3, 3, 10, "inputLayout"); 177 178 QLabel *lbPath = new QLabel (tr ("Folder Path"), this); 178 179 mLePath = new QLineEdit (this); … … 199 200 inputLayout->addMultiCellWidget (mLeName, 1, 1, 1, 2); 200 201 202 if (aEnableSelector) 203 { 204 mCbPermanent = new QCheckBox ("&Make Permanent", this); 205 mCbPermanent->setChecked (true); 206 inputLayout->addMultiCellWidget (mCbPermanent, 2, 2, 0, 2); 207 } 208 201 209 /* Setup Button layout */ 202 210 QHBoxLayout *buttonLayout = new QHBoxLayout (mainLayout, 10, "buttonLayout"); … … 219 227 QString getPath() { return mLePath->text(); } 220 228 QString getName() { return mLeName->text(); } 229 bool getPermanent() 230 { 231 return mCbPermanent ? mCbPermanent->isChecked() : true; 232 } 221 233 222 234 void setPath (const QString &aPath) { mLePath->setText (aPath); } 223 235 void setName (const QString &aName) { mLeName->setText (aName); } 236 void setPermanent (bool aPermanent) 237 { 238 if (mCbPermanent) 239 { 240 mCbPermanent->setChecked (aPermanent); 241 mCbPermanent->setEnabled (!aPermanent); 242 } 243 } 224 244 225 245 private slots: … … 272 292 QLineEdit *mLePath; 273 293 QLineEdit *mLeName; 294 QCheckBox *mCbPermanent; 274 295 }; 275 296 … … 301 322 } 302 323 303 void VBoxSharedFoldersSettings::setDialogType ( 304 VBoxSharedFoldersSettings::SFDialogType aType) 324 void VBoxSharedFoldersSettings::setDialogType (int aType) 305 325 { 306 326 mDialogType = aType; … … 456 476 457 477 /* This function is only available for MachineType dialog */ 458 Assert (mDialogType ==MachineType);478 Assert (mDialogType & MachineType); 459 479 /* Searching for MachineType item's root */ 460 480 QListViewItem *root = listView->findItem (QString::number (MachineType), 2); … … 470 490 471 491 /* This function is only available for ConsoleType dialog */ 472 Assert (mDialogType ==ConsoleType);492 Assert (mDialogType & ConsoleType); 473 493 /* Searching for ConsoleType item's root */ 474 494 QListViewItem *root = listView->findItem (QString::number (ConsoleType), 2); … … 507 527 508 528 529 QListViewItem* VBoxSharedFoldersSettings::searchRoot (bool aIsPermanent) 530 { 531 if (!aIsPermanent) 532 return listView->findItem (QString::number (ConsoleType), 2); 533 else if (mDialogType & MachineType) 534 return listView->findItem (QString::number (MachineType), 2); 535 else 536 return listView->findItem (QString::number (GlobalType), 2); 537 } 538 509 539 void VBoxSharedFoldersSettings::tbAddPressed() 510 540 { 511 541 /* Invoke Add-Box Dialog */ 512 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::AddDType); 542 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::AddDialogType, 543 mDialogType & ConsoleType); 513 544 if (dlg.exec() != QDialog::Accepted) 514 545 return; 515 546 QString name = dlg.getName(); 516 547 QString path = dlg.getPath(); 548 bool isPermanent = dlg.getPermanent(); 517 549 /* Shared folder's name & path could not be empty */ 518 550 Assert (!name.isEmpty() && !path.isEmpty()); 519 551 /* Searching root for the new listview item */ 520 QListViewItem *root = listView->findItem (QString::number (mDialogType), 2);552 QListViewItem *root = searchRoot (isPermanent); 521 553 Assert (root); 522 554 /* Appending a new listview item to the root */ 523 VBoxRichListItem *item = new VBoxRichListItem (VBoxRichListItem::EllipsisFile, 524 root, name, path); 555 VBoxRichListItem *item = new VBoxRichListItem ( 556 VBoxRichListItem::EllipsisFile, root, name, path); 557 /* Make the created item selected */ 525 558 listView->ensureItemVisible (item); 526 559 listView->setCurrentItem (item); 527 560 processCurrentChanged (item); 528 561 listView->setFocus(); 562 529 563 mIsListViewChanged = true; 530 564 } … … 534 568 /* Check selected item */ 535 569 QListViewItem *selectedItem = listView->selectedItem(); 536 VBoxRichListItem *item = 0;537 if (selectedItem->rtti() == VBoxRichListItem::QIRichListItemId)538 item = static_cast<VBoxRichListItem*> (selectedItem);570 VBoxRichListItem *item = 571 selectedItem->rtti() == VBoxRichListItem::QIRichListItemId ? 572 static_cast<VBoxRichListItem*> (selectedItem) : 0; 539 573 Assert (item); 540 /* Invoke Add-Box Dialog */ 541 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::EditDType); 574 Assert (item->parent()); 575 /* Invoke Edit-Box Dialog */ 576 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::EditDialogType, 577 mDialogType & ConsoleType); 542 578 dlg.setPath (item->getText (1)); 543 579 dlg.setName (item->getText (0)); 580 dlg.setPermanent ((SFDialogType)item->parent()->text (2).toInt() 581 != ConsoleType); 544 582 if (dlg.exec() != QDialog::Accepted) 545 583 return; 546 584 QString name = dlg.getName(); 547 585 QString path = dlg.getPath(); 586 bool isPermanent = dlg.getPermanent(); 548 587 /* Shared folder's name & path could not be empty */ 549 588 Assert (!name.isEmpty() && !path.isEmpty()); 589 /* Searching new root for the selected listview item */ 590 QListViewItem *root = searchRoot (isPermanent); 591 Assert (root); 550 592 /* Updating an edited listview item */ 551 593 item->updateText (1, path); 552 594 item->updateText (0, name); 595 if (item->parent() != root) 596 { 597 /* Move the selected item into new location */ 598 item->parent()->takeItem (item); 599 root->insertItem (item); 600 601 /* Make the created item selected */ 602 listView->ensureItemVisible (item); 603 listView->setCurrentItem (item); 604 processCurrentChanged (item); 605 listView->setFocus(); 606 } 607 553 608 mIsListViewChanged = true; 554 609 } … … 591 646 } 592 647 648 void VBoxSharedFoldersSettings::processDoubleClick (QListViewItem *aItem) 649 { 650 bool editEnabled = aItem && aItem->parent() && 651 isEditable (aItem->parent()->text (2)); 652 if (editEnabled) 653 tbEditPressed(); 654 } 655 593 656 bool VBoxSharedFoldersSettings::isEditable (const QString &aKey) 594 657 { … … 601 664 if (!type) 602 665 AssertMsgFailed (("Incorrect listview item key value\n")); 603 return type == mDialogType;666 return mDialogType & type; 604 667 } 605 668 -
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsDlg.ui.h
r3490 r3802 29 29 ** place of a destructor. 30 30 *****************************************************************************/ 31 32 33 extern const char *GUI_SaveMountedAtRuntime;34 extern const char *GUI_FirstRun;35 31 36 32 … … 1524 1520 1525 1521 /* other features */ 1526 QString saveRtimeImages = cmachine.GetExtraData ( GUI_SaveMountedAtRuntime);1522 QString saveRtimeImages = cmachine.GetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime); 1527 1523 chbRememberMedia->setChecked (saveRtimeImages != "no"); 1528 1524 … … 1867 1863 1868 1864 /* other features */ 1869 cmachine.SetExtraData ( GUI_SaveMountedAtRuntime,1865 cmachine.SetExtraData (VBoxDefs::GUI_SaveMountedAtRuntime, 1870 1866 chbRememberMedia->isChecked() ? "yes" : "no"); 1871 1867 … … 1980 1976 * and/or disk configuration were changed */ 1981 1977 if (mResetFirstRunFlag) 1982 cmachine.SetExtraData ( GUI_FirstRun, QString::null);1978 cmachine.SetExtraData (VBoxDefs::GUI_FirstRun, QString::null); 1983 1979 1984 1980 /* audio */
Note:
See TracChangeset
for help on using the changeset viewer.