VirtualBox

Changeset 24877 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 23, 2009 4:28:52 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: 4226: Can't open www.virtualbox.org from Help menu: Fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r24784 r24877  
    42054205bool VBoxGlobal::openURL (const QString &aURL)
    42064206{
    4207     if (QDesktopServices::openUrl (aURL))
    4208         return true;
    4209 
    4210     /* If we go here it means we couldn't open the URL */
    4211     vboxProblem().cannotOpenURL (aURL);
    4212 
    4213     return false;
     4207    /* Service event */
     4208    class ServiceEvent : public QEvent
     4209    {
     4210        public:
     4211
     4212            ServiceEvent (bool aResult) : QEvent (QEvent::User), mResult (aResult) {}
     4213
     4214            bool result() const { return mResult; }
     4215
     4216        private:
     4217
     4218            bool mResult;
     4219    };
     4220
     4221    /* Service-Client object */
     4222    class ServiceClient : public QEventLoop
     4223    {
     4224        public:
     4225
     4226            ServiceClient() : mResult (false) {}
     4227
     4228            bool result() const { return mResult; }
     4229
     4230        private:
     4231
     4232            bool event (QEvent *aEvent)
     4233            {
     4234                if (aEvent->type() == QEvent::User)
     4235                {
     4236                    ServiceEvent *event = static_cast <ServiceEvent*> (aEvent);
     4237                    mResult = event->result();
     4238                    event->accept();
     4239                    quit();
     4240                    return true;
     4241                }
     4242                return false;
     4243            }
     4244
     4245            bool mResult;
     4246    };
     4247
     4248    /* Service-Server object */
     4249    class ServiceServer : public QThread
     4250    {
     4251        public:
     4252
     4253            ServiceServer (ServiceClient &aClient, const QString &aURL)
     4254                : mClient (aClient), mURL (aURL) {}
     4255
     4256        private:
     4257
     4258            void run()
     4259            {
     4260                QApplication::postEvent (&mClient, new ServiceEvent (QDesktopServices::openUrl (mURL)));
     4261            }
     4262
     4263            ServiceClient &mClient;
     4264            const QString &mURL;
     4265    };
     4266
     4267    ServiceClient client;
     4268    ServiceServer server (client, aURL);
     4269    server.start();
     4270    client.exec();
     4271    server.wait();
     4272
     4273    bool result = client.result();
     4274
     4275    if (!result)
     4276        vboxProblem().cannotOpenURL (aURL);
     4277
     4278    return result;
    42144279}
    42154280
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