зеркало из https://github.com/mozilla/gecko-dev.git
First pass at DataCollection Manager
This commit is contained in:
Родитель
a734285ba0
Коммит
316e43f0bc
|
@ -1071,7 +1071,7 @@ CAPIStatus CAPI_StoreEvent(
|
|||
FILE *pFile;
|
||||
PCAPISESSION *pSession = (PCAPISESSION*)s;
|
||||
PCAPIHANDLE* pHandle;
|
||||
PCAPIStream* pStream = (PCAPIStream*)str;
|
||||
PCAPIStream* pStream = (PCAPIStream*)(*(void **)str);
|
||||
NSCalendar *pCal = 0;
|
||||
char* pBuf = 0;
|
||||
size_t iBufSize = BUFSIZ;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "prprty.h"
|
||||
#include "jlog.h"
|
||||
#include "datetime.h"
|
||||
#include "nscalcoreicalexp.h"
|
||||
|
||||
/**
|
||||
* The Attendee class encapsulates the data in the iCalendar
|
||||
|
@ -38,7 +39,7 @@
|
|||
* are stored as t_int32. Other parameters are stored as UnicodeStrings
|
||||
* or as JulianPtrArray's of UnicodeStrings.
|
||||
*/
|
||||
class Attendee : public ICalProperty
|
||||
class NS_CAL_CORE_ICAL Attendee : public ICalProperty
|
||||
{
|
||||
private:
|
||||
|
||||
|
|
|
@ -58,6 +58,9 @@ public:
|
|||
DateTime* aStop,
|
||||
JulianPtrArray* anArray
|
||||
);
|
||||
|
||||
NS_IMETHOD StoreEvent(VEvent& addEvent);
|
||||
|
||||
private:
|
||||
nsresult FetchEventsByRange();
|
||||
};
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
DateTime* aStart,
|
||||
DateTime* aStop, JulianPtrArray* aL
|
||||
);
|
||||
|
||||
NS_IMETHOD StoreEvent(VEvent& addEvent);
|
||||
private:
|
||||
nsIVector * mLayers ;
|
||||
nsCalendarShell * mpShell;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "jdefines.h"
|
||||
#include "julnstr.h"
|
||||
#include "VEvent.h"
|
||||
|
||||
//5482d0d0-4cca-11d2-924a-00805f8a7ab6
|
||||
#define NS_ILAYER_IID \
|
||||
|
@ -75,6 +76,14 @@ public:
|
|||
DateTime* aStop,
|
||||
JulianPtrArray* anArray
|
||||
) = 0;
|
||||
|
||||
/**
|
||||
* Save an event in this layer
|
||||
* @param addEvent the new event to save
|
||||
* @return NS_OK on success
|
||||
*/
|
||||
NS_IMETHOD StoreEvent(VEvent& addEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ nsresult nsLayer::FetchEventsByRange(
|
|||
0);
|
||||
|
||||
capiStatus = pCapi->CAPI_SetStreamCallbacks(
|
||||
pSession->m_Session, &RcvStream, 0,0,RcvData, pCalStreamReader,0);
|
||||
pSession->m_Session, &RcvStream, 0,0 ,RcvData, pCalStreamReader,0);
|
||||
|
||||
if (CAPI_ERR_OK != capiStatus)
|
||||
return 1; /* XXX: really need to fix this up */
|
||||
|
@ -411,7 +411,118 @@ nsresult nsLayer::FetchEventsByRange(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Send data to CAPI. This is invoked on calls such as CAPI_StoreEvent.
|
||||
*/
|
||||
int SndData(void* pData, char* pBuf, size_t iSize, size_t *piTransferred)
|
||||
{
|
||||
nsCapiBufferStruct* pCtx = (nsCapiBufferStruct*)pData;
|
||||
*piTransferred = (pCtx->m_pBufSize > iSize) ? iSize : pCtx->m_pBufSize;
|
||||
memcpy(pBuf,pCtx->m_pBuf,*piTransferred);
|
||||
pCtx->m_pBufSize -= *piTransferred;
|
||||
pCtx->m_pBuf += *piTransferred;
|
||||
return pCtx->m_pBufSize > 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save this event
|
||||
* @return NS_OK on success.
|
||||
*/
|
||||
nsresult
|
||||
nsLayer::StoreEvent(VEvent& addEvent)
|
||||
{
|
||||
ErrorCode status = ZERO_ERROR;
|
||||
PRThread * mainThread = 0;
|
||||
CAPIStream SndStream = 0;
|
||||
CAPIStatus capiStatus;
|
||||
PRMonitor * pCBReaderMonitor = 0; // destroyed
|
||||
PRMonitor *pThreadMonitor = 0; // destroyed
|
||||
|
||||
/*
|
||||
* Select the capi interface to use for this operation...
|
||||
* Each layer stores its curl, ask for a session based on
|
||||
* the curl...
|
||||
*/
|
||||
nsICapi* pCapi = 0;
|
||||
nsCalSession *pSession;
|
||||
nsCurlParser curl(msCurl);
|
||||
if (NS_OK == (mpShell->mSessionMgr.GetSession(msCurl, 0, curl.GetPassword().GetBuffer(), pSession)))
|
||||
{
|
||||
if (0 != pSession)
|
||||
{
|
||||
pCapi = pSession->mCapi;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ASSERTION(1,"Could not get a session");
|
||||
pCapi = mpShell->mSessionMgr.GetAt(0L)->mCapi; // should comment this
|
||||
}
|
||||
|
||||
/*
|
||||
* The data is actually read and parsed in another thread. Set it all
|
||||
* up here...
|
||||
*/
|
||||
#if 0
|
||||
mainThread = PR_CurrentThread();
|
||||
pCBReaderMonitor = PR_NewMonitor(); // destroyed
|
||||
nsCapiCallbackReader * capiReader = new nsCapiCallbackReader(pCBReaderMonitor);
|
||||
pThreadMonitor = ::PR_NewMonitor(); // destroyed
|
||||
PR_EnterMonitor(pThreadMonitor);
|
||||
parseThread = PR_CreateThread(PR_USER_THREAD,
|
||||
main_CalStreamReader,
|
||||
pCalStreamReader,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_LOCAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
|
||||
capiStatus = pCapi->CAPI_SetStreamCallbacks(
|
||||
pSession->m_Session, &RcvStream, 0, 0, RcvData, pCalStreamReader,0);
|
||||
#else
|
||||
UnicodeString thisEvent;
|
||||
nsCapiBufferStruct sBuf;
|
||||
|
||||
thisEvent = "Content-type: text/calendar\nContent-encoding: 7bit\n\nBEGIN:VCALENDAR\n";
|
||||
thisEvent += "METHOD: PUBLISH\n";
|
||||
thisEvent += addEvent.toICALString();
|
||||
thisEvent += "END:VCALENDAR\n";
|
||||
|
||||
sBuf.m_pBuf = thisEvent.toCString("");
|
||||
sBuf.m_pBufSize = strlen(sBuf.m_pBuf);
|
||||
capiStatus = pCapi->CAPI_SetStreamCallbacks(pSession->m_Session, &SndStream, &SndData, (void *)&sBuf, nsnull, nsnull, 0);
|
||||
|
||||
nsCurlParser sessionURL(msCurl);
|
||||
char** asList = gasViewPropList;
|
||||
int iListSize = giViewPropListCount;
|
||||
|
||||
if (nsCurlParser::eCAPI == sessionURL.GetProtocol())
|
||||
{
|
||||
asList = 0;
|
||||
iListSize = 0;
|
||||
}
|
||||
|
||||
CAPIHandle h = 0;
|
||||
JulianString sHandle(sessionURL.GetCSID());
|
||||
|
||||
/*
|
||||
* The handle name may be a file name. We need to make sure that
|
||||
* the characters are in URL form. That is "C|/bla" instead of
|
||||
* "C:/bla"
|
||||
*/
|
||||
nsCurlParser::ConvertToURLFileChars(sHandle);
|
||||
capiStatus = pCapi->CAPI_GetHandle( pSession->m_Session, sHandle.GetBuffer(), 0, &h);
|
||||
if (0 != capiStatus)
|
||||
return 1; /* XXX really need to fix this */
|
||||
|
||||
if ( CAPI_ERR_OK != (pCapi->CAPI_StoreEvent( pSession->m_Session, &h, 1, 0, &SndStream)))
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
if (CAPI_ERR_OK != capiStatus)
|
||||
return 1; /* XXX: really need to fix this up */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -410,4 +410,35 @@ nsresult nsLayerCollection::SetShell(nsCalendarShell* aShell)
|
|||
pLayer->SetShell(aShell);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aStart Starting time for fetch
|
||||
* @param aStart ending time for fetch
|
||||
* @param anArray Match a returned boolean value. If a match is found this value
|
||||
* is returned as PR_TRUE. Otherwise, the it is set to PR_FALSE.
|
||||
*
|
||||
* @return NS_OK on success
|
||||
*/
|
||||
nsresult nsLayerCollection::StoreEvent(VEvent& addEvent)
|
||||
{
|
||||
PRInt32 i,j;
|
||||
PRInt32 iSize = mLayers->Count();
|
||||
PRInt32 iTmpSize;
|
||||
nsILayer *pLayer;
|
||||
JulianPtrArray TmpArray;
|
||||
|
||||
/*
|
||||
* XXX:
|
||||
* This should be made multi-threaded...
|
||||
*/
|
||||
for ( i = 0; i < iSize; i++)
|
||||
{
|
||||
pLayer = (nsILayer*)mLayers->ElementAt(i);
|
||||
if (NS_OK == (pLayer->StoreEvent(addEvent)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ public:
|
|||
NS_IMETHOD SetCAPIPassword(char * aPassword) ;
|
||||
NS_IMETHOD_(char *) GetCAPIPassword() ;
|
||||
|
||||
NS_IMETHOD GetLoggedInUser(nsICalendarUser** LoggInUser);
|
||||
|
||||
// nsIAppShell interfaces
|
||||
NS_IMETHOD Create(int* argc, char ** argv) ;
|
||||
NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener) ;
|
||||
|
@ -81,6 +83,9 @@ public:
|
|||
virtual nsresult Run();
|
||||
virtual void* GetNativeData(PRUint32 aDataType) ;
|
||||
|
||||
NS_IMETHOD ReceiveCallback(nsICollectedData& aReply);
|
||||
NS_IMETHOD CreateEventFunc(nsICollectedData& cdp);
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) ;
|
||||
NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) ;
|
||||
|
||||
|
|
|
@ -22,10 +22,13 @@
|
|||
#include "nsIApplicationShell.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsICalendarUser.h"
|
||||
|
||||
#include "capi.h"
|
||||
#include "nscal.h"
|
||||
|
||||
class nsICollectedData;
|
||||
|
||||
//fe35e400-ea8d-11d1-9244-00805f8a7ab6
|
||||
#define NS_ICAL_SHELL_IID \
|
||||
{ 0xfe35e400, 0xea8d, 0x11d1, \
|
||||
|
@ -55,8 +58,12 @@ public:
|
|||
NS_IMETHOD SetCAPIPassword(char * aPassword) = 0;
|
||||
NS_IMETHOD_(char *) GetCAPIPassword() = 0;
|
||||
|
||||
NS_IMETHOD ReceiveCallback(nsICollectedData& aReply) = 0;
|
||||
|
||||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) = 0 ;
|
||||
|
||||
NS_IMETHOD GetLoggedInUser(nsICalendarUser** LoggInUser) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsICalendarShell_h___ */
|
||||
|
|
|
@ -43,9 +43,14 @@
|
|||
#include "nsXPFCToolkit.h"
|
||||
#include "nsX400Parser.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsIXPFCDataCollectionManager.h"
|
||||
#include "nscalcids.h"
|
||||
|
||||
#include "capi.h"
|
||||
#include "nsICapi.h"
|
||||
#include "uidrgntr.h"
|
||||
#include "attendee.h"
|
||||
|
||||
#include "nsxpfcstrings.h"
|
||||
#include "nsCoreCIID.h"
|
||||
#include "nsLayer.h"
|
||||
|
@ -221,6 +226,122 @@ nsresult nsCalendarShell::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
NS_IMPL_ADDREF(nsCalendarShell)
|
||||
NS_IMPL_RELEASE(nsCalendarShell)
|
||||
|
||||
// eyork temp place for this
|
||||
static NS_DEFINE_IID(kCCalShell, NS_CAL_SHELL_CID);
|
||||
|
||||
nsresult nsCalendarShell::ReceiveCallback(nsICollectedData& aReply)
|
||||
{
|
||||
|
||||
CreateEventFunc(aReply);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCalendarShell::CreateEventFunc(nsICollectedData& cdp)
|
||||
{
|
||||
#define BUF_SIZE 2048
|
||||
char temp[BUF_SIZE];
|
||||
Attendee *aAttendee = nsnull;
|
||||
VEvent ev;
|
||||
nsString StringValue;
|
||||
nsString StringLabel;
|
||||
nsICalendarUser* CalUser = nsnull;
|
||||
|
||||
ev.setDTStamp(DateTime()); // Default DataTime is now
|
||||
ev.setUID(nsCalUIDRandomGenerator::generate());
|
||||
|
||||
StringLabel = nsString("ReqiEditableUserFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
StringValue.ToCString(temp, BUF_SIZE); ev.setOrganizer(UnicodeString(temp));
|
||||
|
||||
StringLabel = nsString("ComposeArea");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
StringValue.ToCString(temp, BUF_SIZE); ev.setDescription(UnicodeString(temp));
|
||||
|
||||
StringLabel = nsString("SubjectEditableTimeFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
StringValue.ToCString(temp, BUF_SIZE); ev.setSummary(UnicodeString(temp));
|
||||
|
||||
StringLabel = nsString("StartEditableTimeFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
ev.setDTStart(DateTime((UnicodeString(StringValue.ToCString(temp, BUF_SIZE)))));
|
||||
|
||||
StringLabel = nsString("EndEditableTimeFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
ev.setDTEnd(DateTime((UnicodeString(StringValue.ToCString(temp, BUF_SIZE)))));
|
||||
|
||||
PRInt32 index = 0;
|
||||
int16 my_space = 0x0020;
|
||||
|
||||
StringLabel = nsString("ReqsEditableUserFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
|
||||
while (index < StringValue.Length())
|
||||
{
|
||||
nsString CurrentAttendee;
|
||||
|
||||
while (index < StringValue.Length())
|
||||
{
|
||||
if (StringValue[index] != my_space)
|
||||
CurrentAttendee += StringValue[index++];
|
||||
else {
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aAttendee = new Attendee(ICalComponent::ICAL_COMPONENT_VEVENT);
|
||||
if (aAttendee)
|
||||
{
|
||||
aAttendee->setName(UnicodeString(CurrentAttendee.ToCString(temp, BUF_SIZE)));
|
||||
aAttendee->setRole(Attendee::ROLE_REQ_PARTICIPANT);
|
||||
ev.addAttendee(aAttendee);
|
||||
}
|
||||
}
|
||||
|
||||
index = 0;
|
||||
StringLabel = nsString("OptEditableUserFields");
|
||||
cdp.FindValueInCollectedData(StringLabel, StringValue);
|
||||
|
||||
while (index < StringValue.Length())
|
||||
{
|
||||
nsString CurrentAttendee;
|
||||
|
||||
while (index < StringValue.Length())
|
||||
{
|
||||
if (StringValue[index] != my_space)
|
||||
CurrentAttendee += StringValue[index++];
|
||||
else {
|
||||
index++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aAttendee = new Attendee(ICalComponent::ICAL_COMPONENT_VEVENT);
|
||||
if (aAttendee)
|
||||
{
|
||||
aAttendee->setName(UnicodeString(CurrentAttendee.ToCString(temp, BUF_SIZE)));
|
||||
aAttendee->setRole(Attendee::ROLE_OPT_PARTICIPANT);
|
||||
ev.addAttendee(aAttendee);
|
||||
}
|
||||
}
|
||||
|
||||
Logon();
|
||||
GetLoggedInUser(&CalUser);
|
||||
if (CalUser)
|
||||
{
|
||||
nsILayer* aLayer = nsnull;
|
||||
|
||||
CalUser->GetLayer(aLayer);
|
||||
|
||||
if (aLayer)
|
||||
{
|
||||
aLayer->StoreEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCalendarShell::Init()
|
||||
{
|
||||
/*
|
||||
|
@ -262,6 +383,17 @@ nsresult nsCalendarShell::Init()
|
|||
*/
|
||||
LoadUI();
|
||||
|
||||
/*
|
||||
* Register the DataCollection Funciotn CreateEvent
|
||||
*/
|
||||
nsIXPFCDataCollectionManager *theMan = mShellInstance->GetDataCollectionManager();
|
||||
if (theMan)
|
||||
{
|
||||
nsString ce = nsString("CreateEvent");
|
||||
// theMan->AddDataCollection(ce, (DataCollectionHandlerFunc *)CreateEventFunc);
|
||||
theMan->AddDataCollection(ce, this);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -328,6 +460,12 @@ nsresult nsCalendarShell::ParseCommandLine()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsCalendarShell::GetLoggedInUser(nsICalendarUser** LoggInUser)
|
||||
{
|
||||
*LoggInUser = mpLoggedInUser;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method establishes a logged in user and opens a connection to
|
||||
* the calendar server (or local database file if they're working offline).
|
||||
|
@ -1079,7 +1217,6 @@ extern "C" int XP_ReBuffer (const char *net_buffer, int32 net_buffer_size,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* mozilla/include/xp_trace.h */
|
||||
|
||||
#if defined(NS_DEBUG)
|
||||
|
@ -1201,3 +1338,4 @@ nsresult nsCalendarShell :: SendCommand(nsString& aCommand, nsString& aReply)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ public:
|
|||
NS_IMETHOD_(nsEventStatus) HandleEvent(nsGUIEvent *aEvent) ;
|
||||
NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) ;
|
||||
NS_IMETHOD StartCommandServer();
|
||||
|
||||
NS_IMETHOD ReceiveCallback(nsICollectedData& aReply);
|
||||
NS_IMETHOD SendCommand(nsString& aCommand);
|
||||
NS_IMETHOD ExecuteJS();
|
||||
|
||||
|
|
|
@ -745,7 +745,6 @@ nsresult nsTrexTestShell::ReceiveCommand(nsString& aCommand, nsString& aReply)
|
|||
delete c;
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -930,6 +929,12 @@ nsresult nsTrexTestShell::StartCommandServer()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
class nsICollectedData;
|
||||
nsresult nsTrexTestShell::ReceiveCallback(nsICollectedData& aReply)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
PR_STATIC_CALLBACK(JSBool) Zulu(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
|
@ -1136,4 +1141,3 @@ nsresult nsTrexTestShell::OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsS
|
|||
SendJS(mJSData);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,17 +43,17 @@
|
|||
<!-- This is the Dialog User Selection -->
|
||||
<canvas name="UserSelection" layout="xbox" height="66">
|
||||
|
||||
<canvas layout="ybox" name="StaticUserFields" width="50">
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqiStaticUserFields" label="From:" height="22" weightmajor="0" weightminor="0"/>
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqsStaticUserFields" label="Req:" height="22" weightmajor="0" weightminor="0" />
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="OptStaticUserFields" label="Opt:" height="22" weightmajor="0" weightminor="0" />
|
||||
</canvas>
|
||||
<canvas layout="ybox" name="StaticUserFields" width="50">
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqiStaticUserFields" label="From:" height="22" weightmajor="0" weightminor="0"/>
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="ReqsStaticUserFields" label="Req:" height="22" weightmajor="0" weightminor="0" />
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="OptStaticUserFields" label="Opt:" height="22" weightmajor="0" weightminor="0" />
|
||||
</canvas>
|
||||
|
||||
<canvas layout="ybox" backgroundcolor="#FFFFFF" name="EditableUserFields">
|
||||
<canvas layout="ybox" backgroundcolor="#FFFFFF" name="EditableUserFields">
|
||||
|
||||
<editfield keyboardfocus="true" tabid="1" backgroundcolor="#FFFFFF" name="ReqiEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
<editfield tabid="2" backgroundcolor="#FFFFFF" name="ReqsEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
<editfield tabid="3" backgroundcolor="#FFFFFF" name="OptEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
<editfield keyboardfocus="true" tabid="1" backgroundcolor="#FFFFFF" name="ReqiEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
<editfield tabid="2" backgroundcolor="#FFFFFF" name="ReqsEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
<editfield tabid="3" backgroundcolor="#FFFFFF" name="OptEditableUserFields" height="22" label="" weightmajor="0" weightminor="0"/>
|
||||
|
||||
</canvas>
|
||||
</canvas>
|
||||
|
@ -61,12 +61,12 @@
|
|||
<!-- This is the Time Selection-->
|
||||
<canvas name="TimeSelection" layout="xbox" height="22">
|
||||
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="DateStaticTimeFields" label="When?" weightmajor="0"/>
|
||||
<editfield tabid="4" backgroundcolor="#FFFFFF" name="DateEditableTimeFields" label="" weightmajor="1"/>
|
||||
<!-- <editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="DateStaticTimeFields" label="When?" weightmajor="0"/> -->
|
||||
<!-- <editfield tabid="4" backgroundcolor="#FFFFFF" name="DateEditableTimeFields" label="" weightmajor="1"/> -->
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="StartStaticTimeFields" label="Start:" weightmajor="0"/>
|
||||
<editfield tabid="5" backgroundcolor="#FFFFFF" name="StartEditableTimeFields" label="" weightmajor="1"/>
|
||||
<editfield tabid="4" backgroundcolor="#FFFFFF" name="StartEditableTimeFields" label="" weightmajor="1"/>
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="EndStaticTimeFields" label="End:" weightmajor="0"/>
|
||||
<editfield tabid="6" backgroundcolor="#FFFFFF" name="EndEditableTimeFields" label="" weightmajor="1"/>
|
||||
<editfield tabid="5" backgroundcolor="#FFFFFF" name="EndEditableTimeFields" label="" weightmajor="1"/>
|
||||
|
||||
</canvas>
|
||||
|
||||
|
@ -74,11 +74,12 @@
|
|||
<canvas name="SubjectSelection" layout="xbox" height="22">
|
||||
|
||||
<editfield backgroundcolor="#448dc0" foregroundcolor="#FFFFFF" name="SubjectStaticTimeFields" label="Subject:" width="70" weightmajor="0"/>
|
||||
<editfield tabid="7" backgroundcolor="#FFFFFF" name="SubjectEditableTimeFields" label="" weightmajor="1"/>
|
||||
<editfield tabid="6" backgroundcolor="#FFFFFF" name="SubjectEditableTimeFields" label="" weightmajor="1"/>
|
||||
|
||||
</canvas>
|
||||
|
||||
<editfield tabid="8" backgroundcolor="#FFFFFF" name="ComposeArea" label="" />
|
||||
<xpbutton height="22" onaction="LoadUrl?resource://res/ui/julian_month_sum.cal?target=content" label="Month" weightmajor="0" weightminor="0"/>
|
||||
<editfield tabid="7" backgroundcolor="#FFFFFF" name="ComposeArea" label="" />
|
||||
|
||||
|
||||
</dialog>
|
||||
|
|
|
@ -47,7 +47,6 @@ nsCalUIDRandomGenerator::~nsCalUIDRandomGenerator()
|
|||
UnicodeString
|
||||
nsCalUIDRandomGenerator::generate(UnicodeString us)
|
||||
{
|
||||
#if 0
|
||||
char sBuf[10];
|
||||
UnicodeString u;
|
||||
DateTime d;
|
||||
|
@ -60,9 +59,6 @@ nsCalUIDRandomGenerator::generate(UnicodeString us)
|
|||
u += '-';
|
||||
u += us;
|
||||
return u;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsIView.h"
|
||||
#include "nsIModel.h"
|
||||
#include "nsIXPFCCommand.h"
|
||||
#include "nsXPFCDialogDataHandlerCommand.h"
|
||||
|
||||
CLASS_EXPORT_XPFC nsXPFCCanvas : public nsIXPFCCanvas,
|
||||
public nsIXPFCObserver,
|
||||
|
@ -299,6 +300,7 @@ private:
|
|||
PRUint32 mTabGroup;
|
||||
nsIModel * mModel;
|
||||
nsString mCommand;
|
||||
nsXPFCDialogDataHandlerCommand* mDataCommand;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nspr.h"
|
||||
#include "nsViewsCID.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsXPFCDialogDataHandlerCommand.h"
|
||||
#include "nsXPFCError.h"
|
||||
|
||||
#define DEFAULT_WIDTH 100
|
||||
|
@ -115,6 +116,7 @@ nsXPFCCanvas :: nsXPFCCanvas(nsISupports* outer) :
|
|||
|
||||
mView = nsnull;
|
||||
mModel = nsnull;
|
||||
mDataCommand = nsnull;
|
||||
|
||||
}
|
||||
|
||||
|
@ -215,10 +217,6 @@ nsXPFCCanvas::Internal::Release(void)
|
|||
return agg->mRefCnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
nsresult nsXPFCCanvas::AggregatedQueryInterface(const nsIID &aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
|
@ -609,7 +607,14 @@ nsresult nsXPFCCanvas :: SetParameter(nsString& aKey, nsString& aValue)
|
|||
|
||||
SetCommand(aValue);
|
||||
|
||||
}
|
||||
} else if (aKey.EqualsIgnoreCase(XPFC_STRING_ONACTION)) {
|
||||
mDataCommand = new nsXPFCDialogDataHandlerCommand();
|
||||
if (mDataCommand)
|
||||
{
|
||||
mDataCommand->Init(aValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check for tab#
|
||||
|
@ -1026,7 +1031,13 @@ nsEventStatus nsXPFCCanvas :: OnResize(nscoord aX, nscoord aY, nscoord aWidth, n
|
|||
|
||||
nsEventStatus nsXPFCCanvas :: OnLeftButtonDown(nsGUIEvent *aEvent)
|
||||
{
|
||||
return (DefaultProcessing(aEvent));
|
||||
// eyork Good place for this?
|
||||
if (mDataCommand)
|
||||
{
|
||||
ProcessCommand(mDataCommand);
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
} else
|
||||
return (DefaultProcessing(aEvent));
|
||||
}
|
||||
|
||||
nsEventStatus nsXPFCCanvas :: OnLeftButtonUp(nsGUIEvent *aEvent)
|
||||
|
@ -2104,15 +2115,12 @@ nsEventStatus nsXPFCCanvas::Action(nsIXPFCCommand * aCommand)
|
|||
*/
|
||||
|
||||
nsRect bounds;
|
||||
|
||||
GetView()->GetBounds(bounds);
|
||||
|
||||
bounds.x = 0;
|
||||
bounds.y = 0;
|
||||
|
||||
if (gXPFCToolkit) gXPFCToolkit->GetViewManager()->UpdateView(GetView(), bounds, NS_VMREFRESH_AUTO_DOUBLE_BUFFER | NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return nsEventStatus_eIgnore;
|
||||
|
|
|
@ -15,6 +15,7 @@ EXPORTS = \
|
|||
nsXPFCMethodInvokerCommand.h \
|
||||
nsXPFCNotificationStateCommand.h \
|
||||
nsXPFCModelUpdateCommand.h \
|
||||
nsXPFCDialogDataHandlerCommand.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCDialogDataHandlerCommand_h___
|
||||
#define nsXPFCDialogDataHandlerCommand_h___
|
||||
|
||||
#include "nsXPFCCommand.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsXPFCDialogDataHandlerCommand : public nsXPFCCommand
|
||||
{
|
||||
public:
|
||||
nsXPFCDialogDataHandlerCommand();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init(nsString& aTarget);
|
||||
|
||||
public:
|
||||
nsString mAction;
|
||||
|
||||
protected:
|
||||
~nsXPFCDialogDataHandlerCommand();
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCActionCommand_h___ */
|
|
@ -23,6 +23,7 @@ CPPSRCS = \
|
|||
nsXPFCMethodInvokerCommand.cpp \
|
||||
nsXPFCNotificationStateCommand.cpp \
|
||||
nsXPFCModelUpdateCommand.cpp \
|
||||
nsXPFCDialogDataHandlerCommand.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = xpcom raptor
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsXPFCDialogDataHandlerCommand.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kXPFCCommandIID, NS_IXPFC_COMMAND_IID);
|
||||
|
||||
nsXPFCDialogDataHandlerCommand :: nsXPFCDialogDataHandlerCommand()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsXPFCDialogDataHandlerCommand :: ~nsXPFCDialogDataHandlerCommand()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsXPFCDialogDataHandlerCommand)
|
||||
NS_IMPL_RELEASE(nsXPFCDialogDataHandlerCommand)
|
||||
|
||||
nsresult nsXPFCDialogDataHandlerCommand::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
|
||||
if (NULL == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kClassIID, kXPFCCommandIID);
|
||||
static NS_DEFINE_IID(kXPFCDialogDataHandlerCommandCID, NS_XPFC_DIALOG_DATA_HANDLER_COMMAND_CID);
|
||||
|
||||
if (aIID.Equals(kClassIID)) {
|
||||
*aInstancePtr = (void*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = (void*) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kXPFCDialogDataHandlerCommandCID)) {
|
||||
*aInstancePtr = (void*)(nsXPFCDialogDataHandlerCommand *) (this);
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return (NS_NOINTERFACE);
|
||||
|
||||
}
|
||||
|
||||
nsresult nsXPFCDialogDataHandlerCommand::Init(nsString& aTarget)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -97,6 +97,11 @@
|
|||
{ 0x782ae760, 0x35fb, 0x11d2, \
|
||||
{0x92, 0x48, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// 10ed1f50-5caf-11d2-80a1-00600832d688
|
||||
#define NS_XPFCDATACOLLECTION_MANAGER_CID \
|
||||
{ 0x10ed1f50, 0x5caf, 0x11d2, \
|
||||
{0x80, 0xa1, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88} }
|
||||
|
||||
// 6c4e09a0-2f54-11d2-bede-00805f8a8dbd
|
||||
#define NS_XPFCMENUCONTAINER_CID \
|
||||
{ 0x6c4e09a0, 0x2f54, 0x11d2, \
|
||||
|
@ -196,6 +201,12 @@
|
|||
{ 0x8d2f7410, 0x28c3, 0x11d2, \
|
||||
{ 0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6 } }
|
||||
|
||||
//c8f15b7c-526a-11d2-b42e-00a0c95531e0
|
||||
#define NS_XPFC_DIALOG_DATA_HANDLER_COMMAND_CID \
|
||||
{ 0xc8f15b7c, 0x526a, 0x11d2, \
|
||||
{ 0xb4, 0x2e, 0x00, 0xa0, 0xc9, 0x55, 0x31, 0xe0 } }
|
||||
|
||||
|
||||
//1eb182f0-62bb-11d2-bee8-00805f8a8dbd
|
||||
#define NS_XPFC_NOTIFICATIONSTATE_COMMAND_CID \
|
||||
{ 0x1eb182f0, 0x62bb, 0x11d2, \
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "nsXPFCXMLContentSink.h"
|
||||
#include "nsMenuManager.h"
|
||||
#include "nsXPFCToolbarManager.h"
|
||||
#include "nsXPFCDataCollectionManager.h"
|
||||
#include "nsStreamManager.h"
|
||||
#include "nsStreamObject.h"
|
||||
#include "nsVector.h"
|
||||
|
@ -71,9 +72,9 @@
|
|||
#include "nsUser.h"
|
||||
|
||||
static NS_DEFINE_IID(kCShellInstance, NS_XPFC_SHELL_INSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuItem, NS_XPFCMENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuBar, NS_XPFCMENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuContainer, NS_XPFCMENUCONTAINER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuItem, NS_XPFCMENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuBar, NS_XPFCMENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCXPFCMenuContainer, NS_XPFCMENUCONTAINER_CID);
|
||||
static NS_DEFINE_IID(kCMenuManager, NS_MENU_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCStreamManager, NS_STREAM_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIStreamManager, NS_ISTREAM_MANAGER_IID);
|
||||
|
@ -82,7 +83,8 @@ static NS_DEFINE_IID(kIStreamObject, NS_ISTREAM_OBJECT_IID);
|
|||
static NS_DEFINE_IID(kCXPFCDTD, NS_IXPFCXML_DTD_IID);
|
||||
static NS_DEFINE_IID(kCXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbar, NS_XPFC_TOOLBAR_CID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarManager, NS_XPFCTOOLBAR_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCToolbarManager, NS_XPFCTOOLBAR_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDataCollectionManager, NS_XPFCDATACOLLECTION_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kCXPFCDialog, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCXPFCButton, NS_XPFC_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPButton, NS_XP_BUTTON_CID);
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#define XPFC_STRING_XBOX "xbox"
|
||||
#define XPFC_STRING_XPITEM "xpitem"
|
||||
#define XPFC_STRING_YBOX "ybox"
|
||||
#define XPFC_STRING_ONACTION "onaction"
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -156,6 +156,8 @@ nsresult nsxpfcFactory::CreateInstance(nsISupports *aOuter,
|
|||
inst = (nsISupports *)new nsXPFCCommand();
|
||||
} else if (mClassID.Equals(kCXPFCCommandServerCID)) {
|
||||
inst = (nsISupports *)new nsCommandServer();
|
||||
} else if (mClassID.Equals(kCXPFCDataCollectionManager)) {
|
||||
inst = (nsISupports *)new nsXPFCDataCollectionManager();
|
||||
} else if (mClassID.Equals(kCSMTPServiceCID)) {
|
||||
inst = (nsISupports *)new nsSMTPService();
|
||||
} else if (mClassID.Equals(kCMIMEServiceCID)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
|
@ -10,11 +10,11 @@
|
|||
GDEPTH = ../../..
|
||||
|
||||
EXPORTS = \
|
||||
$(NULL)
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
nsXPFCDialog.h \
|
||||
$(NULL)
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "nsIXPFCDialog.h"
|
||||
#include "nsXPFCCanvas.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsXPFCDialog : public nsIXPFCDialog,
|
||||
public nsXPFCCanvas
|
||||
|
@ -35,6 +36,9 @@ public:
|
|||
|
||||
NS_IMETHOD SetParameter(nsString& aKey, nsString& aValue) ;
|
||||
NS_IMETHOD GetClassPreferredSize(nsSize& aSize);
|
||||
NS_IMETHOD_(nsEventStatus) ProcessCommand(nsIXPFCCommand * aCommand) ;
|
||||
NS_IMETHOD CollectData();
|
||||
NS_IMETHOD CollectDataInCanvas(nsIXPFCCanvas* host_canvas, nsVoidArray* DataMembers);
|
||||
|
||||
protected:
|
||||
~nsXPFCDialog();
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#define nsIXPFCDialog_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
//52ae6d80-3b81-11d2-bee0-00805f8a8dbd
|
||||
#define NS_IXPFC_DIALOG_IID \
|
||||
|
|
|
@ -19,10 +19,19 @@
|
|||
#include "nsXPFCDialog.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nspr.h"
|
||||
#include "nsXPFCMethodInvokerCommand.h"
|
||||
#include "nsXPFCTextWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsXPFCDataCollectionManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDialogCID, NS_XPFC_DIALOG_CID);
|
||||
static NS_DEFINE_IID(kCIXPFCDialogIID, NS_IXPFC_DIALOG_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDataCollectionManager, NS_XPFCDATACOLLECTION_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIXPFCDataCollectionManager, NS_IXPFCDATACOLLECTION_MANAGER_IID);
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
#define DEFAULT_HEIGHT 300
|
||||
|
@ -83,3 +92,106 @@ nsresult nsXPFCDialog :: GetClassPreferredSize(nsSize& aSize)
|
|||
return (NS_OK);
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kInsTextWidgetIID, NS_ITEXTWIDGET_IID);
|
||||
#define MAX_SIZE 2048
|
||||
|
||||
nsresult nsXPFCDialog :: CollectDataInCanvas(nsIXPFCCanvas* host_canvas, nsVoidArray* DataMembers)
|
||||
{
|
||||
nsresult res ;
|
||||
nsIIterator * iterator;
|
||||
|
||||
res = host_canvas->CreateIterator(&iterator);
|
||||
|
||||
if (NS_OK != res)
|
||||
return NS_OK;
|
||||
|
||||
iterator->Init();
|
||||
while(!(iterator->IsDone()))
|
||||
{
|
||||
nsIXPFCCanvas * canvas = (nsIXPFCCanvas *) iterator->CurrentItem();
|
||||
nsString canvas_name;
|
||||
nsITextWidget * text_widget = nsnull;
|
||||
nsIWidget * widget = nsnull;
|
||||
|
||||
canvas_name = host_canvas->GetNameID();
|
||||
widget = canvas->GetWidget();
|
||||
if (widget)
|
||||
{
|
||||
res = widget->QueryInterface(kInsTextWidgetIID,(void**)&text_widget);
|
||||
NS_RELEASE(widget);
|
||||
|
||||
if (NS_OK == res)
|
||||
{
|
||||
CollectedDataPtr newData;
|
||||
nsString text;
|
||||
nsString name;
|
||||
nsString colon = ":";
|
||||
PRUint32 size;
|
||||
|
||||
text_widget->GetText(text, MAX_SIZE, size);
|
||||
name = canvas->GetNameID();
|
||||
|
||||
NS_RELEASE(text_widget);
|
||||
|
||||
newData = new CollectedData;
|
||||
newData->LabelName = canvas_name;
|
||||
newData->LabelName += colon;
|
||||
newData->LabelName += name;
|
||||
newData->Value = text;
|
||||
DataMembers->AppendElement((void *)newData);
|
||||
}
|
||||
}
|
||||
|
||||
CollectDataInCanvas(canvas, DataMembers);
|
||||
iterator->Next();
|
||||
}
|
||||
|
||||
NS_RELEASE(iterator);
|
||||
}
|
||||
|
||||
nsresult nsXPFCDialog :: CollectData()
|
||||
{
|
||||
nsCollectedData* cdata = new nsCollectedData;
|
||||
nsVoidArray* lDataMembers = cdata->GetDataArray();
|
||||
nsIXPFCDataCollectionManager *theMan = nsnull;
|
||||
|
||||
CollectDataInCanvas(this, lDataMembers);
|
||||
|
||||
for(PRInt32 x = 0; x < lDataMembers->Count(); x++)
|
||||
{
|
||||
nsString a,b;
|
||||
CollectedDataPtr c;
|
||||
c = (CollectedDataPtr)(lDataMembers->ElementAt(x));
|
||||
a = c->LabelName;
|
||||
b = c->Value;
|
||||
}
|
||||
|
||||
nsServiceManager::GetService(kCXPFCDataCollectionManager, kIXPFCDataCollectionManager, (nsISupports**)&theMan);
|
||||
if (theMan)
|
||||
{
|
||||
nsString ce = nsString("CreateEvent");
|
||||
theMan->CallDataHandler(ce, cdata);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we cannot process the command, pass it up the food chain
|
||||
*/
|
||||
|
||||
nsEventStatus nsXPFCDialog::ProcessCommand(nsIXPFCCommand* aCommand)
|
||||
{
|
||||
static NS_DEFINE_IID(kXPFCDialogDataHandlerCommandCID, NS_XPFC_DIALOG_DATA_HANDLER_COMMAND_CID);
|
||||
nsXPFCMethodInvokerCommand * methodinvoker_command = nsnull;
|
||||
|
||||
if (NS_OK == aCommand->QueryInterface(kXPFCDialogDataHandlerCommandCID, (void**)&methodinvoker_command))
|
||||
{
|
||||
CollectData();
|
||||
// NS_RELEASE(this);
|
||||
} else
|
||||
{
|
||||
nsXPFCCanvas::ProcessCommand(aCommand);
|
||||
}
|
||||
return (nsEventStatus_eIgnore);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
# CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
|
||||
# NETSCAPE COMMUNICATIONS CORPORATION
|
||||
# Copyright (C) 1996 Netscape Communications Corporation. All Rights
|
||||
|
@ -10,11 +10,12 @@
|
|||
GDEPTH = ../../..
|
||||
|
||||
EXPORTS = \
|
||||
nsShellInstance.h \
|
||||
nsApplicationManager.h \
|
||||
nsShellInstance.h \
|
||||
nsApplicationManager.h \
|
||||
nsStreamManager.h \
|
||||
nsStreamObject.h \
|
||||
$(NULL)
|
||||
nsXPFCDataCollectionManager.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = xpfc
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class nsIAppShell;
|
|||
class nsIStreamManager;
|
||||
class nsIXPFCToolbarManager;
|
||||
class nsIDeviceContext;
|
||||
|
||||
class nsIXPFCDataCollectionManager;
|
||||
|
||||
// platform independent native handle to application instance
|
||||
typedef void * nsNativeApplicationInstance ;
|
||||
|
@ -140,6 +140,8 @@ public:
|
|||
|
||||
NS_IMETHOD_(nsIXPFCToolbarManager *) GetToolbarManager();
|
||||
|
||||
NS_IMETHOD_(nsIXPFCDataCollectionManager *) GetDataCollectionManager();
|
||||
|
||||
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ;
|
||||
|
||||
NS_IMETHOD LaunchApplication(nsString& aApplication,nsString& aArgument) ;
|
||||
|
@ -154,6 +156,7 @@ private:
|
|||
nsIPref * mPref;
|
||||
nsIStreamManager * mStreamManager;
|
||||
nsIXPFCToolbarManager * mToolbarManager;
|
||||
nsIXPFCDataCollectionManager* mDataCollectionManager;
|
||||
nsIDeviceContext * mDeviceContext;
|
||||
|
||||
public:
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsXPFCDataCollectionManager_h___
|
||||
#define nsXPFCDataCollectionManager_h___
|
||||
|
||||
#include "nsIXPFCDataCollectionManager.h"
|
||||
#include "nsIVector.h"
|
||||
#include "nsIIterator.h"
|
||||
|
||||
class nsCollectedData : public nsICollectedData
|
||||
{
|
||||
public:
|
||||
nsCollectedData();
|
||||
~nsCollectedData();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD FindValueInCollectedData(nsString& Label, nsString& result);
|
||||
NS_IMETHOD_(nsVoidArray*) GetDataArray();
|
||||
NS_IMETHOD_(nsString) GetDataHandlerType();
|
||||
NS_IMETHOD SetDataHandlerType(nsString& TypeString);
|
||||
|
||||
private:
|
||||
nsVoidArray theDataSource;
|
||||
nsString DataHandlerType;
|
||||
};
|
||||
|
||||
class nsXPFCDataCollectionManager : public nsIXPFCDataCollectionManager
|
||||
{
|
||||
|
||||
public:
|
||||
nsXPFCDataCollectionManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD AddDataCollection(nsString& DataHandlerName, nsIApplicationShell *aHostShell);
|
||||
NS_IMETHOD CallDataHandler(nsString& DataHandlerName, nsICollectedData* TheCollectedData);
|
||||
|
||||
protected:
|
||||
~nsXPFCDataCollectionManager();
|
||||
|
||||
private:
|
||||
nsIVector * mDataHands;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsXPFCToolbarManager_h___ */
|
|
@ -16,6 +16,7 @@ EXPORTS = \
|
|||
nsIWebViewerContainer.h\
|
||||
nsIStreamManager.h \
|
||||
nsIStreamObject.h \
|
||||
nsIXPFCDataCollectionManager.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIWidget.h"
|
||||
|
||||
class nsIWebViewerContainer;
|
||||
class nsICollectedData;
|
||||
|
||||
#define NS_IAPPLICATIONSHELL_IID \
|
||||
{ 0xaf9a93e0, 0xdebc, 0x11d1, \
|
||||
|
@ -48,6 +49,11 @@ public:
|
|||
|
||||
NS_IMETHOD GetWebViewerContainer(nsIWebViewerContainer ** aWebViewerContainer) = 0;
|
||||
|
||||
/*
|
||||
** Get call backs from the DataCollection Manager
|
||||
*/
|
||||
NS_IMETHOD ReceiveCallback(nsICollectedData& aReply) = 0;
|
||||
|
||||
NS_IMETHOD StartCommandServer() = 0;
|
||||
|
||||
NS_IMETHOD ReceiveCommand(nsString& aCommand, nsString& aReply) = 0;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsIApplicationShell.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "plgetopt.h"
|
||||
#include "nsIXPFCDataCollectionManager.h"
|
||||
|
||||
class nsIApplicationShell;
|
||||
class nsIPref;
|
||||
|
@ -135,6 +136,12 @@ public:
|
|||
*/
|
||||
NS_IMETHOD_(nsIXPFCToolbarManager *) GetToolbarManager() = 0;
|
||||
|
||||
/**
|
||||
* Get DataCollection Manager
|
||||
* @result An nsIXPFCDataCollectionManager pointer
|
||||
*/
|
||||
NS_IMETHOD_(nsIXPFCDataCollectionManager *) GetDataCollectionManager() = 0;
|
||||
|
||||
PLOptState *opt;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsIXPFCDataCollectionManager_h___
|
||||
#define nsIXPFCDataCollectionManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIXPFCCommandReceiver.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
class nsIXPFCDataCollection;
|
||||
class nsIApplicationShell;
|
||||
|
||||
//a2e85d80-5ca8-11d2-80a1-00600832d688
|
||||
#define NS_IXPFCDATACOLLECTION_MANAGER_IID \
|
||||
{ 0xa2e85d80, 0x5ca8, 0x11d2, \
|
||||
{ 0x80, 0xa1, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88 } }
|
||||
|
||||
//8ea29570-6923-11d2-80a3-00600832d688
|
||||
#define NS_ICOLLECED_MANAGER_IID \
|
||||
{ 0x8ea29570, 0x6923, 0x11d2, \
|
||||
{ 0x80, 0xa3, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88 } }
|
||||
|
||||
typedef struct CollectedData
|
||||
{
|
||||
nsString LabelName;
|
||||
nsString Value;
|
||||
} *CollectedDataPtr;
|
||||
|
||||
class nsIShellInstance;
|
||||
|
||||
class nsICollectedData : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0 ;
|
||||
NS_IMETHOD FindValueInCollectedData(nsString& Label, nsString& result) = 0;
|
||||
NS_IMETHOD_(nsVoidArray*) GetDataArray() = 0;
|
||||
NS_IMETHOD_(nsString) GetDataHandlerType() = 0;
|
||||
NS_IMETHOD SetDataHandlerType(nsString& TypeString) = 0;
|
||||
};
|
||||
|
||||
class nsIXPFCDataCollectionManager : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0 ;
|
||||
// NS_IMETHOD AddDataCollection(nsString& DataHandlerName, DataCollectionHandlerFunc *aDataCollectionHandler) = 0;
|
||||
NS_IMETHOD AddDataCollection(nsString& DataHandlerName, nsIApplicationShell *aHostShell) = 0;
|
||||
|
||||
NS_IMETHOD CallDataHandler(nsString& DataHandlerName, nsICollectedData* TheCollectedData) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCToolbarManager_h___ */
|
|
@ -24,6 +24,7 @@ CPPSRCS = \
|
|||
nsShellInstance.cpp \
|
||||
nsStreamManager.cpp \
|
||||
nsStreamObject.cpp \
|
||||
nsXPFCDataCollectionManager.cpp \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = dom xpcom raptor pref js netlib
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
#include "nsDOMCID.h"
|
||||
#include "nsLayoutCID.h"
|
||||
#include "nsINetService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
#include "nsIXPFCDataCollectionManager.h"
|
||||
|
||||
#ifdef NS_WIN32
|
||||
#include "direct.h"
|
||||
|
@ -92,6 +95,8 @@ static NS_DEFINE_IID(kCXPFCToolbarManager, NS_XPFCTOOLBAR_MANAGER_CID);
|
|||
static NS_DEFINE_IID(kIXPFCToolbarManager, NS_IXPFCTOOLBAR_MANAGER_IID);
|
||||
static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDataCollectionManager, NS_XPFCDATACOLLECTION_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIXPFCDataCollectionManager, NS_IXPFCDATACOLLECTION_MANAGER_IID);
|
||||
|
||||
nsEventStatus PR_CALLBACK HandleEventApplication(nsGUIEvent *aEvent);
|
||||
nsShellInstance * gShellInstance = nsnull;
|
||||
|
@ -172,6 +177,23 @@ nsresult nsShellInstance::Init()
|
|||
|
||||
mToolbarManager->Init();
|
||||
|
||||
// Create a DataCollection Manager
|
||||
#if 0
|
||||
res = nsRepository::CreateInstance(kCXPFCDataCollectionManager,
|
||||
NULL,
|
||||
kIXPFCDataCollectionManager,
|
||||
(void **) &mDataCollectionManager);
|
||||
mDataCollectionManager = new nsXPFCDataCollectionManager();
|
||||
#else
|
||||
nsServiceManager::GetService(kCXPFCDataCollectionManager, kIXPFCDataCollectionManager, (nsISupports**)&mDataCollectionManager);
|
||||
res = NS_OK;
|
||||
|
||||
#endif
|
||||
if (NS_OK != res)
|
||||
return res;
|
||||
|
||||
mDataCollectionManager->Init();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -208,6 +230,11 @@ nsresult nsShellInstance::Run()
|
|||
#endif
|
||||
}
|
||||
|
||||
nsIXPFCDataCollectionManager * nsShellInstance::GetDataCollectionManager()
|
||||
{
|
||||
return (mDataCollectionManager) ;
|
||||
}
|
||||
|
||||
void * nsShellInstance::GetNativeInstance()
|
||||
{
|
||||
return mNativeInstance ;
|
||||
|
@ -270,6 +297,7 @@ nsresult nsShellInstance::RegisterFactories()
|
|||
#define PARSER_DLL "raptorhtmlpars.dll"
|
||||
#define DOM_DLL "jsdom.dll"
|
||||
#define LAYOUT_DLL "raptorhtml.dll"
|
||||
#define XPFC_DLL "xpfc10.dll"
|
||||
#define NETLIB_DLL "netlib.dll"
|
||||
#else
|
||||
#ifdef XP_MAC
|
||||
|
@ -286,6 +314,23 @@ nsresult nsShellInstance::RegisterFactories()
|
|||
#define LAYOUT_DLL "libraptorhtml.so"
|
||||
#define NETLIB_DLL "netlib.so"
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
nsRepository::RegisterFactory(kIWidgetIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
// register graphics classes
|
||||
static NS_DEFINE_IID(kCRenderingContextIID, NS_RENDERING_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kCDeviceContextIID, NS_DEVICE_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID);
|
||||
static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID);
|
||||
static NS_DEFINE_IID(kCRegionIID, NS_REGION_CID);
|
||||
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
|
||||
|
||||
nsRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCFontMetricsIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCImageIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCRegionIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
#endif
|
||||
|
||||
// Class ID's
|
||||
|
@ -387,6 +432,7 @@ nsRepository::RegisterFactory(kCMenuBarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
|||
nsRepository::RegisterFactory(kCMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCMenuItemCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
nsRepository::RegisterFactory(kCXPFCDataCollectionManager, XPFC_DLL, PR_FALSE, PR_FALSE);
|
||||
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
|
||||
nsRepository::RegisterFactory(kCParserNodeCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "prmem.h"
|
||||
#include "nsxpfcCIID.h"
|
||||
#include "nsxpfcutil.h"
|
||||
#include "nsXPFCDataCollectionManager.h"
|
||||
#include "nsIApplicationShell.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kCXPFCDataCollectionManagerCID, NS_XPFCDATACOLLECTION_MANAGER_CID);
|
||||
static NS_DEFINE_IID(kIXPFCDataCollectionManagerIID, NS_IXPFCDATACOLLECTION_MANAGER_IID);
|
||||
|
||||
typedef struct Data_ManagerList
|
||||
{
|
||||
nsString* HandlerName;
|
||||
nsIApplicationShell* HandleShell;
|
||||
} DataManagerListStruct, *DataManagerList;
|
||||
|
||||
nsXPFCDataCollectionManager :: nsXPFCDataCollectionManager()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsXPFCDataCollectionManager :: ~nsXPFCDataCollectionManager()
|
||||
{
|
||||
if (mDataHands != nsnull)
|
||||
{
|
||||
for(PRInt32 x = 0;
|
||||
x < mDataHands->Count();
|
||||
x++)
|
||||
{
|
||||
DataManagerList dml = (DataManagerList)(mDataHands->ElementAt(x));
|
||||
PR_DELETE(dml);
|
||||
}
|
||||
mDataHands->RemoveAll();
|
||||
NS_RELEASE(mDataHands);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPFCDataCollectionManager, kIXPFCDataCollectionManagerIID)
|
||||
NS_IMPL_ADDREF(nsXPFCDataCollectionManager)
|
||||
NS_IMPL_RELEASE(nsXPFCDataCollectionManager)
|
||||
|
||||
nsresult nsXPFCDataCollectionManager :: Init()
|
||||
{
|
||||
static NS_DEFINE_IID(kCVectorCID, NS_VECTOR_CID);
|
||||
nsresult res = nsRepository::CreateInstance(kCVectorCID,
|
||||
nsnull,
|
||||
kCVectorCID,
|
||||
(void **)&mDataHands);
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
mDataHands->Init();
|
||||
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXPFCDataCollectionManager::AddDataCollection(nsString& DataHandlerName, nsIApplicationShell *aHostShell)
|
||||
{
|
||||
DataManagerList dml = PR_NEW(DataManagerListStruct);
|
||||
|
||||
if (dml)
|
||||
{
|
||||
dml->HandleShell = aHostShell;
|
||||
dml->HandlerName = new nsString(DataHandlerName);
|
||||
mDataHands->Append((void *)dml);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXPFCDataCollectionManager :: CallDataHandler(nsString& DataHandlerName, nsICollectedData* TheCollectedData)
|
||||
{
|
||||
for(PRInt32 x = 0; x < mDataHands->Count(); x++)
|
||||
{
|
||||
DataManagerList dml;
|
||||
|
||||
dml = (DataManagerList)(mDataHands->ElementAt(x));
|
||||
if ((*dml->HandlerName) == DataHandlerName)
|
||||
{
|
||||
TheCollectedData->SetDataHandlerType(DataHandlerName);
|
||||
(dml->HandleShell)->ReceiveCallback(*TheCollectedData);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
/********************************************************************************************
|
||||
***
|
||||
Collected Data Code
|
||||
***
|
||||
********************************************************************************************/
|
||||
static NS_DEFINE_IID(kICollectedDataIID, NS_IXPFCDATACOLLECTION_MANAGER_IID);
|
||||
|
||||
nsCollectedData::nsCollectedData()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsCollectedData::~nsCollectedData()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_QUERY_INTERFACE(nsCollectedData, kICollectedDataIID)
|
||||
NS_IMPL_ADDREF(nsCollectedData)
|
||||
NS_IMPL_RELEASE(nsCollectedData)
|
||||
|
||||
nsresult
|
||||
nsCollectedData::Init()
|
||||
{
|
||||
return NS_OK ;
|
||||
}
|
||||
|
||||
nsVoidArray*
|
||||
nsCollectedData::GetDataArray()
|
||||
{
|
||||
return &theDataSource;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCollectedData::FindValueInCollectedData(nsString& Label, nsString& result)
|
||||
{
|
||||
result = "";
|
||||
|
||||
for(PRInt32 x = 0; x < theDataSource.Count(); x++)
|
||||
{
|
||||
nsString a,b;
|
||||
CollectedDataPtr c;
|
||||
c = (CollectedDataPtr)(theDataSource.ElementAt(x));
|
||||
a = c->LabelName;
|
||||
b = c->Value;
|
||||
|
||||
if (a.RFind(Label, PR_TRUE) != -1)
|
||||
{
|
||||
result = b;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsString
|
||||
nsCollectedData::GetDataHandlerType()
|
||||
{
|
||||
return DataHandlerType;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCollectedData::SetDataHandlerType(nsString& TypeString)
|
||||
{
|
||||
DataHandlerType = TypeString;
|
||||
return NS_OK;
|
||||
}
|
Загрузка…
Ссылка в новой задаче