/* -*- 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.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/NPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1998 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): */ /* TaskBarDrop.cpp -- class definition for the task bar drop class Created: Alastair Gourlay , 1-Jan-96. */ #include "TaskBarDrop.h" #include "Command.h" #include "BrowserFrame.h" #ifdef MOZ_MAIL_NEWS #include "ComposeFrame.h" #include "ComposeAttachFolderView.h" #endif #ifdef EDITOR #include "EditorFrame.h" #endif #include #include "xfe2_extern.h" #ifdef DEBUG_sgidev #define XDEBUG(x) x #else #define XDEBUG(x) #endif // // XFE_TaskBarDrop class // // constructor XFE_TaskBarDrop::XFE_TaskBarDrop(Widget parent,const char *command) : XFE_DropNetscape(parent) { _command=command; // Configure the drop site Arg xargs[1]; Cardinal n = 0; XtSetArg(xargs[n],XmNanimationStyle, XmDRAG_UNDER_NONE); n++; update(xargs,n); } XFE_TaskBarDrop::~XFE_TaskBarDrop() { } void XFE_TaskBarDrop::targets() { _numTargets=2; _targets=new Atom[_numTargets]; _targets[0]=_XA_NETSCAPE_URL; _targets[1]=XA_STRING; acceptFileTargets(); } void XFE_TaskBarDrop::operations() { // always copy - move/link irrelevant _operations=(unsigned int)XmDROP_COPY; } /* virtual */ void XFE_TaskBarDrop::dragIn() { XtVaSetValues(_widget,XmNraised,True,NULL); } /* virtual */ void XFE_TaskBarDrop::dragOut() { XtVaSetValues(_widget,XmNraised,False,NULL); } int XFE_TaskBarDrop::processTargets(Atom *targets,const char **data,int numItems) { XDEBUG(printf("XFE_TaskBarDrop::processTargets()\n")); if (!targets || !data || numItems==0) return FALSE; int i; int urlCount=0; // count # of items in list (need to expand multi-item NetscapeURL data) for (i=0;iaddress)) { MWContext *context=XP_GetNonGridContext(fe_all_MWContexts->context); if (context) fe_GetURL(context,urlStruct, FALSE); else NET_FreeURLStruct(urlStruct); return; } #endif // Open a new window with this URL if (_command==xfeCmdOpenOrBringUpBrowser) { fe_showBrowser(FE_GetToplevelWidget(), NULL, NULL, urlStruct); } #ifdef EDITOR else if (_command==xfeCmdOpenEditor) { fe_showEditor(XfeAncestorFindApplicationShell(_widget), NULL, NULL, urlStruct); } #endif } #ifdef MOZ_MAIL_NEWS // process drop on mail or news taskbar icons void XFE_TaskBarDrop::openComposeWindow(const char **urlList,int urlCount) { MWContext *context=XP_GetNonGridContext(fe_all_MWContexts->context); if (!context) return; MSG_Pane* pane = fe_showCompose(XtParent(CONTEXT_WIDGET(context)), NULL, context, NULL, NULL, MSG_DEFAULT, (_command==xfeCmdOpenNewsgroups ? True : False) ); // add urlList as attachments MSG_AttachmentData *attachments=new struct MSG_AttachmentData[urlCount+1]; int i; int numAttachments=0; for (i=0;i0) { attachments[numAttachments].url=NULL; // terminate list MSG_SetAttachmentList(pane,attachments); } // delete list for (i=0;i