VirtualBox

Changeset 6537 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 28, 2008 7:49:44 PM (17 years ago)
Author:
vboxsync
Message:

2626: FE/Qt support for readonly shared folders:

"Writable" checkbox implemented for Shared Folders Add/Edit dialogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h

    r6384 r6537  
    5858    VBoxRichListItem (FormatType aFormat, QListViewItem *aParent,
    5959                      const QString& aName, const QString& aPath,
    60                       const QString& aEdited) :
    61         QListViewItem (aParent, aName, aPath, aEdited), mFormat (aFormat)
    62     {
    63         mTextList << aName << aPath << aEdited;
     60                      const QString& aEdited, const QString& aWritable) :
     61        QListViewItem (aParent, aName, aPath, aEdited, aWritable), mFormat (aFormat)
     62    {
     63        mTextList << aName << aPath << aEdited << aWritable;
    6464    }
    6565
     
    181181                     const SFoldersNameList &aUsedNames)
    182182        : QDialog (aParent, "VBoxAddSFDialog", true /* modal */)
    183         , mLePath (0), mLeName (0), mCbPermanent (0)
     183        , mLePath (0), mLeName (0), mCbPermanent (0), mCbWritable (0)
    184184        , mUsedNames (aUsedNames)
    185185    {
     
    223223        inputLayout->addMultiCellWidget (mLeName, 1, 1, 1, 2);
    224224
     225                QHBoxLayout *cbLayout = new QHBoxLayout (0, "cbLayout");
     226        inputLayout->addMultiCellLayout (cbLayout, 2, 2, 0, 2);
     227                mCbWritable = new QCheckBox (tr ("&Writable"), this);
     228        mCbWritable->setChecked (true);
     229        cbLayout->addWidget (mCbWritable);
    225230        if (aEnableSelector)
    226231        {
    227232            mCbPermanent = new QCheckBox ( tr ("&Make Permanent"), this);
    228233            mCbPermanent->setChecked (true);
    229             inputLayout->addMultiCellWidget (mCbPermanent, 2, 2, 0, 2);
     234            cbLayout->addWidget (mCbPermanent);
    230235            connect (mCbPermanent, SIGNAL (toggled (bool)),
    231236                     this, SLOT (validate()));
     
    256261        return mCbPermanent ? mCbPermanent->isChecked() : true;
    257262    }
     263        bool getWritable() { return mCbWritable->isChecked(); }
    258264
    259265    void setPath (const QString &aPath) { mLePath->setText (aPath); }
     
    267273        }
    268274    }
     275        void setWritable (bool aWritable) { mCbWritable->setChecked (aWritable); }
    269276
    270277private slots:
     
    331338    QLineEdit *mLeName;
    332339    QCheckBox *mCbPermanent;
     340    QCheckBox *mCbWritable;
    333341    SFoldersNameList mUsedNames;
    334342};
     
    483491        CSharedFolder sf = aEn.GetNext();
    484492        new VBoxRichListItem (VBoxRichListItem::EllipsisFile, aRoot,
    485                               sf.GetName(), sf.GetHostPath(), "not edited");
     493                              sf.GetName(), sf.GetHostPath(), "not edited",
     494                              sf.GetWritable() ? "writable" : "readonly");
    486495    }
    487496    listView->setOpen (aRoot, true);
     
    574583        if (item && !item->getText (0).isNull() && !item->getText (1).isNull()
    575584            && item->getText (2) == "edited")
    576             createSharedFolder (item->getText (0), item->getText (1), true, type);
     585            createSharedFolder (item->getText (0), item->getText (1),
     586                                                item->getText (3) == "writable" ? true : false, type);
    577587        iterator = iterator->nextSibling();
    578588    }
     
    621631    /* Appending a new listview item to the root */
    622632    VBoxRichListItem *item = new VBoxRichListItem (
    623         VBoxRichListItem::EllipsisFile, root, name, path, "edited");
     633        VBoxRichListItem::EllipsisFile, root, name, path, "edited",
     634        dlg.getWritable() ? "writable" : "readonly");
    624635    /* Make the created item selected */
    625636    listView->ensureItemVisible (item);
     
    662673    dlg.setPermanent ((SFDialogType)item->parent()->text (2).toInt()
    663674                      != ConsoleType);
     675    dlg.setWritable (item->getText (3) == "writable");
    664676    if (dlg.exec() != QDialog::Accepted)
    665677        return;
     
    673685    Assert (root);
    674686    /* Updating an edited listview item */
     687    item->updateText (3, dlg.getWritable() ? "writable" : "readonly");
    675688    item->updateText (2, "edited");
    676689    item->updateText (1, path);
     
    707720    Assert (item);
    708721    QString tip = tr ("<nobr>Name:&nbsp;&nbsp;%1</nobr><br>"
    709                       "<nobr>Path:&nbsp;&nbsp;%2</nobr>")
    710                       .arg (item->getText (0)).arg (item->getText (1));
     722                "<nobr>Path:&nbsp;&nbsp;%2</nobr><br>"
     723                "<nobr>Access:&nbsp;&nbsp;%3</nobr>")
     724                .arg (item->getText (0)).arg (item->getText (1)).arg (item->getText (3));
    711725    if (!item->getText (0).isNull() && !item->getText (1).isNull())
    712726        QToolTip::add (listView->viewport(), listView->itemRect (aItem), tip);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette