VirtualBox

Changeset 34275 in vbox


Ignore:
Timestamp:
Nov 23, 2010 11:08:52 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68023
Message:

FE/Qt4; Installer-OSX; Resources: add handling of file type association

Location:
trunk/src/VBox
Files:
66 added
13 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r34063 r34275  
    855855        src/darwin/PkgInfo \
    856856        $(PATH_VirtualBox.app)/Info.plist \
    857         $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
     857        $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns \
     858        $(PATH_ROOT)/src/VBox/Resources/darwin/virtualbox-vbox.icns=>Resources/virtualbox-vbox.icns \
     859        $(PATH_ROOT)/src/VBox/Resources/darwin/virtualbox-vbox-extpack.icns=>Resources/virtualbox-vbox-extpack.icns \
     860        $(PATH_ROOT)/src/VBox/Resources/darwin/virtualbox-ovf.icns=>Resources/virtualbox-ovf.icns \
     861        $(PATH_ROOT)/src/VBox/Resources/darwin/virtualbox-ova.icns=>Resources/virtualbox-ova.icns
    858862
    859863$$(PATH_VirtualBox.app)/Info.plist: $(PATH_SUB_CURRENT)/src/darwin/Info.plist $(VBOX_VERSION_MK) | $$(@D)/
     
    882886$$(PATH_VirtualBoxVM.app)/VM-Info.plist: $(PATH_SUB_CURRENT)/src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $$(@D)/
    883887        $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
     888        $(QUIET)$(RM) -f $@
     889        $(QUIET)$(SED) \
     890                -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
     891                -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
     892                -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
     893                -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
     894                -e 's/@VBOX_VENDOR@/$(VBOX_VENDOR)/g' \
     895                -e 's/@VBOX_PRODUCT@/$(VBOX_PRODUCT)/g' \
     896                -e 's/@VBOX_C_YEAR@/$(VBOX_C_YEAR)/g' \
     897                --output $@ $<
     898
     899PROGRAMS += vmstarter
     900vmstarter_TEMPLATE = VBOXR3EXE
     901vmstarter_SOURCES = src/darwin/vmstarter.mm
     902vmstarter_LDFLAGS += -framework AppKit
     903vmstarter_INST = $(INST_BIN)vmstarter
     904
     905INSTALLS += vmstarter.app
     906vmstarter.app_INST = $(VirtualBox.app_INST)Resources/vmstarter.app/Contents
     907vmstarter.app_MODE = 644
     908vmstarter.app_SOURCES = \
     909        src/darwin/vmstarter-PkgInfo=>PkgInfo \
     910        $(PATH_vmstarter.app)/vmstarter-Info.plist=>Info.plist
     911vmstarter.app_SYMLINKS = \
     912    MacOS=>../../../MacOS \
     913    Resources=>../../../Resources
     914
     915$$(PATH_vmstarter.app)/vmstarter-Info.plist: $(PATH_SUB_CURRENT)/src/darwin/vmstarter-Info.plist $(VBOX_VERSION_MK) | $$(@D)/
     916        $(call MSG_GENERATE,vmstarter.app,$<,$@)
    884917        $(QUIET)$(RM) -f $@
    885918        $(QUIET)$(SED) \
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc

    r34189 r34275  
    77    <file alias="vm_discard_32px.png">images/vm_discard_32px.png</file>
    88    <file alias="vm_discard_disabled_32px.png">images/vm_discard_disabled_32px.png</file>
    9     <file alias="vm_add_32px.png">images/vm_add_32px.png</file>
     9    <file alias="vm_add_16px.png">images/vm_add_16px.png</file>
    1010    <file alias="vm_new_32px.png">images/vm_new_32px.png</file>
    1111    <file alias="vm_new_disabled_32px.png">images/vm_new_disabled_32px.png</file>
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/Info.plist

    r33969 r34275  
    1414    <key>CFBundleIconFile</key>                 <string>virtualbox</string>
    1515    <key>CFBundleInfoDictionaryVersion</key>    <string>6.0</string>
    16     <key>LSCanProvideIMVideoDataSource</key>    <true/>
     16    <key>LSCanProvideIMVideoDataSource</key>    <false/>
     17    <key>CFBundleDocumentTypes</key>
     18    <array>
     19     <dict>
     20      <key>CFBundleTypeName</key>               <string>VirtualBox Extension Pack</string>
     21      <key>CFBundleTypeExtensions</key>         <array><string>vbox-extpack</string></array>
     22      <key>CFBundleTypeRole</key>               <string>None</string>
     23      <key>CFBundleTypeIconFile</key>           <string>virtualbox-vbox-extpack</string>
     24     </dict>
     25     <dict>
     26      <key>CFBundleTypeName</key>               <string>Open Virtualization Format</string>
     27      <key>CFBundleTypeExtensions</key>         <array><string>ovf</string></array>
     28      <key>CFBundleTypeRole</key>               <string>Viewer</string>
     29      <key>CFBundleTypeIconFile</key>           <string>virtualbox-ovf</string>
     30     </dict>
     31     <dict>
     32      <key>CFBundleTypeName</key>               <string>Open Virtualization Format Archive</string>
     33      <key>CFBundleTypeExtensions</key>         <array><string>ova</string></array>
     34      <key>CFBundleTypeRole</key>               <string>Viewer</string>
     35      <key>CFBundleTypeIconFile</key>           <string>virtualbox-ova</string>
     36     </dict>
     37    </array>
    1738</dict>
    1839</plist>
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r34192 r34275  
    348348    QPoint local = pWin->mapFromGlobal(global);
    349349    qApp->postEvent(pWin, new QContextMenuEvent(QContextMenuEvent::Mouse, local, global));
     350}
     351
     352QString darwinResolveAlias(const QString &strFile)
     353{
     354    OSErr err = noErr;
     355    FSRef fileRef;
     356    QString strTarget;
     357    do
     358    {
     359        Boolean fDir;
     360        if ((err = FSPathMakeRef((const UInt8*)strFile.toUtf8().constData(), &fileRef, &fDir)) != noErr)
     361            break;
     362        Boolean fAlias = FALSE;
     363        if ((err = FSIsAliasFile(&fileRef, &fAlias, &fDir)) != noErr)
     364            break;
     365        if (fAlias == TRUE)
     366        {
     367            if ((err = FSResolveAliasFile(&fileRef, TRUE, &fAlias, &fDir)) != noErr)
     368                break;
     369            char pszPath[1024];
     370            if ((err = FSRefMakePath(&fileRef, (UInt8*)pszPath, 1024)) != noErr)
     371                break;
     372            strTarget = QString::fromUtf8(pszPath);
     373        }else
     374            strTarget = strFile;
     375    }while(0);
     376
     377    return strTarget;
    350378}
    351379
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.h

    r34192 r34275  
    9292void darwinRetranslateAppMenu();
    9393
     94QString darwinResolveAlias(const QString &strFile);
     95
    9496RT_C_DECLS_END
    9597
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/vmstarter-Info.plist

    r34188 r34275  
    44<dict>
    55    <key>CFBundlePackageType</key>              <string>APPL</string>
    6     <key>CFBundleSignature</key>                <string>VBOX</string>
     6    <key>CFBundleSignature</key>                <string>VMST</string>
    77    <key>CFBundleDevelopmentRegion</key>        <string>English</string>
    8     <key>CFBundleIdentifier</key>               <string>org.virtualbox.app.VirtualBox</string>
    9     <key>CFBundleName</key>                     <string>VirtualBox</string>
    10     <key>CFBundleExecutable</key>               <string>VirtualBox</string>
     8    <key>CFBundleIdentifier</key>               <string>org.virtualbox.app.vmstarter</string>
     9    <key>CFBundleName</key>                     <string>vmstarter</string>
     10    <key>CFBundleExecutable</key>               <string>vmstarter</string>
    1111    <key>CFBundleVersion</key>                  <string>@VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@.@VBOX_VERSION_BUILD@</string>
    1212    <key>CFBundleShortVersionString</key>       <string>@VBOX_VERSION_MAJOR@.@VBOX_VERSION_MINOR@.@VBOX_VERSION_BUILD@</string>
    13     <key>CFBundleGetInfoString</key>            <string>@VBOX_PRODUCT@ Manager @VBOX_VERSION_STRING@, © 2007-@VBOX_C_YEAR@ @VBOX_VENDOR@</string>
     13    <key>CFBundleGetInfoString</key>            <string>@VBOX_PRODUCT@ vmstarter @VBOX_VERSION_STRING@, © 2007-@VBOX_C_YEAR@ @VBOX_VENDOR@</string>
    1414    <key>CFBundleIconFile</key>                 <string>virtualbox</string>
    1515    <key>CFBundleInfoDictionaryVersion</key>    <string>6.0</string>
    16     <key>LSCanProvideIMVideoDataSource</key>    <true/>
     16    <key>LSUIElement</key>                      <true/>
     17    <key>CFBundleDocumentTypes</key>
     18    <array>
     19     <dict>
     20      <key>CFBundleTypeName</key>               <string>VirtualBox Machine Description</string>
     21      <key>CFBundleTypeExtensions</key>         <array><string>vbox</string></array>
     22      <key>CFBundleTypeRole</key>               <string>Editor</string>
     23      <key>LSHandlerRank</key>                  <string>Owner</string>
     24      <key>CFBundleTypeIconFile</key>           <string>virtualbox-vbox</string>
     25     </dict>
     26    </array>
    1727</dict>
    1828</plist>
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/vmstarter-PkgInfo

    r34188 r34275  
    1 APPLVBVM
     1APPLVBST
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r34193 r34275  
    46094609// Private members
    46104610////////////////////////////////////////////////////////////////////////////////
     4611
     4612bool VBoxGlobal::processArgs()
     4613{
     4614    bool fResult = false;
     4615    QStringList args = qApp->arguments();
     4616    QList<QUrl> list;
     4617    for (int i = 1; i < args.size(); ++i)
     4618    {
     4619#ifdef Q_WS_MAC
     4620        QString strArg = ::darwinResolveAlias(args.at(i));
     4621#else /* Q_WS_MAC */
     4622        QString strArg = args.at(i);
     4623#endif /* !Q_WS_MAC */
     4624        if (   !strArg.isEmpty()
     4625            && !strArg.startsWith("-")
     4626            && QFile::exists(strArg))
     4627            list << QUrl(strArg);
     4628    }
     4629    if (!list.isEmpty())
     4630    {
     4631        for (int i = 0; i < list.size(); ++i)
     4632        {
     4633            const QString& strFile = list.at(i).toLocalFile();
     4634            if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxFileExts))
     4635            {
     4636                CVirtualBox vbox = vboxGlobal().virtualBox();
     4637                CMachine machine = vbox.FindMachine(strFile);
     4638                if (!machine.isNull())
     4639                {
     4640                    fResult = true;
     4641                    launchMachine(machine);
     4642                    /* Remove from the arg list. */
     4643                    list.removeAll(strFile);
     4644                }
     4645            }
     4646        }
     4647    }
     4648    if (!list.isEmpty())
     4649    {
     4650        m_ArgUrlList = list;
     4651        QTimer::singleShot(0, &vboxGlobal().selectorWnd(), SLOT(sltOpenUrls()));
     4652    }
     4653    return fResult;
     4654}
    46114655
    46124656void VBoxGlobal::init()
     
    53675411}
    53685412
     5413bool VBoxGlobal::switchToMachine(CMachine &machine)
     5414{
     5415#ifdef Q_WS_MAC
     5416    ULONG64 id = machine.ShowConsoleWindow();
     5417#else
     5418    WId id = (WId) machine.ShowConsoleWindow();
     5419#endif
     5420    AssertWrapperOk(machine);
     5421    if (!machine.isOk())
     5422        return false;
     5423
     5424    /* winId = 0 it means the console window has already done everything
     5425     * necessary to implement the "show window" semantics. */
     5426    if (id == 0)
     5427        return true;
     5428
     5429#if defined (Q_WS_WIN32) || defined (Q_WS_X11)
     5430
     5431    return vboxGlobal().activateWindow(id, true);
     5432
     5433#elif defined (Q_WS_MAC)
     5434    /*
     5435     * This is just for the case were the other process cannot steal
     5436     * the focus from us. It will send us a PSN so we can try.
     5437     */
     5438    ProcessSerialNumber psn;
     5439    psn.highLongOfPSN = id >> 32;
     5440    psn.lowLongOfPSN = (UInt32)id;
     5441    OSErr rc = ::SetFrontProcess(&psn);
     5442    if (!rc)
     5443        Log(("GUI: %#RX64 couldn't do SetFrontProcess on itself, the selector (we) had to do it...\n", id));
     5444    else
     5445        Log(("GUI: Failed to bring %#RX64 to front. rc=%#x\n", id, rc));
     5446    return !rc;
     5447
     5448#endif
     5449
     5450    return false;
     5451
     5452    /// @todo Below is the old method of switching to the console window
     5453    //  based on the process ID of the console process. It should go away
     5454    //  after the new (callback-based) method is fully tested.
     5455#if 0
     5456
     5457    if (!canSwitchTo())
     5458        return false;
     5459
     5460#if defined (Q_WS_WIN32)
     5461
     5462    HWND hwnd = mWinId;
     5463
     5464    /* if there are blockers (modal and modeless dialogs, etc), find the
     5465     * topmost one */
     5466    HWND hwndAbove = NULL;
     5467    do
     5468    {
     5469        hwndAbove = GetNextWindow(hwnd, GW_HWNDPREV);
     5470        HWND hwndOwner;
     5471        if (hwndAbove != NULL &&
     5472            ((hwndOwner = GetWindow(hwndAbove, GW_OWNER)) == hwnd ||
     5473             hwndOwner  == hwndAbove))
     5474            hwnd = hwndAbove;
     5475        else
     5476            break;
     5477    }
     5478    while (1);
     5479
     5480    /* first, check that the primary window is visible */
     5481    if (IsIconic(mWinId))
     5482        ShowWindow(mWinId, SW_RESTORE);
     5483    else if (!IsWindowVisible(mWinId))
     5484        ShowWindow(mWinId, SW_SHOW);
     5485
     5486#if 0
     5487    LogFlowFunc(("mWinId=%08X hwnd=%08X\n", mWinId, hwnd));
     5488#endif
     5489
     5490    /* then, activate the topmost in the group */
     5491    AllowSetForegroundWindow(m_pid);
     5492    SetForegroundWindow(hwnd);
     5493
     5494    return true;
     5495
     5496#elif defined (Q_WS_X11)
     5497
     5498    return false;
     5499
     5500#elif defined (Q_WS_MAC)
     5501
     5502    ProcessSerialNumber psn;
     5503    OSStatus rc = ::GetProcessForPID(m_pid, &psn);
     5504    if (!rc)
     5505    {
     5506        rc = ::SetFrontProcess(&psn);
     5507
     5508        if (!rc)
     5509        {
     5510            ShowHideProcess(&psn, true);
     5511            return true;
     5512        }
     5513    }
     5514    return false;
     5515
     5516#else
     5517
     5518    return false;
     5519
     5520#endif
     5521
     5522#endif
     5523}
     5524
     5525bool VBoxGlobal::launchMachine(CMachine &machine)
     5526{
     5527    if (machine.CanShowConsoleWindow())
     5528        return VBoxGlobal::switchToMachine(machine);
     5529
     5530    KMachineState state = machine.GetState();
     5531    AssertMsg(   state == KMachineState_PoweredOff
     5532              || state == KMachineState_Saved
     5533              || state == KMachineState_Teleported
     5534              || state == KMachineState_Aborted
     5535              , ("Machine must be PoweredOff/Saved/Aborted (%d)", state));
     5536
     5537    CVirtualBox vbox = vboxGlobal().virtualBox();
     5538    CSession session;
     5539    session.createInstance(CLSID_Session);
     5540    if (session.isNull())
     5541    {
     5542        vboxProblem().cannotOpenSession(session);
     5543        return false;
     5544    }
     5545
     5546#if defined(Q_OS_WIN32)
     5547    /* allow the started VM process to make itself the foreground window */
     5548    AllowSetForegroundWindow(ASFW_ANY);
     5549#endif
     5550
     5551    QString env;
     5552#if defined(Q_WS_X11)
     5553    /* make sure the VM process will start on the same display as the Selector */
     5554    const char *display = RTEnvGet("DISPLAY");
     5555    if (display)
     5556        env.append(QString("DISPLAY=%1\n").arg(display));
     5557    const char *xauth = RTEnvGet("XAUTHORITY");
     5558    if (xauth)
     5559        env.append(QString("XAUTHORITY=%1\n").arg(xauth));
     5560#endif
     5561
     5562    CProgress progress = machine.LaunchVMProcess(session, "GUI/Qt", env);
     5563    if (   !vbox.isOk()
     5564        || progress.isNull())
     5565    {
     5566        vboxProblem().cannotOpenSession(vbox, machine);
     5567        return false;
     5568    }
     5569
     5570    /* Hide the "VM spawning" progress dialog */
     5571    /* I hope 1 minute will be enough to spawn any running VM silently, isn't it? */
     5572    int iSpawningDuration = 60000;
     5573    vboxProblem().showModalProgressDialog(progress, machine.GetName(), 0, iSpawningDuration);
     5574    if (progress.GetResultCode() != 0)
     5575        vboxProblem().cannotOpenSession(vbox, machine, progress);
     5576
     5577    session.UnlockMachine();
     5578
     5579    return true;
     5580}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r34065 r34275  
    150150    QString brandingGetKey (QString aKey);
    151151
     152    bool processArgs();
     153
     154    bool switchToMachine(CMachine &machine);
     155    bool launchMachine(CMachine &machine);
     156
    152157    bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
    153158    bool showStartVMErrors() const { return mShowStartVMErrors; }
     
    159164#endif
    160165    QString managedVMUuid() const { return vmUuid; }
     166    QList<QUrl> &argUrlList() { return m_ArgUrlList; }
    161167
    162168    VBoxDefs::RenderMode vmRenderMode() const { return vm_render_mode; }
     
    765771
    766772    QString vmUuid;
     773    QList<QUrl> m_ArgUrlList;
    767774
    768775#ifdef VBOX_GUI_WITH_SYSTRAY
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r33969 r34275  
    473473                break;
    474474
     475
     476            if (vboxGlobal().processArgs())
     477                return 0;
     478
    475479#ifndef VBOX_OSE
    476480#ifdef Q_WS_X11
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.cpp

    r34189 r34275  
    9696            this, SLOT(showViewContextMenu(const QPoint&)));
    9797
    98 #if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
     98#ifdef Q_WS_MAC
    9999    qApp->installEventFilter(this);
    100 #endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
     100#endif /* Q_WS_MAC */
    101101
    102102#if !(defined (Q_WS_WIN) || defined (Q_WS_MAC))
     
    130130    mVmAddAction = new QAction(this);
    131131    mVmAddAction->setIcon(UIIconPool::iconSet(
    132         ":/vm_add_32px.png"));
     132        ":/vm_add_16px.png"));
    133133    mVmConfigAction = new QAction(this);
    134134    mVmConfigAction->setIcon(UIIconPool::iconSetFull(
     
    187187    mVMListView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    188188    connect(mVMListView, SIGNAL(sigUrlsDropped(QList<QUrl>)),
    189             this, SLOT(sltUrlsDropped(QList<QUrl>)), Qt::QueuedConnection);
     189            this, SLOT(sltOpenUrls(QList<QUrl>)), Qt::QueuedConnection);
    190190
    191191    /* Make non-possible to activate list elements by single click,
     
    540540void VBoxSelectorWnd::fileImportAppliance(const QString &strFile /* = "" */)
    541541{
    542     UIImportApplianceWzd wzd(strFile, this);
     542#ifdef Q_WS_MAC
     543    QString strTmpFile = ::darwinResolveAlias(strFile);
     544#else /* Q_WS_MAC */
     545    QString strTmpFile = strFile;
     546#endif /* !Q_WS_MAC */
     547    UIImportApplianceWzd wzd(strTmpFile, this);
    543548
    544549    wzd.exec();
     
    608613void VBoxSelectorWnd::vmAdd(const QString &strFile /* = "" */)
    609614{
     615#ifdef Q_WS_MAC
     616    QString strTmpFile = ::darwinResolveAlias(strFile);
     617#else /* Q_WS_MAC */
    610618    QString strTmpFile = strFile;
     619#endif /* !Q_WS_MAC */
    611620    /* Initialize variables: */
    612621    CVirtualBox vbox = vboxGlobal().virtualBox();
     
    779788              ("Must NOT be a VM console process"));
    780789
    781     /* just switch to the VM window if it already exists */
    782     if (item->canSwitchTo())
    783     {
    784         item->switchTo();
    785         return;
    786     }
    787 
    788     AssertMsg(   item->machineState() == KMachineState_PoweredOff
    789               || item->machineState() == KMachineState_Saved
    790               || item->machineState() == KMachineState_Teleported
    791               || item->machineState() == KMachineState_Aborted
    792               , ("Machine must be PoweredOff/Saved/Aborted (%d)", item->machineState()));
    793 
    794     QString id = item->id();
    795     CVirtualBox vbox = vboxGlobal().virtualBox();
    796     CSession session;
    797 
    798     session.createInstance(CLSID_Session);
    799     if (session.isNull())
    800     {
    801         vboxProblem().cannotOpenSession(session);
    802         return;
    803     }
    804 
    805 #if defined(Q_OS_WIN32)
    806     /* allow the started VM process to make itself the foreground window */
    807     AllowSetForegroundWindow(ASFW_ANY);
    808 #endif
    809 
    810     QString env;
    811 #if defined(Q_WS_X11)
    812     /* make sure the VM process will start on the same display as the Selector */
    813     const char *display = RTEnvGet("DISPLAY");
    814     if (display)
    815         env.append(QString("DISPLAY=%1\n").arg(display));
    816     const char *xauth = RTEnvGet("XAUTHORITY");
    817     if (xauth)
    818         env.append(QString("XAUTHORITY=%1\n").arg(xauth));
    819 #endif
    820 
    821     CProgress progress = item->machine().LaunchVMProcess(session, "GUI/Qt", env);
    822     if (!vbox.isOk())
    823     {
    824         vboxProblem().cannotOpenSession(vbox, item->machine());
    825         return;
    826     }
    827 
    828     /* Hide the "VM spawning" progress dialog */
    829     /* I hope 1 minute will be enough to spawn any running VM silently, isn't it? */
    830     int iSpawningDuration = 60000;
    831     vboxProblem().showModalProgressDialog(progress, item->name(), this, iSpawningDuration);
    832     if (progress.GetResultCode() != 0)
    833         vboxProblem().cannotOpenSession(vbox, item->machine(), progress);
    834 
    835     session.UnlockMachine();
     790    CMachine machine = item->machine();
     791    vboxGlobal().launchMachine(machine);
    836792}
    837793
     
    972928}
    973929
    974 void VBoxSelectorWnd::sltUrlsDropped(QList<QUrl> list)
     930
     931void VBoxSelectorWnd::sltOpenUrls(QList<QUrl> list /* = QList<QUrl>() */)
    975932{
    976933    /* Make sure any pending D&D events are consumed. */
    977934    qApp->processEvents();
     935    if (list.isEmpty())
     936    {
     937        list = vboxGlobal().argUrlList();
     938        vboxGlobal().argUrlList().clear();
     939    }
    978940    /* Check if we are can handle the dropped urls. */
    979941    for (int i = 0; i < list.size(); ++i)
    980942    {
    981         QString file = list.at(i).toLocalFile();
    982         if (!file.isEmpty())
    983         {
    984             if (VBoxGlobal::hasAllowedExtension(file, VBoxDefs::VBoxFileExts))
     943#ifdef Q_WS_MAC
     944        QString strFile = ::darwinResolveAlias(list.at(i).toLocalFile());
     945#else /* Q_WS_MAC */
     946        QString strFile = list.at(i).toLocalFile();
     947#endif /* !Q_WS_MAC */
     948        if (   !strFile.isEmpty()
     949            && QFile::exists(strFile))
     950        {
     951            if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::VBoxFileExts))
    985952            {
    986                 /* VBox config files. Only one file at the time. */
    987                 vmAdd(file);
    988                 break;
     953                /* VBox config files. */
     954                CVirtualBox vbox = vboxGlobal().virtualBox();
     955                CMachine machine = vbox.FindMachine(strFile);
     956                if (!machine.isNull())
     957                {
     958                    CVirtualBox vbox = vboxGlobal().virtualBox();
     959                    CMachine machine = vbox.FindMachine(strFile);
     960                    if (!machine.isNull())
     961                        vboxGlobal().launchMachine(machine);
     962                }else
     963                    vmAdd(strFile);
    989964            }
    990             else if (VBoxGlobal::hasAllowedExtension(file, VBoxDefs::OVFFileExts))
     965            else if (VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::OVFFileExts))
    991966            {
    992967                /* OVF/OVA. Only one file at the time. */
    993                 fileImportAppliance(file);
     968                fileImportAppliance(strFile);
    994969                break;
    995970            }
     
    11081083}
    11091084
    1110 #if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
    1111 bool VBoxSelectorWnd::eventFilter(QObject *aObject, QEvent *aEvent)
     1085#ifdef Q_WS_MAC
     1086bool VBoxSelectorWnd::eventFilter(QObject *pObject, QEvent *pEvent)
    11121087{
    11131088    if (!isActiveWindow())
    1114         return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent);
    1115 
    1116     if (qobject_cast<QWidget*>(aObject) &&
    1117         qobject_cast<QWidget*>(aObject)->window() != this)
    1118         return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent);
    1119 
    1120     switch (aEvent->type())
    1121     {
     1089        return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent);
     1090
     1091    if (qobject_cast<QWidget*>(pObject) &&
     1092        qobject_cast<QWidget*>(pObject)->window() != this)
     1093        return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent);
     1094
     1095    switch (pEvent->type())
     1096    {
     1097        case QEvent::FileOpen:
     1098        {
     1099            sltOpenUrls(QList<QUrl>() << static_cast<QFileOpenEvent*>(pEvent)->file());
     1100            break;
     1101        }
     1102# if (QT_VERSION < 0x040402)
    11221103        case QEvent::KeyPress:
    1123             {
    1124                 /* Bug in Qt below 4.4.2. The key events are send to the current
    1125                  * window even if a menu is shown & has the focus. See
    1126                  * http://trolltech.com/developer/task-tracker/index_html?method=entry&id=214681. */
    1127                 if (::darwinIsMenuOpen())
    1128                     return true;
    1129             }
     1104        {
     1105            /* Bug in Qt below 4.4.2. The key events are send to the current
     1106             * window even if a menu is shown & has the focus. See
     1107             * http://trolltech.com/developer/task-tracker/index_html?method=entry&id=214681. */
     1108            if (::darwinIsMenuOpen())
     1109                return true;
     1110            break;
     1111        }
     1112# endif
    11301113        default:
    11311114            break;
    11321115    }
    1133     return QIWithRetranslateUI2<QMainWindow>::eventFilter(aObject, aEvent);
    1134 }
    1135 #endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
     1116    return QIWithRetranslateUI2<QMainWindow>::eventFilter(pObject, pEvent);
     1117}
     1118#endif /* Q_WS_MAC */
    11361119
    11371120/**
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSelectorWnd.h

    r34096 r34275  
    8383    void showContextMenu(const QPoint &aPoint);
    8484
    85     void sltUrlsDropped(QList<QUrl> list);
     85    void sltOpenUrls(QList<QUrl> list = QList<QUrl>());
    8686
    8787#ifdef VBOX_GUI_WITH_SYSTRAY
     
    105105    bool event(QEvent *aEvent);
    106106    void closeEvent(QCloseEvent *aEvent);
    107 //#if defined (Q_WS_MAC) && (QT_VERSION < 0x040402)
    108 //    bool eventFilter(QObject *aObject, QEvent *aEvent);
    109 //#endif /* defined (Q_WS_MAC) && (QT_VERSION < 0x040402) */
     107#ifdef Q_WS_MAC
     108    bool eventFilter(QObject *pObject, QEvent *pEvent);
     109#endif /* Q_WS_MAC */
    110110
    111111    void retranslateUi();
  • trunk/src/VBox/Installer/darwin/DiskImage/VirtualBox_Uninstall.tool

    r33540 r34275  
    164164
    165165#
     166# Unregister has to be done before the files are removed.
     167#
     168LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
     169if [ -e ${LSREGISTER} ]; then
     170    ${LSREGISTER} -u /Applications/VirtualBox.app > /dev/null
     171    ${LSREGISTER} -u /Applications/VirtualBox.app/Contents/Resources/vmstarter.app > /dev/null
     172fi
     173
     174#
    166175# Display the sudo usage instructions and execute the command.
    167176#
  • trunk/src/VBox/Installer/darwin/Makefile.kmk

    r33185 r34275  
    647647        MacOS/VMMR0.r0 \
    648648        MacOS/VBoxDDR0.r0 \
    649         MacOS/VBoxDD2R0.r0
     649        MacOS/VBoxDD2R0.r0 \
     650        MacOS/vmstarter
    650651
    651652VBOX_DI_VBAPP_OTHER_BINS = \
     
    657658        Resources/VirtualBoxVM.app/Contents/Info.plist \
    658659        Resources/VirtualBoxVM.app/Contents/PkgInfo \
     660        Resources/vmstarter.app/Contents/Info.plist \
     661        Resources/vmstarter.app/Contents/PkgInfo \
    659662        Info.plist \
    660663        PkgInfo \
    661664        Resources/virtualbox.icns \
     665        Resources/virtualbox-vbox.icns \
     666        Resources/virtualbox-vbox-extpack.icns \
     667        Resources/virtualbox-ovf.icns \
     668        Resources/virtualbox-ova.icns \
    662669        MacOS/components/VBoxXPCOMBase.xpt \
    663670        MacOS/components/VirtualBox_XPCOM.xpt
     
    687694        Resources/VirtualBoxVM.app/Contents/MacOS=>../../../MacOS/ \
    688695        Resources/VirtualBoxVM.app/Contents/Resources=>../../../Resources/ \
     696        Resources/vmstarter.app/Contents/MacOS=>../../../MacOS/ \
     697        Resources/vmstarter.app/Contents/Resources=>../../../Resources/ \
    689698        $(foreach qtmod, $(VBOX_QT4_MOD_NAMES), Frameworks/$(qtmod).framework/$(qtmod)=>Versions/4/$(qtmod))
    690699ifdef VBOX_WITH_COCOA_QT
     
    733742                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/Resources/*) \
    734743                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents/Resources/*.lproj/*) \
     744                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/*) \
     745                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/Resources/*) \
     746                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/vmstarter.app/Contents/Resources/*.lproj/*) \
    735747                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/Resources/*.lproj/*) \
    736748                $$(wildcard $(VBOX_PATH_DIST)/VirtualBox.app/Contents/MacOS/*) \
     
    766778                $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app \
    767779                $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/VirtualBoxVM.app/Contents \
     780                $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/vmstarter.app \
     781                $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/Resources/vmstarter.app/Contents \
    768782                $(if-expr defined(VBOX_WITH_PYTHON), \
    769783                        $(VBOX_PATH_PACK_TMP)/VirtualBox.pkg.root/Applications/VirtualBox.app/Contents/MacOS/sdk \
  • trunk/src/VBox/Installer/darwin/VirtualBox/postflight

    r31940 r34275  
    6767VBOXWEBSRV_TRG="${HOME}/Library/LaunchAgents"
    6868if [[ -e "${VBOXWEBSRV}" && -e "${VBOXWEBSRV_TRG}" ]]; then
    69    echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
    70    ${CP} "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
    71    /usr/sbin/chown `/usr/bin/stat -f"%u" "${HOME}"` "${VBOXWEBSRV_TRG}/org.virtualbox.vboxwebsrv.plist"
     69    echo "Installing vboxwebsrv launchd file to ${VBOXWEBSRV_TRG}"
     70    ${CP} "${VBOXWEBSRV}" "${VBOXWEBSRV_TRG}/"
     71    /usr/sbin/chown "${USER}" "${VBOXWEBSRV_TRG}/org.virtualbox.vboxwebsrv.plist"
    7272fi
    7373
     
    7777DATAPATH="`/usr/bin/dirname "${0}"`/../../../../../.."
    7878if [ -d "${DATAPATH}/.custom" ]; then
    79    echo  1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
    80    ${CPDIR} "${DATAPATH}/.custom/"   "${VBOX_INSTALL_PATH}/custom"
     79    echo  1>&2 "Copy ${DATAPATH}/.custom to ${VBOX_INSTALL_PATH}...";
     80    ${CPDIR} "${DATAPATH}/.custom/"   "${VBOX_INSTALL_PATH}/custom"
     81fi
     82
     83#
     84# Register our file extensions
     85#
     86LSREGISTER=/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
     87if [ -e ${LSREGISTER} ]; then
     88    echo "Register file extensions for $USER"
     89    /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app
     90    /usr/bin/sudo -u "${USER}" ${LSREGISTER} -f /Applications/VirtualBox.app/Contents/Resources/vmstarter.app
    8191fi
    8292
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