VirtualBox

Changeset 968 in vbox


Ignore:
Timestamp:
Feb 18, 2007 11:43:54 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18738
Message:
  1. Problem reporter methods created for console transient shared folders creation&removing errors displaying.
  2. Assert warning fixed (Shared Folders setting dialog).
  3. Add share caption moved from shared folder’s open dialog to add new shared folder dialog.
Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/include/VBoxProblemReporter.h

    r945 r968  
    188188    void cannotRemoveSharedFolder (QWidget *, const CMachine &,
    189189                                   const QString &, const QString &);
     190    void cannotCreateSharedFolder (QWidget *, const CConsole &,
     191                                   const QString &, const QString &);
     192    void cannotRemoveSharedFolder (QWidget *, const CConsole &,
     193                                   const QString &, const QString &);
    190194
    191195    bool confirmReleaseImage (QWidget*, QString);
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r952 r968  
    11531153    message (aParent, Error,
    11541154             tr ("Failed to create a shared folder <b>%1</b> "
    1155                  "(pointing to <nobr><b>%2</b></nobr>)"
     1155                 "(pointing to <nobr><b>%2</b></nobr>) "
    11561156                 "for the virtual machine <b>%3</b>.")
    11571157                 .arg (aName)
     
    11711171    message (aParent, Error,
    11721172             tr ("Failed to remove the shared folder <b>%1</b> "
    1173                  "(pointing to <nobr><b>%2</b></nobr>)"
     1173                 "(pointing to <nobr><b>%2</b></nobr>) "
    11741174                 "from the virtual machine <b>%3</b>.")
    11751175                 .arg (aName)
    11761176                 .arg (aPath)
    11771177                 .arg (aMachine.GetName()),
     1178             formatErrorInfo (errInfo));
     1179}
     1180
     1181void VBoxProblemReporter::cannotCreateSharedFolder (QWidget        *aParent,
     1182                                                    const CConsole &aConsole,
     1183                                                    const QString  &aName,
     1184                                                    const QString  &aPath)
     1185{
     1186    /* preserve the current error info before calling the object again */
     1187    COMErrorInfo errInfo = aConsole.errorInfo();
     1188
     1189    message (aParent, Error,
     1190             tr ("Failed to create a shared folder <b>%1</b> "
     1191                 "(pointing to <nobr><b>%2</b></nobr>) "
     1192                 "for the virtual machine <b>%3</b>.")
     1193                 .arg (aName)
     1194                 .arg (aPath)
     1195                 .arg (aConsole.GetMachine().GetName()),
     1196             formatErrorInfo (errInfo));
     1197}
     1198
     1199void VBoxProblemReporter::cannotRemoveSharedFolder (QWidget        *aParent,
     1200                                                    const CConsole &aConsole,
     1201                                                    const QString  &aName,
     1202                                                    const QString  &aPath)
     1203{
     1204    /* preserve the current error info before calling the object again */
     1205    COMErrorInfo errInfo = aConsole.errorInfo();
     1206
     1207    message (aParent, Error,
     1208             tr ("Failed to remove the shared folder <b>%1</b> "
     1209                 "(pointing to <nobr><b>%2</b></nobr>) "
     1210                 "from the virtual machine <b>%3</b>.")
     1211                 .arg (aName)
     1212                 .arg (aPath)
     1213                 .arg (aConsole.GetMachine().GetName()),
    11781214             formatErrorInfo (errInfo));
    11791215}
  • TabularUnified trunk/src/VBox/Frontends/VirtualBox/ui/VBoxSharedFoldersSettings.ui.h

    r952 r968  
    6565    int rtti() const { return QIRichListItemId; }
    6666
    67     const QString& getText (int aIndex) { return mTextList [aIndex]; }
     67    QString getText (int aIndex)
     68    {
     69        return aIndex >= 0 && aIndex < (int)mTextList.size() ?
     70            mTextList [aIndex] : QString::null;
     71    }
    6872
    6973protected:
     
    7882    void processColumn (int aColumn, int aWidth)
    7983    {
    80         QString oneString = mTextList [aColumn];
    81         if (oneString.isEmpty())
     84        QString oneString = aColumn >= 0 && aColumn < (int)mTextList.size() ?
     85            mTextList [aColumn] : QString::null;
     86        if (oneString.isNull())
    8287            return;
    8388        int oldSize = listView()->fontMetrics().width (oneString);
     
    147152        mLePath (0), mLeName (0)
    148153    {
     154        setCaption (tr ("Add Share"));
    149155        QVBoxLayout *mainLayout = new QVBoxLayout (this, 10, 10, "mainLayout");
    150156
     
    207213        QFileDialog dlg (QDir::rootDirPath(), QString::null, this);
    208214        dlg.setMode (QFileDialog::DirectoryOnly);
    209         dlg.setCaption (tr ("Add Share"));
    210215        if (dlg.exec() == QDialog::Accepted)
    211216        {
     
    253258    new QIListViewSelectionPreserver (this, listView);
    254259    listView->setShowToolTips (false);
     260    listView->setRootIsDecorated (true);
    255261    tbAdd->setIconSet (VBoxGlobal::iconSet ("select_file_16px.png",
    256262                                            "select_file_dis_16px.png"));
     
    300306            mConsole.RemoveSharedFolder (aName);
    301307            if (!mConsole.isOk())
    302                 vboxProblem().cannotRemoveSharedFolder (this, mConsole.GetMachine(),
     308                vboxProblem().cannotRemoveSharedFolder (this, mConsole,
    303309                                                        aName, aPath);
    304310            break;
     
    337343            mConsole.CreateSharedFolder (aName, aPath);
    338344            if (!mConsole.isOk())
    339                 vboxProblem().cannotCreateSharedFolder (this, mConsole.GetMachine(),
     345                vboxProblem().cannotCreateSharedFolder (this, mConsole,
    340346                                                        aName, aPath);
    341347            break;
     
    447453                                           QListViewItem *aRoot)
    448454{
     455    Assert (!aRoot->text (2).isNull());
    449456    SFDialogType type = (SFDialogType)aRoot->text (2).toInt();
    450     Assert (type);
    451457
    452458    /* deleting all existing folders if the list */
     
    464470        if (iterator->rtti() == VBoxRichListItem::QIRichListItemId)
    465471            item = static_cast<VBoxRichListItem*> (iterator);
    466         if (item)
     472        if (item && !item->getText (0).isNull() && !item->getText (1).isNull())
    467473            createSharedFolder (item->getText (0), item->getText (1), type);
    468474        else
     
    513519                      "<nobr>Path:&nbsp;&nbsp;%2</nobr>")
    514520                      .arg (item->getText (0)).arg (item->getText (1));
    515     if (!item->getText (0).isEmpty() && !item->getText (1).isEmpty())
     521    if (!item->getText (0).isNull() && !item->getText (1).isNull())
    516522        QToolTip::add (listView->viewport(), listView->itemRect (aItem), tip);
    517523    else
     
    521527void VBoxSharedFoldersSettings::processCurrentChanged (QListViewItem *aItem)
    522528{
    523     if (aItem && listView->selectedItem() != aItem)
     529    if (aItem && aItem->isSelectable() && listView->selectedItem() != aItem)
    524530        listView->setSelected (aItem, true);
    525531    bool removeEnabled = aItem && aItem->parent() &&
Note: See TracChangeset for help on using the changeset viewer.

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