Changeset 1024 in vbox for trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
- Timestamp:
- Feb 22, 2007 11:26:33 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h
r973 r1024 69 69 return aIndex >= 0 && aIndex < (int)mTextList.size() ? 70 70 mTextList [aIndex] : QString::null; 71 } 72 73 void updateText (int aColumn, const QString &aText) 74 { 75 if (aColumn >= 0 && aColumn < (int)mTextList.size()) 76 mTextList [aColumn] = aText; 71 77 } 72 78 … … 148 154 public: 149 155 150 VBoxAddSFDialog (QWidget *aParent) : 156 enum DialogType { AddDType, EditDType }; 157 158 VBoxAddSFDialog (QWidget *aParent, VBoxAddSFDialog::DialogType aType) : 151 159 QDialog (aParent, "VBoxAddSFDialog", true /* modal */), 152 160 mLePath (0), mLeName (0) 153 161 { 154 setCaption (tr ("Add Share")); 162 switch (aType) 163 { 164 case AddDType: 165 setCaption (tr ("Add Share")); 166 break; 167 case EditDType: 168 setCaption (tr ("Edit Share")); 169 break; 170 default: 171 AssertMsgFailed (("Incorrect SF Dialog type\n")); 172 } 155 173 QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout"); 156 174 … … 199 217 200 218 QString getPath() { return mLePath->text(); } 201 202 219 QString getName() { return mLeName->text(); } 220 221 void setPath (const QString &aPath) { mLePath->setText (aPath); } 222 void setName (const QString &aName) { mLeName->setText (aName); } 203 223 204 224 private slots: … … 262 282 tbAdd->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png", 263 283 "select_file_dis_16px.png")); 284 tbEdit->setIconSet (VBoxGlobal::iconSet ("global_settings_16px.png", 285 "global_settings_diasbled_16px.png")); 264 286 tbRemove->setIconSet (VBoxGlobal::iconSet ("eraser_16px.png", 265 287 "eraser_disabled_16px.png")); 288 QToolTip::add (tbAdd, tr ("Add new shared folder")); 289 QToolTip::add (tbEdit, tr ("Edit selected shared folder")); 290 QToolTip::add (tbRemove, tr ("Remove selected shared folder")); 266 291 connect (tbAdd, SIGNAL (clicked()), this, SLOT (tbAddPressed())); 292 connect (tbEdit, SIGNAL (clicked()), this, SLOT (tbEditPressed())); 267 293 connect (tbRemove, SIGNAL (clicked()), this, SLOT (tbRemovePressed())); 268 294 connect (listView, SIGNAL (currentChanged (QListViewItem *)), … … 483 509 { 484 510 /* Invoke Add-Box Dialog */ 485 VBoxAddSFDialog dlg (this );511 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::AddDType); 486 512 if (dlg.exec() != QDialog::Accepted) 487 513 return; … … 503 529 } 504 530 531 void VBoxSharedFoldersSettings::tbEditPressed() 532 { 533 /* Check selected item */ 534 QListViewItem *selectedItem = listView->selectedItem(); 535 VBoxRichListItem *item = 0; 536 if (selectedItem->rtti() == VBoxRichListItem::QIRichListItemId) 537 item = static_cast<VBoxRichListItem*> (selectedItem); 538 Assert (item); 539 /* Invoke Add-Box Dialog */ 540 VBoxAddSFDialog dlg (this, VBoxAddSFDialog::EditDType); 541 dlg.setPath (item->getText (1)); 542 dlg.setName (item->getText (0)); 543 if (dlg.exec() != QDialog::Accepted) 544 return; 545 QString name = dlg.getName(); 546 QString path = dlg.getPath(); 547 /* Shared folder's name & path could not be empty */ 548 Assert (!name.isEmpty() && !path.isEmpty()); 549 /* Updating an edited listview item */ 550 item->updateText (1, path); 551 item->updateText (0, name); 552 mIsListViewChanged = true; 553 } 554 505 555 void VBoxSharedFoldersSettings::tbRemovePressed() 506 556 { … … 530 580 if (aItem && aItem->isSelectable() && listView->selectedItem() != aItem) 531 581 listView->setSelected (aItem, true); 532 bool removeEnabled = aItem && aItem->parent() &&533 isEditable (aItem->parent()->text (2));534 582 bool addEnabled = aItem && 535 583 (isEditable (aItem->text (2)) || 536 584 aItem->parent() && isEditable (aItem->parent()->text (2))); 585 bool removeEnabled = aItem && aItem->parent() && 586 isEditable (aItem->parent()->text (2)); 587 tbAdd->setEnabled (addEnabled); 588 tbEdit->setEnabled (removeEnabled); 537 589 tbRemove->setEnabled (removeEnabled); 538 tbAdd->setEnabled (addEnabled);539 590 } 540 591 … … 554 605 555 606 #include "VBoxSharedFoldersSettings.ui.moc" 556
Note:
See TracChangeset
for help on using the changeset viewer.