Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
nsBeOSApp Class Reference

List of all members.

Public Member Functions

 nsBeOSApp (sem_id sem)
 ~nsBeOSApp ()
void ReadyToRun ()
void ArgvReceived (int32 argc, char **argv)
void RefsReceived (BMessage *msg)
void MessageReceived (BMessage *msg)
 nsBeOSApp (sem_id sem)
void ReadyToRun (void)
 nsBeOSApp (sem_id sem)
 ~nsBeOSApp ()
void ReadyToRun ()
void ArgvReceived (int32 argc, char **argv)
void RefsReceived (BMessage *msg)
void MessageReceived (BMessage *msg)
char * GetAppSig ()
char * GetAppFile ()

Static Public Member Functions

static int32 Main (void *args)
static int32 Main (void *args)
static int32 Main (void *args)

Private Member Functions

char * GetAppSig ()
char * GetAppFile ()

Private Attributes

sem_id init
BMessage * mMessage
bool appEnabled
nsVoidArray mMessage

Detailed Description

Definition at line 113 of file nsNativeAppSupportBeOS.cpp.


Constructor & Destructor Documentation

nsBeOSApp::nsBeOSApp ( sem_id  sem) [inline]

Definition at line 116 of file nsNativeAppSupportBeOS.cpp.

                          : BApplication( GetAppSig() ), init(sem), mMessage(NULL)
    {}

Here is the caller graph for this function:

nsBeOSApp::~nsBeOSApp ( ) [inline]

Definition at line 119 of file nsNativeAppSupportBeOS.cpp.

       {
        delete mMessage;
       }
nsBeOSApp::nsBeOSApp ( sem_id  sem) [inline]

Definition at line 120 of file nsBeOSMain.cpp.

    : BApplication("application/x-vnd.mozilla.viewer"), init(sem) { }
nsBeOSApp::nsBeOSApp ( sem_id  sem) [inline]

Definition at line 148 of file nsNativeAppSupportBeOS.cpp.

                             : BApplication(GetAppSig()), init(sem),
                                                 appEnabled(false), mMessage(0)
       {}
nsBeOSApp::~nsBeOSApp ( ) [inline]

Definition at line 152 of file nsNativeAppSupportBeOS.cpp.

       {
              mMessage.Clear();
       }

Member Function Documentation

void nsBeOSApp::ArgvReceived ( int32  argc,
char **  argv 
) [inline]

Definition at line 137 of file nsNativeAppSupportBeOS.cpp.

    {
        if (IsLaunching())
        {
#ifdef DC_PROGRAMNAME
                     TRACE("ArgvReceived Launching\n");
#endif
                     return;
        }
        PRInt32 aState = /*IsLaunching() ?
                         nsICommandLine::STATE_INITIAL_LAUNCH :*/
                         nsICommandLine::STATE_REMOTE_AUTO;
        nsNativeAppSupportBeOS::HandleCommandLine(argc, argv, aState);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBeOSApp::ArgvReceived ( int32  argc,
char **  argv 
) [inline]

Definition at line 170 of file nsNativeAppSupportBeOS.cpp.

Here is the call graph for this function:

char* nsBeOSApp::GetAppFile ( ) [inline, private]

Definition at line 224 of file nsNativeAppSupportBeOS.cpp.

    {
        image_info info;
        int32 cookie = 0;
        if (get_next_image_info(0, &cookie, &info) == B_OK && strlen(info.name) > 0)
            return info.name;
        
        return "";
    }

Here is the caller graph for this function:

char* nsBeOSApp::GetAppFile ( ) [inline]

Definition at line 254 of file nsNativeAppSupportBeOS.cpp.

       {
              image_info info;
              int32 cookie = 0;
              if (get_next_image_info(0, &cookie, &info) == B_OK && strlen(info.name) > 0)
                     return info.name;
              return "./seamonkey-bin";
       }
char* nsBeOSApp::GetAppSig ( ) [inline, private]

Definition at line 206 of file nsNativeAppSupportBeOS.cpp.

    {
        image_info info;
        int32 cookie = 0;
        BFile file;
        BAppFileInfo appFileInfo;
        static char sig[B_MIME_TYPE_LENGTH];

        sig[0] = 0;
        if (get_next_image_info(0, &cookie, &info) == B_OK &&
            file.SetTo(info.name, B_READ_ONLY) == B_OK &&
            appFileInfo.SetTo(&file) == B_OK &&
            appFileInfo.GetSignature(sig) == B_OK)
            return sig;

        return "application/x-vnd.Mozilla";
    }
char* nsBeOSApp::GetAppSig ( ) [inline]

Definition at line 235 of file nsNativeAppSupportBeOS.cpp.

       {
              image_info info;
              int32 cookie = 0;
              BFile file;
              BAppFileInfo appFileInfo;
              static char sig[B_MIME_TYPE_LENGTH];

              sig[0] = 0;
              if (get_next_image_info(0, &cookie, &info) == B_OK &&
                     file.SetTo(info.name, B_READ_ONLY) == B_OK &&
                     appFileInfo.SetTo(&file) == B_OK &&
                     appFileInfo.GetSignature(sig) == B_OK)
              {
                     return sig;
              }
              return "application/x-vnd.Mozilla-SeaMonkey";
       }
static int32 nsBeOSApp::Main ( void args) [inline, static]

Definition at line 127 of file nsBeOSMain.cpp.

                                     {
              nsBeOSApp *app = new nsBeOSApp((sem_id)args);
              if (!app)
                     return B_ERROR;
              return app->Run();
       }

Here is the call graph for this function:

static int32 nsBeOSApp::Main ( void args) [inline, static]

Definition at line 129 of file nsNativeAppSupportBeOS.cpp.

    {
        nsBeOSApp *app = new nsBeOSApp((sem_id)args);
        if (app == NULL)
            return B_ERROR;
        return app->Run();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static int32 nsBeOSApp::Main ( void args) [inline, static]

Definition at line 162 of file nsNativeAppSupportBeOS.cpp.

       {
              nsBeOSApp *app = new nsBeOSApp((sem_id)args);
              if (app == NULL)
                     return B_ERROR;
              return app->Run();
       }

Here is the call graph for this function:

void nsBeOSApp::MessageReceived ( BMessage *  msg) [inline]

Definition at line 185 of file nsNativeAppSupportBeOS.cpp.

    {
        // BMessage from nsNativeAppBeOS::Enable() received.
        // Services are ready, so we can supply stored refs
        if (msg->what == 'enbl' && mMessage)
        {
#ifdef DC_PROGRAMNAME
            TRACE("enbl received");
#endif
            be_app_messenger.SendMessage(mMessage);
        }
        // Processing here file drop events from BWindow
        // - until we implement native DnD in widget.
        else if (msg->what == B_SIMPLE_DATA)
        {
            RefsReceived(msg);
        }
        else
            BApplication::MessageReceived(msg);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBeOSApp::MessageReceived ( BMessage *  msg) [inline]

Definition at line 209 of file nsNativeAppSupportBeOS.cpp.

       {
              if (msg->what == 'enbl' && !appEnabled)
              {
#ifdef DC_PROGRAMNAME
                     TRACE("mMessage!");
#endif
                     appEnabled = true;
              }
              
              if (appEnabled && mMessage.Count())
              {
                     for (int i = 0; i < mMessage.Count(); i++)
                     {
                            be_app_messenger.SendMessage((BMessage *)mMessage.SafeElementAt(i));
                     }
                     mMessage.Clear();
              }
              
              if (msg->what == B_SIMPLE_DATA && appEnabled)
              {
                     RefsReceived(msg);
              }
              BApplication::MessageReceived(msg);
       }

Here is the call graph for this function:

Definition at line 123 of file nsBeOSMain.cpp.

                             {
              release_sem(init);
       }

Definition at line 124 of file nsNativeAppSupportBeOS.cpp.

    {
        release_sem(init);
    }

Definition at line 157 of file nsNativeAppSupportBeOS.cpp.

       {
              release_sem(init);
       }
void nsBeOSApp::RefsReceived ( BMessage *  msg) [inline]

Definition at line 152 of file nsNativeAppSupportBeOS.cpp.

    {
#ifdef DC_PROGRAMNAME
        TRACE("RefsReceived\n");
#endif
        if (IsLaunching())
        {
           mMessage = new BMessage(*msg);
           return;
        }
        BPath path;
        entry_ref er;
        for (uint32 i = 0; msg->FindRef("refs", i, &er) == B_OK; i++)
        {
            int Argc = 2;
            char **Argv = new char*[ 3 ];
            BEntry entry(&er, true);
            BEntry fentry(GetAppFile(), false);
            entry.GetPath(&path);
            
            Argv[0] = strdup( GetAppFile() ? GetAppFile() : "" );
            Argv[1] = strdup( path.Path() ? path.Path() : "" );
            // Safety measure
            Argv[2] = 0;
            // Is started, call ArgReceived, delete mArgv, else store for future usage
            // after ::Enable() was called
            ArgvReceived(2, Argv);
            Argc = 0;
            delete [] Argv;
            Argv = NULL;
        } 
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsBeOSApp::RefsReceived ( BMessage *  msg) [inline]

Definition at line 176 of file nsNativeAppSupportBeOS.cpp.

       {
              // If UI is started, call ArgReceived, else store for future usage.
              // appEnabled is set to true after ::HideSplash() was called
              if (!appEnabled)
              {
#ifdef DC_PROGRAMNAME
                     TRACE("Refs at Launch!");
#endif
                     mMessage.InsertElementAt((void *)new BMessage(*msg), mMessage.Count());
                     return;
              }

              entry_ref er;
              BPath path;   
              for (uint32 i = 0; msg->FindRef("refs", i, &er) == B_OK; i++)
              {
                     int Argc = 2;
                     char **Argv = new char*[ 3 ];
                     BEntry entry(&er, true);
                     BEntry fentry(GetAppFile(), false);
                     entry.GetPath(&path);
                     Argv[0] = strdup( GetAppFile() ? GetAppFile() : "" );
                     Argv[1] = strdup( path.Path() ? path.Path() : "" );
                     // Safety measure
                     Argv[2] = 0;
                     ArgvReceived(Argc, Argv);
                     Argc = 0;
                     delete [] Argv;
                     Argv = NULL;
              } 
       }

Here is the call graph for this function:


Member Data Documentation

Definition at line 265 of file nsNativeAppSupportBeOS.cpp.

sem_id nsBeOSApp::init [private]

Definition at line 234 of file nsNativeAppSupportBeOS.cpp.

BMessage* nsBeOSApp::mMessage [private]

Definition at line 235 of file nsNativeAppSupportBeOS.cpp.

Definition at line 266 of file nsNativeAppSupportBeOS.cpp.


The documentation for this class was generated from the following files: