diff --git a/cmd/xfe/src/RDFBase.cpp b/cmd/xfe/src/RDFBase.cpp index 943f70cf27a..2310311e892 100644 --- a/cmd/xfe/src/RDFBase.cpp +++ b/cmd/xfe/src/RDFBase.cpp @@ -229,29 +229,6 @@ XFE_RDFBase::updateRoot() { } ////////////////////////////////////////////////////////////////////////// -/*static*/ XP_Bool -XFE_RDFBase::ht_IsFECommand(HT_Resource item) -{ - const char* url = HT_GetNodeURL(item); - - return (XP_STRNCMP(url, "command:", 8) == 0); -} -////////////////////////////////////////////////////////////////////////// -/*static*/ CommandType -XFE_RDFBase::ht_GetFECommand(HT_Resource item) -{ - const char* url = HT_GetNodeURL(item); - - if (url && XP_STRNCMP(url, "command:", 8) == 0) - { - return Command::convertOldRemote(url + 8); - } - else - { - return NULL; - } -} -////////////////////////////////////////////////////////////////////////// /*virtual*/ void XFE_RDFBase::notify(HT_Resource n, HT_Event whatHappened) { diff --git a/cmd/xfe/src/RDFBase.h b/cmd/xfe/src/RDFBase.h index 71ae8645b96..4e88eb717e4 100644 --- a/cmd/xfe/src/RDFBase.h +++ b/cmd/xfe/src/RDFBase.h @@ -80,13 +80,6 @@ public: // Update the current view from the root. virtual void updateRoot (); - - // Is the URL a 'special' command url that - // translates to an FE command? - static XP_Bool ht_IsFECommand (HT_Resource item); - static CommandType ht_GetFECommand (HT_Resource item); - - // Handle HT events virtual void notify (HT_Resource n, HT_Event whatHappened); diff --git a/cmd/xfe/src/RDFMenuToolbarBase.cpp b/cmd/xfe/src/RDFMenuToolbarBase.cpp index 30ce5b85934..1eb2d9ced79 100644 --- a/cmd/xfe/src/RDFMenuToolbarBase.cpp +++ b/cmd/xfe/src/RDFMenuToolbarBase.cpp @@ -31,6 +31,7 @@ #include "IconGroup.h" #include "View.h" #include "ToolbarDrop.h" +#include "RDFUtils.h" #include "felocale.h" #include "intl_csi.h" @@ -318,7 +319,7 @@ XFE_RDFMenuToolbarBase::getPixmapsForEntry(HT_Resource entry, #ifdef NOT_YET if (hasCustomIcon(entry)) {} /*else {*/ #endif /*NOT_YET*/ - if (ht_IsFECommand(entry)) + if (XFE_RDFUtils::ht_IsFECommand(entry)) { const char* url = HT_GetNodeURL(entry); @@ -554,7 +555,7 @@ XFE_RDFMenuToolbarBase::entryActivated(Widget w, HT_Resource entry) { if (entry) { - if (ht_IsFECommand(entry)) + if (XFE_RDFUtils::ht_IsFECommand(entry)) { Cardinal numparams = 1; CommandType cmd; @@ -563,7 +564,7 @@ XFE_RDFMenuToolbarBase::entryActivated(Widget w, HT_Resource entry) if (HT_IsURLBar(entry)) { cmd = xfeCmdOpenPage; } else { - cmd = ht_GetFECommand(entry); + cmd = XFE_RDFUtils::ht_GetFECommand(entry); } XFE_CommandInfo info(XFE_COMMAND_EVENT_ACTION, @@ -1479,7 +1480,7 @@ XFE_RDFMenuToolbarBase::getStyleAndLayout(HT_Resource entry, int32 * toolbar_st else { // Value not provided. It is top for command buttons and side // for personal - if (ht_IsFECommand(entry)) + if (XFE_RDFUtils::ht_IsFECommand(entry)) *layout = XmBUTTON_LABEL_ON_BOTTOM; else *layout = XmBUTTON_LABEL_ON_RIGHT; diff --git a/cmd/xfe/src/RDFUtils.cpp b/cmd/xfe/src/RDFUtils.cpp new file mode 100644 index 00000000000..5e3bf5f66d8 --- /dev/null +++ b/cmd/xfe/src/RDFUtils.cpp @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; 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. + */ + +////////////////////////////////////////////////////////////////////////// +// // +// Name: RDFUtils.cpp // +// // +// Description: Misc RDF XFE specific utilities. // +// // +// Author: Ramiro Estrugo // +// // +////////////////////////////////////////////////////////////////////////// + +#include "RDFUtils.h" +#include "xp_str.h" +#include "xpassert.h" + +////////////////////////////////////////////////////////////////////////// +// +// XFE Command utilities +// +// Is the URL a 'special' command url that translates to an FE command ? +// +////////////////////////////////////////////////////////////////////////// +/*static*/ XP_Bool +XFE_RDFUtils::ht_IsFECommand(HT_Resource item) +{ + const char* url = HT_GetNodeURL(item); + + return (XP_STRNCMP(url, "command:", 8) == 0); +} +////////////////////////////////////////////////////////////////////////// +/*static*/ CommandType +XFE_RDFUtils::ht_GetFECommand(HT_Resource item) +{ + const char* url = HT_GetNodeURL(item); + + if (url && XP_STRNCMP(url, "command:", 8) == 0) + { + return Command::convertOldRemote(url + 8); + } + else + { + return NULL; + } +} +////////////////////////////////////////////////////////////////////////// diff --git a/cmd/xfe/src/RDFUtils.h b/cmd/xfe/src/RDFUtils.h new file mode 100644 index 00000000000..f6b24782a5b --- /dev/null +++ b/cmd/xfe/src/RDFUtils.h @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; 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. + */ + +////////////////////////////////////////////////////////////////////////// +// // +// Name: RDFUtils.h // +// // +// Description: Misc RDF XFE specific utilities. // +// // +// Author: Ramiro Estrugo // +// // +////////////////////////////////////////////////////////////////////////// + +#ifndef _xfe_rdf_utils_h_ +#define _xfe_rdf_utils_h_ + +#include "htrdf.h" +#include "xp_core.h" +#include "Command.h" + +class XFE_RDFUtils +{ +public: + + XFE_RDFUtils() {} + ~XFE_RDFUtils() {} + + ////////////////////////////////////////////////////////////////////// + // // + // XFE Command utilities // + // // + // Is the URL a 'special' command url that translates to an FE // + // command ? // + // // + ////////////////////////////////////////////////////////////////////// + static XP_Bool ht_IsFECommand (HT_Resource item); + static CommandType ht_GetFECommand (HT_Resource item); +}; + +#endif // _xfe_rdf_utils_h_