Ejemplo n.º 1
0
void
LoginProcess::showError() const
{
    switch ( m_lastError.enumValue() )
    {
        case lastfm::ws::AuthenticationFailed:
            // COPYTODO
            QMessageBoxBuilder( 0 )
                    .setIcon( QMessageBox::Critical )
                    .setTitle( tr("Login Failed") )
                    .setText( tr("Sorry, we don't recognise that username, or you typed the password wrongly.") )
                    .exec();
            break;

        default:
            // COPYTODO
            QMessageBoxBuilder( 0 )
                    .setIcon( QMessageBox::Critical )
                    .setTitle( tr("Last.fm Unavailable") )
                    .setText( tr("There was a problem communicating with the Last.fm services. Please try again later.") )
                    .exec();
            break;

        case lastfm::ws::TryAgainLater:
        case lastfm::ws::UnknownError:
            switch ( m_lastNetworkError )
            {
                case QNetworkReply::ProxyConnectionClosedError:
                case QNetworkReply::ProxyConnectionRefusedError:
                case QNetworkReply::ProxyNotFoundError:
                case QNetworkReply::ProxyTimeoutError:
                case QNetworkReply::ProxyAuthenticationRequiredError: //TODO we are meant to prompt!
                case QNetworkReply::UnknownProxyError:
                case QNetworkReply::UnknownNetworkError:
                    break;
                default:
                    return;
            }

            // TODO proxy prompting?
            // COPYTODO
            QMessageBoxBuilder( 0 )
                    .setIcon( QMessageBox::Critical )
                    .setTitle( tr("Cannot connect to Last.fm") )
                    .setText( tr("Last.fm cannot be reached. Please check your firewall or proxy settings.") )
                    .exec();

#ifdef WIN32
            // show Internet Settings Control Panel
            HMODULE h = LoadLibraryA( "InetCpl.cpl" );
            if (!h) break;
            BOOL (WINAPI *cpl)(HWND) = (BOOL (WINAPI *)(HWND)) GetProcAddress( h, "LaunchConnectionDialog" );
            if (cpl) cpl( qApp->activeWindow()->winId() );
            FreeLibrary( h );
#endif
            break;
    }
}
Ejemplo n.º 2
0
Archivo: main.c Proyecto: kkaneda/vm
static void
raise_device_not_available_exception_if_ts_set ( struct mon_t *mon, privilege_level_t saved_cpl ) 
{
	privilege_level_t curr_cpl = cpl ( mon->regs );

	/* [TODO] consider EM flag of cr0 (IA-32 vol3A. 2-19) */
	if ( ( saved_cpl == SUPERVISOR_MODE ) && ( curr_cpl == USER_MODE ) && 
	     ( mon->regs->sys.cr0.task_switched ) ) {
		/* raise device-not-available exception (#NM) for restoring fpu */
		Monitor_raise_interrupt ( mon, IVECTOR_DEVICE_NOT_AVAILABLE ); 
	}
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: kkaneda/vm
static void
____monitor_run ( struct mon_t *mon, int signo ) 
{
	privilege_level_t saved_cpl;

	ASSERT ( mon != NULL );

	saved_cpl = cpl ( mon->regs );

	handle_signal_with_stat ( mon, signo );
	try_handle_msgs_with_stat ( mon );
	try_generate_interrupt_with_stat ( mon );

	/* for restoring the state of FPU */
	raise_device_not_available_exception_if_ts_set ( mon, saved_cpl );
}
Ejemplo n.º 4
0
/////////////////////////////////////////////////////////////////////////////
//++
//
//	CBasePropertyPage::BSetPrivateProps
//
//	Routine Description:
//		Set the private properties for this object.
//
//	Arguments:
//		bValidateOnly	[IN] TRUE = only validate the data.
//
//	Return Value:
//		ERROR_SUCCESS	The operation was completed successfully.
//		!0				Failure.
//
//--
/////////////////////////////////////////////////////////////////////////////
BOOL CBasePropertyPage::BSetPrivateProps(IN BOOL bValidateOnly)
{
	BOOL			bSuccess	= TRUE;
	CClusPropList	cpl(BWizard() /*bAlwaysAddProp*/);
	CWaitCursor	wc;

	ASSERT(Peo() != NULL);

	// Build the property list.
	try
	{
		BuildPropList(cpl);
	}  // try
	catch (CException * pe)
	{
		pe->ReportError();
		pe->Delete();
		bSuccess = FALSE;
	}  // catch:  CException

	// Set the data.
	if (bSuccess)
	{
		if ((cpl.PbProplist() != NULL) && (cpl.CbProplist() > 0))
		{
			DWORD		dwStatus;
			DWORD		dwControlCode;
			DWORD		cbProps;

			switch (Cot())
			{
				case CLUADMEX_OT_NODE:
					ASSERT(Peo()->PndNodeData() != NULL);
					ASSERT(Peo()->PndNodeData()->m_hnode != NULL);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterNodeControl(
									Peo()->PndNodeData()->m_hnode,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				case CLUADMEX_OT_GROUP:
					ASSERT(Peo()->PgdGroupData() != NULL);
					ASSERT(Peo()->PgdGroupData()->m_hgroup != NULL);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterGroupControl(
									Peo()->PgdGroupData()->m_hgroup,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				case CLUADMEX_OT_RESOURCE:
					ASSERT(Peo()->PrdResData() != NULL);
					ASSERT(Peo()->PrdResData()->m_hresource != NULL);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterResourceControl(
									Peo()->PrdResData()->m_hresource,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				case CLUADMEX_OT_RESOURCETYPE:
					ASSERT(Peo()->PodObjData() != NULL);
					ASSERT(Peo()->PodObjData()->m_strName.GetLength() > 0);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterResourceTypeControl(
									Hcluster(),
									Peo()->PodObjData()->m_strName,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				case CLUADMEX_OT_NETWORK:
					ASSERT(Peo()->PndNetworkData() != NULL);
					ASSERT(Peo()->PndNetworkData()->m_hnetwork != NULL);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterNetworkControl(
									Peo()->PndNetworkData()->m_hnetwork,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				case CLUADMEX_OT_NETINTERFACE:
					ASSERT(Peo()->PndNetInterfaceData() != NULL);
					ASSERT(Peo()->PndNetInterfaceData()->m_hnetinterface != NULL);

					// Determine which control code to use.
					if (bValidateOnly)
						dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES;
					else
						dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;

					// Set private properties.
					dwStatus = ClusterNetInterfaceControl(
									Peo()->PndNetInterfaceData()->m_hnetinterface,
									NULL,	// hNode
									dwControlCode,
									cpl.PbProplist(),
									cpl.CbProplist(),
									NULL,	// lpOutBuffer
									0,		// nOutBufferSize
									&cbProps
									);
					break;
				default:
					ASSERT(0);
			}  // switch:  object type

			// Handle errors.
			if (dwStatus != ERROR_SUCCESS)
			{
				CString strMsg;
				FormatError(strMsg, dwStatus);
				AfxMessageBox(strMsg);
				if (bValidateOnly
						|| (dwStatus != ERROR_RESOURCE_PROPERTIES_STORED))
					bSuccess = FALSE;
			}  // if:  error setting/validating data
		}  // if:  there is data to set
	}  // if:  no errors building the property list

	// Save data locally.
	if (!bValidateOnly && bSuccess)
	{
		// Save new values as previous values.
		try
		{
			DWORD					cprop;
			const CObjectProperty *	pprop;

			for (pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop--)
			{
				switch (pprop->m_propFormat)
				{
					case CLUSPROP_FORMAT_SZ:
					case CLUSPROP_FORMAT_EXPAND_SZ:
						ASSERT(pprop->m_value.pstr != NULL);
						ASSERT(pprop->m_valuePrev.pstr != NULL);
						*pprop->m_valuePrev.pstr = *pprop->m_value.pstr;
						break;
					case CLUSPROP_FORMAT_DWORD:
						ASSERT(pprop->m_value.pdw != NULL);
						ASSERT(pprop->m_valuePrev.pdw != NULL);
						*pprop->m_valuePrev.pdw = *pprop->m_value.pdw;
						break;
					case CLUSPROP_FORMAT_BINARY:
					case CLUSPROP_FORMAT_MULTI_SZ:
						ASSERT(pprop->m_value.ppb != NULL);
						ASSERT(*pprop->m_value.ppb != NULL);
						ASSERT(pprop->m_value.pcb != NULL);
						ASSERT(pprop->m_valuePrev.ppb != NULL);
						ASSERT(*pprop->m_valuePrev.ppb != NULL);
						ASSERT(pprop->m_valuePrev.pcb != NULL);
						delete [] *pprop->m_valuePrev.ppb;
						*pprop->m_valuePrev.ppb = new BYTE[*pprop->m_value.pcb];
						CopyMemory(*pprop->m_valuePrev.ppb, *pprop->m_value.ppb, *pprop->m_value.pcb);
						*pprop->m_valuePrev.pcb = *pprop->m_value.pcb;
						break;
					default:
						ASSERT(0);	// don't know how to deal with this type
				}  // switch:  property format
			}  // for:  each property
		}  // try
		catch (CException * pe)
		{
			pe->ReportError();
			pe->Delete();
			bSuccess = FALSE;
		}  // catch:  CException
	}  // if:  not just validating and successful so far

	return bSuccess;

}  //*** CBasePropertyPage::BSetPrivateProps()
/////////////////////////////////////////////////////////////////////////////
//++
//
//  CBasePropertyPage::BSetPrivateProps
//
//  Description:
//      Set the private properties for this object.
//
//  Arguments:
//      fValidateOnlyIn
//          TRUE = only validate the data.
//
//      fNoNewPropsIn
//          TRUE = exclude properties marked with opfNew.
//
//  Return Value:
//      ERROR_SUCCESS
//          The operation was completed successfully.
//
//      Other Win32 values.
//          Failure.
//
//--
/////////////////////////////////////////////////////////////////////////////
BOOL
CBasePropertyPage::BSetPrivateProps(
      BOOL fValidateOnlyIn   // = FALSE
    , BOOL fNoNewPropsIn     // = FALSE
    )
{
    BOOL            fSuccess   = TRUE;
    CClusPropList   cpl( BWizard() /*bAlwaysAddProp*/ );

    ASSERT( Peo() != NULL );
    ASSERT( Peo()->PodObjData() );

    //
    //  Build the property list.
    //

    try
    {
        fSuccess = BBuildPropList( cpl, fNoNewPropsIn );
    } // try
    catch ( CException * pe )
    {
        pe->ReportError();
        pe->Delete();
        fSuccess = FALSE;
    } // catch: CException

    //
    //  Set the data.
    //

    if ( fSuccess )
    {
        if ( (cpl.PbPropList() != NULL) && (cpl.CbPropList() > 0) )
        {
            DWORD       sc = ERROR_SUCCESS;
            DWORD       dwControlCode;
            DWORD       cbProps;

            switch ( Cot() )
            {
                case CLUADMEX_OT_NODE:
                {
                    CNodeData * pcnd = reinterpret_cast< CNodeData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNode() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNodeControl(
                                      pcnd->GetHNode()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_GROUP:
                {
                    CGroupData * pcgd = reinterpret_cast< CGroupData * >( Peo()->PodObjData() );
                    ASSERT( pcgd && (pcgd->GetHGroup() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterGroupControl(
                                      pcgd->GetHGroup()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_RESOURCE:
                {
                    CResData * pcrd = reinterpret_cast< CResData * >( Peo()->PodObjData() );
                    ASSERT( pcrd && (pcrd->GetHResource() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterResourceControl(
                                      pcrd->GetHResource()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_RESOURCETYPE:
                {
                    CResTypeData * pcrd = reinterpret_cast< CResTypeData * >( Peo()->PodObjData() );
                    ASSERT( pcrd && (pcrd->StrName().GetLength() > 0) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterResourceTypeControl(
                                      Hcluster()
                                    , pcrd->StrName()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_NETWORK:
                {
                    CNetworkData * pcnd = reinterpret_cast< CNetworkData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNetwork() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNetworkControl(
                                      pcnd->GetHNetwork()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                case CLUADMEX_OT_NETINTERFACE:
                {
                    CNetInterfaceData * pcnd = reinterpret_cast< CNetInterfaceData * >( Peo()->PodObjData() );
                    ASSERT( pcnd && (pcnd->GetHNetInterface() != NULL) );

                    //
                    //  Determine which control code to use.
                    //

                    if ( fValidateOnlyIn )
                    {
                        dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES;
                    } // if: only validating data
                    else
                    {
                        dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
                    } // else: setting data

                    //
                    //  Set private properties.
                    //

                    sc = ClusterNetInterfaceControl(
                                      pcnd->GetHNetInterface()
                                    , NULL   // hNode
                                    , dwControlCode
                                    , cpl.PbPropList()
                                    , static_cast< DWORD >( cpl.CbPropList() )
                                    , NULL   // lpOutBuffer
                                    , 0      // nOutBufferSize
                                    , &cbProps
                                    );
                    break;
                } // case:

                default:
                    ASSERT( 0 );

            } // switch: object type

            //
            //  Handle errors.
            //

            if ( sc != ERROR_SUCCESS )
            {
                if ( sc == ERROR_INVALID_PARAMETER )
                {
                    if ( ! fNoNewPropsIn )
                    {
                        fSuccess = BSetPrivateProps( fValidateOnlyIn, TRUE /*fNoNewPropsIn*/ );
                    } // if: new props are allowed
                    else
                        fSuccess = FALSE;
                } // if: invalid parameter error occurred
                else
                {
                    fSuccess = FALSE;
                } // else: some other error occurred

                //
                // If an error occurred, display an error message.
                //

                if ( ! fSuccess )
                {
                    DisplaySetPropsError( sc, fValidateOnlyIn ? IDS_ERROR_VALIDATING_PROPERTIES : IDS_ERROR_SETTING_PROPERTIES );
                    if ( sc == ERROR_RESOURCE_PROPERTIES_STORED )
                    {
                        fSuccess = TRUE;
                    } // if: properties only stored
                } // if: error occurred
            } // if: error setting/validating data
        } // if: there is data to set
    } // if: no errors building the property list

    //
    //  Save data locally.
    //

    if ( ! fValidateOnlyIn && fSuccess )
    {
        //
        //  Save new values as previous values.
        //

        try
        {
            DWORD                   cprop;
            const CObjectProperty * pprop;

            for ( pprop = Pprops(), cprop = Cprops() ; cprop > 0 ; pprop++, cprop-- )
            {
                switch ( pprop->m_propFormat )
                {
                    case CLUSPROP_FORMAT_SZ:
                    case CLUSPROP_FORMAT_EXPAND_SZ:
                        ASSERT(pprop->m_value.pstr != NULL);
                        ASSERT(pprop->m_valuePrev.pstr != NULL);
                        *pprop->m_valuePrev.pstr = *pprop->m_value.pstr;
                        break;

                    case CLUSPROP_FORMAT_DWORD:
                    case CLUSPROP_FORMAT_LONG:
                        ASSERT( pprop->m_value.pdw != NULL );
                        ASSERT( pprop->m_valuePrev.pdw != NULL );
                        *pprop->m_valuePrev.pdw = *pprop->m_value.pdw;
                        break;

                    case CLUSPROP_FORMAT_BINARY:
                    case CLUSPROP_FORMAT_MULTI_SZ:
                        ASSERT( pprop->m_value.ppb != NULL );
                        ASSERT( *pprop->m_value.ppb != NULL );
                        ASSERT( pprop->m_value.pcb != NULL );
                        ASSERT( pprop->m_valuePrev.ppb != NULL );
                        ASSERT( *pprop->m_valuePrev.ppb != NULL );
                        ASSERT( pprop->m_valuePrev.pcb != NULL );
                        delete [] *pprop->m_valuePrev.ppb;
                        *pprop->m_valuePrev.ppb = new BYTE[ *pprop->m_value.pcb ];
                        CopyMemory( *pprop->m_valuePrev.ppb, *pprop->m_value.ppb, *pprop->m_value.pcb );
                        *pprop->m_valuePrev.pcb = *pprop->m_value.pcb;
                        break;

                    default:
                        ASSERT( 0 ); // don't know how to deal with this type

                } // switch: property format
            } // for: each property
        } // try
        catch ( CException * pe )
        {
            pe->ReportError();
            pe->Delete();
            fSuccess = FALSE;
        } // catch: CException
    } // if: not just validating and successful so far

    //
    // Indicate we successfully saved the properties.
    //

    if ( ! fValidateOnlyIn && fSuccess )
    {
        m_bSaved = TRUE;
    } // if: successfully saved data

    return fSuccess;

} //*** CBasePropertyPage::BSetPrivateProps
Ejemplo n.º 6
0
void
LoginDialog::onAuthenticated( WsReply* reply )
{
	switch (reply->error())
    {
        case Ws::NoError:
        {
            try
            {
                WsDomElement session = reply->lfm()["session"];
                
                // replace username; because eg. perhaps the user typed their
                // username with the wrong camel case
                QString username = session.optional( "name" ).text();
                if (username.size())
                    m_username = username;
                
                m_sessionKey = session["key"].nonEmptyText();
                m_subscriber = session["subscriber"].text() != "0";
                accept();
				
			#ifdef Q_WS_MAC
				ui.text->setText( "<b>Authentication successful" );
			#endif
                break;
            }
            catch (std::runtime_error& e)
            {
                qWarning() << e.what();
            }
			
            // FALL THROUGH!
        }
			
        case Ws::AuthenticationFailed:
            // COPYTODO
            QMessageBoxBuilder( this )
					.setIcon( QMessageBox::Critical )
					.setTitle( tr("Login Failed") )
					.setText( tr("Sorry, we don't recognise that username, or you typed the password wrongly.") )
					.exec();
            break;
			
        default:
            // COPYTODO
            QMessageBoxBuilder( this )
					.setIcon( QMessageBox::Critical )
					.setTitle( tr("Last.fm Unavailable") )
					.setText( tr("There was a problem communicating with the Last.fm services. Please try again later.") )
					.exec();
            break;
			
        case Ws::UrProxyIsFuckedLol:
        case Ws::UrLocalNetworkIsFuckedLol:
            // TODO proxy prompting?
            // COPYTODO
            QMessageBoxBuilder( this )
					.setIcon( QMessageBox::Critical )
					.setTitle( tr("Cannot connect to Last.fm") )
					.setText( tr("Last.fm cannot be reached. Please check your firewall or proxy settings.") )
					.exec();
        #ifdef WIN32
            // show Internet Settings Control Panel
            HMODULE h = LoadLibraryA( "InetCpl.cpl" );
            if (!h) break;
			BOOL (WINAPI *cpl)(HWND) = (BOOL (WINAPI *)(HWND)) GetProcAddress( h, "LaunchConnectionDialog" );
            if (cpl) cpl( winId() );
            FreeLibrary( h );
        #endif
            break;
    }
    
    
#ifdef Q_WS_MAC
	ui.transient->hide();
#else
    // do last, otherwise it looks weird
    ui.retranslateUi( this ); //resets Window title
    ok()->setEnabled( true );
    ui.spinner->hide();
#endif
}