diff --git a/calendar/modules/shell/src/nsCalendarShell.cpp b/calendar/modules/shell/src/nsCalendarShell.cpp index 7652616f8a3..05e57024681 100644 --- a/calendar/modules/shell/src/nsCalendarShell.cpp +++ b/calendar/modules/shell/src/nsCalendarShell.cpp @@ -814,8 +814,6 @@ nsresult nsCalendarShell::LoadUI() res = mDocumentContainer->LoadURL(pUI,nsnull); mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_CALENDAR,pUI,&i); res = mDocumentContainer->LoadURL(pUI,nsnull); - mShellInstance->GetPreferences()->GetCharPref(CAL_STRING_PREF_JULIAN_UI_XML_TOOLBAR,pUI,&i); - res = mDocumentContainer->LoadURL(pUI,nsnull); #endif mShellInstance->ShowApplicationWindow(PR_TRUE) ; diff --git a/calendar/modules/ui/res/demo/Makefile b/calendar/modules/ui/res/demo/Makefile new file mode 100644 index 00000000000..e69de29bb2d diff --git a/calendar/modules/ui/res/demo/julian1.cal b/calendar/modules/ui/res/demo/julian1.cal new file mode 100644 index 00000000000..b3e72191dd5 --- /dev/null +++ b/calendar/modules/ui/res/demo/julian1.cal @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/julian2.cal b/calendar/modules/ui/res/demo/julian2.cal new file mode 100644 index 00000000000..08dafd878a4 --- /dev/null +++ b/calendar/modules/ui/res/demo/julian2.cal @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/julian3.cal b/calendar/modules/ui/res/demo/julian3.cal new file mode 100644 index 00000000000..03878050519 --- /dev/null +++ b/calendar/modules/ui/res/demo/julian3.cal @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +--> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/julian4.cal b/calendar/modules/ui/res/demo/julian4.cal new file mode 100644 index 00000000000..268d4886a75 --- /dev/null +++ b/calendar/modules/ui/res/demo/julian4.cal @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/manifest.mn b/calendar/modules/ui/res/demo/manifest.mn new file mode 100644 index 00000000000..e69de29bb2d diff --git a/calendar/modules/ui/res/demo/trex1.ui b/calendar/modules/ui/res/demo/trex1.ui new file mode 100644 index 00000000000..2d56f22774e --- /dev/null +++ b/calendar/modules/ui/res/demo/trex1.ui @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/trex2.ui b/calendar/modules/ui/res/demo/trex2.ui new file mode 100644 index 00000000000..b8b140e1132 --- /dev/null +++ b/calendar/modules/ui/res/demo/trex2.ui @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/demo/trex3.ui b/calendar/modules/ui/res/demo/trex3.ui new file mode 100644 index 00000000000..9c741d0918e --- /dev/null +++ b/calendar/modules/ui/res/demo/trex3.ui @@ -0,0 +1,22 @@ + + + + + + + + + + + + + diff --git a/calendar/modules/ui/res/manifest.mn b/calendar/modules/ui/res/manifest.mn index e1f6883fe4a..9473777d8bd 100644 --- a/calendar/modules/ui/res/manifest.mn +++ b/calendar/modules/ui/res/manifest.mn @@ -9,6 +9,8 @@ # GDEPTH = ../../../.. +DIRS_LIBS = demo + MODULE = trex REQUIRES = raptor diff --git a/calendar/modules/ui/res/toolbar.ui b/calendar/modules/ui/res/toolbar.ui index c8d53b3b464..7ffbd43b6ea 100644 --- a/calendar/modules/ui/res/toolbar.ui +++ b/calendar/modules/ui/res/toolbar.ui @@ -46,7 +46,7 @@ - + diff --git a/calendar/modules/ui/res/trex.ui b/calendar/modules/ui/res/trex.ui index 12049d05f26..e178eee76a0 100644 --- a/calendar/modules/ui/res/trex.ui +++ b/calendar/modules/ui/res/trex.ui @@ -15,9 +15,8 @@ - - - + + diff --git a/xpfc/core/inc/nsxpfcstrings.h b/xpfc/core/inc/nsxpfcstrings.h index 4b42e91afbd..92ad134f068 100644 --- a/xpfc/core/inc/nsxpfcstrings.h +++ b/xpfc/core/inc/nsxpfcstrings.h @@ -25,6 +25,7 @@ #define XPFC_STRING_BOTTOM "bottom" #define XPFC_STRING_CENTER "center" #define XPFC_STRING_CLASS "class" +#define XPFC_STRING_COMMAND "command" #define XPFC_STRING_CONTAINER "container" #define XPFC_STRING_ENABLE "enable" #define XPFC_STRING_FOLDER_CANVAS "foldercanvas" diff --git a/xpfc/parser/inc/nsXPFCXMLDTD.h b/xpfc/parser/inc/nsXPFCXMLDTD.h index 8a1388d29ac..6b7c9b10f7f 100644 --- a/xpfc/parser/inc/nsXPFCXMLDTD.h +++ b/xpfc/parser/inc/nsXPFCXMLDTD.h @@ -29,6 +29,7 @@ enum eXPFCXMLTags eXPFCXMLTag_doctype, eXPFCXMLTag_xml, + eXPFCXMLTag_application, eXPFCXMLTag_button, eXPFCXMLTag_canvas, eXPFCXMLTag_dialog, diff --git a/xpfc/parser/src/nsXPFCXMLContentSink.cpp b/xpfc/parser/src/nsXPFCXMLContentSink.cpp index 45cf2a24c99..a351a1934b2 100644 --- a/xpfc/parser/src/nsXPFCXMLContentSink.cpp +++ b/xpfc/parser/src/nsXPFCXMLContentSink.cpp @@ -56,10 +56,11 @@ static NS_DEFINE_IID(kCXPFCTabWidgetCID, NS_XPFC_TABWIDGET_CID); static NS_DEFINE_IID(kCXPFCTextWidgetCID, NS_XPFC_TEXTWIDGET_CID); static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID); -#define XPFC_PARSING_STATE_UNKNOWN 0 -#define XPFC_PARSING_STATE_TOOLBAR 1 -#define XPFC_PARSING_STATE_MENUBAR 2 -#define XPFC_PARSING_STATE_DIALOG 3 +#define XPFC_PARSING_STATE_UNKNOWN 0 +#define XPFC_PARSING_STATE_TOOLBAR 1 +#define XPFC_PARSING_STATE_MENUBAR 2 +#define XPFC_PARSING_STATE_DIALOG 3 +#define XPFC_PARSING_STATE_APPLICATION 4 class ContainerListEntry { public: @@ -195,6 +196,37 @@ NS_IMETHODIMP nsXPFCXMLContentSink::OpenContainer(const nsIParserNode& aNode) mState = XPFC_PARSING_STATE_TOOLBAR; else if (eXPFCXMLTag_dialog == tag) mState = XPFC_PARSING_STATE_DIALOG; + else if (eXPFCXMLTag_application == tag) + mState = XPFC_PARSING_STATE_APPLICATION; + + if (mState == XPFC_PARSING_STATE_APPLICATION) + { + if (eXPFCXMLTag_canvas == tag) + { + PRInt32 i = 0; + nsString key,value; + + for (i = 0; i < aNode.GetAttributeCount(); i++) + { + + key = aNode.GetKeyAt(i); + value = aNode.GetValueAt(i); + + key.StripChars("\""); + value.StripChars("\""); + + if (key.EqualsIgnoreCase("src")) + { + // Load the url! + mViewerContainer->LoadURL(value,nsnull); + break; + } + + } + + } + return NS_OK; + } nsString text = aNode.GetText(); @@ -578,6 +610,7 @@ NS_IMETHODIMP nsXPFCXMLContentSink::CIDFromTag(eXPFCXMLTags tag, nsCID &aClass) aClass = kCXPFCDialogCID; break; + case eXPFCXMLTag_application: case eXPFCXMLTag_canvas: case eXPFCXMLTag_separator: aClass = kCXPFCCanvasCID; diff --git a/xpfc/parser/src/nsXPFCXMLDTD.cpp b/xpfc/parser/src/nsXPFCXMLDTD.cpp index d3372fd035e..ecf7368c385 100644 --- a/xpfc/parser/src/nsXPFCXMLDTD.cpp +++ b/xpfc/parser/src/nsXPFCXMLDTD.cpp @@ -40,6 +40,8 @@ static const char* kToolbarXMLTextContentType = "ui/toolbar"; static const char* kToolbarXMLDocHeader= "OpenContainer(*attrNode); @@ -337,6 +347,7 @@ nsresult nsXPFCXMLDTD::HandleEndToken(CToken* aToken) case eXPFCXMLTag_toolbar: case eXPFCXMLTag_canvas: case eXPFCXMLTag_dialog: + case eXPFCXMLTag_application: { mSink->CloseContainer(*attrNode); } diff --git a/xpfc/toolkit/inc/nsXPFCToolkit.h b/xpfc/toolkit/inc/nsXPFCToolkit.h index a4c391162da..cd52425c49a 100644 --- a/xpfc/toolkit/inc/nsXPFCToolkit.h +++ b/xpfc/toolkit/inc/nsXPFCToolkit.h @@ -43,6 +43,9 @@ public: NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas); NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ; + NS_IMETHOD SetApplicationShell(nsIApplicationShell * aApplicationShell) ; + NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell() ; + protected: ~nsXPFCToolkit(); diff --git a/xpfc/toolkit/public/nsIXPFCToolkit.h b/xpfc/toolkit/public/nsIXPFCToolkit.h index 1eb33c3d710..9fd787688b9 100644 --- a/xpfc/toolkit/public/nsIXPFCToolkit.h +++ b/xpfc/toolkit/public/nsIXPFCToolkit.h @@ -48,6 +48,9 @@ public: NS_IMETHOD GetRootCanvas(nsIXPFCCanvas ** aCanvas) = 0; NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() = 0; + NS_IMETHOD SetApplicationShell(nsIApplicationShell * aApplicationShell) = 0; + NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell() = 0; + }; #endif /* nsIXPFCToolkit_h___ */ diff --git a/xpfc/toolkit/src/nsXPFCToolkit.cpp b/xpfc/toolkit/src/nsXPFCToolkit.cpp index 2f7e82d4bf8..d668f57e056 100644 --- a/xpfc/toolkit/src/nsXPFCToolkit.cpp +++ b/xpfc/toolkit/src/nsXPFCToolkit.cpp @@ -84,6 +84,17 @@ nsIXPFCObserverManager * nsXPFCToolkit::GetObserverManager() return (mObserverManager); } +nsresult nsXPFCToolkit::SetApplicationShell(nsIApplicationShell * aApplicationShell) +{ + mApplicationShell = aApplicationShell; + return NS_OK; +} + +nsIApplicationShell * nsXPFCToolkit::GetApplicationShell() +{ + return (mApplicationShell); +} + nsresult nsXPFCToolkit::SetCanvasManager(nsIXPFCCanvasManager * aCanvasManager) { mCanvasManager = aCanvasManager; diff --git a/xpfc/widget/src/nsXPButton.cpp b/xpfc/widget/src/nsXPButton.cpp index 839f5b1160d..896b44e6285 100644 --- a/xpfc/widget/src/nsXPButton.cpp +++ b/xpfc/widget/src/nsXPButton.cpp @@ -32,6 +32,7 @@ #include "nsITimer.h" #include "nsIThrobber.h" #include "nsXPItem.h" +#include "nsIWebViewerContainer.h" static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID); @@ -42,6 +43,8 @@ static NS_DEFINE_IID(kInsButtonIID, NS_IBUTTON_IID); #define DEFAULT_WIDTH 50 #define DEFAULT_HEIGHT 50 +nsString gCommandString; + nsXPButton :: nsXPButton(nsISupports* outer) : nsXPItem(outer) { NS_INIT_REFCNT(); @@ -120,6 +123,13 @@ nsresult nsXPButton :: SetParameter(nsString& aKey, nsString& aValue) mFullPressedImageRequest = RequestImage(aValue); + } else if (aKey.EqualsIgnoreCase(XPFC_STRING_COMMAND)) { + + // XXX: Total hack here for demo purposes ... sorry + + aValue.Mid(gCommandString,8,aValue.Length()-8); + + } else if (aKey.EqualsIgnoreCase(XPFC_STRING_ENABLE)) { @@ -327,6 +337,19 @@ nsEventStatus nsXPButton :: OnLeftButtonUp(nsGUIEvent *aEvent) { mState &= ~eButtonState_pressed; GetWidget()->Invalidate(PR_FALSE); + + if (gCommandString.Length() > 0) + { + nsIWebViewerContainer * webViewerContainer = nsnull; + gXPFCToolkit->GetApplicationShell()->GetWebViewerContainer(&webViewerContainer); + + if (webViewerContainer != nsnull) + { + webViewerContainer->LoadURL(gCommandString,nsnull); + NS_RELEASE(webViewerContainer); + } + } + return (nsXPItem::OnLeftButtonUp(aEvent)); }