void
unicorn::Application::init()
{
#ifdef Q_OS_MAC
    addLibraryPath( applicationDirPath() + "/../plugins" );
#elif defined Q_OS_WIN
    addLibraryPath( applicationDirPath() + "/plugins" );
#endif

#ifdef Q_WS_MAC
    qt_mac_set_menubar_icons( false );
#endif

    CoreApplication::init();

    setupHotKeys();

#ifdef __APPLE__
    setGetURLEventHandler();
    AEEventHandlerUPP urlHandler = NewAEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( kInternetEventClass, kAEGetURL, urlHandler, 0, false );

    setOpenApplicationEventHandler();
    AEEventHandlerUPP openHandler = NewAEEventHandlerUPP( appleEventHandler );
    AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, openHandler, 0, false );
#endif

#ifdef Q_WS_MAC
#define CSS_PATH "/../Resources/"
#else
#define CSS_PATH "/"
#endif

    refreshStyleSheet();

    translate();

    m_icm = new lastfm::InternetConnectionMonitor( this );

    connect( m_icm, SIGNAL( up( QString ) ), this, SIGNAL( internetConnectionUp() ) );
    connect( m_icm, SIGNAL( down( QString ) ), this, SIGNAL( internetConnectionDown() ) );

    connect( &m_bus, SIGNAL( wizardRunningQuery( QString )), SLOT( onWizardRunningQuery( QString )));
    connect( &m_bus, SIGNAL( sessionQuery( QString )), SLOT( onBusSessionQuery( QString )));
    connect( &m_bus, SIGNAL( sessionChanged( const QMap<QString, QString>& )), SLOT( onBusSessionChanged( const QMap<QString, QString>& )));
    connect( &m_bus, SIGNAL( lovedStateChanged(bool)), SIGNAL( busLovedStateChanged(bool)));

    m_bus.board();

#ifdef __APPLE__
    setQuitOnLastWindowClosed( false );
#endif
}
Session::Session( const QString& username, QString sessionKey )
{
    init( username, sessionKey );
    connect( qApp, SIGNAL( internetConnectionUp() ), SLOT( fetchInfo() ) );
}