Fix the urlbar somemore. It now set the url string properly.

git-svn-id: svn://10.0.0.236/trunk@13019 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ramiro%netscape.com
1998-10-16 21:31:54 +00:00
parent 8c3d3311e8
commit 1b7053743f
8 changed files with 73 additions and 8 deletions

View File

@@ -59,7 +59,7 @@ XFE_LocationDrag::~XFE_LocationDrag()
// set drag data, for later use by drag callback
void XFE_LocationDrag::setDragData(URL_Struct* u)
void XFE_LocationDrag::setDragDataFromURL(URL_Struct* u)
{
if (_dragDataURL)
XP_FREE(_dragDataURL);
@@ -67,6 +67,14 @@ void XFE_LocationDrag::setDragData(URL_Struct* u)
_dragDataURL=((u && u->address) ? XP_STRDUP(u->address) : 0);
}
void XFE_LocationDrag::setDragDataFromString(const String str)
{
if (_dragDataURL)
XP_FREE(_dragDataURL);
_dragDataURL = str ? XP_STRDUP(str) : 0;
}
// decide if this drag is interesting

View File

@@ -36,7 +36,8 @@ class XFE_LocationDrag : public XFE_DragNetscape
public:
XFE_LocationDrag(Widget);
~XFE_LocationDrag();
void setDragData(URL_Struct*);
void setDragDataFromURL(URL_Struct*);
void setDragDataFromString(const String str);
protected:
char *_dragDataURL;

View File

@@ -149,7 +149,6 @@ CPPSRCS = \
ToolbarDrop.cpp \
Toolbox.cpp \
ToolboxItem.cpp \
URLBar.cpp \
ViewDialog.cpp \
ViewGlue.cpp \
View.cpp \

View File

@@ -632,7 +632,11 @@ void XFE_PrefsPageBrowser::cb_expireNow(Widget /* widget */,
if (XFE_Confirm(fep->context, fe_globalData.expire_now_message)) {
GH_ClearGlobalHistory();
fe_RefreshAllAnchors();
XFE_URLBar::clearAll();
//
// XXX Please fix me. XXX
//
// XFE_URLBar::clearAll();
}
}

View File

@@ -721,7 +721,7 @@ XFE_CALLBACK_DEFN(XFE_RDFToolbar,urlBarTextActivatedNotice)
//
// Have a nive day -re
//
urlbar->setTextStringFromURL(url);
// urlbar->setTextStringFromURL(url);
}
}
//////////////////////////////////////////////////////////////////////////

View File

@@ -31,6 +31,8 @@
#include "IconGroup.h"
#include "Button.h"
#include "HTMLView.h" // For XFE_HTMLView::newURLLoading
#include <Xfe/FancyBox.h>
#include <Xfe/ToolBar.h>
@@ -51,10 +53,16 @@ XFE_ToolbarUrlBar::XFE_ToolbarUrlBar(XFE_Frame * frame,
m_proxyIcon(NULL),
m_proxyIconDragSite(NULL)
{
getAncestorFrame()->registerInterest(XFE_HTMLView::newURLLoading,
this,
newPageLoadingNotice_cb);
}
//////////////////////////////////////////////////////////////////////////
XFE_ToolbarUrlBar::~XFE_ToolbarUrlBar()
{
getAncestorFrame()->unregisterInterest(XFE_HTMLView::newURLLoading,
this,
newPageLoadingNotice_cb);
}
//////////////////////////////////////////////////////////////////////////
@@ -117,7 +125,7 @@ XFE_ToolbarUrlBar::setTextStringFromURL(URL_Struct * url)
// Update the proxy icon
if (m_proxyIconDragSite != NULL)
{
m_proxyIconDragSite->setDragData(url);
m_proxyIconDragSite->setDragDataFromURL(url);
}
// Lots of munging and sanitization need to happen here. See
@@ -126,6 +134,24 @@ XFE_ToolbarUrlBar::setTextStringFromURL(URL_Struct * url)
XfeComboBoxSetTextString(m_widget,url->address);
}
//////////////////////////////////////////////////////////////////////////
void
XFE_ToolbarUrlBar::setTextString(const String str)
{
XP_ASSERT( isAlive() );
XP_ASSERT( str != NULL );
// Update the proxy icon
if (m_proxyIconDragSite != NULL)
{
m_proxyIconDragSite->setDragDataFromString(str);
}
// Lots of munging and sanitization need to happen here. See
// URLBar.cpp for the insanity
XfeComboBoxSetTextString(m_widget,str);
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
@@ -226,3 +252,22 @@ XFE_ToolbarUrlBar::textActivateCB(Widget /* w */,
urlbar->textActivate();
}
//////////////////////////////////////////////////////////////////////////
XFE_CALLBACK_DEFN(XFE_ToolbarUrlBar, newPageLoadingNotice)
(XFE_NotificationCenter * /* obj */,
void * clientData,
void * callData)
{
URL_Struct * url = (URL_Struct *) callData;
XP_ASSERT( url != NULL );
if (url == NULL)
{
setTextString("Carajo, ahora si que estamos jodidos.");
}
else
{
setTextStringFromURL(url);
}
}
//////////////////////////////////////////////////////////////////////////

View File

@@ -58,7 +58,8 @@ public:
// Text string methods //
// //
//////////////////////////////////////////////////////////////////////
void setTextStringFromURL(URL_Struct * url);
void setTextStringFromURL (URL_Struct * url);
void setTextString (const String str);
//////////////////////////////////////////////////////////////////////
// //
@@ -125,6 +126,13 @@ private:
XtPointer clientData,
XtPointer callData);
//////////////////////////////////////////////////////////////////////
// //
// Called when a new page loads as a result of fe_GetUrl() - i think//
// //
//////////////////////////////////////////////////////////////////////
XFE_CALLBACK_DECL(newPageLoadingNotice)
};
#endif // _xfe_toolbar_url_bar_h_

View File

@@ -581,7 +581,7 @@ XFE_URLBar::setURLString(URL_Struct *url)
/* update ProxyIcon drag object with new URL */
if (m_proxyIconDragSite)
m_proxyIconDragSite->setDragData(url);
m_proxyIconDragSite->setTextStringFromURL(url);
XtCallbackRec *cblist, *text_cb;
int i;